Commit Diff


commit - d21afce2b6fdc919a80c4eb1d6ba781c1cf63f3c
commit + 005340c83f3f481bdcdc6a03ae9b9b2973248ceb
blob - 74d8b9d116b3bb71de2388a0c71838f0c86f4e29
blob + 99cd26f45818a1fa3a42bb36c67f58a4c7ac86b2
--- src/ngircd/irc-login.c
+++ src/ngircd/irc-login.c
@@ -18,6 +18,7 @@
 
 #include "imp.h"
 #include <assert.h>
+#include <ctype.h>
 #include <stdlib.h>
 #include <string.h>
 #include <strings.h>
@@ -422,11 +423,9 @@ IRC_USER(CLIENT * Client, REQUEST * Req)
 		   punctuation is allowed.*/
 		ptr = Req->argv[0];
 		while (*ptr) {
-			if ((*ptr < '0' || *ptr > '9') &&
-			    (*ptr < 'A' || *ptr > 'Z') &&
-			    (*ptr < 'a' || *ptr > 'z') &&
-			    (*ptr != '+') && (*ptr != '-') &&
-			    (*ptr != '.') && (*ptr != '_')) {
+			if (!isalnum(*ptr) &&
+			    *ptr != '+' && *ptr != '-' &&
+			    *ptr != '.' && *ptr != '_') {
 				Conn_Close(Client_Conn(Client), NULL,
 					   "Invalid user name", true);
 				return DISCONNECTED;