diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_chghost.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_chgident.cpp | 13 | ||||
-rw-r--r-- | src/modules/m_chgname.cpp | 10 | ||||
-rw-r--r-- | src/modules/m_sethost.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_setident.cpp | 20 | ||||
-rw-r--r-- | src/modules/m_setname.cpp | 18 |
6 files changed, 44 insertions, 27 deletions
diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index d914fd2a2..12fb8db03 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -39,7 +39,7 @@ class cmd_chghost : public command_t { if (!hostmap[(unsigned char)*x]) { - user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname"); + user->WriteServ("NOTICE "+std::string(user->nick)+" :*** CHGHOST: Invalid characters in hostname"); return CMD_FAILURE; } } @@ -51,14 +51,14 @@ class cmd_chghost : public command_t if ((parameters[1] - x) > 63) { - user->WriteServ("NOTICE %s :*** CHGHOST: Host too long",user->nick); + user->WriteServ("NOTICE %s :*** CHGHOST: Host too long", user->nick); return CMD_FAILURE; } userrec* dest = ServerInstance->FindNick(parameters[0]); if (!dest) { - /* Drop it like a hot potato. XXX - we should probably message here.. -- w00t */ + user->WriteServ("401 %s %s :No such nick/channel", user->nick, parameters[0]); return CMD_FAILURE; } diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index e3067fe56..a212077ed 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -40,12 +40,19 @@ class cmd_chgident : public command_t if (!*parameters[1]) { - user->WriteServ("NOTICE %s :*** CHGIDENT: Needs non-zero length ident", user->nick); + user->WriteServ("NOTICE %s :*** CHGIDENT: Ident must be specified", user->nick); return CMD_FAILURE; } - if(!ServerInstance->IsIdent(parameters[1])) + + if (strlen(parameters[1]) > IDENTMAX) { - user->WriteServ("NOTICE %s :*** Invalid characters in ident", user->nick); + user->WriteServ("NOTICE %s :*** CHGIDENT: Ident is too long", user->nick); + return CMD_FAILURE; + } + + if (!ServerInstance->IsIdent(parameters[1])) + { + user->WriteServ("NOTICE %s :*** CHGIDENT: Invalid characters in ident", user->nick); return CMD_FAILURE; } diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index f3ea9cc25..887940124 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -37,11 +37,19 @@ class cmd_chgname : public command_t user->WriteServ("401 %s %s :No such nick/channel", user->nick, parameters[0]); return CMD_FAILURE; } + if (!*parameters[1]) { - user->WriteServ("NOTICE %s :*** GECOS is too short", user->nick); + user->WriteServ("NOTICE %s :*** GECOS must be specified", user->nick); return CMD_FAILURE; } + + if (strlen(parameters[1]) > MAXGECOS) + { + user->WriteServ("NOTICE %s :*** GECOS too long", user->nick); + return CMD_FAILURE; + } + if (IS_LOCAL(dest)) { dest->ChangeName(parameters[1]); diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index 0719bd648..ff7d0c4da 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -38,13 +38,13 @@ class cmd_sethost : public command_t { if (!hostmap[(unsigned char)*x]) { - user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname"); + user->WriteServ("NOTICE "+std::string(user->nick)+" :*** SETHOST: Invalid characters in hostname"); return CMD_FAILURE; } } if (len == 0) { - user->WriteServ("NOTICE %s :*** SETHOST: Host too short", user->nick); + user->WriteServ("NOTICE %s :*** SETHOST: Host must be specified", user->nick); return CMD_FAILURE; } if (len > 64) diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp index a98592299..97ed80496 100644 --- a/src/modules/m_setident.cpp +++ b/src/modules/m_setident.cpp @@ -30,26 +30,24 @@ class cmd_setident : public command_t CmdResult Handle(const char** parameters, int pcnt, userrec *user) { - size_t len = 0; - for(const char* x = parameters[0]; *x; x++, len++) + if (!*parameters[0]) { - if(((*x >= 'A') && (*x <= '}')) || strchr(".-0123456789", *x)) - continue; - - user->WriteServ("NOTICE %s :*** Invalid characters in ident", user->nick); + user->WriteServ("NOTICE %s :*** SETIDENT: Ident must be specified", user->nick); return CMD_FAILURE; } - if (len == 0) + + if (strlen(parameters[0]) > IDENTMAX) { - user->WriteServ("NOTICE %s :*** SETIDENT: Ident too short", user->nick); + user->WriteServ("NOTICE %s :*** SETIDENT: Ident is too long", user->nick); return CMD_FAILURE; } - if (len > IDENTMAX) + + if (!ServerInstance->IsIdent(parameters[0])) { - user->WriteServ("NOTICE %s :*** Ident is too long", user->nick); + user->WriteServ("NOTICE %s :*** SETIDENT: Invalid characters in ident", user->nick); return CMD_FAILURE; } - + user->ChangeIdent(parameters[0]); ServerInstance->WriteOpers("%s used SETIDENT to change their ident to '%s'", user->nick, user->ident); diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp index 3ececbbb3..ecf0d41a9 100644 --- a/src/modules/m_setname.cpp +++ b/src/modules/m_setname.cpp @@ -31,19 +31,23 @@ class cmd_setname : public command_t CmdResult Handle (const char** parameters, int pcnt, userrec *user) { - std::string line; - for (int i = 0; i < pcnt-1; i++) + if (!*parameters[0]) { - line = line + std::string(parameters[i]) + " "; + user->WriteServ("NOTICE %s :*** SETNAME: GECOS must be specified", user->nick); + return CMD_FAILURE; } - line = line + std::string(parameters[pcnt-1]); - if (line.length() == 0) + if (strlen(parameters[0]) > MAXGECOS) { - user->WriteServ("NOTICE %s :*** GECOS too short", user->nick); + user->WriteServ("NOTICE %s :*** SETNAME: GECOS too long", user->nick); return CMD_FAILURE; } - user->ChangeName(line.c_str()); + + if (user->ChangeName(parameters[0])) + { + ServerInstance->WriteOpers("%s used SETNAME to change their GECOS to %s", user->nick, parameters[0]); + return CMD_SUCCESS; + } return CMD_SUCCESS; } |