mirror of
https://github.com/anope/anope.git
synced 2026-06-24 16:46:39 +02:00
Added options:passlen
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2831 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
@@ -8,6 +8,7 @@ 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
|
||||
db_plain:database added to configure what database file to use
|
||||
options:passlen added to specify the maximum length of passwords
|
||||
|
||||
** MODIFIED CONFIGURATION DIRECTIVES **
|
||||
options:encryption added enc_sha256
|
||||
|
||||
@@ -278,6 +278,11 @@ options
|
||||
*/
|
||||
encryption = "enc_none enc_sha1 enc_sha256 enc_md5 enc_old"
|
||||
|
||||
/*
|
||||
* The maximum length of passwords
|
||||
*/
|
||||
passlen = 32
|
||||
|
||||
/*
|
||||
* The database modules are used for saving and loading databases for Anope.
|
||||
*
|
||||
|
||||
@@ -31,11 +31,6 @@
|
||||
/* Maximum amount of data from/to the network to buffer (bytes). */
|
||||
#define NET_BUFSIZE 65536
|
||||
|
||||
/******* OperServ configuration *******/
|
||||
|
||||
/* Define this to enable OperServ's svs commands (superadmin only). */
|
||||
#define USE_OSSVS
|
||||
|
||||
/******************* END OF USER-CONFIGURABLE SECTION ********************/
|
||||
|
||||
/* Size of input buffer (note: this is different from BUFSIZ)
|
||||
@@ -43,13 +38,6 @@
|
||||
* things will happen. */
|
||||
#define BUFSIZE 1024
|
||||
|
||||
/* Extra warning: If you change CHANMAX, your ChanServ database will be
|
||||
* unusable.
|
||||
*/
|
||||
|
||||
/* Maximum length of a password */
|
||||
#define PASSMAX 32
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
#endif /* CONFIG_H */
|
||||
|
||||
@@ -408,9 +408,12 @@ class ServerConfig
|
||||
unsigned NickLen;
|
||||
/* Max length of idents */
|
||||
unsigned UserLen;
|
||||
/* Max lenghts of hostnames */
|
||||
/* Max lenght of hostnames */
|
||||
unsigned HostLen;
|
||||
|
||||
/* Max length of passwords */
|
||||
unsigned PassLen;
|
||||
|
||||
/* NickServ Name */
|
||||
char *s_NickServ;
|
||||
/* ChanServ Name */
|
||||
|
||||
@@ -611,6 +611,7 @@ int ServerConfig::Read(bool bail)
|
||||
{"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", "passlen", "32", new ValueContainerUInt(&Config.PassLen), DT_UINTEGER | DT_NORELOAD, NoValidation},
|
||||
{"options", "database", "", new ValueContainerString(&DBModules), DT_STRING | DT_NORELOAD, ValidateNotEmpty},
|
||||
{"options", "userkey1", "0", new ValueContainerLUInt(&Config.UserKey1), DT_LUINTEGER, NoValidation},
|
||||
{"options", "userkey2", "0", new ValueContainerLUInt(&Config.UserKey2), DT_LUINTEGER, NoValidation},
|
||||
|
||||
+2
-1
@@ -346,7 +346,7 @@ class EMD5 : public Module
|
||||
EventReturn OnEncrypt(const std::string &src, std::string &dest)
|
||||
{
|
||||
MD5_CTX context;
|
||||
char digest[PASSMAX];
|
||||
char *digest = new char[Config.PassLen];
|
||||
std::string buf = "md5:";
|
||||
char cpass[1000];
|
||||
|
||||
@@ -358,6 +358,7 @@ class EMD5 : public Module
|
||||
buf.append(cpass);
|
||||
Alog(LOG_DEBUG_2) << "(enc_md5) hashed password from [" << src << "] to [" << buf << "]";
|
||||
dest.assign(buf);
|
||||
delete [] digest;
|
||||
return EVENT_ALLOW;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -199,7 +199,7 @@ class ESHA1 : public Module
|
||||
EventReturn OnEncrypt(const std::string &src, std::string &dest)
|
||||
{
|
||||
SHA1_CTX context;
|
||||
char digest[PASSMAX];
|
||||
char *digest = new char[Config.PassLen];
|
||||
std::string buf = "sha1:";
|
||||
char cpass[1000];
|
||||
|
||||
@@ -213,6 +213,7 @@ class ESHA1 : public Module
|
||||
buf.append(cpass);
|
||||
Alog(LOG_DEBUG_2) << "(enc_sha1) hashed password from [" << src << "] to [" << buf << "]";
|
||||
dest.assign(buf);
|
||||
delete [] digest;
|
||||
return EVENT_ALLOW;
|
||||
}
|
||||
|
||||
|
||||
@@ -263,7 +263,7 @@ class CommandNSRegister : public CommandNSConfirm
|
||||
}
|
||||
else if (!stricmp(u->nick.c_str(), pass) || (Config.StrictPasswords && strlen(pass) < 5))
|
||||
notice_lang(Config.s_NickServ, u, MORE_OBSCURE_PASSWORD);
|
||||
else if (strlen(pass) > PASSMAX)
|
||||
else if (strlen(pass) > Config.PassLen)
|
||||
notice_lang(Config.s_NickServ, u, PASSWORD_TOO_LONG);
|
||||
else if (email && !MailValidate(email))
|
||||
notice_lang(Config.s_NickServ, u, MAIL_X_INVALID, email);
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ private:
|
||||
notice_lang(Config.s_NickServ, u, MORE_OBSCURE_PASSWORD);
|
||||
return MOD_CONT;
|
||||
}
|
||||
else if (len > PASSMAX)
|
||||
else if (len > Config.PassLen)
|
||||
{
|
||||
notice_lang(Config.s_NickServ, u, PASSWORD_TOO_LONG);
|
||||
return MOD_CONT;
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ class CommandNSSet : public Command
|
||||
notice_lang(Config.s_NickServ, u, MORE_OBSCURE_PASSWORD);
|
||||
return MOD_CONT;
|
||||
}
|
||||
else if (len > PASSMAX)
|
||||
else if (len > Config.PassLen)
|
||||
{
|
||||
notice_lang(Config.s_NickServ, u, PASSWORD_TOO_LONG);
|
||||
return MOD_CONT;
|
||||
|
||||
Reference in New Issue
Block a user