From: Kevin L. Mitchell Date: Tue, 19 Dec 2000 21:37:58 +0000 (+0000) Subject: Author: Kev X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=commitdiff_plain;h=3bad42600acc8707336aa73cd3e7bcb9a89fbe74 Author: Kev Log message: Removed last vestiges of GODMODE; made a whole bunch of formerly compile- time options into run-time options through the features subsystem; bashed a couple of bugs in ircd_log.c and m_ison.c; added a new "read-only" flag to ircd_features.c. Testing: Compiles and runs; m_ison.c compiles. Again, needs extensive testing; turn the features on and off and see what happens. NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE Make sure you add "F:HUB:TRUE" to your ircd.conf if you normally turn HUB on. I may make HUB go away completely in the future, but not until m_server gets rewritten from scratch. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@350 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- diff --git a/ChangeLog b/ChangeLog index df1ad9a..6558001 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,81 @@ +2000-12-19 Kevin L. Mitchell + + * ircd/m_ison.c (m_ison): Dianora says that ISON has to end with a + space (*sigh* stupid clients...) + + * ircd/s_user.c: make WALLOPS_OPER_ONLY a feature managed through + ircd_features.[ch] + + * ircd/s_err.c: get rid of GODMODE conditionals + + * ircd/s_debug.c (debug_serveropts): switch to using appropriate + calls into the features subsystem for various serveropts + characters + + * ircd/s_conf.c (find_conf_entry): get rid of USEONE conditional + + * ircd/s_bsd.c: remove GODMODE conditional; use features subsystem + to get value of VIRTUAL_HOST and CLIENT_FLOOD; remove + NOFLOWCONTROL conditional + + * ircd/s_auth.c: use features subsystem to determine value of + KILL_IPMISMATCH + + * ircd/parse.c: get rid of NOOPER and GODMODE conditionals; use + features subsystem to determine the setting of IDLE_FROM_MSG + + * ircd/numnicks.c: get rid of EXTENDED_NUMERICS conditionals + + * ircd/motd.c: get value of NODEFAULTMOTD from features subsystem; + use features subsystem to get motd file names + + * ircd/m_settime.c: get value of RELIABLE_CLOCK from features + subsystem + + * ircd/m_server.c: get rid of CRYPT_LINK_PASSWORD, since it does + us no good; use features subsystem to figure out if we need to do + HUB-type stuff; make TESTNET debugging sendto_opmask_butone's use + the Debug(()) macro instead; get value of RELIABLE_CLOCK from + features subsystem + + * ircd/m_privmsg.c: get IDLE_FROM_MSG from the features subsystem + + * ircd/m_oper.c: get CRYPT_OPER_PASSWORD from the features + subsystem + + * ircd/m_connect.c: get SERVER_PORT from the features subsystem + + * ircd/ircd_log.c (log_set_file): fix a bug that kept log files + from getting marked if they were already set to something... + + * ircd/ircd_features.c: add a flag to indicates read-only access; + add several new features that used to be compile-time selected + + * ircd/ircd.c: grab pidfile out of feature subsystem; don't check + access to motd files (what the heck?); make sure to initialize the + feature subsystem before trying to write the config file + + * ircd/dbuf.c: use feature_int() to retrieve BUFFERPOOL settings; + use feature_bool() to figure out if we're using the FERGUSON + flusher + + * ircd/Makefile.in: MPATH and RPATH are now done differently, so + remove the clause that creates empty files of that name; also ran + make depend + + * include/sys.h: CLIENT_FLOOD is now a feature; unfortunately, + there is no easy way to bounds-check it at present + + * include/querycmds.h: make sure ircd_features.h is included; use + feature_str(FEAT_DOMAINNAME) in calls to match() + + * include/ircd_features.h: many new features that used to be + compile-time selected + + * config/config-sh.in: add * to DOMAINNAME; try also using first + argument to search in /etc/resolv.conf; removed many compile-time + options that now can be configured through the features system + 2000-12-18 Kevin L. Mitchell * doc/api/log.txt: how to use the logging API diff --git a/config/config-sh.in b/config/config-sh.in index d464cd8..f5661c2 100644 --- a/config/config-sh.in +++ b/config/config-sh.in @@ -169,14 +169,17 @@ fi mainmenu_option next_comment comment 'Host specific defines' if [ -f /etc/resolv.conf ]; then - DOMAINNAME_DEFAULT="`awk '/^domain/ { print $2; exit }' /etc/resolv.conf`" + DOMAINNAME_DEFAULT="`awk '/^domain/ { print "*" $2; exit }' /etc/resolv.conf`" fi - string 'What is the domain name of your network' DOMAINNAME $DOMAINNAME_DEFAULT - if [ -z "$DOMAINNAME" ]; then - DOMAINNAME=none + if [ -z "$DOMAINNAME_DEFAULT" ]; then + DOMAINNAME_DEFAULT="`awk '/^search/ { print "*" $2; exit }' /etc/resolv.conf`" fi + if [ -z "$DOMAINNAME_DEFAULT" ]; then + DOMAINNAME_DEFAULT=none + fi + define_string DOMAINNAME $DOMAINNAME_DEFAULT + string 'Please give a random seed of eight characters' RANDOM_SEED 12345678 - bool 'Does your host have a reliable clock' RELIABLE_CLOCK endmenu mainmenu_option next_comment @@ -195,12 +198,6 @@ comment 'General defines' echo " SECURITY: Then don't install the daemon SUID or SGID !" fi fi - bool 'Do you need virtual hosting' VIRTUAL_HOST - PREV_HUB=$HUB - bool 'Will you connect to more then one server at a time' HUB - if [ "$PREV_HUB" != "$HUB" ]; then - BUFFERPOOL= - fi endmenu @@ -215,43 +212,17 @@ comment 'Paths and files' fi echo "The following filenames are either full paths or files within DPATH" string 'Server configuration file' CPATH 'ircd.conf' - string 'Server MOTD file' MPATH 'ircd.motd' - string 'Server remote MOTD file (3 lines max)' RPATH 'remote.motd' if [ "$DEBUGMODE" = "y" ]; then string 'Debug file if DEBUGMODE' LPATH '/tmp/ircd.log' else define_string LPATH "$LPATH" fi - string 'File for server pid' PPATH 'ircd.pid' endmenu mainmenu_option next_comment comment 'Configuration' - bool 'Use crypted passwords for operators' CRYPT_OPER_PASSWORD y - DUMMY=`echo "$BUFFERPOOL" | sed -e 's/[0-9]//g'` - if [ "$DUMMY" != "" ]; then - BUFFERPOOL= - fi - if [ "$HUB" = "y" ]; then - int 'Max size of the total of of all sendqs (bytes)' BUFFERPOOL 27000000 - else - int 'Max size of the total of of all sendqs (bytes)' BUFFERPOOL 9000000 - fi - bool 'Aggressively empty the sendqpool (Read Help!)' HAS_FERGUSON_FLUSHER n - int 'Max receive queue for clients (bytes)' CLIENT_FLOOD 1024 int 'Maximum number of network connections (23 - (FD_SETSIZE-4))' MAXCONNECTIONS 252 - int 'Default port for connections to other servers' SERVER_PORT 4400 int 'Nickname history length' NICKNAMEHISTORYLENGTH 800 - bool 'Do you want to use R: lines in your configuration file' R_LINES - if [ "$R_LINES" = "y" ]; then - bool 'Process R: lines every rehash' R_LINES_REHASH y - bool 'Process R: lines always' R_LINES_OFTEN - else - define_bool R_LINES_REHASH $R_LINES_REHASH - define_bool R_LINES_OFTEN $R_LINES_OFTEN - fi - bool 'Send a short message instead of the MOTD to connecting clients' NODEFAULTMOTD y - bool 'Kill connecting clients when forward and reverse DNS mismatch' KILL_IPMISMATCH n endmenu mainmenu_option next_comment @@ -264,8 +235,6 @@ comment 'Server characteristics' define_string DEFAULT_LIST "$DEFAULT_LIST" define_bool DEFAULT_LIST_PARAM n fi - bool 'K: line comments treated as a file by default' COMMENT_IS_FILE y - bool 'Only nullify idle-time on PRIVMSG' IDLE_FROM_MSG y endmenu mainmenu_option next_comment diff --git a/include/ircd_features.h b/include/ircd_features.h index 758bf5b..fe194f4 100644 --- a/include/ircd_features.h +++ b/include/ircd_features.h @@ -24,13 +24,32 @@ struct Client; enum Feature { + /* Misc. features */ FEAT_LOG, + FEAT_DOMAINNAME, + FEAT_RELIABLE_CLOCK, + FEAT_BUFFERPOOL, + FEAT_HAS_FERGUSON_FLUSHER, + FEAT_CLIENT_FLOOD, + FEAT_SERVER_PORT, + FEAT_NODEFAULTMOTD, + FEAT_KILL_IPMISMATCH, + FEAT_IDLE_FROM_MSG, + FEAT_HUB, + FEAT_WALLOPS_OPER_ONLY, + + /* Some misc. default paths */ + FEAT_MPATH, + FEAT_RPATH, + FEAT_PPATH, /* Networking features */ + FEAT_VIRTUAL_HOST, FEAT_TOS_SERVER, FEAT_TOS_CLIENT, /* features that affect all operators */ + FEAT_CRYPT_OPER_PASSWORD, FEAT_OPER_NO_CHAN_LIMIT, FEAT_OPER_MODE_LCHAN, FEAT_OPER_WALK_THROUGH_LMODES, diff --git a/include/querycmds.h b/include/querycmds.h index d982463..621d888 100644 --- a/include/querycmds.h +++ b/include/querycmds.h @@ -6,6 +6,10 @@ #ifndef INCLUDED_querycmds_h #define INCLUDED_querycmds_h +#ifndef INCLUDED_ircd_features_h +#include "ircd_features.h" /* feature_str() */ +#endif + struct Client; /* @@ -57,7 +61,7 @@ extern struct UserStatistics UserStats; #define Count_unknownbecomesclient(cptr, UserStats) \ do { \ --UserStats.unknowns; ++UserStats.local_clients; ++UserStats.clients; \ - if (match("*" DOMAINNAME, cli_sockhost(cptr)) == 0) \ + if (match(feature_str(FEAT_DOMAINNAME), cli_sockhost(cptr)) == 0) \ ++current_load.local_count; \ if (UserStats.local_clients > max_client_count) \ max_client_count = UserStats.local_clients; \ @@ -74,7 +78,7 @@ extern struct UserStatistics UserStats; do \ { \ --UserStats.local_clients; --UserStats.clients; \ - if (match("*" DOMAINNAME, cli_sockhost(cptr)) == 0) \ + if (match(feature_str(FEAT_DOMAINNAME), cli_sockhost(cptr)) == 0) \ --current_load.local_count; \ } while(0) #define Count_serverdisconnects(UserStats) do { --UserStats.local_servers; --UserStats.servers; } while(0) diff --git a/include/sys.h b/include/sys.h index a8c86ee..11d23a3 100644 --- a/include/sys.h +++ b/include/sys.h @@ -51,14 +51,6 @@ #undef DOTERMCAP #endif -#if defined(CLIENT_FLOOD) -#if (CLIENT_FLOOD > 8000) || (CLIENT_FLOOD < 512) -#error CLIENT_FLOOD needs redefining. -#endif -#else -#error CLIENT_FLOOD undefined -#endif - #ifndef CONFIG_SETUGID #undef IRC_UID #undef IRC_GID diff --git a/ircd/Makefile.in b/ircd/Makefile.in index fa1c980..0aa7445 100644 --- a/ircd/Makefile.in +++ b/ircd/Makefile.in @@ -242,11 +242,11 @@ install: build @${RM} /tmp/ircd.tag ${INSTALL} -s -m 700 -o ${IRCDOWN} -g ${IRCDGRP} chkconf ${BINDIR} ${INSTALL} -m 600 -o ${IRCDOWN} -g ${IRCDGRP} ../doc/example.conf ${DPATH} - ( cd ${DPATH}; \ - ${TOUCH} ${MPATH}; \ - ${TOUCH} ${RPATH}; \ - ${CHOWN} ${IRCDOWN} ${MPATH} ${RPATH}; \ - ${CHGRP} ${IRCDGRP} ${MPATH} ${RPATH}; ) +# ( cd ${DPATH}; \ +# ${TOUCH} ${MPATH}; \ +# ${TOUCH} ${RPATH}; \ +# ${CHOWN} ${IRCDOWN} ${MPATH} ${RPATH}; \ +# ${CHGRP} ${IRCDGRP} ${MPATH} ${RPATH}; ) uninstall: @if [ "${BINDIR}" != "${DPATH}" ]; then \ @@ -306,10 +306,11 @@ channel.o: channel.c ../include/channel.h ../config/config.h \ ../include/ircd_log.h ../include/ircd_reply.h \ ../include/ircd_snprintf.h ../include/ircd_string.h ../include/list.h \ ../include/match.h ../include/msg.h ../include/numeric.h \ - ../include/numnicks.h ../include/querycmds.h ../include/s_bsd.h \ - ../include/s_conf.h ../include/s_debug.h ../include/s_misc.h \ - ../include/s_user.h ../include/send.h ../include/sprintf_irc.h \ - ../include/support.h ../include/sys.h ../include/whowas.h + ../include/numnicks.h ../include/querycmds.h \ + ../include/ircd_features.h ../include/s_bsd.h ../include/s_conf.h \ + ../include/s_debug.h ../include/s_misc.h ../include/s_user.h \ + ../include/send.h ../include/sprintf_irc.h ../include/support.h \ + ../include/sys.h ../include/whowas.h class.o: class.c ../include/class.h ../include/client.h \ ../include/ircd_defs.h ../config/config.h ../config/setup.h \ ../include/dbuf.h ../include/msgq.h ../include/ircd_handler.h \ @@ -330,8 +331,9 @@ crule.o: crule.c ../include/crule.h ../include/client.h \ ../include/fda.h ../include/ircd_chattr.h ../include/ircd_string.h \ ../include/match.h ../include/s_bsd.h ../include/s_debug.h dbuf.o: dbuf.c ../include/dbuf.h ../include/ircd_alloc.h \ - ../include/fda.h ../include/ircd_chattr.h ../include/send.h \ - ../include/sys.h ../config/config.h ../config/setup.h + ../include/fda.h ../include/ircd_chattr.h ../include/ircd_features.h \ + ../include/send.h ../include/sys.h ../config/config.h \ + ../config/setup.h fda.o: fda.c fileio.o: fileio.c ../include/fileio.h ../include/ircd_alloc.h \ ../include/fda.h @@ -356,28 +358,29 @@ ircd.o: ircd.c ../include/ircd.h ../config/config.h ../config/setup.h \ ../include/class.h ../include/client.h ../include/dbuf.h \ ../include/msgq.h ../include/ircd_handler.h ../include/crule.h \ ../include/hash.h ../include/ircd_alloc.h ../include/fda.h \ - ../include/ircd_log.h ../include/ircd_reply.h \ - ../include/ircd_signal.h ../include/ircd_string.h \ - ../include/ircd_chattr.h ../include/jupe.h ../include/list.h \ - ../include/match.h ../include/motd.h ../include/msg.h \ - ../include/numeric.h ../include/numnicks.h ../include/parse.h \ - ../include/res.h ../include/s_auth.h ../include/s_bsd.h \ - ../include/s_conf.h ../include/s_debug.h ../include/s_misc.h \ - ../include/send.h ../include/sys.h ../include/uping.h \ - ../include/userload.h ../include/version.h ../include/whowas.h + ../include/ircd_features.h ../include/ircd_log.h \ + ../include/ircd_reply.h ../include/ircd_signal.h \ + ../include/ircd_string.h ../include/ircd_chattr.h ../include/jupe.h \ + ../include/list.h ../include/match.h ../include/motd.h \ + ../include/msg.h ../include/numeric.h ../include/numnicks.h \ + ../include/parse.h ../include/res.h ../include/s_auth.h \ + ../include/s_bsd.h ../include/s_conf.h ../include/s_debug.h \ + ../include/s_misc.h ../include/send.h ../include/sys.h \ + ../include/uping.h ../include/userload.h ../include/version.h \ + ../include/whowas.h ircd_alloc.o: ircd_alloc.c ../include/ircd_alloc.h ../include/fda.h \ ../include/ircd_string.h ../config/config.h ../config/setup.h \ ../include/ircd_chattr.h ../include/s_debug.h ../include/ircd_defs.h -ircd_features.o: ircd_features.c ../include/ircd_features.h \ - ../include/client.h ../include/ircd_defs.h ../config/config.h \ - ../config/setup.h ../include/dbuf.h ../include/msgq.h \ - ../include/ircd_handler.h ../include/hash.h ../include/ircd.h \ - ../include/struct.h ../include/ircd_alloc.h ../include/fda.h \ - ../include/ircd_log.h ../include/ircd_reply.h \ - ../include/ircd_string.h ../include/ircd_chattr.h ../include/match.h \ - ../include/msg.h ../include/numeric.h ../include/numnicks.h \ - ../include/s_bsd.h ../include/s_debug.h ../include/s_misc.h \ - ../include/send.h ../include/support.h ../include/sys.h +ircd_features.o: ircd_features.c ../config/config.h ../config/setup.h \ + ../include/ircd_features.h ../include/client.h ../include/ircd_defs.h \ + ../include/dbuf.h ../include/msgq.h ../include/ircd_handler.h \ + ../include/hash.h ../include/ircd.h ../include/struct.h \ + ../include/ircd_alloc.h ../include/fda.h ../include/ircd_log.h \ + ../include/ircd_reply.h ../include/ircd_string.h \ + ../include/ircd_chattr.h ../include/match.h ../include/msg.h \ + ../include/numeric.h ../include/numnicks.h ../include/s_bsd.h \ + ../include/s_debug.h ../include/s_misc.h ../include/send.h \ + ../include/support.h ../include/sys.h ircd_log.o: ircd_log.c ../include/ircd_log.h ../include/client.h \ ../include/ircd_defs.h ../config/config.h ../config/setup.h \ ../include/dbuf.h ../include/msgq.h ../include/ircd_handler.h \ @@ -436,11 +439,11 @@ listener.o: listener.c ../include/listener.h ../include/ircd_defs.h \ ../include/client.h ../config/config.h ../config/setup.h \ ../include/dbuf.h ../include/msgq.h ../include/ircd_handler.h \ ../include/ircd.h ../include/struct.h ../include/ircd_alloc.h \ - ../include/fda.h ../include/ircd_osdep.h ../include/ircd_reply.h \ - ../include/ircd_string.h ../include/ircd_chattr.h \ - ../include/numeric.h ../include/s_bsd.h ../include/s_conf.h \ - ../include/s_misc.h ../include/send.h ../include/sprintf_irc.h \ - ../include/sys.h + ../include/fda.h ../include/ircd_features.h ../include/ircd_osdep.h \ + ../include/ircd_reply.h ../include/ircd_string.h \ + ../include/ircd_chattr.h ../include/numeric.h ../include/s_bsd.h \ + ../include/s_conf.h ../include/s_misc.h ../include/send.h \ + ../include/sprintf_irc.h ../include/sys.h m_admin.o: m_admin.c ../include/client.h ../include/ircd_defs.h \ ../config/config.h ../config/setup.h ../include/dbuf.h \ ../include/msgq.h ../include/ircd_handler.h ../include/ircd_reply.h \ @@ -480,11 +483,12 @@ m_connect.o: m_connect.c ../include/client.h ../include/ircd_defs.h \ ../config/config.h ../config/setup.h ../include/dbuf.h \ ../include/msgq.h ../include/ircd_handler.h ../include/crule.h \ ../include/hash.h ../include/ircd.h ../include/struct.h \ - ../include/ircd_log.h ../include/ircd_reply.h \ - ../include/ircd_string.h ../include/ircd_chattr.h ../include/jupe.h \ - ../include/match.h ../include/msg.h ../include/numeric.h \ - ../include/numnicks.h ../include/s_bsd.h ../include/s_conf.h \ - ../include/s_user.h ../include/send.h + ../include/ircd_features.h ../include/ircd_log.h \ + ../include/ircd_reply.h ../include/ircd_string.h \ + ../include/ircd_chattr.h ../include/jupe.h ../include/match.h \ + ../include/msg.h ../include/numeric.h ../include/numnicks.h \ + ../include/s_bsd.h ../include/s_conf.h ../include/s_user.h \ + ../include/send.h m_cprivmsg.o: m_cprivmsg.c ../include/client.h ../include/ircd_defs.h \ ../config/config.h ../config/setup.h ../include/dbuf.h \ ../include/msgq.h ../include/ircd_handler.h ../include/ircd_reply.h \ @@ -630,8 +634,9 @@ m_lusers.o: m_lusers.c ../include/client.h ../include/ircd_defs.h \ ../include/msgq.h ../include/ircd_handler.h ../include/ircd.h \ ../include/struct.h ../include/ircd_reply.h ../include/ircd_string.h \ ../include/ircd_chattr.h ../include/msg.h ../include/numeric.h \ - ../include/numnicks.h ../include/querycmds.h ../include/s_user.h \ - ../include/s_serv.h ../include/send.h + ../include/numnicks.h ../include/querycmds.h \ + ../include/ircd_features.h ../include/s_user.h ../include/s_serv.h \ + ../include/send.h m_map.o: m_map.c ../include/client.h ../include/ircd_defs.h \ ../config/config.h ../config/setup.h ../include/dbuf.h \ ../include/msgq.h ../include/ircd_handler.h ../include/ircd.h \ @@ -639,7 +644,7 @@ m_map.o: m_map.c ../include/client.h ../include/ircd_defs.h \ ../include/ircd_snprintf.h ../include/ircd_string.h \ ../include/ircd_chattr.h ../include/list.h ../include/match.h \ ../include/numeric.h ../include/s_user.h ../include/s_serv.h \ - ../include/send.h ../include/querycmds.h + ../include/send.h ../include/querycmds.h ../include/ircd_features.h m_mode.o: m_mode.c ../include/handlers.h ../include/channel.h \ ../config/config.h ../config/setup.h ../include/ircd_defs.h \ ../include/client.h ../include/dbuf.h ../include/msgq.h \ @@ -680,12 +685,13 @@ m_notice.o: m_notice.c ../include/client.h ../include/ircd_defs.h \ m_oper.o: m_oper.c ../include/client.h ../include/ircd_defs.h \ ../config/config.h ../config/setup.h ../include/dbuf.h \ ../include/msgq.h ../include/ircd_handler.h ../include/hash.h \ - ../include/ircd.h ../include/struct.h ../include/ircd_log.h \ - ../include/ircd_reply.h ../include/ircd_string.h \ - ../include/ircd_chattr.h ../include/ircd_xopen.h ../include/msg.h \ - ../include/numeric.h ../include/numnicks.h ../include/querycmds.h \ - ../include/s_conf.h ../include/s_debug.h ../include/s_user.h \ - ../include/s_misc.h ../include/send.h ../include/support.h + ../include/ircd.h ../include/struct.h ../include/ircd_features.h \ + ../include/ircd_log.h ../include/ircd_reply.h \ + ../include/ircd_string.h ../include/ircd_chattr.h \ + ../include/ircd_xopen.h ../include/msg.h ../include/numeric.h \ + ../include/numnicks.h ../include/querycmds.h ../include/s_conf.h \ + ../include/s_debug.h ../include/s_user.h ../include/s_misc.h \ + ../include/send.h ../include/support.h m_opmode.o: m_opmode.c ../include/client.h ../include/ircd_defs.h \ ../config/config.h ../config/setup.h ../include/dbuf.h \ ../include/msgq.h ../include/ircd_handler.h ../include/channel.h \ @@ -721,7 +727,8 @@ m_pong.o: m_pong.c ../include/client.h ../include/ircd_defs.h \ m_privmsg.o: m_privmsg.c ../include/client.h ../include/ircd_defs.h \ ../config/config.h ../config/setup.h ../include/dbuf.h \ ../include/msgq.h ../include/ircd_handler.h ../include/ircd.h \ - ../include/struct.h ../include/ircd_chattr.h ../include/ircd_relay.h \ + ../include/struct.h ../include/ircd_chattr.h \ + ../include/ircd_features.h ../include/ircd_relay.h \ ../include/ircd_reply.h ../include/ircd_string.h ../include/match.h \ ../include/msg.h ../include/numeric.h ../include/send.h m_privs.o: m_privs.c ../include/client.h ../include/ircd_defs.h \ @@ -780,12 +787,13 @@ m_server.o: m_server.c ../include/client.h ../include/ircd_defs.h \ ../config/config.h ../config/setup.h ../include/dbuf.h \ ../include/msgq.h ../include/ircd_handler.h ../include/hash.h \ ../include/ircd.h ../include/struct.h ../include/ircd_log.h \ - ../include/ircd_reply.h ../include/ircd_string.h \ - ../include/ircd_chattr.h ../include/jupe.h ../include/list.h \ - ../include/match.h ../include/msg.h ../include/numeric.h \ - ../include/numnicks.h ../include/querycmds.h ../include/s_bsd.h \ - ../include/s_conf.h ../include/s_debug.h ../include/s_misc.h \ - ../include/s_serv.h ../include/send.h ../include/userload.h + ../include/ircd_features.h ../include/ircd_reply.h \ + ../include/ircd_string.h ../include/ircd_chattr.h ../include/jupe.h \ + ../include/list.h ../include/match.h ../include/msg.h \ + ../include/numeric.h ../include/numnicks.h ../include/querycmds.h \ + ../include/s_bsd.h ../include/s_conf.h ../include/s_debug.h \ + ../include/s_misc.h ../include/s_serv.h ../include/send.h \ + ../include/userload.h m_set.o: m_set.c ../include/client.h ../include/ircd_defs.h \ ../config/config.h ../config/setup.h ../include/dbuf.h \ ../include/msgq.h ../include/ircd_handler.h ../include/hash.h \ @@ -796,10 +804,11 @@ m_set.o: m_set.c ../include/client.h ../include/ircd_defs.h \ m_settime.o: m_settime.c ../include/client.h ../include/ircd_defs.h \ ../config/config.h ../config/setup.h ../include/dbuf.h \ ../include/msgq.h ../include/ircd_handler.h ../include/hash.h \ - ../include/ircd.h ../include/struct.h ../include/ircd_reply.h \ - ../include/ircd_string.h ../include/ircd_chattr.h ../include/list.h \ - ../include/msg.h ../include/numeric.h ../include/numnicks.h \ - ../include/s_user.h ../include/send.h + ../include/ircd.h ../include/struct.h ../include/ircd_features.h \ + ../include/ircd_reply.h ../include/ircd_string.h \ + ../include/ircd_chattr.h ../include/list.h ../include/msg.h \ + ../include/numeric.h ../include/numnicks.h ../include/s_user.h \ + ../include/send.h m_silence.o: m_silence.c ../include/channel.h ../config/config.h \ ../config/setup.h ../include/ircd_defs.h ../include/client.h \ ../include/dbuf.h ../include/msgq.h ../include/ircd_handler.h \ @@ -925,10 +934,11 @@ motd.o: motd.c ../include/motd.h ../include/class.h \ ../config/setup.h ../include/dbuf.h ../include/msgq.h \ ../include/ircd_handler.h ../include/fileio.h ../include/ircd.h \ ../include/struct.h ../include/ircd_alloc.h ../include/fda.h \ - ../include/ircd_reply.h ../include/ircd_string.h \ - ../include/ircd_chattr.h ../include/match.h ../include/msg.h \ - ../include/numeric.h ../include/numnicks.h ../include/s_conf.h \ - ../include/s_debug.h ../include/s_user.h ../include/send.h + ../include/ircd_features.h ../include/ircd_reply.h \ + ../include/ircd_string.h ../include/ircd_chattr.h ../include/match.h \ + ../include/msg.h ../include/numeric.h ../include/numnicks.h \ + ../include/s_conf.h ../include/s_debug.h ../include/s_user.h \ + ../include/send.h msgq.o: msgq.c ../include/msgq.h ../include/ircd_defs.h \ ../include/ircd_alloc.h ../include/fda.h ../include/ircd_snprintf.h \ ../config/config.h ../config/setup.h ../include/s_debug.h @@ -958,14 +968,15 @@ parse.o: parse.c ../include/parse.h ../include/client.h \ ../include/dbuf.h ../include/msgq.h ../include/ircd_handler.h \ ../include/channel.h ../include/handlers.h ../include/hash.h \ ../include/ircd.h ../include/struct.h ../include/ircd_alloc.h \ - ../include/fda.h ../include/ircd_chattr.h ../include/ircd_reply.h \ - ../include/ircd_string.h ../include/msg.h ../include/numeric.h \ - ../include/numnicks.h ../include/opercmds.h ../include/querycmds.h \ - ../include/res.h ../include/s_bsd.h ../include/s_conf.h \ - ../include/s_debug.h ../include/s_misc.h ../include/s_numeric.h \ - ../include/s_user.h ../include/send.h ../include/sys.h \ - ../include/whocmds.h ../include/whowas.h -querycmds.o: querycmds.c ../include/querycmds.h + ../include/fda.h ../include/ircd_chattr.h ../include/ircd_features.h \ + ../include/ircd_reply.h ../include/ircd_string.h ../include/msg.h \ + ../include/numeric.h ../include/numnicks.h ../include/opercmds.h \ + ../include/querycmds.h ../include/res.h ../include/s_bsd.h \ + ../include/s_conf.h ../include/s_debug.h ../include/s_misc.h \ + ../include/s_numeric.h ../include/s_user.h ../include/send.h \ + ../include/sys.h ../include/whocmds.h ../include/whowas.h +querycmds.o: querycmds.c ../include/querycmds.h \ + ../include/ircd_features.h random.o: random.c ../include/random.h ../config/config.h \ ../config/setup.h res.o: res.c ../include/res.h ../include/client.h \ @@ -983,25 +994,25 @@ s_auth.o: s_auth.c ../include/s_auth.h ../config/config.h \ ../include/dbuf.h ../include/msgq.h ../include/ircd_handler.h \ ../include/IPcheck.h ../include/ircd.h ../include/struct.h \ ../include/ircd_alloc.h ../include/fda.h ../include/ircd_chattr.h \ - ../include/ircd_log.h ../include/ircd_osdep.h \ - ../include/ircd_string.h ../include/list.h ../include/numeric.h \ - ../include/querycmds.h ../include/res.h ../include/s_bsd.h \ - ../include/s_debug.h ../include/s_misc.h ../include/send.h \ - ../include/sprintf_irc.h ../include/sys.h + ../include/ircd_features.h ../include/ircd_log.h \ + ../include/ircd_osdep.h ../include/ircd_string.h ../include/list.h \ + ../include/numeric.h ../include/querycmds.h ../include/res.h \ + ../include/s_bsd.h ../include/s_debug.h ../include/s_misc.h \ + ../include/send.h ../include/sprintf_irc.h ../include/sys.h s_bsd.o: s_bsd.c ../include/s_bsd.h ../config/config.h \ ../config/setup.h ../include/client.h ../include/ircd_defs.h \ ../include/dbuf.h ../include/msgq.h ../include/ircd_handler.h \ ../include/IPcheck.h ../include/channel.h ../include/class.h \ - ../include/hash.h ../include/ircd_log.h ../include/ircd_osdep.h \ - ../include/ircd_reply.h ../include/ircd_string.h \ - ../include/ircd_chattr.h ../include/ircd.h ../include/struct.h \ - ../include/list.h ../include/listener.h ../include/msg.h \ - ../include/numeric.h ../include/numnicks.h ../include/packet.h \ - ../include/parse.h ../include/querycmds.h ../include/res.h \ - ../include/s_auth.h ../include/s_conf.h ../include/s_debug.h \ - ../include/s_misc.h ../include/s_user.h ../include/send.h \ - ../include/sprintf_irc.h ../include/support.h ../include/sys.h \ - ../include/uping.h ../include/version.h + ../include/hash.h ../include/ircd_log.h ../include/ircd_features.h \ + ../include/ircd_osdep.h ../include/ircd_reply.h \ + ../include/ircd_string.h ../include/ircd_chattr.h ../include/ircd.h \ + ../include/struct.h ../include/list.h ../include/listener.h \ + ../include/msg.h ../include/numeric.h ../include/numnicks.h \ + ../include/packet.h ../include/parse.h ../include/querycmds.h \ + ../include/res.h ../include/s_auth.h ../include/s_conf.h \ + ../include/s_debug.h ../include/s_misc.h ../include/s_user.h \ + ../include/send.h ../include/sprintf_irc.h ../include/support.h \ + ../include/sys.h ../include/uping.h ../include/version.h s_conf.o: s_conf.c ../include/s_conf.h ../include/IPcheck.h \ ../include/class.h ../include/client.h ../include/ircd_defs.h \ ../config/config.h ../config/setup.h ../include/dbuf.h \ @@ -1038,10 +1049,10 @@ s_misc.o: s_misc.c ../include/s_misc.h ../include/IPcheck.h \ ../include/ircd_string.h ../include/ircd_chattr.h ../include/list.h \ ../include/match.h ../include/msg.h ../include/numeric.h \ ../include/numnicks.h ../include/parse.h ../include/querycmds.h \ - ../include/res.h ../include/s_bsd.h ../include/s_conf.h \ - ../include/s_debug.h ../include/s_user.h ../include/send.h \ - ../include/sprintf_irc.h ../include/support.h ../include/sys.h \ - ../include/uping.h ../include/userload.h + ../include/ircd_features.h ../include/res.h ../include/s_bsd.h \ + ../include/s_conf.h ../include/s_debug.h ../include/s_user.h \ + ../include/send.h ../include/sprintf_irc.h ../include/support.h \ + ../include/sys.h ../include/uping.h ../include/userload.h s_numeric.o: s_numeric.c ../include/s_numeric.h ../include/channel.h \ ../config/config.h ../config/setup.h ../include/ircd_defs.h \ ../include/client.h ../include/dbuf.h ../include/msgq.h \ @@ -1058,10 +1069,10 @@ s_serv.o: s_serv.c ../include/s_serv.h ../include/IPcheck.h \ ../include/ircd_snprintf.h ../include/ircd_xopen.h ../include/jupe.h \ ../include/list.h ../include/match.h ../include/msg.h \ ../include/numeric.h ../include/numnicks.h ../include/parse.h \ - ../include/querycmds.h ../include/s_bsd.h ../include/s_conf.h \ - ../include/s_debug.h ../include/s_misc.h ../include/s_user.h \ - ../include/send.h ../include/sprintf_irc.h ../include/sys.h \ - ../include/userload.h + ../include/querycmds.h ../include/ircd_features.h ../include/s_bsd.h \ + ../include/s_conf.h ../include/s_debug.h ../include/s_misc.h \ + ../include/s_user.h ../include/send.h ../include/sprintf_irc.h \ + ../include/sys.h ../include/userload.h s_stats.o: s_stats.c ../include/s_stats.h ../include/class.h \ ../include/client.h ../include/ircd_defs.h ../config/config.h \ ../config/setup.h ../include/dbuf.h ../include/msgq.h \ @@ -1077,16 +1088,16 @@ s_user.o: s_user.c ../include/s_user.h ../include/IPcheck.h \ ../include/dbuf.h ../include/msgq.h ../include/ircd_handler.h \ ../include/gline.h ../include/hash.h ../include/ircd.h \ ../include/struct.h ../include/ircd_alloc.h ../include/fda.h \ - ../include/ircd_chattr.h ../include/ircd_log.h \ - ../include/ircd_reply.h ../include/ircd_string.h ../include/list.h \ - ../include/match.h ../include/motd.h ../include/msg.h \ - ../include/numeric.h ../include/numnicks.h ../include/parse.h \ - ../include/querycmds.h ../include/random.h ../include/s_bsd.h \ - ../include/s_conf.h ../include/s_debug.h ../include/s_misc.h \ - ../include/s_serv.h ../include/send.h ../include/sprintf_irc.h \ - ../include/support.h ../include/supported.h ../include/sys.h \ - ../include/userload.h ../include/version.h ../include/whowas.h \ - ../include/handlers.h + ../include/ircd_chattr.h ../include/ircd_features.h \ + ../include/ircd_log.h ../include/ircd_reply.h \ + ../include/ircd_string.h ../include/list.h ../include/match.h \ + ../include/motd.h ../include/msg.h ../include/numeric.h \ + ../include/numnicks.h ../include/parse.h ../include/querycmds.h \ + ../include/random.h ../include/s_bsd.h ../include/s_conf.h \ + ../include/s_debug.h ../include/s_misc.h ../include/s_serv.h \ + ../include/send.h ../include/sprintf_irc.h ../include/support.h \ + ../include/supported.h ../include/sys.h ../include/userload.h \ + ../include/version.h ../include/whowas.h ../include/handlers.h send.o: send.c ../include/send.h ../include/channel.h \ ../config/config.h ../config/setup.h ../include/ircd_defs.h \ ../include/class.h ../include/client.h ../include/dbuf.h \ @@ -1117,8 +1128,9 @@ userload.o: userload.c ../include/userload.h ../include/client.h \ ../include/ircd_defs.h ../config/config.h ../config/setup.h \ ../include/dbuf.h ../include/msgq.h ../include/ircd_handler.h \ ../include/ircd.h ../include/struct.h ../include/msg.h \ - ../include/numnicks.h ../include/querycmds.h ../include/s_misc.h \ - ../include/send.h ../include/sys.h + ../include/numnicks.h ../include/querycmds.h \ + ../include/ircd_features.h ../include/s_misc.h ../include/send.h \ + ../include/sys.h whocmds.o: whocmds.c ../include/whocmds.h ../config/config.h \ ../config/setup.h ../include/channel.h ../include/ircd_defs.h \ ../include/client.h ../include/dbuf.h ../include/msgq.h \ @@ -1126,11 +1138,11 @@ whocmds.o: whocmds.c ../include/whocmds.h ../config/config.h \ ../include/struct.h ../include/ircd_chattr.h ../include/ircd_reply.h \ ../include/ircd_string.h ../include/list.h ../include/match.h \ ../include/numeric.h ../include/numnicks.h ../include/querycmds.h \ - ../include/random.h ../include/s_bsd.h ../include/s_conf.h \ - ../include/s_misc.h ../include/s_user.h ../include/send.h \ - ../include/sprintf_irc.h ../include/support.h ../include/sys.h \ - ../include/userload.h ../include/version.h ../include/whowas.h \ - ../include/msg.h + ../include/ircd_features.h ../include/random.h ../include/s_bsd.h \ + ../include/s_conf.h ../include/s_misc.h ../include/s_user.h \ + ../include/send.h ../include/sprintf_irc.h ../include/support.h \ + ../include/sys.h ../include/userload.h ../include/version.h \ + ../include/whowas.h ../include/msg.h whowas.o: whowas.c ../include/whowas.h ../include/client.h \ ../include/ircd_defs.h ../config/config.h ../config/setup.h \ ../include/dbuf.h ../include/msgq.h ../include/ircd_handler.h \ diff --git a/ircd/dbuf.c b/ircd/dbuf.c index e2937b4..d8c00a6 100644 --- a/ircd/dbuf.c +++ b/ircd/dbuf.c @@ -21,6 +21,7 @@ #include "dbuf.h" #include "ircd_alloc.h" #include "ircd_chattr.h" +#include "ircd_features.h" #include "send.h" #include "sys.h" /* MIN */ @@ -69,7 +70,7 @@ static struct DBufBuffer *dbuf_alloc(void) dbufFreeList = db->next; ++DBufUsedCount; } - else if (DBufAllocCount * DBUF_SIZE < BUFFERPOOL) { + else if (DBufAllocCount * DBUF_SIZE < feature_int(FEAT_BUFFERPOOL)) { db = (struct DBufBuffer*) MyMalloc(sizeof(struct DBufBuffer)); assert(0 != db); ++DBufAllocCount; @@ -147,27 +148,29 @@ int dbuf_put(struct DBuf *dyn, const char *buf, unsigned int length) for (; length > 0; h = &(db->next)) { if (0 == (db = *h)) { if (0 == (db = dbuf_alloc())) { -#if defined(HAS_FERGUSON_FLUSHER) - /* - * from "Married With Children" episode were Al bought a REAL toilet - * on the black market because he was tired of the wimpy water - * conserving toilets they make these days --Bleep - */ - /* - * Apparently this doesn't work, the server _has_ to - * dump a few clients to handle the load. A fully loaded - * server cannot handle a net break without dumping some - * clients. If we flush the connections here under a full - * load we may end up starving the kernel for mbufs and - * crash the machine - */ - /* - * attempt to recover from buffer starvation before - * bailing this may help servers running out of memory - */ - flush_connections(0); - if (0 == (db = dbuf_alloc())) -#endif + if (feature_bool(FEAT_HAS_FERGUSON_FLUSHER)) { + /* + * from "Married With Children" episode were Al bought a REAL toilet + * on the black market because he was tired of the wimpy water + * conserving toilets they make these days --Bleep + */ + /* + * Apparently this doesn't work, the server _has_ to + * dump a few clients to handle the load. A fully loaded + * server cannot handle a net break without dumping some + * clients. If we flush the connections here under a full + * load we may end up starving the kernel for mbufs and + * crash the machine + */ + /* + * attempt to recover from buffer starvation before + * bailing this may help servers running out of memory + */ + flush_connections(0); + db = dbuf_alloc(); + } + + if (0 == db) return dbuf_malloc_error(dyn); } dyn->tail = db; diff --git a/ircd/ircd.c b/ircd/ircd.c index fc941da..24d966d 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -26,6 +26,7 @@ #include "crule.h" #include "hash.h" #include "ircd_alloc.h" +#include "ircd_features.h" #include "ircd_log.h" #include "ircd_reply.h" #include "ircd_signal.h" @@ -163,14 +164,16 @@ static void outofmemory(void) { static void write_pidfile(void) { FILE *pidf; - if (!(pidf = fopen(PPATH, "w+"))) { + if (!(pidf = fopen(feature_str(FEAT_PPATH), "w+"))) { Debug((DEBUG_NOTICE, - "Error opening pid file \"%s\": %s", PPATH, strerror(errno))); + "Error opening pid file \"%s\": %s", feature_str(FEAT_PPATH), + strerror(errno))); return; } if (fprintf(pidf, "%5d\n", getpid()) < 5) - Debug((DEBUG_NOTICE, "Error writing to pid file %s", PPATH)); + Debug((DEBUG_NOTICE, "Error writing to pid file %s", + feature_str(FEAT_PPATH))); fclose(pidf); } @@ -629,9 +632,7 @@ int main(int argc, char **argv) { /* Check paths for accessibility */ if (!check_file_access(SPATH, 'S', X_OK) || - !check_file_access(configfile, 'C', R_OK) || - !check_file_access(MPATH, 'M', R_OK) || - !check_file_access(RPATH, 'R', R_OK)) + !check_file_access(configfile, 'C', R_OK)) return 4; #ifdef DEBUG @@ -643,6 +644,7 @@ int main(int argc, char **argv) { daemon_init(thisServer.bootopt & BOOT_TTY); setup_signals(); + feature_mark(); /* initialize features... */ log_init(*argv); set_nomem_handler(outofmemory); diff --git a/ircd/ircd_features.c b/ircd/ircd_features.c index 5c23538..7c8e9fb 100644 --- a/ircd/ircd_features.c +++ b/ircd/ircd_features.c @@ -18,6 +18,7 @@ * * $Id$ */ +#include "config.h" #include "ircd_features.h" #include "client.h" #include "hash.h" @@ -189,6 +190,8 @@ typedef void (*feat_report_call)(struct Client*, int); #define FEAT_OPER 0x0100 /* set to display only to opers */ #define FEAT_MYOPER 0x0200 /* set to display only to local opers */ +#define FEAT_READ 0x1000 /* feature is read-only (for now, perhaps?) */ + static struct FeatureDesc { enum Feature feat; /* feature identifier */ char* type; /* string describing type */ @@ -217,14 +220,33 @@ static struct FeatureDesc { { FEAT_ ## type, #type, FEAT_STR | (flags), 0, 0, 0, (v_str), \ 0, 0, 0, 0, 0, 0 } + /* Misc. features */ F_N(LOG, FEAT_MYOPER, feature_log_set, feature_log_reset, feature_log_get, log_feature_unmark, log_feature_mark, log_feature_report), + F_S(DOMAINNAME, 0, DOMAINNAME), + F_B(RELIABLE_CLOCK, 0, 0), + F_I(BUFFERPOOL, 0, 27000000), + F_B(HAS_FERGUSON_FLUSHER, 0, 0), + F_I(CLIENT_FLOOD, 0, 1024), + F_I(SERVER_PORT, FEAT_OPER, 4400), + F_B(NODEFAULTMOTD, 0, 1), + F_B(KILL_IPMISMATCH, FEAT_OPER, 0), + F_B(IDLE_FROM_MSG, 0, 1), + F_B(HUB, 0, 0), + F_B(WALLOPS_OPER_ONLY, 0, 0), + + /* Some misc. default paths */ + F_S(MPATH, FEAT_CASE | FEAT_MYOPER, "ircd.motd"), + F_S(RPATH, FEAT_CASE | FEAT_MYOPER, "remote.motd"), + F_S(PPATH, FEAT_CASE | FEAT_MYOPER | FEAT_READ, "ircd.pid"), /* Networking features */ + F_B(VIRTUAL_HOST, 0, 0), F_I(TOS_SERVER, 0, 0x08), F_I(TOS_CLIENT, 0, 0x08), /* features that affect all operators */ + F_B(CRYPT_OPER_PASSWORD, FEAT_MYOPER | FEAT_READ, 1), F_B(OPER_NO_CHAN_LIMIT, 0, 1), F_B(OPER_MODE_LCHAN, 0, 1), F_B(OPER_WALK_THROUGH_LMODES, 0, 0), @@ -307,6 +329,9 @@ feature_set(struct Client* from, const char* const* fields, int count) else log_write(LS_CONFIG, L_ERROR, 0, "Not enough fields in F line"); } else if ((feat = feature_desc(from, fields[0]))) { /* find feature */ + if (from && feat->flags & FEAT_READ) + return send_reply(from, ERR_NOFEATURE, fields[0]); + switch (feat->flags & FEAT_MASK) { case FEAT_NONE: if (feat->set && (i = (*feat->set)(from, fields + 1, count - 1))) { @@ -414,6 +439,9 @@ feature_reset(struct Client* from, const char* const* fields, int count) if (count < 1) /* check arguments */ need_more_params(from, "RESET"); else if ((feat = feature_desc(from, fields[0]))) { /* get descriptor */ + if (from && feat->flags & FEAT_READ) + return send_reply(from, ERR_NOFEATURE, fields[0]); + switch (feat->flags & FEAT_MASK) { case FEAT_NONE: /* None... */ if (feat->reset && (i = (*feat->reset)(from, fields + 1, count - 1))) { diff --git a/ircd/ircd_log.c b/ircd/ircd_log.c index d40c7f1..ab65f3b 100644 --- a/ircd/ircd_log.c +++ b/ircd/ircd_log.c @@ -627,15 +627,15 @@ log_set_file(const char *subsys, const char *filename) if (!(desc = log_find(subsys))) return 2; - /* no change, don't go to the trouble of destroying and recreating */ - if (desc->file && filename && !strcmp(desc->file->file, filename)) - return 0; - if (filename) desc->mark |= LOG_MARK_FILE; /* mark that file has been changed */ else desc->mark &= ~LOG_MARK_FILE; /* file has been reset to defaults */ + /* no change, don't go to the trouble of destroying and recreating */ + if (desc->file && filename && !strcmp(desc->file->file, filename)) + return 0; + /* debug log is special, since it has to be opened on fd 2 */ if (desc->subsys == LS_DEBUG) return log_debug_file(filename); diff --git a/ircd/m_connect.c b/ircd/m_connect.c index 0330e4f..cbc75bb 100644 --- a/ircd/m_connect.c +++ b/ircd/m_connect.c @@ -91,6 +91,7 @@ #include "crule.h" #include "hash.h" #include "ircd.h" +#include "ircd_features.h" #include "ircd_log.h" #include "ircd_reply.h" #include "ircd_string.h" @@ -327,7 +328,7 @@ int mo_connect(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) return 0; } } - if (0 == port && 0 == (port = SERVER_PORT)) { + if (0 == port && 0 == (port = feature_int(FEAT_SERVER_PORT))) { sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Connect: missing port number", sptr); return 0; diff --git a/ircd/m_ison.c b/ircd/m_ison.c index e26b0d2..7f68d28 100644 --- a/ircd/m_ison.c +++ b/ircd/m_ison.c @@ -120,7 +120,6 @@ int m_ison(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) char* name; char* p = 0; struct MsgBuf* mb; - int found1 = 0; int i; if (parc < 2) @@ -137,10 +136,8 @@ int m_ison(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) msgq_clean(mb); /* then do another round */ mb = msgq_make(sptr, rpl_str(RPL_ISON), cli_name(&me), cli_name(sptr)); - found1 = 0; } - msgq_append(0, mb, "%s%s", found1 ? " " : "", cli_name(acptr)); - found1++; + msgq_append(0, mb, "%s ", cli_name(acptr)); } } } diff --git a/ircd/m_oper.c b/ircd/m_oper.c index b57c685..813e2b3 100644 --- a/ircd/m_oper.c +++ b/ircd/m_oper.c @@ -90,6 +90,7 @@ #include "client.h" #include "hash.h" #include "ircd.h" +#include "ircd_features.h" #include "ircd_log.h" #include "ircd_reply.h" #include "ircd_string.h" @@ -109,7 +110,6 @@ #include #include -#ifdef CRYPT_OPER_PASSWORD int oper_password_match(const char* to_match, const char* passwd) { /* @@ -117,18 +117,14 @@ int oper_password_match(const char* to_match, const char* passwd) * * passwd may be NULL. Head it off at the pass... */ - if (to_match && passwd) { - const char *encr = ircd_crypt(to_match, passwd); - return (0 == strcmp(encr, passwd)); - } - return 0; -} -#else -int oper_password_match(const char* to_match, const char* passwd) -{ - return (to_match && passwd) ? (0 == strcmp(to_match, passwd)) : 0; + if (!to_match || !passwd) + return 0; + + if (feature_bool(FEAT_CRYPT_OPER_PASSWORD)) + to_match = ircd_crypt(to_match, passwd); + + return (0 == strcmp(to_match, passwd)); } -#endif /* * m_oper - generic message handler diff --git a/ircd/m_privmsg.c b/ircd/m_privmsg.c index a3a396c..2aa19b8 100644 --- a/ircd/m_privmsg.c +++ b/ircd/m_privmsg.c @@ -90,6 +90,7 @@ #include "client.h" #include "ircd.h" #include "ircd_chattr.h" +#include "ircd_features.h" #include "ircd_relay.h" #include "ircd_reply.h" #include "ircd_string.h" @@ -118,9 +119,8 @@ int m_privmsg(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) cli_flags(sptr) &= ~FLAGS_TS8; -#ifdef IDLE_FROM_MSG - cli_user(sptr)->last = CurrentTime; -#endif + if (feature_bool(FEAT_IDLE_FROM_MSG)) + cli_user(sptr)->last = CurrentTime; if (parc < 2 || EmptyString(parv[1])) return send_reply(sptr, ERR_NORECIPIENT, MSG_PRIVATE); @@ -209,9 +209,8 @@ int mo_privmsg(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) cli_flags(sptr) &= ~FLAGS_TS8; -#ifdef IDLE_FROM_MSG - cli_user(sptr)->last = CurrentTime; -#endif + if (feature_bool(FEAT_IDLE_FROM_MSG)) + cli_user(sptr)->last = CurrentTime; if (parc < 2 || EmptyString(parv[1])) return send_reply(sptr, ERR_NORECIPIENT, MSG_PRIVATE); diff --git a/ircd/m_server.c b/ircd/m_server.c index 69f24a8..796f839 100644 --- a/ircd/m_server.c +++ b/ircd/m_server.c @@ -91,6 +91,7 @@ #include "hash.h" #include "ircd.h" #include "ircd_log.h" +#include "ircd_features.h" #include "ircd_reply.h" #include "ircd_string.h" #include "jupe.h" @@ -324,16 +325,7 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) return exit_client_msg(cptr, cptr, &me, "Access denied. No conf line for server %s", cli_name(cptr)); } -#ifdef CRYPT_LINK_PASSWORD - /* passwd may be NULL. Head it off at the pass... */ - if (*(cli_passwd(cptr))) { - encr = ircd_crypt(cli_passwd(cptr), aconf->passed); - } - else - encr = ""; -#else encr = cli_passwd(cptr); -#endif /* CRYPT_LINK_PASSWORD */ if (*aconf->passwd && !!strcmp(aconf->passwd, encr)) { ++ServerStats->is_ref; @@ -345,14 +337,14 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) memset(cli_passwd(cptr), 0, sizeof(cli_passwd(cptr))); -#ifndef HUB - for (i = 0; i <= HighestFd; i++) - if (LocalClientArray[i] && IsServer(LocalClientArray[i])) { - active_lh_line = 3; - LHcptr = 0; - break; - } -#endif + if (!feature_bool(FEAT_HUB)) { + for (i = 0; i <= HighestFd; i++) + if (LocalClientArray[i] && IsServer(LocalClientArray[i])) { + active_lh_line = 3; + LHcptr = 0; + break; + } + } } /* @@ -702,65 +694,58 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) SetServerYXX(cptr, cptr, parv[6]); if (start_timestamp > OLDEST_TS) { -#ifndef RELIABLE_CLOCK -#ifdef TESTNET - sendto_opmask_butone(0, SNO_OLDSNO, "Debug: my start time: %Tu ; " - "others start time: %Tu", cli_serv(&me)->timestamp, - start_timestamp); - sendto_opmask_butone(0, SNO_OLDSNO, "Debug: receive time: %Tu ; " - "received timestamp: %Tu ; difference %ld", - recv_time, timestamp, timestamp - recv_time); -#endif - if (start_timestamp < cli_serv(&me)->timestamp) - { - sendto_opmask_butone(0, SNO_OLDSNO, "got earlier start time: " - "%Tu < %Tu", start_timestamp, cli_serv(&me)->timestamp); - cli_serv(&me)->timestamp = start_timestamp; - TSoffset += timestamp - recv_time; - sendto_opmask_butone(0, SNO_OLDSNO, "clock adjusted by adding %d", - (int)(timestamp - recv_time)); - } - else if ((start_timestamp > cli_serv(&me)->timestamp) && IsUnknown(cptr)) - cli_serv(cptr)->timestamp = TStime(); - - else if (timestamp != recv_time) - { - /* - * Equal start times, we have a collision. Let the connected-to server - * decide. This assumes leafs issue more than half of the connection - * attempts. - */ - if (IsUnknown(cptr)) - cli_serv(cptr)->timestamp = TStime(); - else if (IsHandshake(cptr)) - { - sendto_opmask_butone(0, SNO_OLDSNO, "clock adjusted by adding %d", + Debug((DEBUG_DEBUG, "My start time: %Tu; other's start time: %Tu", + cli_serv(&me)->timestamp, start_timestamp)); + Debug((DEBUG_DEBUG, "Receive time: %Tu; received timestamp: %Tu; " + "difference %ld", recv_time, timestamp, timestamp - recv_time)); + if (feature_bool(FEAT_RELIABLE_CLOCK)) { + if (start_timestamp < cli_serv(&me)->timestamp) + cli_serv(&me)->timestamp = start_timestamp; + if (IsUnknown(cptr)) + cli_serv(cptr)->timestamp = TStime(); + } else { + if (start_timestamp < cli_serv(&me)->timestamp) { + sendto_opmask_butone(0, SNO_OLDSNO, "got earlier start time: " + "%Tu < %Tu", start_timestamp, + cli_serv(&me)->timestamp); + cli_serv(&me)->timestamp = start_timestamp; + TSoffset += timestamp - recv_time; + sendto_opmask_butone(0, SNO_OLDSNO, "clock adjusted by adding %d", (int)(timestamp - recv_time)); - TSoffset += timestamp - recv_time; - } + } else if ((start_timestamp > cli_serv(&me)->timestamp) && + IsUnknown(cptr)) + cli_serv(cptr)->timestamp = TStime(); + + else if (timestamp != recv_time) { + /* + * Equal start times, we have a collision. Let the connected-to + * server decide. This assumes leafs issue more than half of the + * connection attempts. + */ + if (IsUnknown(cptr)) + cli_serv(cptr)->timestamp = TStime(); + else if (IsHandshake(cptr)) { + sendto_opmask_butone(0, SNO_OLDSNO, "clock adjusted by adding %d", + (int)(timestamp - recv_time)); + TSoffset += timestamp - recv_time; + } + } } -#else /* RELIABLE CLOCK IS TRUE, we _always_ use our own clock */ - if (start_timestamp < cli_serv(&me)->timestamp) - cli_serv(&me)->timestamp = start_timestamp; - if (IsUnknown(cptr)) - cli_serv(cptr)->timestamp = TStime(); -#endif } ret = server_estab(cptr, aconf, ajupe); } else ret = 0; -#ifdef RELIABLE_CLOCK - if (abs(cli_serv(cptr)->timestamp - recv_time) > 30) - { + + if (feature_bool(FEAT_RELIABLE_CLOCK) && + abs(cli_serv(cptr)->timestamp - recv_time) > 30) { sendto_opmask_butone(0, SNO_OLDSNO, "Connected to a net with a " "timestamp-clock difference of %Td seconds! " "Used SETTIME to correct this.", timestamp - recv_time); sendcmdto_one(&me, CMD_SETTIME, cptr, "%Tu :%s", TStime(), cli_name(&me)); } -#endif return ret; } @@ -979,17 +964,7 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) return exit_client_msg(cptr, cptr, &me, "Access denied. No conf line for server %s", cli_name(cptr)); } -#ifdef CRYPT_LINK_PASSWORD - /* passwd may be NULL. Head it off at the pass... */ - if (*(cli_passwd(cptr))) - { - encr = ircd_crypt(cli_passwd(cptr), cli_passwd(aconf)); - } - else - encr = ""; -#else encr = cli_passwd(cptr); -#endif /* CRYPT_LINK_PASSWORD */ if (*(aconf->passwd) && !!strcmp(aconf->passwd, encr)) { ++ServerStats->is_ref; @@ -1000,14 +975,14 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) } memset(cli_passwd(cptr), 0, sizeof(cli_passwd(cptr))); -#ifndef HUB - for (i = 0; i <= HighestFd; i++) - if (LocalClientArray[i] && IsServer(LocalClientArray[i])) { - active_lh_line = 3; - LHcptr = 0; - break; - } -#endif + if (!feature_bool(FEAT_HUB)) { + for (i = 0; i <= HighestFd; i++) + if (LocalClientArray[i] && IsServer(LocalClientArray[i])) { + active_lh_line = 3; + LHcptr = 0; + break; + } + } } /* @@ -1353,64 +1328,57 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) SetServerYXX(cptr, cptr, parv[6]); if (start_timestamp > OLDEST_TS) { -#ifndef RELIABLE_CLOCK -#ifdef TESTNET - sendto_opmask_butone(0, SNO_OLDSNO, "Debug: my start time: %Tu ; " - "others start time: %Tu", cli_serv(&me)->timestamp, - start_timestamp); - sendto_opmask_butone(0, SNO_OLDSNO, "Debug: receive time: %Tu ; " - "received timestamp: %Tu ; difference %ld", - recv_time, timestamp, timestamp - recv_time); -#endif - if (start_timestamp < cli_serv(&me)->timestamp) - { - sendto_opmask_butone(0, SNO_OLDSNO, "got earlier start time: " - "%Tu < %Tu", start_timestamp, cli_serv(&me)->timestamp); - cli_serv(&me)->timestamp = start_timestamp; - TSoffset += timestamp - recv_time; - sendto_opmask_butone(0, SNO_OLDSNO, "clock adjusted by adding %d", - (int)(timestamp - recv_time)); - } - else if ((start_timestamp > cli_serv(&me)->timestamp) && IsUnknown(cptr)) - cli_serv(cptr)->timestamp = TStime(); - - else if (timestamp != recv_time) - { - /* - * Equal start times, we have a collision. Let the connected-to server - * decide. This assumes leafs issue more than half of the connection - * attempts. - */ - if (IsUnknown(cptr)) - cli_serv(cptr)->timestamp = TStime(); - else if (IsHandshake(cptr)) - { - sendto_opmask_butone(0, SNO_OLDSNO, "clock adjusted by adding %d", + Debug((DEBUG_DEBUG, "My start time: %Tu; other's start time: %Tu", + cli_serv(&me)->timestamp, start_timestamp)); + Debug((DEBUG_DEBUG, "Receive time: %Tu; received timestamp: %Tu; " + "difference %ld", recv_time, timestamp, timestamp - recv_time)); + if (feature_bool(FEAT_RELIABLE_CLOCK)) { + if (start_timestamp < cli_serv(&me)->timestamp) + cli_serv(&me)->timestamp = start_timestamp; + if (IsUnknown(cptr)) + cli_serv(cptr)->timestamp = TStime(); + } else { + if (start_timestamp < cli_serv(&me)->timestamp) { + sendto_opmask_butone(0, SNO_OLDSNO, "got earlier start time: " + "%Tu < %Tu", start_timestamp, + cli_serv(&me)->timestamp); + cli_serv(&me)->timestamp = start_timestamp; + TSoffset += timestamp - recv_time; + sendto_opmask_butone(0, SNO_OLDSNO, "clock adjusted by adding %d", (int)(timestamp - recv_time)); - TSoffset += timestamp - recv_time; - } + } else if ((start_timestamp > cli_serv(&me)->timestamp) && + IsUnknown(cptr)) + cli_serv(cptr)->timestamp = TStime(); + + else if (timestamp != recv_time) { + /* + * Equal start times, we have a collision. Let the connected-to + * server decide. This assumes leafs issue more than half of the + * connection attempts. + */ + if (IsUnknown(cptr)) + cli_serv(cptr)->timestamp = TStime(); + else if (IsHandshake(cptr)) { + sendto_opmask_butone(0, SNO_OLDSNO, "clock adjusted by adding %d", + (int)(timestamp - recv_time)); + TSoffset += timestamp - recv_time; + } + } } -#else /* RELIABLE CLOCK IS TRUE, we _always_ use our own clock */ - if (start_timestamp < cli_serv(&me)->timestamp) - cli_serv(&me)->timestamp = start_timestamp; - if (IsUnknown(cptr)) - cli_serv(cptr)->timestamp = TStime(); -#endif } ret = server_estab(cptr, aconf, ajupe); } else ret = 0; -#ifdef RELIABLE_CLOCK - if (abs(cli_serv(cptr)->timestamp - recv_time) > 30) - { + + if (feature_bool(FEAT_RELIABLE_CLOCK) && + abs(cli_serv(cptr)->timestamp - recv_time) > 30) { sendto_opmask_butone(0, SNO_OLDSNO, "Connected to a net with a " "timestamp-clock difference of %Td seconds! Used " "SETTIME to correct this.", timestamp - recv_time); sendcmdto_one(&me, CMD_SETTIME, cptr, "%Tu :%s", TStime(), cli_name(&me)); } -#endif return ret; } diff --git a/ircd/m_settime.c b/ircd/m_settime.c index a75a3c0..08b5d6e 100644 --- a/ircd/m_settime.c +++ b/ircd/m_settime.c @@ -90,6 +90,7 @@ #include "client.h" #include "hash.h" #include "ircd.h" +#include "ircd_features.h" #include "ircd_reply.h" #include "ircd_string.h" #include "list.h" @@ -137,10 +138,11 @@ int ms_settime(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (IsServer(sptr)) /* send to unlagged servers */ { -#ifdef RELIABLE_CLOCK - sprintf_irc(tbuf, TIME_T_FMT, TStime()); - parv[1] = tbuf; -#endif + if (feature_bool(FEAT_RELIABLE_CLOCK)) { + sprintf_irc(tbuf, TIME_T_FMT, TStime()); + parv[1] = tbuf; + } + for (lp = cli_serv(&me)->down; lp; lp = lp->next) if (cptr != lp->value.cptr && MsgQLength(&(cli_sendQ(lp->value.cptr))) < 8000) sendcmdto_one(sptr, CMD_NOTICE, lp->value.cptr, "%s", parv[1]); @@ -154,28 +156,27 @@ int ms_settime(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) return 0; } -#ifdef RELIABLE_CLOCK - if ((dt > 600) || (dt < -600)) - sendcmdto_serv_butone(&me, CMD_WALLOPS, 0, ":Bad SETTIME from %s: %Tu", - cli_name(sptr), t); - if (IsUser(sptr)) - { - sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :clock is not set %ld seconds %s " - ": RELIABLE_CLOCK is defined", sptr, (dt < 0) ? -dt : dt, - (dt < 0) ? "forwards" : "backwards"); - } -#else - sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld " - "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt, - (dt < 0) ? "forwards" : "backwards"); - TSoffset -= dt; - if (IsUser(sptr)) - { - sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :clock is set %ld seconds %s", - sptr, (dt < 0) ? -dt : dt, - (dt < 0) ? "forwards" : "backwards"); + if (feature_bool(FEAT_RELIABLE_CLOCK)) { + if ((dt > 600) || (dt < -600)) + sendcmdto_serv_butone(&me, CMD_WALLOPS, 0, ":Bad SETTIME from %s: %Tu", + cli_name(sptr), t); + if (IsUser(sptr)) { + sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :clock is not set %ld " + "seconds %s : RELIABLE_CLOCK is defined", sptr, + (dt < 0) ? -dt : dt, (dt < 0) ? "forwards" : "backwards"); + } + } else { + sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld " + "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt, + (dt < 0) ? "forwards" : "backwards"); + TSoffset -= dt; + if (IsUser(sptr)) { + sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :clock is set %ld seconds %s", + sptr, (dt < 0) ? -dt : dt, + (dt < 0) ? "forwards" : "backwards"); + } } -#endif + return 0; } @@ -213,10 +214,11 @@ int mo_settime(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (IsServer(sptr)) /* send to unlagged servers */ { -#ifdef RELIABLE_CLOCK - sprintf_irc(tbuf, TIME_T_FMT, TStime()); - parv[1] = tbuf; -#endif + if (feature_bool(FEAT_RELIABLE_CLOCK)) { + sprintf_irc(tbuf, TIME_T_FMT, TStime()); + parv[1] = tbuf; + } + for (lp = cli_serv(&me)->down; lp; lp = lp->next) if (cptr != lp->value.cptr && MsgQLength(&(cli_sendQ(lp->value.cptr))) < 8000) sendcmdto_one(sptr, CMD_SETTIME, lp->value.cptr, "%s", parv[1]); @@ -230,28 +232,27 @@ int mo_settime(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) return 0; } -#ifdef RELIABLE_CLOCK - if ((dt > 600) || (dt < -600)) - sendcmdto_serv_butone(&me, CMD_WALLOPS, 0, ":Bad SETTIME from %s: %Tu", - cli_name(sptr), t); - if (IsUser(sptr)) - { - sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :clock is not set %ld seconds %s " - ": RELIABLE_CLOCK is defined", sptr, (dt < 0) ? -dt : dt, - (dt < 0) ? "forwards" : "backwards"); - } -#else - sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld " - "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt, - (dt < 0) ? "forwards" : "backwards"); - TSoffset -= dt; - if (IsUser(sptr)) - { - sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :clock is set %ld seconds %s", - sptr, (dt < 0) ? -dt : dt, - (dt < 0) ? "forwards" : "backwards"); + if (feature_bool(FEAT_RELIABLE_CLOCK)) { + if ((dt > 600) || (dt < -600)) + sendcmdto_serv_butone(&me, CMD_WALLOPS, 0, ":Bad SETTIME from %s: %Tu", + cli_name(sptr), t); + if (IsUser(sptr)) { + sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :clock is not set %ld " + "seconds %s : RELIABLE_CLOCK is defined", sptr, + (dt < 0) ? -dt : dt, (dt < 0) ? "forwards" : "backwards"); + } + } else { + sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld " + "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt, + (dt < 0) ? "forwards" : "backwards"); + TSoffset -= dt; + if (IsUser(sptr)) { + sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :clock is set %ld seconds %s", + sptr, (dt < 0) ? -dt : dt, + (dt < 0) ? "forwards" : "backwards"); + } } -#endif + return 0; } diff --git a/ircd/motd.c b/ircd/motd.c index acf1cec..2dc5daa 100644 --- a/ircd/motd.c +++ b/ircd/motd.c @@ -29,6 +29,7 @@ #include "fileio.h" #include "ircd.h" #include "ircd_alloc.h" +#include "ircd_features.h" #include "ircd_reply.h" #include "ircd_string.h" #include "match.h" @@ -258,18 +259,18 @@ motd_signon(struct Client* cptr) cache = motd_cache(motd_lookup(cptr)); -#ifdef NODEFAULTMOTD - send_reply(cptr, RPL_MOTDSTART, cli_name(&me)); - send_reply(cptr, SND_EXPLICIT | RPL_MOTD, ":\002Type /MOTD to read the AUP " - "before continuing using this service.\002"); - send_reply(cptr, SND_EXPLICIT | RPL_MOTD, ":The message of the day was last " - "changed: %d-%d-%d %d:%d", cache->modtime.tm_year + 1900, - cache->modtime.tm_mon + 1, cache->modtime.tm_mday, - cache->modtime.tm_hour, cache->modtime.tm_min); - send_reply(cptr, RPL_ENDOFMOTD); -#else - motd_forward(cptr, cache); -#endif + if (!feature_bool(FEAT_NODEFAULTMOTD)) + motd_forward(cptr, cache); + else { + send_reply(cptr, RPL_MOTDSTART, cli_name(&me)); + send_reply(cptr, SND_EXPLICIT | RPL_MOTD, ":\002Type /MOTD to read the " + "AUP before continuing using this service.\002"); + send_reply(cptr, SND_EXPLICIT | RPL_MOTD, ":The message of the day was " + "last changed: %d-%d-%d %d:%d", cache->modtime.tm_year + 1900, + cache->modtime.tm_mon + 1, cache->modtime.tm_mday, + cache->modtime.tm_hour, cache->modtime.tm_min); + send_reply(cptr, RPL_ENDOFMOTD); + } } /* motd_recache causes all the MOTD caches to be cleared */ @@ -295,11 +296,11 @@ motd_recache(void) void motd_init(void) { - MotdList.local = motd_create(0, MPATH, MOTD_MAXLINES); /* init local */ - motd_cache(MotdList.local); /* and cache it */ + MotdList.local = motd_create(0, feature_str(FEAT_MPATH), MOTD_MAXLINES); + motd_cache(MotdList.local); /* init local and cache it */ - MotdList.remote = motd_create(0, RPATH, MOTD_MAXREMOTE); /* init remote */ - motd_cache(MotdList.remote); /* and cache it */ + MotdList.remote = motd_create(0, feature_str(FEAT_RPATH), MOTD_MAXREMOTE); + motd_cache(MotdList.remote); /* init remote and cache it */ MotdList.other = 0; /* no T-lines processed yet */ } diff --git a/ircd/numnicks.c b/ircd/numnicks.c index 921206c..6bdca99 100644 --- a/ircd/numnicks.c +++ b/ircd/numnicks.c @@ -55,10 +55,6 @@ * just-disconnected-client aren't confused with just-connected ones. */ -/* - * Lets have *LOTS* of connections... - */ -#define EXTENDED_NUMERICS /* These must be the same on ALL servers ! Do not change ! */ @@ -67,11 +63,7 @@ #define NUMNICKBASE 64 /* (2 << NUMNICKLOG) */ #define NUMNICKMASK 63 /* (NUMNICKBASE-1) */ #define NN_MAX_SERVER 4096 /* (NUMNICKBASE * NUMNICKBASE) */ -#if defined(EXTENDED_NUMERICS) #define NN_MAX_CLIENT 262144 /* NUMNICKBASE ^ 3 */ -#else -#define NN_MAX_CLIENT 4096 /* (NUMNICKBASE * NUMNICKBASE) */ -#endif /* * The internal counter for the 'XX' of local clients @@ -244,11 +236,7 @@ void SetYXXCapacity(struct Client* c, unsigned int capacity) exit(-1); } --max_clients; -#if defined(EXTENDED_NUMERICS) inttobase64(cli_serv(c)->nn_capacity, max_clients, 3); -#else - inttobase64(cli_serv(c)->nn_capacity, max_clients, 2); -#endif cli_serv(c)->nn_mask = max_clients; /* Our Numeric Nick mask */ cli_serv(c)->client_list = (struct Client**) MyCalloc(max_clients + 1, sizeof(struct Client*)); @@ -260,12 +248,7 @@ void SetYXXServerName(struct Client* c, unsigned int numeric) assert(0 != c); assert(numeric < NN_MAX_SERVER); -#if defined(EXTENDED_NUMERICS) inttobase64(cli_yxx(c), numeric, 2); -#else - assert(numeric < NUMNICKBASE); - (cli_yxx(c))[0] = convert2y[numeric]; -#endif if (numeric >= lastNNServer) lastNNServer = numeric + 1; server_list[numeric] = c; @@ -337,11 +320,7 @@ int SetLocalNumNick(struct Client *cptr) } client_list[last_nn & mask] = cptr; /* Reserve the numeric ! */ -#if defined(EXTENDED_NUMERICS) inttobase64(cli_yxx(cptr), last_nn, 3); -#else - inttobase64(cli_yxx(cptr), last_nn, 2); -#endif if (++last_nn == NN_MAX_CLIENT) last_nn = 0; return 1; diff --git a/ircd/parse.c b/ircd/parse.c index 3f78605..152ef99 100644 --- a/ircd/parse.c +++ b/ircd/parse.c @@ -27,6 +27,7 @@ #include "ircd.h" #include "ircd_alloc.h" #include "ircd_chattr.h" +#include "ircd_features.h" #include "ircd_reply.h" #include "ircd_string.h" #include "msg.h" @@ -353,11 +354,7 @@ struct Message msgtab[] = { TOK_OPER, 0, MAXPARA, MFLG_SLOW, 0, /* UNREG, CLIENT, SERVER, OPER, SERVICE */ -#ifndef NOOPER { m_unregistered, m_oper, ms_oper, mo_oper, m_ignore } -#else - { m_unregistered, m_oper, m_ignore, m_ignore, m_ignore } -#endif }, { MSG_CONNECT, @@ -572,10 +569,6 @@ struct Message msgtab[] = { }; -#ifdef GODMODE -extern int sdbflag; -#endif /* GODMODE */ - static char *para[MAXPARA + 2]; /* leave room for prefix and null */ /* @@ -920,10 +913,9 @@ int parse_client(struct Client *cptr, char *buffer, char *bufend) handler = mptr->handlers[cli_handler(cptr)]; assert(0 != handler); -#ifndef IDLE_FROM_MSG - if (IsUser(cptr) && handler != m_ping && handler != m_ignore) + if (!feature_bool(FEAT_IDLE_FROM_MSG) && IsUser(cptr) && + handler != m_ping && handler != m_ignore) cli_user(from)->last = CurrentTime; -#endif return (*handler) (cptr, from, i, para); } diff --git a/ircd/s_auth.c b/ircd/s_auth.c index 9b1457b..00ecdab 100644 --- a/ircd/s_auth.c +++ b/ircd/s_auth.c @@ -33,6 +33,7 @@ #include "ircd.h" #include "ircd_alloc.h" #include "ircd_chattr.h" +#include "ircd_features.h" #include "ircd_log.h" #include "ircd_osdep.h" #include "ircd_string.h" @@ -221,10 +222,10 @@ static void auth_dns_callback(void* vptr, struct DNSReply* reply) sendto_opmask_butone(0, SNO_IPMISMATCH, "IP# Mismatch: %s != %s[%s]", cli_sock_ip(auth->client), hp->h_name, ircd_ntoa(hp->h_addr_list[0])); -#if defined(KILL_IPMISMATCH) - auth_kill_client(auth); - return; -#endif + if (feature_bool(FEAT_KILL_IPMISMATCH)) { + auth_kill_client(auth); + return; + } } else { ++reply->ref_count; diff --git a/ircd/s_bsd.c b/ircd/s_bsd.c index c9d6f76..6a5904f 100644 --- a/ircd/s_bsd.c +++ b/ircd/s_bsd.c @@ -26,6 +26,7 @@ #include "class.h" #include "hash.h" #include "ircd_log.h" +#include "ircd_features.h" #include "ircd_osdep.h" #include "ircd_reply.h" #include "ircd_string.h" @@ -100,15 +101,6 @@ const char* const SOCKET_ERROR_MSG = "error creating socket for %s: %s"; const char* const TOS_ERROR_MSG = "error setting TOS for %s: %s"; -#ifdef GODMODE -#ifndef NODNS -#define NODNS -#endif -#ifndef NOFLOODCONTROL -#define NOFLOODCONTROL -#endif -#endif - #if !defined(USE_POLL) #if FD_SETSIZE < (MAXCONNECTIONS + 4) /* @@ -260,17 +252,18 @@ static int connect_inet(struct ConfItem* aconf, struct Client* cptr) * leading to a freezing select() on this side for some time. * I had this on my Linux 1.1.88 --Run */ -#ifdef VIRTUAL_HOST + /* * No, we do bind it if we have virtual host support. If we don't * explicitly bind it, it will default to IN_ADDR_ANY and we lose * due to the other server not allowing our base IP --smg */ - if (bind(cli_fd(cptr), (struct sockaddr*) &VirtualHost, sizeof(VirtualHost))) { + if (feature_bool(FEAT_VIRTUAL_HOST) && + bind(cli_fd(cptr), (struct sockaddr*) &VirtualHost, + sizeof(VirtualHost))) { report_error(BIND_ERROR_MSG, cli_name(cptr), errno); return 0; } -#endif memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; @@ -633,7 +626,9 @@ static int read_packet(struct Client *cptr, int socket_ready) unsigned int dolen = 0; unsigned int length = 0; - if (socket_ready && !(IsUser(cptr) && DBufLength(&(cli_recvQ(cptr))) > CLIENT_FLOOD)) { + if (socket_ready && + !(IsUser(cptr) && + DBufLength(&(cli_recvQ(cptr))) > feature_int(FEAT_CLIENT_FLOOD))) { switch (os_recv_nonb(cli_fd(cptr), readbuf, sizeof(readbuf), &length)) { case IO_SUCCESS: if (length) { @@ -668,18 +663,16 @@ static int read_packet(struct Client *cptr, int socket_ready) if (length > 0 && 0 == dbuf_put(&(cli_recvQ(cptr)), readbuf, length)) { return exit_client(cptr, cptr, &me, "dbuf_put fail"); } -#ifndef NOFLOODCONTROL + /* * XXX - cptr will always be a user or unregistered */ - if (IsUser(cptr) && DBufLength(&(cli_recvQ(cptr))) > CLIENT_FLOOD) + if (IsUser(cptr) && + DBufLength(&(cli_recvQ(cptr))) > feature_int(FEAT_CLIENT_FLOOD)) return exit_client(cptr, cptr, &me, "Excess Flood"); while (DBufLength(&(cli_recvQ(cptr))) && !NoNewLine(cptr) && (IsTrusted(cptr) || cli_since(cptr) - CurrentTime < 10)) -#else - while (DBufLength(&(cli_recvQ(cptr))) && !NoNewLine(cptr)) -#endif { /* * If it has become registered as a Server diff --git a/ircd/s_conf.c b/ircd/s_conf.c index 06beff8..af30c21 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -648,9 +648,6 @@ static struct ConfItem *find_conf_entry(struct ConfItem *aconf, (EmptyString(aconf->passwd) && !EmptyString(bconf->passwd))) continue; if (!EmptyString(bconf->passwd) && (!IsDigit(*bconf->passwd) || bconf->passwd[1]) -#ifdef USEONE - && 0 != ircd_strcmp(bconf->passwd, "ONE") -#endif && 0 != ircd_strcmp(bconf->passwd, aconf->passwd)) continue; diff --git a/ircd/s_debug.c b/ircd/s_debug.c index 482e077..c28038a 100644 --- a/ircd/s_debug.c +++ b/ircd/s_debug.c @@ -59,28 +59,27 @@ static char serveropts[256]; /* should be large enough for anything */ const char* debug_serveropts(void) { + int bp; int i = 0; #define AddC(c) serveropts[i++] = (c) -#if BUFFERPOOL < 1000000 - AddC('b'); -#if BUFFERPOOL > 99999 - AddC((char)('0' + (BUFFERPOOL/100000))); -#endif -#if BUFFERPOOL > 9999 - AddC((char)('0' + (BUFFERPOOL/10000) % 10)); -#endif - AddC((char)('0' + (BUFFERPOOL/1000) % 10)); -#else - AddC('B'); -#if BUFFERPOOL > 99999999 - AddC((char)('0' + (BUFFERPOOL/100000000))); -#endif -#if BUFFERPOOL > 9999999 - AddC((char)('0' + (BUFFERPOOL/10000000) % 10)); -#endif - AddC((char)('0' + (BUFFERPOOL/1000000) % 10)); -#endif + bp = feature_int(FEAT_BUFFERPOOL); + if (bp < 1000000) { + AddC('b'); + if (bp > 99999) + AddC((char)('0' + (bp / 100000))); + if (bp > 9999) + AddC((char)('0' + (bp / 10000) % 10)); + AddC((char)('0' + (bp / 1000) % 10)); + } else { + AddC('B'); + if (bp > 99999999) + AddC((char)('0' + (bp / 100000000))); + if (bp > 9999999) + AddC((char)('0' + (bp / 10000000) % 10)); + AddC((char)('0' + (bp / 1000000) % 10)); + } + #ifdef CHROOTDIR AddC('c'); #endif @@ -103,9 +102,8 @@ const char* debug_serveropts(void) if (feature_bool(FEAT_OPER_MODE_LCHAN)) AddC('f'); -#ifdef HUB - AddC('H'); -#endif + if (feature_bool(FEAT_HUB)) + AddC('H'); if (feature_bool(FEAT_SHOW_ALL_INVISIBLE_USERS)) AddC('I'); @@ -122,25 +120,17 @@ const char* debug_serveropts(void) if (feature_bool(FEAT_OPER_WALK_THROUGH_LMODES)) AddC('l'); -#ifdef IDLE_FROM_MSG - AddC('M'); -#endif -#ifdef USEONE - AddC('O'); -#endif + if (feature_bool(FEAT_IDLE_FROM_MSG)) + AddC('M'); if (feature_bool(FEAT_NO_OPER_DEOP_LCHAN)) AddC('o'); -#ifdef CRYPT_OPER_PASSWORD - AddC('p'); -#endif -#ifdef CRYPT_LINK_PASSWORD - AddC('P'); -#endif -#ifdef RELIABLE_CLOCK - AddC('R'); -#endif + if (feature_bool(FEAT_CRYPT_OPER_PASSWORD)) + AddC('p'); + + if (feature_bool(FEAT_RELIABLE_CLOCK)) + AddC('R'); if (feature_bool(FEAT_LOCOP_RESTART)) AddC('s'); @@ -151,9 +141,9 @@ const char* debug_serveropts(void) #if defined(USE_POLL) && defined(HAVE_POLL_H) AddC('U'); #endif -#ifdef VIRTUAL_HOST - AddC('v'); -#endif + + if (feature_bool(FEAT_VIRTUAL_HOST)) + AddC('v'); serveropts[i] = '\0'; diff --git a/ircd/s_err.c b/ircd/s_err.c index 6290bc0..b5a3a94 100644 --- a/ircd/s_err.c +++ b/ircd/s_err.c @@ -431,11 +431,7 @@ static Numeric replyTable[] = { /* 199 */ { 0 }, /* 200 */ -#ifndef GODMODE { RPL_TRACELINK, "Link %s%s %s %s", "200" }, -#else /* GODMODE */ - { RPL_TRACELINK, "Link %s%s %s %s " TIME_T_FMT, "200" }, -#endif /* GODMODE */ /* 201 */ { RPL_TRACECONNECTING, "Try. %d %s", "201" }, /* 202 */ @@ -763,11 +759,7 @@ static Numeric replyTable[] = { /* 363 */ { RPL_CLOSEEND, "%d :Connections Closed", "363" }, /* 364 */ -#ifndef GODMODE { RPL_LINKS, "%s %s :%d P%u %s", "364" }, -#else /* GODMODE */ - { RPL_LINKS, "%s %s :%d P%u " TIME_T_FMT " (%s) %s", "364" }, -#endif /* GODMODE */ /* 365 */ { RPL_ENDOFLINKS, "%s :End of /LINKS list.", "365" }, /* 366 */ diff --git a/ircd/s_user.c b/ircd/s_user.c index 1539369..f483a0e 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -32,6 +32,7 @@ #include "ircd.h" #include "ircd_alloc.h" #include "ircd_chattr.h" +#include "ircd_features.h" #include "ircd_log.h" #include "ircd_reply.h" #include "ircd_string.h" @@ -1218,13 +1219,12 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv */ if (!(setflags & FLAGS_CHSERV)) ClearChannelService(sptr); -#ifdef WALLOPS_OPER_ONLY /* * only send wallops to opers */ - if (!IsAnOper(sptr) && !(setflags & FLAGS_WALLOP)) + if (feature_bool(FEAT_WALLOPS_OPER_ONLY) && !IsAnOper(sptr) && + !(setflags & FLAGS_WALLOP)) ClearWallops(sptr); -#endif } if (MyConnect(sptr)) { if ((setflags & (FLAGS_OPER | FLAGS_LOCOP)) && !IsAnOper(sptr))