mirror of
https://github.com/osmarks/ngircd.git
synced 2025-06-22 00:04:09 +00:00
Simplify check for valid user names in IRC_USER().
Patches from Federico G. Schwindt, thanks! (cherry picked from commit a44b7126227ba1118ec02b399e31b08102af5e8c and 6fbe9583753b2620da275676cde46a89cb4d06c2)
This commit is contained in:
parent
d21afce2b6
commit
005340c83f
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
@ -422,11 +423,9 @@ IRC_USER(CLIENT * Client, REQUEST * Req)
|
|||||||
punctuation is allowed.*/
|
punctuation is allowed.*/
|
||||||
ptr = Req->argv[0];
|
ptr = Req->argv[0];
|
||||||
while (*ptr) {
|
while (*ptr) {
|
||||||
if ((*ptr < '0' || *ptr > '9') &&
|
if (!isalnum(*ptr) &&
|
||||||
(*ptr < 'A' || *ptr > 'Z') &&
|
*ptr != '+' && *ptr != '-' &&
|
||||||
(*ptr < 'a' || *ptr > 'z') &&
|
*ptr != '.' && *ptr != '_') {
|
||||||
(*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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user