diff options
author | Luke Bratch <luke@bratch.co.uk> | 2019-05-21 23:04:46 +0100 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2019-05-21 23:04:46 +0100 |
commit | 1f4375b77e0f6bd6d898bbfb6d525589ed11ada3 (patch) | |
tree | 272e6f5d3a5dbdc7fa949bb9f82966e2d992940a /blabouncer.c | |
parent | 5280e648d96fbcb20948f7470afdca8b38f80a44 (diff) |
Only try new nicks if the server tells us 432/ERR_ERRONEUSNICKNAME or 433/ERR_NICKNAMEINUSE if we weren't already registered with it. Avoids crash if the server changes our nick and our next automatic attempt was in use or invalid.
Diffstat (limited to 'blabouncer.c')
-rw-r--r-- | blabouncer.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/blabouncer.c b/blabouncer.c index 401b5fd..32ba454 100644 --- a/blabouncer.c +++ b/blabouncer.c @@ -1206,7 +1206,8 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli } // Server 432 (ERR_ERRONEUSNICKNAME) or 433 (ERR_NICKNAMEINUSE) received? See which nick we're on and try another. - if (strncmp(tokens[1], "432", strlen(tokens[1])) == 0 || strncmp(tokens[1], "433", strlen(tokens[1])) == 0) { + // (But only if we're not already registered with the real IRC server.) + if ((strncmp(tokens[1], "432", strlen(tokens[1])) == 0 || strncmp(tokens[1], "433", strlen(tokens[1])) == 0) && !strlen(ircdstrings->greeting004)) { printf("Server 432 (ERR_ERRONEUSNICKNAME) or 433 (ERR_NICKNAMEINUSE) found and it is: %s with length %zd! Trying another nick...\n", tokens[1], strlen(tokens[1])); // Make sure nick3 hasn't already been tried |