diff options
Diffstat (limited to 'src/botserv.c')
| -rw-r--r-- | src/botserv.c | 62 |
1 files changed, 53 insertions, 9 deletions
diff --git a/src/botserv.c b/src/botserv.c index 5531084e8..fdee40b6f 100644 --- a/src/botserv.c +++ b/src/botserv.c @@ -1893,12 +1893,21 @@ static int do_kickcmd(User * u) if (ttb) { ci->ttb[TTB_BADWORDS] = strtol(ttb, (char **) NULL, 10); - if (errno) { + /* Only error if errno returns ERANGE or EINVAL or we are less then 0 - TSL */ + if (errno == ERANGE || errno == EINVAL + || ci->ttb[TTB_BADWORDS] < 0) { + /* leaving the debug behind since we might want to know what these are */ + if (debug) { + alog("debug: errno is %d ERANGE %d EINVAL %d ttb %d", errno, ERANGE, EINVAL, ci->ttb[TTB_BADWORDS]); + } + /* reset the value back to 0 - TSL */ + ci->ttb[TTB_BADWORDS] = 0; notice_lang(s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; } - } else + } else { ci->ttb[TTB_BADWORDS] = 0; + } ci->botflags |= BS_KICK_BADWORDS; if (ci->ttb[TTB_BADWORDS]) notice_lang(s_BotServ, u, BOT_KICK_BADWORDS_ON_BAN, @@ -1913,7 +1922,12 @@ static int do_kickcmd(User * u) if (!stricmp(value, "ON")) { if (ttb) { ci->ttb[TTB_BOLDS] = strtol(ttb, (char **) NULL, 10); - if (errno) { + if (errno == ERANGE || errno == EINVAL + || ci->ttb[TTB_BOLDS] < 0) { + if (debug) { + alog("debug: errno is %d ERANGE %d EINVAL %d ttb %d", errno, ERANGE, EINVAL, ci->ttb[TTB_BOLDS]); + } + ci->ttb[TTB_BOLDS] = 0; notice_lang(s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; } @@ -1936,7 +1950,12 @@ static int do_kickcmd(User * u) if (ttb) { ci->ttb[TTB_CAPS] = strtol(ttb, (char **) NULL, 10); - if (errno) { + if (errno == ERANGE || errno == EINVAL + || ci->ttb[TTB_CAPS] < 0) { + if (debug) { + alog("debug: errno is %d ERANGE %d EINVAL %d ttb %d", errno, ERANGE, EINVAL, ci->ttb[TTB_CAPS]); + } + ci->ttb[TTB_CAPS] = 0; notice_lang(s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; } @@ -1973,7 +1992,12 @@ static int do_kickcmd(User * u) if (!stricmp(value, "ON")) { if (ttb) { ci->ttb[TTB_COLORS] = strtol(ttb, (char **) NULL, 10); - if (errno) { + if (errno == ERANGE || errno == EINVAL + || ci->ttb[TTB_COLORS] < 0) { + if (debug) { + alog("debug: errno is %d ERANGE %d EINVAL %d ttb %d", errno, ERANGE, EINVAL, ci->ttb[TTB_COLORS]); + } + ci->ttb[TTB_COLORS] = 0; notice_lang(s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; } @@ -1996,7 +2020,12 @@ static int do_kickcmd(User * u) if (ttb) { ci->ttb[TTB_FLOOD] = strtol(ttb, (char **) NULL, 10); - if (errno) { + if (errno == ERANGE || errno == EINVAL + || ci->ttb[TTB_FLOOD] < 0) { + if (debug) { + alog("debug: errno is %d ERANGE %d EINVAL %d ttb %d", errno, ERANGE, EINVAL, ci->ttb[TTB_FLOOD]); + } + ci->ttb[TTB_FLOOD] = 0; notice_lang(s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; } @@ -2035,7 +2064,12 @@ static int do_kickcmd(User * u) if (ttb) { ci->ttb[TTB_REPEAT] = strtol(ttb, (char **) NULL, 10); - if (errno) { + if (errno == ERANGE || errno == EINVAL + || ci->ttb[TTB_REPEAT] < 0) { + if (debug) { + alog("debug: errno is %d ERANGE %d EINVAL %d ttb %d", errno, ERANGE, EINVAL, ci->ttb[TTB_REPEAT]); + } + ci->ttb[TTB_REPEAT] = 0; notice_lang(s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; } @@ -2065,7 +2099,12 @@ static int do_kickcmd(User * u) if (ttb) { ci->ttb[TTB_REVERSES] = strtol(ttb, (char **) NULL, 10); - if (errno) { + if (errno == ERANGE || errno == EINVAL + || ci->ttb[TTB_REVERSES] < 0) { + if (debug) { + alog("debug: errno is %d ERANGE %d EINVAL %d ttb %d", errno, ERANGE, EINVAL, ci->ttb[TTB_REVERSES]); + } + ci->ttb[TTB_REVERSES] = 0; notice_lang(s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; } @@ -2086,7 +2125,12 @@ static int do_kickcmd(User * u) if (ttb) { ci->ttb[TTB_UNDERLINES] = strtol(ttb, (char **) NULL, 10); - if (errno) { + if (errno == ERANGE || errno == EINVAL + || ci->ttb[TTB_UNDERLINES] < 0) { + if (debug) { + alog("debug: errno is %d ERANGE %d EINVAL %d ttb %d", errno, ERANGE, EINVAL, ci->ttb[TTB_UNDERLINES]); + } + ci->ttb[TTB_UNDERLINES] = 0; notice_lang(s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; } |
