]> PatchyGit - patchyircd.git/commitdiff
wait for SASL password check
authorEgor <egor@patchysicp.xyz>
Fri, 28 Jun 2024 18:57:51 +0000 (21:57 +0300)
committerEgor <egor@patchysicp.xyz>
Fri, 28 Jun 2024 18:57:51 +0000 (21:57 +0300)
src/irc.c

index c4f3337..df370c2 100644 (file)
--- a/src/irc.c
+++ b/src/irc.c
@@ -220,6 +220,7 @@ static void cont_sasl(struct client_data *client, int res) {
                }
                free(client->saslusername);
                client->saslusername = 0;
+               newUser(client);
        }
 }
 static void cont_pass(struct client_data *client, int res) {
@@ -1197,9 +1198,9 @@ unknown:
 }
 
 void newUser(struct client_data *client) {
-       if (client->regstate == REG_CAPLS || !client->nick_reg || !client->username || client->passwait || client->webircwait)
+       if (client->regstate != REG_INIT || !client->nick_reg || !client->username || client->passwait || client->webircwait || client->saslusername)
                return;
-       if (client->saslbuf || client->saslusername) {
+       if (client->saslbuf) {
                copy_strf(&databuf, ":%s 906 * :SASL auhtentication aborted\r\n", hostname), sendbuf(client);
                if (client->saslbuf) {
                        memset(client->saslbuf, 0, 1024);
@@ -1207,10 +1208,6 @@ void newUser(struct client_data *client) {
                        client->saslbuf = 0;
                        client->saslbufLen = 0;
                }
-               if (client->saslusername) {
-                       free(client->saslusername);
-                       client->saslusername = 0;
-               }
        }
        if (client->username[0] == '~' && client->pass_reg) {
                job_password_check(client, client->username+1, client->pass_reg, getdatafile("users.txt"), cont_pass);