mirror of
https://github.com/anope/anope.git
synced 2026-07-03 22:23:12 +02:00
Made usermax and hostmax configurable
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2829 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
@@ -5,6 +5,8 @@ options:enablelogchannel added to auto turn on the logchannel on startup
|
||||
options:mlock added to configure the default mlock modes on new channels
|
||||
options:database added for the database modules
|
||||
options:botmodes added to configure modes BotServ bots should use
|
||||
options:userlen added to configure maxiumum ident length
|
||||
options:hostlen added to configure maximum hostname length
|
||||
|
||||
** MODIFIED CONFIGURATION DIRECTIVES **
|
||||
options:encryption added enc_sha256
|
||||
|
||||
@@ -228,6 +228,20 @@ networkinfo
|
||||
* but recommended.
|
||||
*/
|
||||
nicklen = 31
|
||||
|
||||
/* Set this to the maximum allowed ident length on your network.
|
||||
* Be sure to set this correctly, as setting this wrong can result in
|
||||
* Services being disconnected from the network. This directive is optional,
|
||||
* but recommended.
|
||||
*/
|
||||
userlen = 10
|
||||
|
||||
/* Set this to the maximum allowed hostname length on your network.
|
||||
* Be sure to set this correctly, as setting this wrong can result in
|
||||
* Services being disconnected from the network. This directive is optional,
|
||||
* but recommended.
|
||||
*/
|
||||
hostlen = 64
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -53,12 +53,6 @@
|
||||
/* Maximum length of a password */
|
||||
#define PASSMAX 32
|
||||
|
||||
/* Maximum length of a username */
|
||||
#define USERMAX 10
|
||||
|
||||
/* Maximum length of a domain */
|
||||
#define HOSTMAX 64
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
#endif /* CONFIG_H */
|
||||
|
||||
@@ -406,6 +406,10 @@ class ServerConfig
|
||||
char *NetworkName;
|
||||
/* The max legnth of nicks */
|
||||
unsigned NickLen;
|
||||
/* Max length of idents */
|
||||
unsigned UserLen;
|
||||
/* Max lenghts of hostnames */
|
||||
unsigned HostLen;
|
||||
|
||||
/* NickServ Name */
|
||||
char *s_NickServ;
|
||||
|
||||
@@ -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},
|
||||
|
||||
+12
-12
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -482,7 +482,7 @@ int doValidHost(const char *host, int type)
|
||||
|
||||
len = strlen(host);
|
||||
|
||||
if (len > HOSTMAX) {
|
||||
if (len > Config.HostLen) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user