diff options
author | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-15 17:52:23 +0000 |
---|---|---|
committer | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-15 17:52:23 +0000 |
commit | a5eb22efd8fd32be8c0c3c6e83b91d8ae4c0ad13 (patch) | |
tree | a966e69c141affa7cd2ea593a4193c6ac3713de2 | |
parent | 7fde7771aadceb5a02b4e28fb5dc290d5ade0897 (diff) |
Added userkey[123] directives to options block in new config.
Added ValueContainerLUInt specialization of ValueContainer for the above directives.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1701 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | data/example_new.conf | 15 | ||||
-rw-r--r-- | include/configreader.h | 6 | ||||
-rw-r--r-- | src/config.c | 14 |
3 files changed, 31 insertions, 4 deletions
diff --git a/data/example_new.conf b/data/example_new.conf index db174af73..80dbe84a2 100644 --- a/data/example_new.conf +++ b/data/example_new.conf @@ -237,6 +237,21 @@ options { * - enc_sha1 (SHA1 encryption) */ encryption = "enc_none" + + /* + * These keys are used to initiate the random number generator. These numbers + * MUST be random as you want your passcodes to be random. Don't give these + * keys to anyone! Keep them private! + * + * NOTE: If you don't uncomment these or keep their default values, any talented + * programmer would be able to easily "guess" random strings used to mask + * information. Be safe, and come up with three different 7-digit numbers. + * + * These directives are optional, but highly recommended. + */ + #userkey1 = 9866235 + #userkey2 = 8362013 + #userkey3 = 2362899 } /* diff --git a/include/configreader.h b/include/configreader.h index 6db8f03dc..87bc4e34d 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -29,6 +29,7 @@ enum ConfigDataType { DT_NOTHING, // No data DT_INTEGER, // Integer DT_UINTEGER, // Unsigned Integer + DT_LUINTEGER, // Long Unsigned Integer DT_CHARPTR, // Char pointer DT_STRING, // std::string DT_BOOLEAN, // Boolean @@ -190,6 +191,11 @@ typedef ValueContainer<bool *> ValueContainerBool; typedef ValueContainer<unsigned *> ValueContainerUInt; /** A specialization of ValueContainer to hold a pointer to + * a long unsigned int + */ +typedef ValueContainer<long unsigned *> ValueContainerLUInt; + +/** A specialization of ValueContainer to hold a pointer to * a char array. */ typedef ValueContainer<char **> ValueContainerChar; diff --git a/src/config.c b/src/config.c index c477862d9..770072b96 100644 --- a/src/config.c +++ b/src/config.c @@ -635,6 +635,9 @@ int ServerConfig::Read(bool bail) {"networkinfo", "networkname", "", new ValueContainerChar(&NetworkName), DT_CHARPTR, ValidateNotEmpty}, {"networkinfo", "nicklen", "0", new ValueContainerInt(&NickLen), DT_INTEGER | DT_NORELOAD, ValidateNickLen}, {"options", "encryption", "", new ValueContainerChar(&EncModule), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty}, + {"options", "userkey1", "0", new ValueContainerLUInt(&UserKey1), DT_LUINTEGER, NoValidation}, + {"options", "userkey2", "0", new ValueContainerLUInt(&UserKey2), DT_LUINTEGER, NoValidation}, + {"options", "userkey3", "0", new ValueContainerLUInt(&UserKey3), DT_LUINTEGER, NoValidation}, {"nickserv", "nick", "NickServ", new ValueContainerChar(&s_NickServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty}, {"nickserv", "description", "Nickname Registration Service", new ValueContainerChar(&desc_NickServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty}, {"nickserv", "database", "nick.db", new ValueContainerChar(&NickDBName), DT_CHARPTR, ValidateNotEmpty}, @@ -836,7 +839,13 @@ int ServerConfig::Read(bool bail) case DT_UINTEGER: { unsigned val = vi.GetInteger(); ValueContainerUInt *vci = dynamic_cast<ValueContainerUInt *>(Values[Index].val); - vci->Set(&val, sizeof(int)); + vci->Set(&val, sizeof(unsigned)); + } + break; + case DT_LUINTEGER: { + long unsigned val = vi.GetInteger(); + ValueContainerLUInt *vci = dynamic_cast<ValueContainerLUInt *>(Values[Index].val); + vci->Set(&val, sizeof(long unsigned)); } break; case DT_TIME: { @@ -1382,9 +1391,6 @@ Directive directives[] = { {"UpdateTimeout", {{PARAM_TIME, PARAM_RELOAD, &UpdateTimeout}}}, {"UsePrivmsg", {{PARAM_SET, PARAM_RELOAD, &UsePrivmsg}}}, {"UseStrictPrivMsg", {{PARAM_SET, PARAM_RELOAD, &UseStrictPrivMsg}}}, - {"UserKey1", {{PARAM_POSINT, PARAM_RELOAD, &UserKey1}}}, - {"UserKey2", {{PARAM_POSINT, PARAM_RELOAD, &UserKey2}}}, - {"UserKey3", {{PARAM_POSINT, PARAM_RELOAD, &UserKey3}}}, {"UseSVSHOLD", {{PARAM_SET, PARAM_RELOAD, &UseSVSHOLD}}}, {"UseTS6", {{PARAM_SET, 0, &UseTS6}}}, {"UnRestrictSAdmin", {{PARAM_SET, PARAM_RELOAD, &UnRestrictSAdmin}}}, |