summaryrefslogtreecommitdiff
path: root/message.c
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-09-06 21:41:28 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-09-06 21:41:28 +0100
commit38bd2b2761b7d0f556945ffad78f73536e12e157 (patch)
tree241402b5b883f77e3fb20608f173db5028484323 /message.c
parentfb3963446890cbb966db2d463813d15701cd8fb1 (diff)
Send remote IP addresses instead of fd numbers in NOTICEs to clients and print both in related debugprint()s.
Diffstat (limited to 'message.c')
-rw-r--r--message.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/message.c b/message.c
index f360e99..0373ef3 100644
--- a/message.c
+++ b/message.c
@@ -731,7 +731,7 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int
// PASS received? User is trying to log in, check their password.
if (strncasecmp(tokens[0], "PASS", strlen(tokens[0])) == 0) {
if (checkpassword(tokens[1], settings)) {
- debugprint(DEBUG_FULL, "Password accepted! Setting fd %d to authenticated.\n", sourcefd);
+ debugprint(DEBUG_FULL, "Password accepted! Setting client %s with fd %d to authenticated.\n", clients[arrindex(clients, sourcefd)].remoteip, sourcefd);
// Find the client in the clients array and set them as authenticated
for (int i = 0; i < MAXCLIENTS; i++) {
if (clients[i].fd == sourcefd) {
@@ -740,7 +740,8 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int
debugprint(DEBUG_FULL, "Found and authenticated fd in arr_authed.\n");
// Alert other clients about the successful authentication
char alertmsg[MAXDATASIZE];
- if (!snprintf(alertmsg, MAXDATASIZE, "NOTICE %s :blabouncer: new client with fd %d has successfully authenticated.", ircdstate->ircnick, sourcefd)) {
+ if (!snprintf(alertmsg, MAXDATASIZE, "NOTICE %s :blabouncer: new client %s has successfully authenticated.", ircdstate->ircnick,
+ clients[arrindex(clients, sourcefd)].remoteip)) {
fprintf(stderr, "Error while preparing authentication success NOTICE!\n");
debugprint(DEBUG_CRIT, "Error while preparing authentication success NOTICE!\n");
alertmsg[0] = '\0';
@@ -750,11 +751,12 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int
}
}
} else {
- debugprint(DEBUG_SOME, "Password rejected, disconnecting fd %d.\n", sourcefd);
+ debugprint(DEBUG_SOME, "Password rejected, disconnecting client %s with fd %d.\n", clients[arrindex(clients, sourcefd)].remoteip, sourcefd);
disconnectclient(sourcefd, clients, ircdstate, settings, clientcodes);
// Alert other clients about the failed authentication
char alertmsg[MAXDATASIZE];
- if (!snprintf(alertmsg, MAXDATASIZE, "NOTICE %s :blabouncer: new client with fd %d has failed to authenticate.", ircdstate->ircnick, sourcefd)) {
+ if (!snprintf(alertmsg, MAXDATASIZE, "NOTICE %s :blabouncer: new client %s has failed to authenticate.", ircdstate->ircnick,
+ clients[arrindex(clients, sourcefd)].remoteip)) {
fprintf(stderr, "Error while preparing authentication failure NOTICE!\n");
debugprint(DEBUG_CRIT, "Error while preparing authentication failure NOTICE!\n");
alertmsg[0] = '\0';