[srvx-commits] CVS: services/src hash.h,1.81,1.81.2.1 opserv.c,1.235.2.4,1.235.2.5
Brought to you by:
entrope
|
From: Adrian D. <sai...@us...> - 2002-07-26 04:08:48
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv30005
Modified Files:
Tag: rel-1_1-branch
hash.h opserv.c
Log Message:
Fix IsNickName() macro (used by ?helpserv register)
Use IsNickName() macro for checking the nick when manipulating clones.
Index: hash.h
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.h,v
retrieving revision 1.81
retrieving revision 1.81.2.1
diff -C2 -r1.81 -r1.81.2.1
*** hash.h 12 May 2002 15:25:09 -0000 1.81
--- hash.h 26 Jul 2002 04:08:43 -0000 1.81.2.1
***************
*** 188,196 ****
void DelServer(struct server* serv, int announce, const char *message);
#define IsNickName(x) ( \
! (isalpha(*(x)) || \
! ((*(x) >= 0x5B) && (*(x) <= 0x60)) || \
! ((*(x) >= 0x7B) && (*(x) <= 0x7D))) && \
! !strcspn((x)+1, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789[]\\`_^{|}"))
typedef int (*new_user_func_t) (struct userNode *user);
void reg_new_user_func(new_user_func_t handler);
--- 188,196 ----
void DelServer(struct server* serv, int announce, const char *message);
+ /* The last test is a faster way of checking if strspn((x)+1, ...) returns strlen(x)-1 */
#define IsNickName(x) ( \
! (isalpha(*(x)) || strchr("{|}~[\\]^_`", *(x))) && \
! (strlen(x) <= nicklen) && \
! !(x)[1+strspn((x)+1, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789{|}~[\\]^-_`")])
typedef int (*new_user_func_t) (struct userNode *user);
void reg_new_user_func(new_user_func_t handler);
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.235.2.4
retrieving revision 1.235.2.5
diff -C2 -r1.235.2.4 -r1.235.2.5
*** opserv.c 25 Jul 2002 01:24:43 -0000 1.235.2.4
--- opserv.c 26 Jul 2002 04:08:43 -0000 1.235.2.5
***************
*** 172,175 ****
--- 172,176 ----
#define OSMSG_ADDED_TRUSTED "Added trusted hosts to the trusted-hosts list."
#define OSMSG_REMOVED_TRUSTED "Removed trusted hosts from the trusted-hosts list."
+ #define OSMSG_CLONE_NICK_INVALID "Requested nick $b%s$b is invalid."
#define OSMSG_CLONE_EXISTS "Nick $b%s$b is already in use."
#define OSMSG_NOT_A_HOSTMASK "The hostmask must be in user@host form."
***************
*** 2485,2488 ****
--- 2486,2490 ----
OPSERV_MIN_PARMS(3, false);
+ if (!IsNickName(argv[2])) opserv_notice(user, OSMSG_CLONE_NICK_INVALID, argv[2]);
clone = GetUserH(argv[2]);
if (!strcasecmp(argv[1], "ADD")) {
|