summaryrefslogtreecommitdiff
path: root/message.c
diff options
context:
space:
mode:
Diffstat (limited to 'message.c')
-rw-r--r--message.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/message.c b/message.c
index 6f4c9dd..7e5497e 100644
--- a/message.c
+++ b/message.c
@@ -905,16 +905,18 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int
// Found client in array, set to authenticated
clients[i].authed = 1;
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 %s has successfully authenticated.", ircdstate->ircnick,
- clients[clientindex].remoteip)) {
- fprintf(stderr, "Error while preparing authentication success NOTICE!\n");
- debugprint(DEBUG_CRIT, "Error while preparing authentication success NOTICE!\n");
- alertmsg[0] = '\0';
+ // Alert other clients about the successful authentication (if enabled)
+ if (settings->alertauthsuccess) {
+ char alertmsg[MAXDATASIZE];
+ if (!snprintf(alertmsg, MAXDATASIZE, "NOTICE %s :blabouncer: new client %s has successfully authenticated.", ircdstate->ircnick,
+ clients[clientindex].remoteip)) {
+ fprintf(stderr, "Error while preparing authentication success NOTICE!\n");
+ debugprint(DEBUG_CRIT, "Error while preparing authentication success NOTICE!\n");
+ alertmsg[0] = '\0';
+ }
+ // "except" the current fd - we can use this as "except/sourcefd" since we set them as authed just above
+ sendtoallclients(clients, alertmsg, sourcefd, settings);
}
- // "except" the current fd - we can use this as "except/sourcefd" since we set them as authed just above
- sendtoallclients(clients, alertmsg, sourcefd, settings);
}
}
} else {
@@ -924,15 +926,17 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int
strncpy(remoteip, clients[clientindex].remoteip, INET6_ADDRSTRLEN);
debugprint(DEBUG_SOME, "Password rejected, disconnecting client %s with fd %d.\n", 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 %s failed to authenticate.", ircdstate->ircnick, remoteip)) {
- fprintf(stderr, "Error while preparing authentication failure NOTICE!\n");
- debugprint(DEBUG_CRIT, "Error while preparing authentication failure NOTICE!\n");
- alertmsg[0] = '\0';
- }
- // "except" 0 since we trust this message
- sendtoallclients(clients, alertmsg, 0, settings);
+ // Alert other clients about the failed authentication (if enabled)
+ if (settings->alertauthfail) {
+ char alertmsg[MAXDATASIZE];
+ if (!snprintf(alertmsg, MAXDATASIZE, "NOTICE %s :blabouncer: new client %s failed to authenticate.", ircdstate->ircnick, remoteip)) {
+ fprintf(stderr, "Error while preparing authentication failure NOTICE!\n");
+ debugprint(DEBUG_CRIT, "Error while preparing authentication failure NOTICE!\n");
+ alertmsg[0] = '\0';
+ }
+ // "except" 0 since we trust this message
+ sendtoallclients(clients, alertmsg, 0, settings);
+ }
}
return 1;