summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>2008-10-13 12:32:37 +0000
committerRobin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>2008-10-13 12:32:37 +0000
commit2b0e9c3f5f0eb631619bc111764146553bcdf303 (patch)
treedc85f649a57bf72fc300808b36bee606daff9688
parent3324e62bae6f04e4f16f113b2e3352fae242f405 (diff)
Merge commit 'cbx/anopeng-config' into anopeng-config
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1429 5417fbe8-f217-4b02-8779-1006273d7864
-rwxr-xr-xconfigure194
-rw-r--r--configure.in2
-rw-r--r--data/example.conf3
-rw-r--r--data/example_new.conf176
-rw-r--r--include/extern.h38
-rw-r--r--include/hashcomp.h82
-rw-r--r--include/services.h3
-rw-r--r--include/sysconf.h.in6
-rw-r--r--include/sysconf.h.win322
-rw-r--r--makefile.inc.win321
-rw-r--r--src/Makefile32
-rw-r--r--src/compat.c24
-rw-r--r--src/config.c257
-rw-r--r--src/datafiles.c34
-rw-r--r--src/hashcomp.cpp56
-rw-r--r--src/protocol/bahamut.c1
-rw-r--r--src/protocol/charybdis.c1
-rw-r--r--src/protocol/inspircd11.c1
-rw-r--r--src/protocol/ratbox.c1
-rw-r--r--src/protocol/unreal32.c1
20 files changed, 458 insertions, 457 deletions
diff --git a/configure b/configure
index d9e420987..5090a5a78 100755
--- a/configure
+++ b/configure
@@ -6955,200 +6955,6 @@ fi
done
-for ac_func in strdup
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
- eval "$as_ac_var=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_var'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_STRDUP 1
-_ACEOF
-
-fi
-done
-
-
-for ac_func in strspn
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
- eval "$as_ac_var=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_var'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_STRSPN 1
-_ACEOF
-
-fi
-done
-
-
for ac_func in gettimeofday
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
diff --git a/configure.in b/configure.in
index 7e91eaed8..4a880af7d 100644
--- a/configure.in
+++ b/configure.in
@@ -234,8 +234,6 @@ AC_CHECK_HEADER(execinfo.h,AC_DEFINE(HAVE_BACKTRACE,1,""))
AC_CHECK_FUNCS(stricmp,AC_DEFINE(HAVE_STRICMP,1))
AC_CHECK_FUNCS(strcasecmp,AC_DEFINE(HAVE_STRCASECMP,1))
-AC_CHECK_FUNCS(strdup,AC_DEFINE(HAVE_STRDUP,1))
-AC_CHECK_FUNCS(strspn,AC_DEFINE(HAVE_STRSPN,1))
AC_CHECK_FUNCS(gettimeofday,AC_DEFINE(HAVE_GETTIMEOFDAY,1))
AC_CHECK_FUNCS(setgrent,AC_DEFINE(HAVE_SETGRENT,1))
AC_CHECK_FUNCS(umask,AC_DEFINE(HAVE_UMASK,1))
diff --git a/data/example.conf b/data/example.conf
index 2c494fa4a..b6cd27bb9 100644
--- a/data/example.conf
+++ b/data/example.conf
@@ -1274,9 +1274,6 @@ WallDrop
# with a large exception list, can degrade services' performance.
# See the source and comments in sessions.c and the online help for more
# information about session limiting.
-#
-# NOTE: This option is not available when STREAMLINED is defined in
-# the Makefile.
LimitSessions
diff --git a/data/example_new.conf b/data/example_new.conf
index 333b651b7..bca494c00 100644
--- a/data/example_new.conf
+++ b/data/example_new.conf
@@ -123,6 +123,7 @@ uplink
* [REQUIRED] NickServ Config
*
* This section is used to set up the Nickname Registration Service pseudo-client.
+ * Unless specified otherwise, all directives are required.
*/
nickserv
{
@@ -130,9 +131,184 @@ nickserv
* The nickname of the NickServ client.
*/
nick = "NickServ"
+
/*
* The description of the NickServ client, which will be used as the GECOS (real
* name) of the client.
*/
description = "Nickname Registration Service"
+
+ /*
+ * The filename of the NickServ database. The path is relative to the services
+ * executable. If not given, defaults to "nick.db".
+ */
+ database = "nick.db"
+
+ /*
+ * The filename of the NickServ Pre-Nick database. The path is relative to the
+ * services executable. This directive is only required if the e-mail registration
+ * option is enabled.
+ */
+ #prenickdatabase = "prenick.db"
+
+ /*
+ * Force users to give an e-mail address when they register a nick. This directive
+ * is recommended to be enabled, and required if the e-mail registration option is
+ * enabled.
+ */
+ forceemail = yes
+
+ /*
+ * Require an e-mail to be sent to the user before they can register their nick.
+ */
+ #emailregistration = yes
+
+ /*
+ * The default options for newly registered nicks. Note that changing these options
+ * will have no effect on nicks which are already registered. The list must be separated
+ * by spaces
+ *
+ * The options are:
+ * - kill: Kill nick if not identified within 60 seconds
+ * - killquick: Kill nick if not identified within 20 seconds, this one overrides the above
+ * option and the above must be specified with this one
+ * - secure: Enable nickname security, requiring the nick's password before any operations
+ * can be done on it
+ * - private: Hide the nick from NickServ's LIST command
+ * - hideemail: Hide's the nick's e-mail address from NickServ's INFO command
+ * - hideusermask: Hide's the nick's last or current user@host from NickServ's INFO command
+ * - hidequit: Hide's the nick's last quit message
+ * - memosignon: Notify user if they have a new memo when they sign into the nick
+ * - memoreceive: Notify user if they have a new memo as soon as it's received
+ * - autoop: User will be automatically opped in channels they enter and have access to
+ * - msg: Services messages will be sent as PRIVMSGs instead of NOTICEs, requires UsePrivmsg
+ * to be enabled as well
+ *
+ * This directive is optional, if left blank, the options will default to secure, memosignon, and
+ * memoreceive. If you really want no defaults, use "none" by itself as the option.
+ */
+ defaults="secure private hideemail hideusermask memosignon memoreceive autoop"
+
+ /*
+ * Default language that non- and newly-registered nicks will receive messages in. The number
+ * here is the same as the number in NickServ's SET LANGUAGE help.
+ */
+ defaultlanguage = 1
+
+ /*
+ * The minimum length of time between consecutive uses of NickServ's REGISTER command. This
+ * directive is optional, but recommended. If not set, this restriction will be disabled.
+ */
+ regdelay = 30s
+
+ /*
+ * The minimum length of time between consecutive uses of NickServ's RESEND command. This
+ * directive is optional, but recommended. If not set, this restriction will be disabled.
+ */
+ resenddelay = 90s
+
+ /*
+ * The length of time before a nick registration expires. This directive is optional, but
+ * recommended. If not set, the default is 21 days.
+ */
+ expire = 21d
+
+ /*
+ * The length of time a user gets to enter the confirmation code which has been e-mailed
+ * to them before the nick will be released for general use again. This directive is
+ * only required if the e-mail registration option is enabled.
+ */
+ #preregexpire = 1d
+
+ /*
+ * The maximum number of nicks allowed in a group. This directve is optional, but
+ * recommended. If not set or set to 0, no limits will be applied.
+ */
+ maxaliases = 16
+
+ /*
+ * The maximum number of entries allowed on a nickname's access list.
+ */
+ accessmax = 32
+
+ /*
+ * The username (and possibly hostname) used for the fake user created when NickServ collides
+ * a user. Should be in the user@host format. If the host is not given, the one from ServicesUser
+ * is used.
+ */
+ enforceruser = "enforcer@localhost.net"
+ #enforceruser = "enforcer"
+
+ /*
+ * The delay before a NickServ-collided nick is released.
+ */
+ releasetimeout = 1m
+
+ /*
+ * Allow the use of the IMMED option in the NickServ SET KILL command. This directive is optional.
+ */
+ #allowkillimmed = yes
+
+ /*
+ * If set, the NickServ GROUP command won't allow any group change. This is recommended for
+ * better performance and to protect against nick stealing, however users will have less
+ * flexibility. This directive is optional.
+ */
+ #nogroupchange = yes
+
+ /*
+ * Limits the use of the NickServ LIST command to IRC operators. This directive is optional.
+ */
+ #listopersonly = yes
+
+ /*
+ * The maximum number of nicks to be returned for a NickServ LIST command.
+ */
+ listmax = 50
+
+ /*
+ * When a user's nick is forcibly changed to enforce a "nick kill", their new nick will start
+ * with this value. The rest will be made up of 6 or 7 digits.
+ */
+ guestnickprefix = "Guest"
+
+ /*
+ * Prevents the use of the DROP, FORBID, GETPASS, and SET PASSWORD commands by Services Admins
+ * on other Services Admins or the Services Root(s). This directive is optional, but
+ * recommended.
+ */
+ secureadmins = yes
+
+ /*
+ * If set, any user wanting to use the privileges of Services Root, Services Admin, or Services
+ * Operator must have been logged as an IRC Operator with the /oper command. This directive is
+ * optional, but recommended.
+ */
+ strictprivileges = yes
+
+ /*
+ * If set, Services will set the channel modes a user has access to upon identifying, assuming
+ * they are not already set. This directive is optional.
+ */
+ #modeonid = yes
+
+ /*
+ * If set, Services will only allow Services Root(s) to use the NickServ GETPASS command on
+ * a nick. This directive is optional.
+ */
+ restrictgetpass = yes
+
+ /*
+ * If set, Services will track your last nick identified when issuing nick changes. This
+ * directive is optional.
+ */
+ #nicktracking = yes
+
+ /*
+ * If set, Services will add the usermask of registering users to the access list of their
+ * newly created account. If not set, users will always have to identify to NickServ before
+ * being recognized, unless they manually add an address to the access list of their account.
+ * This directive is optional.
+ */
+ addaccessonreg = yes
}
diff --git a/include/extern.h b/include/extern.h
index 7135f7229..44f489fdd 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -217,12 +217,6 @@ E char *get_mlock_modes(ChannelInfo * ci, int complete);
E int stricmp(const char *s1, const char *s2);
E int strnicmp(const char *s1, const char *s2, size_t len);
#endif
-#if !HAVE_STRDUP
-E char *strdup(const char *s);
-#endif
-#if !HAVE_STRSPN
-E size_t strspn(const char *s, const char *accept);
-#endif
#ifdef _WIN32
char *sockstrerror(int error);
#endif
@@ -324,28 +318,28 @@ E int DontQuoteAddresses;
E int NSDefFlags;
E int NSDefLanguage;
-E int NSRegDelay;
-E int NSResendDelay;
-E int NSExpire;
-E int NSRExpire;
-E int NSForceEmail;
+E time_t NSRegDelay;
+E time_t NSResendDelay;
+E time_t NSExpire;
+E time_t NSRExpire;
+E bool NSForceEmail;
E int NSMaxAliases;
E int NSAccessMax;
E char *NSEnforcerUser;
E char *NSEnforcerHost;
-E int NSReleaseTimeout;
-E int NSAllowKillImmed;
-E int NSNoGroupChange;
-E int NSListOpersOnly;
+E time_t NSReleaseTimeout;
+E bool NSAllowKillImmed;
+E bool NSNoGroupChange;
+E bool NSListOpersOnly;
E int NSListMax;
E char *NSGuestNickPrefix;
-E int NSSecureAdmins;
-E int NSStrictPrivileges;
-E int NSEmailReg;
-E int NSModeOnID;
-E int NSRestrictGetPass;
-E int NSNickTracking;
-E int NSAddAccessOnReg;
+E bool NSSecureAdmins;
+E bool NSStrictPrivileges;
+E bool NSEmailReg;
+E bool NSModeOnID;
+E bool NSRestrictGetPass;
+E bool NSNickTracking;
+E bool NSAddAccessOnReg;
E int CSDefFlags;
E int CSMaxReg;
diff --git a/include/hashcomp.h b/include/hashcomp.h
new file mode 100644
index 000000000..8d0b09ec2
--- /dev/null
+++ b/include/hashcomp.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2002-2008 InspIRCd Development Team
+ * Copyright (C) 2008 Anope Team <info@anope.org>
+ *
+ * Please read COPYING and README for further details.
+ *
+ * These classes have been copied from InspIRCd and modified
+ * for use in Anope.
+ *
+ * $Id$
+ *
+ */
+
+#ifndef _HASHCOMP_H_
+#define _HASHCOMP_H_
+
+#include <string>
+
+/** sepstream allows for splitting token seperated lists.
+ * Each successive call to sepstream::GetToken() returns
+ * the next token, until none remain, at which point the method returns
+ * an empty string.
+ */
+class sepstream
+{
+ private:
+ /** Original string.
+ */
+ std::string tokens;
+ /** Last position of a seperator token
+ */
+ std::string::iterator last_starting_position;
+ /** Current string position
+ */
+ std::string::iterator n;
+ /** Seperator value
+ */
+ char sep;
+ public:
+ /** Create a sepstream and fill it with the provided data
+ */
+ sepstream(const std::string &source, char seperator);
+ virtual ~sepstream() { }
+
+ /** Fetch the next token from the stream
+ * @param token The next token from the stream is placed here
+ * @return True if tokens still remain, false if there are none left
+ */
+ virtual bool GetToken(std::string &token);
+
+ /** Fetch the entire remaining stream, without tokenizing
+ * @return The remaining part of the stream
+ */
+ virtual const std::string GetRemaining();
+
+ /** Returns true if the end of the stream has been reached
+ * @return True if the end of the stream has been reached, otherwise false
+ */
+ virtual bool StreamEnd();
+};
+
+/** A derived form of sepstream, which seperates on commas
+ */
+class commasepstream : public sepstream
+{
+ public:
+ /** Initialize with comma seperator
+ */
+ commasepstream(const std::string &source) : sepstream(source, ',') { }
+};
+
+/** A derived form of sepstream, which seperates on spaces
+ */
+class spacesepstream : public sepstream
+{
+ public:
+ /** Initialize with space seperator
+ */
+ spacesepstream(const std::string &source) : sepstream(source, ' ') { }
+};
+
+#endif
diff --git a/include/services.h b/include/services.h
index aafbb3ddc..c8d9af8ac 100644
--- a/include/services.h
+++ b/include/services.h
@@ -266,7 +266,6 @@ struct ircdvars_ {
const char *operservmode; /* Mode used by OperServ */
const char *botservmode; /* Mode used by BotServ */
const char *helpservmode; /* Mode used by HelpServ */
- const char *devnullmode; /* Mode used by Dev/Null */
const char *globalmode; /* Mode used by Global */
const char *botserv_bot_mode; /* Mode used by BotServ Bots */
int max_symbols; /* Chan Max Symbols */
@@ -409,7 +408,7 @@ typedef struct {
/* Flags: */
#define PARAM_OPTIONAL 0x01
-#define PARAM_FULLONLY 0x02 /* Directive only allowed if !STREAMLINED */
+/*#define PARAM_FULLONLY 0x02 unused */
#define PARAM_RELOAD 0x04 /* Directive is reloadable */
/*************************************************************************/
diff --git a/include/sysconf.h.in b/include/sysconf.h.in
index f4b3f99e7..8c0f63f56 100644
--- a/include/sysconf.h.in
+++ b/include/sysconf.h.in
@@ -42,9 +42,6 @@
/* Define to 1 if you have the `strcasecmp' function. */
#undef HAVE_STRCASECMP
-/* Define to 1 if you have the `strdup' function. */
-#undef HAVE_STRDUP
-
/* Define to 1 if you have the `stricmp' function. */
#undef HAVE_STRICMP
@@ -60,9 +57,6 @@
/* Define to 1 if you have the `strlcpy' function. */
#undef HAVE_STRLCPY
-/* Define to 1 if you have the `strspn' function. */
-#undef HAVE_STRSPN
-
/* "" */
#undef HAVE_SYS_SELECT_H
diff --git a/include/sysconf.h.win32 b/include/sysconf.h.win32
index fb6d5a6e9..5b33a3608 100644
--- a/include/sysconf.h.win32
+++ b/include/sysconf.h.win32
@@ -18,8 +18,6 @@ typedef unsigned __int8 u_int8_t;
#define HAVE_STRICMP 1
#define HAVE_STRCASECMP 0
-#define HAVE_STRDUP 1
-#define HAVE_STRSPN 1
#define HAVE_STRSIGNAL 0
#define HAVE_GETTIMEOFDAY 0
#define HAVE_SETGRENT 0
diff --git a/makefile.inc.win32 b/makefile.inc.win32
index 62448d015..aa81608ac 100644
--- a/makefile.inc.win32
+++ b/makefile.inc.win32
@@ -87,7 +87,6 @@ BASE_CFLAGS=/D USE_ENCRYPTION /D ENCRYPT_MD5 $(BASE_CFLAGS)
# Compilation options:
# -DCLEAN_COMPILE Attempt to compile without any warnings (note that
# this may reduce performance)
-# -DSTREAMLINED Leave out "fancy" options to enhance performance
CDEFS =
diff --git a/src/Makefile b/src/Makefile
index ea4b572c2..3d7122c5f 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,21 +1,21 @@
MYSQL_OBJ = $(MYSQL:.c=.o)
RDB_OBJ = $(RDB:.c=.o)
OBJS = actions.o base64.o bots.o botserv.o channels.o chanserv.o commands.o compat.o \
- config.o datafiles.o encrypt.o events.o helpserv.o hostserv.o init.o ircd.o language.o log.o mail.o main.o \
+ config.o datafiles.o encrypt.o events.o hashcomp.o helpserv.o hostserv.o init.o ircd.o language.o log.o mail.o main.o \
memory.o memoserv.o messages.o misc.o modules.o news.o nickserv.o operserv.o \
process.o send.o servers.o sessions.o slist.o sockutil.o timeout.o users.o \
- $(RDB_OBJ) $(MYSQL_OBJ)
+ $(RDB_OBJ) $(MYSQL_OBJ)
SRCS = actions.c base64.c bots.cpp botserv.c channels.c chanserv.c commands.c compat.c \
- config.c datafiles.c encrypt.c events.c helpserv.c hostserv.c init.c ircd.c language.c log.c mail.c main.c \
+ config.c datafiles.c encrypt.c events.c hashcomp.c helpserv.c hostserv.c init.c ircd.c language.c log.c mail.c main.c \
memory.c memoserv.c messages.c misc.c modules.c news.c nickserv.c operserv.c \
process.c send.c servers.c sessions.c s sockutil.c timeout.c users.c \
- $(RDB) $(MYSQL)
+ $(RDB) $(MYSQL)
INCLUDES = ../include/commands.h ../include/defs.h ../include/language.h \
../include/pseudo.h ../include/sysconf.h ../include/config.h \
../include/encrypt.h ../include/messages.h ../include/services.h \
../include/timeout.h ../include/datafiles.h ../include/extern.h \
- ../include/modules.h ../include/slist.h
+ ../include/modules.h ../include/slist.h ../include/hashcomp.h
MAKEARGS = 'CFLAGS=${CFLAGS}' 'CC=${CC}' 'ANOPELIBS=${ANOPELIBS}' \
'LDFLAGS=${LDFLAGS}' 'BINDEST=${BINDEST}' 'INSTALL=${INSTALL}' \
@@ -36,26 +36,26 @@ distclean: spotless
distclean_modules: clean_modules spotless
services: $(OBJS) mod_version
- @../run-cc.pl $(CC) $(CFLAGS) $(OBJS) $(ANOPELIBS) $(MLIBS) -o $@ $(LDFLAGS)
+ @../run-cc.pl $(CC) $(CFLAGS) $(OBJS) $(ANOPELIBS) $(MLIBS) -o $@ $(LDFLAGS)
$(OBJS): Makefile
actions.o: actions.c $(INCLUDES)
-base64.o: base64.c $(INCLUDES)
+base64.o: base64.c $(INCLUDES)
bots.o: bots.cpp $(INCLUDES)
-botserv.o: botserv.c $(INCLUDES)
-channels.o: channels.c $(INCLUDES)
-chanserv.o: chanserv.c $(INCLUDES)
-commands.o: commands.c $(INCLUDES)
+botserv.o: botserv.c $(INCLUDES)
+channels.o: channels.c $(INCLUDES)
+chanserv.o: chanserv.c $(INCLUDES)
+commands.o: commands.c $(INCLUDES)
compat.o: compat.c $(INCLUDES)
-config.o: config.c $(INCLUDES)
+config.o: config.c $(INCLUDES)
datafiles.o: datafiles.c $(INCLUDES)
-encrypt.o: encrypt.c $(INCLUDES)
+encrypt.o: encrypt.c $(INCLUDES)
events.o: events.c $(INCLUDES)
init.o: init.c $(INCLUDES)
ircd.o: ircd.c $(INCLUDES)
-helpserv.o: helpserv.c $(INCLUDES)
-hostserv.o: hostserv.c $(INCLUDES)
-language.o: language.c $(INCLUDES)
+helpserv.o: helpserv.c $(INCLUDES)
+hostserv.o: hostserv.c $(INCLUDES)
+language.o: language.c $(INCLUDES)
log.o: log.c $(INCLUDES)
mail.o: mail.c $(INCLUDES)
main.o: main.c $(INCLUDES)
diff --git a/src/compat.c b/src/compat.c
index 7b7947c1c..0279efec8 100644
--- a/src/compat.c
+++ b/src/compat.c
@@ -57,27 +57,3 @@ int strnicmp(const char *s1, const char *s2, size_t len)
/*************************************************************************/
-#if !HAVE_STRDUP
-char *strdup(const char *s)
-{
- char *new = calloc(strlen(s) + 1, 1);
- if (new)
- strcpy(new, s);
- return new;
-}
-#endif
-
-/*************************************************************************/
-
-#if !HAVE_STRSPN
-size_t strspn(const char *s, const char *accept)
-{
- size_t i = 0;
-
- while (*s && strchr(accept, *s))
- ++i, ++s;
- return i;
-}
-#endif
-
-/*************************************************************************/
diff --git a/src/config.c b/src/config.c
index 639cfae12..41f5cedd7 100644
--- a/src/config.c
+++ b/src/config.c
@@ -14,6 +14,7 @@
#include "services.h"
#include "configreader.h"
+#include "hashcomp.h" // If this gets added to services.h or someplace else later, remove it from here -- CyberBotX
/*************************************************************************/
@@ -114,43 +115,32 @@ int RestrictMail;
int MailDelay;
int DontQuoteAddresses;
-static int NSDefNone;
+static std::string NSDefaults;
char *NSGuestNickPrefix;
-int NSAllowKillImmed;
-int NSNoGroupChange;
-int NSDefKill;
-int NSDefKillQuick;
-int NSDefSecure;
-int NSDefPrivate;
-int NSDefMsg;
-int NSDefHideEmail;
-int NSDefHideUsermask;
-int NSDefHideQuit;
-int NSDefMemoSignon;
-int NSDefMemoReceive;
+bool NSAllowKillImmed;
+bool NSNoGroupChange;
int NSDefFlags;
int NSDefLanguage;
-int NSDefAutoop;
-int NSRegDelay;
-int NSResendDelay;
-int NSExpire;
-int NSRExpire;
-int NSForceEmail;
+time_t NSRegDelay;
+time_t NSResendDelay;
+time_t NSExpire;
+time_t NSRExpire;
+bool NSForceEmail;
int NSMaxAliases;
int NSAccessMax;
char *NSEnforcerUser;
char *NSEnforcerHost;
static char *temp_nsuserhost;
-int NSReleaseTimeout;
-int NSListOpersOnly;
+time_t NSReleaseTimeout;
+bool NSListOpersOnly;
int NSListMax;
-int NSSecureAdmins;
-int NSStrictPrivileges;
-int NSEmailReg;
-int NSModeOnID;
-int NSRestrictGetPass;
-int NSNickTracking;
-int NSAddAccessOnReg;
+bool NSSecureAdmins;
+bool NSStrictPrivileges;
+bool NSEmailReg;
+bool NSModeOnID;
+bool NSRestrictGetPass;
+bool NSNickTracking;
+bool NSAddAccessOnReg;
int CSDefNone;
int CSDefKeepTopic;
@@ -452,6 +442,26 @@ bool ValidateNotEmpty(ServerConfig *, const char *tag, const char *value, ValueI
return true;
}
+bool ValidateNotZero(ServerConfig *, const char *tag, const char *value, ValueItem &data)
+{
+ if (!data.GetInteger()) throw ConfigException(static_cast<std::string>("The value for <") + tag + ":" + value + "> must be non-zero!");
+ return true;
+}
+
+bool ValidateEmailReg(ServerConfig *, const char *tag, const char *value, ValueItem &data)
+{
+ if (static_cast<std::string>(value) == "prenickdatabase") {
+ if (!*data.GetString()) throw ConfigException(static_cast<std::string>("The value for <") + tag + ":" + value + "> cannot be empty when e-mail registrations are enabled!");
+ }
+ else if (static_cast<std::string>(value) == "preregexpire") {
+ if (!data.GetInteger()) throw ConfigException(static_cast<std::string>("The value for <") + tag + ":" + value + "> must be non-zero when e-mail registration are enabled!");
+ }
+ else {
+ if (!data.GetBool()) throw ConfigException(static_cast<std::string>("The value for <") + tag + ":" + value + "> must be set to yes when e-mail registrations are enabled!");
+ }
+ return true;
+}
+
bool ValidatePort(ServerConfig *, const char *tag, const char *value, ValueItem &data)
{
int port = data.GetInteger();
@@ -461,6 +471,23 @@ bool ValidatePort(ServerConfig *, const char *tag, const char *value, ValueItem
return true;
}
+bool ValidateLanguage(ServerConfig *, const char *, const char *, ValueItem &data)
+{
+ int language = data.GetInteger();
+ char maxlang[3];
+ snprintf(maxlang, 3, "%d", USED_LANGS);
+ if (language < 1 || language > USED_LANGS) throw ConfigException(static_cast<std::string>("The value for <nickserv:defaultlanguage> must be between 1 and ") + maxlang + "!");
+ data.Set(--language);
+ return true;
+}
+
+bool ValidateGuestPrefix(ServerConfig *conf, const char *tag, const char *value, ValueItem &data)
+{
+ ValidateNotEmpty(conf, tag, value, data);
+ if (strlen(data.GetString()) > 21) throw ConfigException("The value for <nickserv:guestnickprefix> cannot exceed 21 characters in length!");
+ return true;
+}
+
void ServerConfig::ReportConfigError(const std::string &errormessage, bool bail)
{
alog("There were errors in your configuration file: %s", errormessage.c_str());
@@ -532,6 +559,31 @@ int ServerConfig::Read(bool bail)
{"uplink", "password", "", new ValueContainerChar(&RemotePassword), DT_NOSPACES | DT_NORELOAD, ValidateNotEmpty},
{"nickserv", "nick", "NickServ", new ValueContainerChar(&s_NickServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
{"nickserv", "descrption", "Nickname Registration Service", new ValueContainerChar(&desc_NickServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
+ {"nickserv", "database", "nick.db", new ValueContainerChar(&NickDBName), DT_CHARPTR, ValidateNotEmpty},
+ {"nickserv", "emailregistration", "no", new ValueContainerBool(&NSEmailReg), DT_BOOLEAN, NoValidation},
+ {"nickserv", "prenickdatabase", "", new ValueContainerChar(&PreNickDBName), DT_CHARPTR, ValidateEmailReg},
+ {"nickserv", "forceemail", "no", new ValueContainerBool(&NSForceEmail), DT_BOOLEAN, ValidateEmailReg},
+ {"nickserv", "defaults", "secure memosignon memoreceive", new ValueContainerString(&NSDefaults), DT_BOOLEAN, NoValidation},
+ {"nickserv", "defaultlanguage", "0", new ValueContainerInt(&NSDefLanguage), DT_INTEGER, ValidateLanguage},
+ {"nickserv", "regdelay", "0", new ValueContainerTime(&NSRegDelay), DT_TIME, NoValidation},
+ {"nickserv", "resenddelay", "0", new ValueContainerTime(&NSResendDelay), DT_TIME, NoValidation},
+ {"nickserv", "expire", "21d", new ValueContainerTime(&NSExpire), DT_TIME, ValidateNotZero},
+ {"nickserv", "preregexpire", "0", new ValueContainerTime(&NSRExpire), DT_TIME, ValidateEmailReg},
+ {"nickserv", "maxaliases", "0", new ValueContainerInt(&NSMaxAliases), DT_INTEGER, NoValidation},
+ {"nickserv", "accessmax", "0", new