summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.c2
-rw-r--r--src/core/bs_bot.c24
-rw-r--r--src/core/hs_set.c12
-rw-r--r--src/core/hs_setall.c14
-rw-r--r--src/core/os_chankill.c9
-rw-r--r--src/misc.c2
-rw-r--r--src/modules/hs_request.c20
7 files changed, 49 insertions, 34 deletions
diff --git a/src/config.c b/src/config.c
index 08d29f692..662d6819b 100644
--- a/src/config.c
+++ b/src/config.c
@@ -608,6 +608,8 @@ int ServerConfig::Read(bool bail)
{"networkinfo", "logbot", "no", new ValueContainerBool(&Config.LogBot), DT_BOOLEAN, NoValidation},
{"networkinfo", "networkname", "", new ValueContainerChar(&Config.NetworkName), DT_CHARPTR, ValidateNotEmpty},
{"networkinfo", "nicklen", "0", new ValueContainerUInt(&Config.NickLen), DT_UINTEGER | DT_NORELOAD, ValidateNickLen},
+ {"networkinfo", "userlen", "10", new ValueContainerUInt(&Config.UserLen), DT_UINTEGER | DT_NORELOAD, NoValidation},
+ {"networkinfo", "hostlen", "64", new ValueContainerUInt(&Config.HostLen), DT_UINTEGER | DT_NORELOAD, NoValidation},
{"options", "encryption", "", new ValueContainerString(&EncModules), DT_STRING | DT_NORELOAD, ValidateNotEmpty},
{"options", "database", "", new ValueContainerString(&DBModules), DT_STRING | DT_NORELOAD, ValidateNotEmpty},
{"options", "userkey1", "0", new ValueContainerLUInt(&Config.UserKey1), DT_LUINTEGER, NoValidation},
diff --git a/src/core/bs_bot.c b/src/core/bs_bot.c
index cfaafac23..9c7ce4854 100644
--- a/src/core/bs_bot.c
+++ b/src/core/bs_bot.c
@@ -39,15 +39,15 @@ class CommandBSBot : public Command
return MOD_CONT;
}
- if (strlen(user) >= USERMAX)
+ if (strlen(user) > Config.UserLen)
{
- notice_lang(Config.s_BotServ, u, BOT_LONG_IDENT, USERMAX - 1);
+ notice_lang(Config.s_BotServ, u, BOT_LONG_IDENT, Config.UserLen);
return MOD_CONT;
}
- if (strlen(user) > HOSTMAX)
+ if (strlen(user) > Config.HostLen)
{
- notice_lang(Config.s_BotServ, u, BOT_LONG_HOST, HOSTMAX);
+ notice_lang(Config.s_BotServ, u, BOT_LONG_HOST, Config.HostLen);
return MOD_CONT;
}
@@ -81,11 +81,11 @@ class CommandBSBot : public Command
return MOD_CONT;
}
- for (ch = user; *ch && (ch - user) < USERMAX; ch++)
+ for (ch = user; *ch && (ch - user) < Config.UserLen; ch++)
{
if (!isalnum(*ch))
{
- notice_lang(Config.s_BotServ, u, BOT_BAD_IDENT, USERMAX - 1);
+ notice_lang(Config.s_BotServ, u, BOT_BAD_IDENT, Config.UserLen);
return MOD_CONT;
}
}
@@ -150,15 +150,15 @@ class CommandBSBot : public Command
return MOD_CONT;
}
- if (user && strlen(user) >= USERMAX)
+ if (user && strlen(user) > Config.UserLen)
{
- notice_lang(Config.s_BotServ, u, BOT_LONG_IDENT, USERMAX - 1);
+ notice_lang(Config.s_BotServ, u, BOT_LONG_IDENT, Config.UserLen);
return MOD_CONT;
}
- if (host && strlen(host) > HOSTMAX)
+ if (host && strlen(host) > Config.HostLen)
{
- notice_lang(Config.s_BotServ, u, BOT_LONG_HOST, HOSTMAX);
+ notice_lang(Config.s_BotServ, u, BOT_LONG_HOST, Config.HostLen);
return MOD_CONT;
}
@@ -210,11 +210,11 @@ class CommandBSBot : public Command
if (user)
{
- for (ch = user; *ch && (ch - user) < USERMAX; ch++)
+ for (ch = user; *ch && (ch - user) < Config.UserLen; ch++)
{
if (!isalnum(*ch))
{
- notice_lang(Config.s_BotServ, u, BOT_BAD_IDENT, USERMAX - 1);
+ notice_lang(Config.s_BotServ, u, BOT_BAD_IDENT, Config.UserLen);
return MOD_CONT;
}
}
diff --git a/src/core/hs_set.c b/src/core/hs_set.c
index e50723d0e..c4b9559e0 100644
--- a/src/core/hs_set.c
+++ b/src/core/hs_set.c
@@ -26,7 +26,7 @@ class CommandHSSet : public Command
{
const char *nick = params[0].c_str();
const char *rawhostmask = params[1].c_str();
- char *hostmask = new char[HOSTMAX];
+ char *hostmask = new char[Config.HostLen];
NickAlias *na;
int32 tmp_time;
@@ -45,9 +45,9 @@ class CommandHSSet : public Command
delete [] hostmask;
return MOD_CONT;
}
- if (strlen(vIdent) > USERMAX - 1)
+ if (strlen(vIdent) > Config.UserLen)
{
- notice_lang(Config.s_HostServ, u, HOST_SET_IDENTTOOLONG, USERMAX);
+ notice_lang(Config.s_HostServ, u, HOST_SET_IDENTTOOLONG, Config.UserLen);
delete [] vIdent;
delete [] rawhostmask;
delete [] hostmask;
@@ -76,11 +76,11 @@ class CommandHSSet : public Command
return MOD_CONT;
}
}
- if (strlen(rawhostmask) < HOSTMAX - 1)
- snprintf(hostmask, HOSTMAX - 1, "%s", rawhostmask);
+ if (strlen(rawhostmask) < Config.HostLen)
+ snprintf(hostmask, Config.HostLen, "%s", rawhostmask);
else
{
- notice_lang(Config.s_HostServ, u, HOST_SET_TOOLONG, HOSTMAX);
+ notice_lang(Config.s_HostServ, u, HOST_SET_TOOLONG, Config.HostLen);
if (vIdent)
{
delete [] vIdent;
diff --git a/src/core/hs_setall.c b/src/core/hs_setall.c
index bb6f9cd15..b15fc29ba 100644
--- a/src/core/hs_setall.c
+++ b/src/core/hs_setall.c
@@ -26,7 +26,7 @@ class CommandHSSetAll : public Command
{
const char *nick = params[0].c_str();
const char *rawhostmask = params[1].c_str();
- char *hostmask = new char[HOSTMAX];
+ char *hostmask = new char[Config.HostLen];
NickAlias *na;
int32 tmp_time;
@@ -36,11 +36,13 @@ class CommandHSSetAll : public Command
if (!(na = findnick(nick)))
{
+ delete [] hostmask;
notice_lang(Config.s_HostServ, u, HOST_NOREG, nick);
return MOD_CONT;
}
else if (na->HasFlag(NS_FORBIDDEN))
{
+ delete [] hostmask;
notice_lang(Config.s_HostServ, u, NICK_X_FORBIDDEN, nick);
return MOD_CONT;
}
@@ -56,9 +58,9 @@ class CommandHSSetAll : public Command
delete [] hostmask;
return MOD_CONT;
}
- if (strlen(vIdent) > USERMAX - 1)
+ if (strlen(vIdent) > Config.UserLen)
{
- notice_lang(Config.s_HostServ, u, HOST_SET_IDENTTOOLONG, USERMAX);
+ notice_lang(Config.s_HostServ, u, HOST_SET_IDENTTOOLONG, Config.UserLen);
delete [] vIdent;
delete [] rawhostmask;
delete [] hostmask;
@@ -88,11 +90,11 @@ class CommandHSSetAll : public Command
}
}
- if (strlen(rawhostmask) < HOSTMAX - 1)
- snprintf(hostmask, HOSTMAX - 1, "%s", rawhostmask);
+ if (strlen(rawhostmask) < Config.HostLen)
+ snprintf(hostmask, Config.HostLen, "%s", rawhostmask);
else
{
- notice_lang(Config.s_HostServ, u, HOST_SET_TOOLONG, HOSTMAX);
+ notice_lang(Config.s_HostServ, u, HOST_SET_TOOLONG, Config.HostLen);
if (vIdent)
{
delete [] vIdent;
diff --git a/src/core/os_chankill.c b/src/core/os_chankill.c
index bdb3ecc69..2920e0b4d 100644
--- a/src/core/os_chankill.c
+++ b/src/core/os_chankill.c
@@ -27,7 +27,7 @@ class CommandOSChanKill : public Command
const char *expiry, *channel;
char reason[BUFSIZE];
time_t expires;
- char mask[USERMAX + HOSTMAX + 2];
+ char *mask = new char[Config.UserLen + Config.HostLen + 2];
unsigned last_param = 1;
Channel *c;
@@ -47,6 +47,7 @@ class CommandOSChanKill : public Command
if (expires != 0 && expires < 60)
{
notice_lang(Config.s_OperServ, u, BAD_EXPIRY_TIME);
+ delete [] mask;
return MOD_CONT;
}
else if (expires > 0)
@@ -55,6 +56,7 @@ class CommandOSChanKill : public Command
if (params.size() <= last_param)
{
this->OnSyntaxError(u, "");
+ delete [] mask;
return MOD_CONT;
}
snprintf(reason, sizeof(reason), "%s%s", params[last_param].c_str(), (params.size() > last_param + 1 ? params[last_param + 1].c_str() : ""));
@@ -76,8 +78,8 @@ class CommandOSChanKill : public Command
if (is_oper(uc->user))
continue;
- strlcpy(mask, "*@", sizeof(mask)); /* Use *@" for the akill's, */
- strlcat(mask, uc->user->host, sizeof(mask));
+ strlcpy(mask, "*@", Config.UserLen + Config.HostLen + 2); /* Use *@" for the akill's, */
+ strlcat(mask, uc->user->host, Config.UserLen + Config.HostLen + 2);
add_akill(NULL, mask, Config.s_OperServ, expires, realreason.c_str());
check_akill(uc->user->nick.c_str(), uc->user->GetIdent().c_str(), uc->user->host, NULL, NULL);
}
@@ -87,6 +89,7 @@ class CommandOSChanKill : public Command
else
notice_lang(Config.s_OperServ, u, CHAN_X_NOT_IN_USE, channel);
}
+ delete [] mask;
return MOD_CONT;
}
diff --git a/src/misc.c b/src/misc.c
index a39886ccb..953d28fcd 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -482,7 +482,7 @@ int doValidHost(const char *host, int type)
len = strlen(host);
- if (len > HOSTMAX) {
+ if (len > Config.HostLen) {
return 0;
}
diff --git a/src/modules/hs_request.c b/src/modules/hs_request.c
index 018fc20be..fdacc91a2 100644
--- a/src/modules/hs_request.c
+++ b/src/modules/hs_request.c
@@ -80,7 +80,7 @@ class CommandHSRequest : public Command
{
const char *nick;
const char *rawhostmask = params[0].c_str();
- char hostmask[HOSTMAX];
+ char *hostmask = new char[Config.HostLen];
NickAlias *na;
char *s;
char *vIdent = NULL;
@@ -96,13 +96,15 @@ class CommandHSRequest : public Command
{
me->NoticeLang(Config.s_HostServ, u, LNG_REQUEST_SYNTAX);
delete [] vIdent;
+ delete [] hostmask;
return MOD_CONT;
}
- if (strlen(vIdent) > USERMAX - 1)
+ if (strlen(vIdent) > Config.UserLen)
{
- notice_lang(Config.s_HostServ, u, HOST_SET_IDENTTOOLONG, USERMAX);
+ notice_lang(Config.s_HostServ, u, HOST_SET_IDENTTOOLONG, Config.UserLen);
delete [] vIdent;
delete [] rawhostmask;
+ delete [] hostmask;
return MOD_CONT;
}
else
@@ -114,6 +116,7 @@ class CommandHSRequest : public Command
notice_lang(Config.s_HostServ, u, HOST_SET_IDENT_ERROR);
delete [] vIdent;
delete [] rawhostmask;
+ delete [] hostmask;
return MOD_CONT;
}
}
@@ -123,19 +126,21 @@ class CommandHSRequest : public Command
notice_lang(Config.s_HostServ, u, HOST_NO_VIDENT);
delete [] vIdent;
delete [] rawhostmask;
+ delete [] hostmask;
return MOD_CONT;
}
}
- if (strlen(rawhostmask) < HOSTMAX)
- snprintf(hostmask, HOSTMAX, "%s", rawhostmask);
+ if (strlen(rawhostmask) < Config.HostLen)
+ snprintf(hostmask, Config.HostLen, "%s", rawhostmask);
else
{
- notice_lang(Config.s_HostServ, u, HOST_SET_TOOLONG, HOSTMAX);
+ notice_lang(Config.s_HostServ, u, HOST_SET_TOOLONG, Config.HostLen);
if (vIdent)
{
delete [] vIdent;
delete [] rawhostmask;
}
+ delete [] hostmask;
return MOD_CONT;
}
@@ -147,6 +152,7 @@ class CommandHSRequest : public Command
delete [] vIdent;
delete [] rawhostmask;
}
+ delete [] hostmask;
return MOD_CONT;
}
@@ -163,6 +169,7 @@ class CommandHSRequest : public Command
delete [] vIdent;
delete [] rawhostmask;
}
+ delete [] hostmask;
return MOD_CONT;
}
}
@@ -180,6 +187,7 @@ class CommandHSRequest : public Command
delete [] vIdent;
delete [] rawhostmask;
}
+ delete [] hostmask;
return MOD_CONT;
}