From fda96b89dce38aa0ba86125acc329739376c3a82 Mon Sep 17 00:00:00 2001 From: Alex Iadicicco Date: Wed, 17 Apr 2013 17:27:27 -0700 Subject: [PATCH] m_nick: Reject nicks with '~' in them, rather than cutting at the '~' The behavior of cutting at the first '~' is confusing at first, and looks too much like a bug. --- modules/core/m_nick.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/modules/core/m_nick.c b/modules/core/m_nick.c index bb928f89..6d26fbf5 100644 --- a/modules/core/m_nick.c +++ b/modules/core/m_nick.c @@ -115,7 +115,6 @@ mr_nick(struct Client *client_p, struct Client *source_p, int parc, const char * { struct Client *target_p; char nick[NICKLEN]; - char *s; if (strlen(client_p->id) == 3) { @@ -123,20 +122,13 @@ mr_nick(struct Client *client_p, struct Client *source_p, int parc, const char * return 0; } - if(parc < 2 || EmptyString(parv[1]) || (parv[1][0] == '~')) + if(parc < 2 || EmptyString(parv[1])) { sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN), me.name, EmptyString(source_p->name) ? "*" : source_p->name); return 0; } - /* due to the scandinavian origins, (~ being uppercase of ^) and ~ - * being disallowed as a nick char, we need to chop the first ~ - * instead of just erroring. - */ - if((s = strchr(parv[1], '~'))) - *s = '\0'; - /* copy the nick and terminate it */ rb_strlcpy(nick, parv[1], ConfigFileEntry.nicklen); @@ -181,21 +173,13 @@ m_nick(struct Client *client_p, struct Client *source_p, int parc, const char *p { struct Client *target_p; char nick[NICKLEN]; - char *s; - if(parc < 2 || EmptyString(parv[1]) || (parv[1][0] == '~')) + if(parc < 2 || EmptyString(parv[1])) { sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN), me.name, source_p->name); return 0; } - /* due to the scandinavian origins, (~ being uppercase of ^) and ~ - * being disallowed as a nick char, we need to chop the first ~ - * instead of just erroring. - */ - if((s = strchr(parv[1], '~'))) - *s = '\0'; - /* mark end of grace period, to prevent nickflooding */ if(!IsFloodDone(source_p)) flood_endgrace(source_p);