diff options
author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-03-21 19:57:22 +0000 |
---|---|---|
committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-03-21 19:57:22 +0000 |
commit | 9302af51a355f47c490aed6cabb49c19fffbad67 (patch) | |
tree | f7f58de6ac3eeb29bf2fc1b6b0981b473dfc909c | |
parent | 287169d6e8a0aefe12dac1df04778fa73b792682 (diff) |
Added options:passlen
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2831 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | Changes.conf | 1 | ||||
-rw-r--r-- | data/example.conf | 5 | ||||
-rw-r--r-- | include/config.h | 12 | ||||
-rw-r--r-- | include/configreader.h | 5 | ||||
-rw-r--r-- | src/config.c | 1 | ||||
-rw-r--r-- | src/core/enc_md5.c | 3 | ||||
-rw-r--r-- | src/core/enc_sha1.c | 3 | ||||
-rw-r--r-- | src/core/ns_register.c | 2 | ||||
-rw-r--r-- | src/core/ns_saset.c | 2 | ||||
-rw-r--r-- | src/core/ns_set.c | 2 |
10 files changed, 18 insertions, 18 deletions
diff --git a/Changes.conf b/Changes.conf index eecebc1af..2c3d33ceb 100644 --- a/Changes.conf +++ b/Changes.conf @@ -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 diff --git a/data/example.conf b/data/example.conf index cdfe7c6b0..3cc20ad31 100644 --- a/data/example.conf +++ b/data/example.conf @@ -279,6 +279,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. * * Supported: diff --git a/include/config.h b/include/config.h index 320c43d57..0ec5f9bf9 100644 --- a/include/config.h +++ b/include/config.h @@ -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 */ diff --git a/include/configreader.h b/include/configreader.h index 9b66ba7b3..a461c1f15 100644 --- a/include/configreader.h +++ b/include/configreader.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 */ diff --git a/src/config.c b/src/config.c index 662d6819b..162d81b07 100644 --- a/src/config.c +++ b/src/config.c @@ -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}, diff --git a/src/core/enc_md5.c b/src/core/enc_md5.c index cc187b3bc..e7c90f56e 100644 --- a/src/core/enc_md5.c +++ b/src/core/enc_md5.c @@ -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; } diff --git a/src/core/enc_sha1.c b/src/core/enc_sha1.c index 95f7083ee..cea80b110 100644 --- a/src/core/enc_sha1.c +++ b/src/core/enc_sha1.c @@ -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; } diff --git a/src/core/ns_register.c b/src/core/ns_register.c index fcd9c329c..519266747 100644 --- a/src/core/ns_register.c +++ b/src/core/ns_register.c @@ -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); diff --git a/src/core/ns_saset.c b/src/core/ns_saset.c index e7cc089ed..23eb5af39 100644 --- a/src/core/ns_saset.c +++ b/src/core/ns_saset.c @@ -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; diff --git a/src/core/ns_set.c b/src/core/ns_set.c index 7f7348e69..58e2ae4e1 100644 --- a/src/core/ns_set.c +++ b/src/core/ns_set.c @@ -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; |