Allow limited punctuation in usernames, for better PAM integration.

This commit is contained in:
Brett Smith 2012-09-14 11:56:38 -04:00
parent a072180c92
commit 85abfd84be
1 changed files with 5 additions and 2 deletions

View File

@ -418,12 +418,15 @@ IRC_USER(CLIENT * Client, REQUEST * Req)
Client_ID(Client), Client_ID(Client),
Req->command); Req->command);
/* User name: only alphanumeric characters are allowed! */ /* User name: only alphanumeric characters and limited
punctuation is allowed.*/
ptr = Req->argv[0]; ptr = Req->argv[0];
while (*ptr) { while (*ptr) {
if ((*ptr < '0' || *ptr > '9') && if ((*ptr < '0' || *ptr > '9') &&
(*ptr < 'A' || *ptr > 'Z') && (*ptr < 'A' || *ptr > 'Z') &&
(*ptr < 'a' || *ptr > 'z')) { (*ptr < 'a' || *ptr > 'z') &&
(*ptr != '+') && (*ptr != '-') &&
(*ptr != '.') && (*ptr != '_')) {
Conn_Close(Client_Conn(Client), NULL, Conn_Close(Client_Conn(Client), NULL,
"Invalid user name", true); "Invalid user name", true);
return DISCONNECTED; return DISCONNECTED;