summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/botserv.c62
-rw-r--r--src/nickserv.c12
2 files changed, 59 insertions, 15 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;
}
diff --git a/src/nickserv.c b/src/nickserv.c
index b6becd218..6c9a5fd45 100644
--- a/src/nickserv.c
+++ b/src/nickserv.c
@@ -2022,21 +2022,21 @@ static int do_register(User * u)
if (RestrictOperNicks) {
for (i = 0; i < RootNumber; i++) {
- if (strstr(u->nick, ServicesRoots[i]) && !is_oper(u)) {
+ if (stristr(u->nick, ServicesRoots[i]) && !is_oper(u)) {
notice_lang(s_NickServ, u, NICK_CANNOT_BE_REGISTERED,
u->nick);
return MOD_CONT;
}
}
for (i = 0; i < servadmins.count && (nc = servadmins.list[i]); i++) {
- if (strstr(u->nick, nc->display) && !is_oper(u)) {
+ if (stristr(u->nick, nc->display) && !is_oper(u)) {
notice_lang(s_NickServ, u, NICK_CANNOT_BE_REGISTERED,
u->nick);
return MOD_CONT;
}
}
for (i = 0; i < servopers.count && (nc = servopers.list[i]); i++) {
- if (strstr(u->nick, nc->display) && !is_oper(u)) {
+ if (stristr(u->nick, nc->display) && !is_oper(u)) {
notice_lang(s_NickServ, u, NICK_CANNOT_BE_REGISTERED,
u->nick);
return MOD_CONT;
@@ -2342,21 +2342,21 @@ static int do_group(User * u)
if (RestrictOperNicks) {
for (i = 0; i < RootNumber; i++) {
- if (strstr(u->nick, ServicesRoots[i]) && !is_oper(u)) {
+ if (stristr(u->nick, ServicesRoots[i]) && !is_oper(u)) {
notice_lang(s_NickServ, u, NICK_CANNOT_BE_REGISTERED,
u->nick);
return MOD_CONT;
}
}
for (i = 0; i < servadmins.count && (nc = servadmins.list[i]); i++) {
- if (strstr(u->nick, nc->display) && !is_oper(u)) {
+ if (stristr(u->nick, nc->display) && !is_oper(u)) {
notice_lang(s_NickServ, u, NICK_CANNOT_BE_REGISTERED,
u->nick);
return MOD_CONT;
}
}
for (i = 0; i < servopers.count && (nc = servopers.list[i]); i++) {
- if (strstr(u->nick, nc->display) && !is_oper(u)) {
+ if (stristr(u->nick, nc->display) && !is_oper(u)) {
notice_lang(s_NickServ, u, NICK_CANNOT_BE_REGISTERED,
u->nick);
return MOD_CONT;