X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Firc-login.c;h=9e1abdd59e8b0349b535b9b1299989f994a3827c;hp=bf3254c985807e62ff24232e46ab1f6babc32752;hb=e01e8f1cb6812ac24821fa540fd6ce4e61ccbc12;hpb=110be707c306683c666bd736a8dcd7aef86d9f21 diff --git a/src/ngircd/irc-login.c b/src/ngircd/irc-login.c index bf3254c9..9e1abdd5 100644 --- a/src/ngircd/irc-login.c +++ b/src/ngircd/irc-login.c @@ -19,6 +19,7 @@ #include "imp.h" #include #include +#include #include #include "conn-func.h" @@ -86,7 +87,7 @@ IRC_PASS( CLIENT *Client, REQUEST *Req ) Client_ID(Client)); } - Client_SetPassword(Client, Req->argv[0]); + Conn_SetPassword(Client_Conn(Client), Req->argv[0]); /* Protocol version */ if (Req->argc >= 2 && strlen(Req->argv[1]) >= 4) { @@ -399,9 +400,7 @@ GLOBAL bool IRC_USER(CLIENT * Client, REQUEST * Req) { CLIENT *c; -#ifdef IDENTAUTH char *ptr; -#endif assert(Client != NULL); assert(Req != NULL); @@ -419,7 +418,19 @@ IRC_USER(CLIENT * Client, REQUEST * Req) Client_ID(Client), Req->command); - /* User name */ + /* User name: only alphanumeric characters are allowed! */ + ptr = Req->argv[0]; + while (*ptr) { + if ((*ptr < '0' || *ptr > '9') && + (*ptr < 'A' || *ptr > 'Z') && + (*ptr < 'a' || *ptr > 'z')) { + Conn_Close(Client_Conn(Client), NULL, + "Invalid user name", true); + return DISCONNECTED; + } + ptr++; + } + #ifdef IDENTAUTH ptr = Client_User(Client); if (!ptr || !*ptr || *ptr == '~')