diff --git a/.CHANGES.NEW b/.CHANGES.NEW index 01a13a522..b49ab807f 100644 --- a/.CHANGES.NEW +++ b/.CHANGES.NEW @@ -7,16 +7,14 @@ \___/|_| |_|_| \___|\__,_|_|\___/\_| \_| \____/\__,_| Configuration Program - for Unreal3.4-alpha3 + for Unreal3.4-alpha4 This program will help you to compile your IRC server, and ask you questions regarding the compile-time settings of it during the process. regarding the setup of it, during the process. -If you have problems regarding the setup & compile, read Unreal.nfo to get -more information on where to get help. Please, before running this setup, -read the documentation in the "doc" folder. Docs are also avail online @ -http://www.unrealircd.com/unreal32docs.html +A short installation guide is available online at: +https://www.unrealircd.org/docs/Installing_from_source -NOTE: The documentation has not been updated to reflect the changes - between UnrealIRCd 3.2.x and 3.4.x. +Full documentation is available at: +https://www.unrealircd.org/docs/UnrealIRCd_3.4.x_documentation diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..6e5115038 --- /dev/null +++ b/.gitignore @@ -0,0 +1,58 @@ +# Ignore configure step +config.log +conftest.* +config.settings +extras/pcre2* +extras/c-ares* +extras/regexp* +config.status +extras/tre* +extras/ircdcron/ircd.cron +extras/ircdcron/ircdchk +src/modules/snomasks/Makefile +src/modules/chanmodes/Makefile +src/modules/extbans/Makefile +src/modules/usermodes/Makefile +src/modules/Makefile +/Makefile +unrealircd +include/setup.h + + +# Ignores for platform stuff +.DS_Store + +# Ignores for build artifacts +*.so +*.o +*.dSYM +*.dylib +src/ircd +src/version.c +src/include + +# Ignores for mac stuff +## Various settings +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata + +## Other +*.xccheckout +*.moved-aside +*.xcuserstate +*.xcscmblueprint + +## Obj-C/Swift specific +*.hmap +*.ipa + +src/macosx/build/ +DerivedData +src/macosx/pods/ diff --git a/Config b/Config index 706c34e4d..58341fdce 100755 --- a/Config +++ b/Config @@ -32,6 +32,8 @@ if [ -z "$BINDIR" -o -z "$DATADIR" -o -z "$CONFDIR" -o -z "$MODULESDIR" -o -z "$ exit fi +mkdir -p $TMPDIR + # Do this even if we're not in advanced mode if [ "$SHOWLISTMODES" = "1" ] ; then ARG="$ARG--with-showlistmodes " @@ -447,7 +449,8 @@ echo "You can just press ENTER to accept the defaults!" TEST="$BASEPATH" echo "" echo "In what directory do you want to install UnrealIRCd?" -echo "(Note: in Unreal3.4.x you should always install somewhere)" +echo "(Note: in Unreal3.4.x you should always install somewhere," +echo "and if this directory does not exist it will be created)" echo $n "[$TEST] -> $c" read cc if [ -z "$cc" ] ; then @@ -829,6 +832,7 @@ fi rm -f config.settings cat > config.settings << __EOF__ # +BASEPATH="$BASEPATH" BINDIR="$BINDIR" DATADIR="$DATADIR" CONFDIR="$CONFDIR" diff --git a/Makefile.in b/Makefile.in index 7018c7be1..9dec8f7b3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -203,11 +203,13 @@ install: all $(INSTALL) -m 0700 src/modules/usermodes/*.so @MODULESDIR@/usermodes $(INSTALL) -m 0700 -d @MODULESDIR@/chanmodes $(INSTALL) -m 0700 src/modules/chanmodes/*.so @MODULESDIR@/chanmodes + $(INSTALL) -m 0700 -d @MODULESDIR@/snomasks + $(INSTALL) -m 0700 src/modules/snomasks/*.so @MODULESDIR@/snomasks $(INSTALL) -m 0700 -d @MODULESDIR@/extbans $(INSTALL) -m 0700 src/modules/extbans/*.so @MODULESDIR@/extbans $(INSTALL) -m 0700 -d @TMPDIR@ $(INSTALL) -m 0700 -d @CACHEDIR@ - $(INSTALL) -m 0700 -d @DATADIR@ + $(INSTALL) -m 0700 -d @PERMDATADIR@ $(INSTALL) -m 0700 -d @LOGDIR@ # TODO: ircdcron.. where? -@if [ ! -f "@CONFDIR@/ssl/server.cert.pem" ] ; then \ diff --git a/configure b/configure index b645bf8ca..8db88fba7 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for unrealircd 3.4-alpha3. +# Generated by GNU Autoconf 2.69 for unrealircd 3.4-alpha4. # # Report bugs to . # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='unrealircd' PACKAGE_TARNAME='unrealircd' -PACKAGE_VERSION='3.4-alpha3' -PACKAGE_STRING='unrealircd 3.4-alpha3' +PACKAGE_VERSION='3.4-alpha4' +PACKAGE_STRING='unrealircd 3.4-alpha4' PACKAGE_BUGREPORT='http://bugs.unrealircd.org/' PACKAGE_URL='http://unrealircd.org/' @@ -624,6 +624,7 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS LIBOBJS +BUILDDIR UNRLINCDIR URL PTHREAD_CFLAGS @@ -650,7 +651,7 @@ TRE_CFLAGS FD_SETSIZE PIDFILE DOCDIR -DATADIR +PERMDATADIR TMPDIR CACHEDIR LOGDIR @@ -1312,7 +1313,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures unrealircd 3.4-alpha3 to adapt to many kinds of systems. +\`configure' configures unrealircd 3.4-alpha4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1377,7 +1378,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of unrealircd 3.4-alpha3:";; + short | recursive ) echo "Configuration of unrealircd 3.4-alpha4:";; esac cat <<\_ACEOF @@ -1526,7 +1527,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -unrealircd configure 3.4-alpha3 +unrealircd configure 3.4-alpha4 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2132,7 +2133,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by unrealircd $as_me 3.4-alpha3, which was +It was created by unrealircd $as_me 3.4-alpha4, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -6229,17 +6230,17 @@ fi if test "${with_datadir+set}" = set; then : withval=$with_datadir; cat >>confdefs.h <<_ACEOF -#define DATADIR "$withval" +#define PERMDATADIR "$withval" _ACEOF - DATADIR="$withval" + PERMDATADIR="$withval" else cat >>confdefs.h <<_ACEOF #define DATADIR "$HOME/unrealircd/data" _ACEOF - DATADIR="$HOME/unrealircd/data" + PERMDATADIR="$HOME/unrealircd/data" fi @@ -6274,10 +6275,10 @@ _ACEOF else cat >>confdefs.h <<_ACEOF -#define PIDFILE "$HOME/unrealircd/data/ircd.pid" +#define PIDFILE "$HOME/unrealircd/data/unrealircd.pid" _ACEOF - PIDFILE="$HOME/unrealircd/data/ircd.pid" + PIDFILE="$HOME/unrealircd/data/unrealircd.pid" fi @@ -7987,7 +7988,10 @@ fi UNRLINCDIR="`pwd`/include" -ac_config_files="$ac_config_files Makefile src/modules/Makefile src/modules/chanmodes/Makefile src/modules/usermodes/Makefile src/modules/extbans/Makefile unrealircd extras/ircdcron/ircdchk extras/ircdcron/ircd.cron" +BUILDDIR="`pwd`" + + +ac_config_files="$ac_config_files Makefile src/modules/Makefile src/modules/chanmodes/Makefile src/modules/usermodes/Makefile src/modules/snomasks/Makefile src/modules/extbans/Makefile unrealircd extras/ircdcron/ircdchk extras/ircdcron/ircd.cron" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -8495,7 +8499,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by unrealircd $as_me 3.4-alpha3, which was +This file was extended by unrealircd $as_me 3.4-alpha4, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -8558,7 +8562,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -unrealircd config.status 3.4-alpha3 +unrealircd config.status 3.4-alpha4 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -8684,6 +8688,7 @@ do "src/modules/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/Makefile" ;; "src/modules/chanmodes/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/chanmodes/Makefile" ;; "src/modules/usermodes/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/usermodes/Makefile" ;; + "src/modules/snomasks/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/snomasks/Makefile" ;; "src/modules/extbans/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/extbans/Makefile" ;; "unrealircd") CONFIG_FILES="$CONFIG_FILES unrealircd" ;; "extras/ircdcron/ircdchk") CONFIG_FILES="$CONFIG_FILES extras/ircdcron/ircdchk" ;; diff --git a/configure.ac b/configure.ac index eb45dd7fb..da078b388 100644 --- a/configure.ac +++ b/configure.ac @@ -8,7 +8,7 @@ dnl src/win32/unrealinst.iss dnl .CHANGES.NEW dnl src/version.c.SH -AC_INIT([unrealircd], [3.4-alpha3], [http://bugs.unrealircd.org/], [], [http://unrealircd.org/]) +AC_INIT([unrealircd], [3.4-alpha4], [http://bugs.unrealircd.org/], [], [http://unrealircd.org/]) AC_CONFIG_SRCDIR([src/ircd.c]) AC_CONFIG_HEADER([include/setup.h]) AC_CONFIG_AUX_DIR([autoconf]) @@ -508,10 +508,10 @@ AC_ARG_WITH(tmpdir, [AS_HELP_STRING([--with-tmpdir=path],[Specify the directory TMPDIR="$HOME/unrealircd/tmp"]) AC_ARG_WITH(datadir, [AS_HELP_STRING([--with-datadir=path],[Specify the directory where permanent data is stored])], - [AC_DEFINE_UNQUOTED([DATADIR], ["$withval"], [Define the location of permanent data files]) - DATADIR="$withval"], + [AC_DEFINE_UNQUOTED([PERMDATADIR], ["$withval"], [Define the location of permanent data files]) + PERMDATADIR="$withval"], [AC_DEFINE_UNQUOTED([DATADIR], ["$HOME/unrealircd/data"], [Define the location of permanent data files]) - DATADIR="$HOME/unrealircd/data"]) + PERMDATADIR="$HOME/unrealircd/data"]) AC_ARG_WITH(docdir, [AS_HELP_STRING([--with-docdir=path],[Specify the directory where documentation is stored])], [AC_DEFINE_UNQUOTED([DOCDIR], ["$withval"], [Define the location of the documentation]) @@ -532,7 +532,9 @@ AC_SUBST(MODULESDIR) AC_SUBST(LOGDIR) AC_SUBST(CACHEDIR) AC_SUBST(TMPDIR) -AC_SUBST(DATADIR) +dnl Why o why PERMDATADIR and not DATADIR you ask? +dnl well, Because DATADIR conflicts with the Windows SDK header files.. amazing. +AC_SUBST(PERMDATADIR) AC_SUBST(DOCDIR) AC_SUBST(PIDFILE) @@ -784,10 +786,14 @@ CHECK_LIBCURL UNRLINCDIR="`pwd`/include" AC_SUBST(UNRLINCDIR) +BUILDDIR="`pwd`" +AC_SUBST(BUILDDIR) + AC_CONFIG_FILES([Makefile src/modules/Makefile src/modules/chanmodes/Makefile src/modules/usermodes/Makefile + src/modules/snomasks/Makefile src/modules/extbans/Makefile unrealircd extras/ircdcron/ircdchk diff --git a/doc/RELEASE-NOTES b/doc/RELEASE-NOTES index 3e66427c1..202e8bfca 100644 --- a/doc/RELEASE-NOTES +++ b/doc/RELEASE-NOTES @@ -1,8 +1,8 @@ -Unreal3.4-alpha3 Release Notes +Unreal3.4-alpha4 Release Notes =============================== -This is the third 'alpha' version of UnrealIRCd 3.4. We plan to move to -'beta' stage in 1-2 months and have a stable 3.4.x release later in 2015. +This is the fourth 'alpha' version of UnrealIRCd 3.4. We plan to move to +'beta' stage in a month to have a stable 3.4.x release later in 2015. IMPORTANT REMARKS as long as UnrealIRCd 3.4.x is in alpha stage: * Because this is an alpha version it is far more likely to crash or hang. @@ -12,46 +12,54 @@ IMPORTANT REMARKS as long as UnrealIRCd 3.4.x is in alpha stage: limited to: configuration, command syntax, location of files, etc. Therefore: -* You should never run 3.4-alpha3 as a production server -* You should not link 3.4-alpha3 with a production 3.2.x network +* You should never run 3.4-alpha4 as a production server +* You should not link 3.4-alpha4 with a production 3.2.x network Please do: -* Install 3.4-alpha3 to play around, show to your friends, have fun with +* Install 3.4-alpha4 to play around, show to your friends, have fun with the latest features and improvements, test things. * Report any problems, bugs, issues and other feedback on https://bugs.unrealircd.org/ so we can improve 3.4.x! - During alpha stage we are still very flexible so feedback is really helpful. Finally: -* If you are moving from 3.2.x then be sure to read 'CONFIGURATION CHANGES'! -* The documentation has not been updated to reflect the changes in 3.4.x. +* If you are moving from 3.2.x then be sure to read 'CONFIGURATION CHANGES' + which explains the new directory structure and how to make UnrealIRCd + convert your existing 3.2.x configuration file to the 3.4.x format. -==[ GENERAL INFORMATION ]== -* Documentation is still in doc\unreal32docs.html but - as said - is not - up to date for 3.4.x. FAQ is on: http://www.unrealircd.com/faq -* Please report bugs at http://bugs.unrealircd.org/ -* Below you will see a summary of all changes. Changes may be tagged when - a change was made in a specific version, e.g. "(A3)" means 3.4-alpha3. - For a complete list of changes (500+) use 'git log' or have a look at - https://github.com/unrealircd/unrealircd/commits/unreal34 +==[ DOCUMENTATION ]== +UnrealIRCd 3.4.x documentation is now located in a wiki online at: +* https://www.unrealircd.org/docs/ +The old unreal32docs.*html files have been removed. ==[ CONFIGURATION CHANGES ]== -UnrealIRCd 3.4.x comes with an easy to use tool to upgrade your configuration -file from the 3.2.x syntax to 3.4.x. If you already have a good working -3.2.x configuration file then this should make it very easy to move to 3.4.x. +Starting with 3.4-alpha4 we use a new directory structure. -After UnrealIRCd is compiled/installed you copy your unrealircd.conf over -from 3.2.x (along with any other custom .conf's). -Then, on *NIX run './unreal upgrade-conf'. -On Windows simply try to boot and watch all the errors, click OK and -you will be asked if UnrealIRCd should upgrade your configuration file. +*NIX: If you are not on Windows then this means you must now choose a + target directory to install UnrealIRCd to. ./Config will ask this + and it's ~/unrealircd by default (eg: /home/nerd/unrealircd). + You also need to run 'make install' after 'make' now. + After compiling, you should leave your Unreal3.4-alphaX directory + and change to ~/unrealircd as everything takes place there. + For example to start UnrealIRCd you run './unrealircd start' + (again, from the /home/xxxx/unrealircd directory). -UnrealIRCd will go through your unrealircd.conf and any other files that -are included from there and upgrade the files one by one. +The new directory structure is as follows (both on Windows and *NIX): +conf/ contains all configuration files +logs/ for log files +modules/ all modules (.so files on *NIX, .dll files on Windows) +tmp/ temporary files +data/ persistent data such as ircd.tune +cache/ cached remote includes -For both *NIX and Windows, after running the step from above, simply -start UnrealIRCd (again) and it should boot up fine with your freshly -converted configuration file(s). +It is possible to use your existing 3.2.x configuration file, but it needs +to be 'upgraded' to the new 3.4.x syntax. UnrealIRCd can do this for you. +Simply place your unrealircd.conf (and any other .conf's you use) in the +conf/ directory and then: +* On *NIX run './unrealircd upgrade-conf' (from /home/xxxx/unrealircd) +* On Windows simply try to boot and watch all the errors, click OK and + you will be asked if UnrealIRCd should upgrade your configuration file. +On either OS, after running the step from above, simply start UnrealIRCd +again and it should boot up fine with your converted configuration file(s). Note: UnrealIRCd can only convert *working* 3.2.x configuration files! If your 3.2.x configuration contains mistakes or errors then the upgrade @@ -60,14 +68,50 @@ process will likely fail or the resulting config file will fail to load. You may still be interested in the configuration changes, they are listed on: https://www.unrealircd.org/docs/Upgrading_from_3.2.x +==[ GENERAL INFORMATION ]== +* Below you will see a summary of all changes. Changes may be tagged when + a change was made in a specific version, e.g. "(A3)" means 3.4-alpha3. + For a complete list of changes (600+) use 'git log' or have a look at + https://github.com/unrealircd/unrealircd/commits/unreal34 + ==[ NEW ]== -* We moved a lot of channel and user modes to modules. These are all - loaded by modules.conf, but if you don't want to load a certain module - you can now simply comment them out or remove that line. - Since a lot of code has been moved from the core to these modules it - makes it A) easier for coders to see all source code related to a - specific feature, and B) makes it possible to fix something and reload - the module rather than restart the IRCd. +* We moved a lot of functionality, including most channel modes, user + modes and all extended bans into 145 separate modules. + This makes it... + A) possible to fully customize what exact functionality you want to load. + You could even strip down UnrealIRCd to get something close to the + basic RFC1459 features from the 1990s. (No idea why you would want + that, but it's possible) + B) easier for coders to see all source code related to a specific feature + C) possible to fix bugs and just reload rather than restart the IRCd. + + Have a look at modules.default.conf which contains the "default" set of + modules that you can load if you just want to load all functionality. + If you want to customize the list of modules to load then simply make + a copy of that file, give it a different name, and include that one + instead. Since the file is fully documented, you can just comment out + or delete the loadmodule lines of things you don't want to load. +* Oper permissions have changed completely: (A4) + * All previous oper levels/ranks no longer exist (Netadmin, Admin, ..) + * oper::flags has been removed. Instead you must specify an operclass + in oper::operclass (for example, 'operclass netadmin'). + * In operclass block(s) you define the privileges. You can now control + exactly what an IRCOp can and cannot do. (This process is on-going) + Have a look at operclass.default.conf which ships with UnrealIRCd, + it contains a number of default operclass blocks suitable for the + most common situations. See also the operclass block documentation: + https://www.unrealircd.org/docs/Operclass_block + * If you ask UnrealIRCd to convert your 3.2.x configuration file then + it will try to select a suitable operclass for the oper. This will + not always 100% match your current oper block rights, though. + * Channel Mode +A (Admin Only) has been removed. You can use the new + extended ban ~O:. This allows you to, for example, create + an operclass 'netadmin' only channel: /MODE #chan +iI ~O:netadmin* + * set::hosts has been removed, use oper::vhost instead. + * Since oper levels have been removed you no longer see things like + "OperX is a Network Administrator" in /WHOIS by default. + If you want that, then you can set oper::swhois to + "is a Network Administrator" (or any other text). * Entirely rewritten I/O and event loop. This allows the IRCd to scale more easily to tens of thousands of clients by using kernel-evented I/O mechanisms such as epoll and kqueue. @@ -135,6 +179,31 @@ listed on: https://www.unrealircd.org/docs/Upgrading_from_3.2.x * Because having both allow::ip and allow::hostname in the same allow block was highly confusing (it was an OR-match) you must now choose between either allow::ip OR allow::hostname. (A3) +* cgiirc block is renamed to webirc and the syntax has changed (A4) +* set::pingpong-warning is removed, warning always off now (A4) +* More helpful configuration file parse error messages (A4) +* You can use '/OPER username' without password if you use SSL + certificate (fingerprint) authentication. The same is true for + '/VHOST username'. (A4) +* You must now always use 'make install' on *NIX (A4) +* Changed (default) directory structure entirely, see the section + titled 'CONFIGURATION CHANGES' about 100 lines up. (A4) +* badword quit { } is removed, we use badword channel for it. (A4) +* badwords.*.conf is now just one badwords.conf +* To load all default modules you now include modules.default.conf. + This file was called modules.conf in earlier alpha's. + The file has been split up in sections and a lot of comments have + been added to aid the user in deciding whether to load or not to + load each module. (A4) +* Snomask +s is now (always) IRCOp-only. (A4) +* There's now actually an idea behind HalfOp permissions. The idea + is that halfops should be able to help out in case of a flood but + not be able to +* Previously there was little logic behind what modes halfops could + set. Now the idea is as follows: halfops should be able to help out + in case of a flood but not be able to change any 'policy decission + modes' such as +G, +S, +c, +s. Due to this change halfops can now + set modes +beiklmntIMKNCR (was: +beikmntI). ==[ MODULE CODERS / DEVELOPERS ]== * A lot of technical documentation for module coders has been added @@ -149,21 +218,24 @@ listed on: https://www.unrealircd.org/docs/Upgrading_from_3.2.x ==[ MAJOR BUGS FIXED ]== * Crash bug on-boot in alpha1 (A2) * IRCOp commands such as /GLINE were not always working (A2) +* link::outgoing::options::autoconnect did not work (A4) * This is still an alpha release, so likely contains major issues +* If the IRCd could not bind to any ports it started anyway (A4) +* alpha3 did not compile on x86 (32 bit) systems (A4) ==[ MINOR BUGS FIXED ]== * Errors in example configuration files (A2) * Some fixes in delayjoin (Channel mode +d) (A2) * Deal with services who allow you to log in by account name (A3) +* Detect "IRCd not running" situations better (A4) +* './unrealircd restart' will now always try to start UnrealIRCd, + so also if it wasn't running previously. (A4) ==[ REMOVED / DROPPED ]== * Numeric server IDs, see above. (A1) * PROTOCTL TOKEN and SJB64 are no longer implemented. (A1) * Ziplinks have been removed. (A1) * WebTV support. (A3) - -==[ KNOWN ISSUES ]== -* Documentation has NOT been updated to reflect 3.4.x features!!! - -==[ ADDITIONAL INFO ]== -* See Changelog for more details +* User mode +h (helpop). This user mode only added a line in /WHOIS + saying the user "is available for help". You can use a vhost block + with a vhost::swhois as a replacement. Or oper::swhois. (A4) diff --git a/doc/conf/examples/example.conf b/doc/conf/examples/example.conf index a981f2271..fca5e6f51 100644 --- a/doc/conf/examples/example.conf +++ b/doc/conf/examples/example.conf @@ -22,22 +22,22 @@ # This is also a comment, again this line is ignored (comment type #3) /* UnrealIRCd makes heavy use of modules. By using this include we - * tell the ircd to read the file 'modules.full.conf' which contains - * more than a hundred loadmodule lines that load all the necessary - * modules. + * tell the ircd to read the file 'modules.default.conf' which contains + * more than 150 loadmodule lines that load all the necessary modules. */ -include "modules.full.conf"; +include "modules.default.conf"; /* Now let's include some other files as well: - * - help.conf for our on-IRC /HELPOP system - * - badwords.*.conf for channel and user mode +G + * - help/help.conf for our on-IRC /HELPOP system + * - badwords.conf for channel and user mode +G * - spamfilter.conf as an example for spamfilter usage + * - operclass.default.conf contains some good operclasses which + * you can use in your oper blocks. */ -include "help.conf"; -include "badwords.channel.conf"; -include "badwords.message.conf"; -include "badwords.quit.conf"; +include "help/help.conf"; +include "badwords.conf"; include "spamfilter.conf"; +include "operclass.default.conf"; /* This is the me { } block which basically says who we are. * It defines our server name, some information line and an unique "sid". @@ -97,7 +97,6 @@ class servers /* Allow everyone in, but only 5 connections per IP */ allow { ip *@*; - hostname *@*; class clients; maxperip 5; }; @@ -107,7 +106,6 @@ allow { */ allow { ip *@192.0.2.1; - hostname *@NOMATCH; class clients; password "somesecretpasswd"; maxperip 20; @@ -127,13 +125,9 @@ oper bobsmith { class clients; mask *@*; password "test"; - flags - { - netadmin; - can_zline; - can_gzline; - can_gkline; - }; + operclass netadmin; + swhois "is a Network Administrator"; + vhost netadmin.mynet.org; }; /* Listen blocks define the ports where the server should listen on. @@ -184,9 +178,10 @@ link hub.mynet.org hostname hub.mynet.org; port 6900; options { ssl; }; - password "00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF"; /* SSL fingerprint of other server */ }; + password "00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF"; /* SSL fingerprint of other server */ + class servers; }; @@ -341,23 +336,12 @@ set { "and another one"; "and another one"; }; - - /* on-oper host */ - hosts { - local "locop.mynet.org"; - global "ircop.mynet.org"; - coadmin "coadmin.mynet.org"; - admin "admin.mynet.org"; - servicesadmin "csops.mynet.org"; - netadmin "netadmin.mynet.org"; - host-on-oper-up yes; - }; }; /* Server specific configuration */ set { - kline-address "set.this.email"; /* e-mail shown when a user is banned */ + kline-address "set.this.to.email.address"; /* e-mail shown when a user is banned */ modes-on-connect "+ixw"; modes-on-oper "+xwgs"; oper-auto-join "#opers"; diff --git a/doc/conf/examples/example.fr.conf b/doc/conf/examples/example.fr.conf index 0f190b46b..5969dc8ca 100644 --- a/doc/conf/examples/example.fr.conf +++ b/doc/conf/examples/example.fr.conf @@ -33,9 +33,9 @@ /* * UnrealIRCd supporte des modules et certains sont obligatoires. - * La ligne suivante charge tous les modules définis dans modules.full.conf + * La ligne suivante charge tous les modules définis dans modules.default.conf */ -include "modules.full.conf"; +include "modules.default.conf"; /* * Vous pouvez également inclure d'autres fichiers de configuration. @@ -46,10 +46,9 @@ include "modules.full.conf"; * Vous voudrez probablement les inclure: */ include "doc/help.fr.conf"; -include "badwords.channel.conf"; -include "badwords.message.conf"; -include "badwords.quit.conf"; +include "badwords.conf"; include "spamfilter.conf"; +include "operclass.default.conf"; /* * ACTUEL : me {} diff --git a/doc/conf/help/help.conf b/doc/conf/help/help.conf index c6e150f3b..2b0bfc8f1 100644 --- a/doc/conf/help/help.conf +++ b/doc/conf/help/help.conf @@ -163,7 +163,7 @@ help Chmodes { " b = Bans the nick!ident@host from the channel [h]"; " (For more info on extended bantypes, see /HELPOP EXTBANS)"; " c = Block messages containing mIRC color codes [o]"; - " C = No CTCPs allowed in the channel [o]"; + " C = No CTCPs allowed in the channel [h]"; " e = Overrides a ban for matching users [h]"; " f = Flood protection (for more info see /HELPOP CHMODEF) [o]"; " G = Filters out all Bad words in messages with [o]"; @@ -171,18 +171,18 @@ help Chmodes { " I = Overrides +i for matching users [h]"; " j = Throttle joins per-user to 'joins' per 'sec' seconds [o]"; " k = Users must specify to join [h]"; - " K = /KNOCK is not allowed [o]"; + " K = /KNOCK is not allowed [h]"; " L = Channel link (If +l is full, the next user will auto-join ) [q]"; - " l = Channel may hold at most of users [o]"; + " l = Channel may hold at most of users [h]"; " m = Moderated channel (only +vhoaq users may speak) [h]"; - " M = Must be using a registered nick (+r), or have voice access to talk [o]"; - " N = No Nickname changes are permitted in the channel [o]"; + " M = Must be using a registered nick (+r), or have voice access to talk [h]"; + " N = No Nickname changes are permitted in the channel [h]"; " n = Users outside the channel can not send PRIVMSGs to the channel [h]"; " O = IRC Operator only channel (settable by IRCops)"; " p = Private channel [o]"; " P = Permanent channel (the channel is not destroyed when empty) (settable by IRCops)"; " Q = No kicks allowed [o]"; - " R = Only registered (+r) users may join the channel [o]"; + " R = Only registered (+r) users may join the channel [h]"; " r = The channel is registered (settable by services only)"; " s = Secret channel [o]"; " S = Strips mIRC color codes [o]"; diff --git a/doc/conf/modules.full.conf b/doc/conf/modules.default.conf similarity index 88% rename from doc/conf/modules.full.conf rename to doc/conf/modules.default.conf index b331a0f3c..742762611 100644 --- a/doc/conf/modules.full.conf +++ b/doc/conf/modules.default.conf @@ -3,7 +3,7 @@ * * If you want to have all UnrealIRCd functionality, then include this * file from your unrealircd.conf by using: - * include "modules.full.conf"; + * include "modules.default.conf"; * * DO NOT EDIT THIS FILE! IT WILL BE OVERWRITTEN DURING NEXT UPGRADE!! * If you want to customize the modules to load, make a copy of this @@ -74,7 +74,6 @@ loadmodule "cap_invitenotify"; loadmodule "m_addline"; loadmodule "m_addmotd"; loadmodule "m_addomotd"; -loadmodule "m_adminchat"; loadmodule "m_chatops"; loadmodule "m_chghost"; loadmodule "m_chgident"; @@ -87,7 +86,6 @@ loadmodule "m_globops"; loadmodule "m_kill"; /* also server-to-server */ loadmodule "m_locops"; loadmodule "m_mkpasswd"; -loadmodule "m_nachat"; loadmodule "m_oper"; loadmodule "m_opermotd"; loadmodule "m_rping"; @@ -133,7 +131,6 @@ loadmodule "m_svsnick"; loadmodule "m_svsnline"; loadmodule "m_svsnolag"; loadmodule "m_svsnoop"; -loadmodule "m_svso"; loadmodule "m_svspart"; loadmodule "m_svssilence"; loadmodule "m_svssno"; @@ -154,7 +151,6 @@ loadmodule "chanmodes/delayjoin"; /* +D */ loadmodule "chanmodes/noknock"; /* +K */ loadmodule "chanmodes/noinvite"; /* +V */ loadmodule "chanmodes/operonly"; /* +O */ -loadmodule "chanmodes/adminonly"; /* +A */ loadmodule "chanmodes/nonotice"; /* +T */ loadmodule "chanmodes/regonly"; /* +R */ loadmodule "chanmodes/nonickchange"; /* +N */ @@ -174,14 +170,19 @@ loadmodule "usermodes/nokick"; /* +q (unkickable oper) */ loadmodule "usermodes/regonlymsg"; /* +R (only registered users may private message you) */ +/*** Server notice masks */ +loadmodule "snomasks/dccreject"; /* +D (rejected DCC's) */ + + /*** Extended Bans ***/ -loadmodule "extbans/join"; /* +b ~j */ -loadmodule "extbans/quiet"; /* +b ~q */ -loadmodule "extbans/nickchange"; /* +b ~n */ -loadmodule "extbans/realname"; /* +b ~r */ -loadmodule "extbans/regnick"; /* +b ~R */ -loadmodule "extbans/account"; /* +b ~a */ -loadmodule "extbans/inchannel"; /* +b ~c */ +loadmodule "extbans/join"; /* +b ~j (prevent only joins) */ +loadmodule "extbans/quiet"; /* +b ~q (prevent only messaging) */ +loadmodule "extbans/nickchange"; /* +b ~n (prevent only nick changes) */ +loadmodule "extbans/realname"; /* +b ~r (ban by real name) */ +loadmodule "extbans/regnick"; /* +b ~R (ban/exempt if using registered nick) */ +loadmodule "extbans/account"; /* +b ~a (ban/exempt if logged in with services account) */ +loadmodule "extbans/inchannel"; /* +b ~c (ban/exempt if in channel) */ +loadmodule "extbans/operclass"; /* +b ~O (ban/exempt by operclass) */ /*** Other ***/ diff --git a/doc/conf/operclass.default.conf b/doc/conf/operclass.default.conf new file mode 100644 index 000000000..e2d573dff --- /dev/null +++ b/doc/conf/operclass.default.conf @@ -0,0 +1,156 @@ +/* This file defines a number of default operclass blocks which you can + * use in your oper blocks (via oper::operclass). + * + * This file is normally included from your unrealircd.conf through: + * include "operclass.default.conf"; + * + * The operclass block is extensively documented at: + * https://www.unrealircd.org/docs/Operclass_block + * + * DO NOT EDIT THIS FILE! IT WILL BE OVERWRITTEN DURING NEXT UPGRADE!! + * Instead, if you want to change the privileges in an operclass block, + * you should copy the definition, or this entire file, to either your + * unrealircd.conf or some other file (eg: operclass.conf) that you + * you will include from your unrealircd.conf. + * Then edit it, and while doing so don't forget to change the name + * of your custom operclass block(s), so operclass . + */ + +/* Local IRC Operator */ +operclass locop { + privileges { + privacy; + chat; + channel; + client; + immune; + notice { local; }; + server { info; module; rping; dns; rehash; }; + route { local; }; + kill { local; }; + tkl { + kline; + zline { local; }; + }; + trace { local; invisible-users; }; + }; +}; + +/* Global IRC Operator */ +operclass globop { + privileges { + privacy; + chat; + channel; + client; + immune; + notice; + server { info; remote; module; rping; dns; rehash; }; + route; + kill; + tkl { shun; zline; kline; gline; }; + trace; + who; + override { see; }; + }; + map; +}; + +/* Server administrator */ +operclass admin { + privileges { + privacy; + chat; + channel; + client; + immune; + notice; + server { info; remote; module; rping; dns; addline; rehash; description; addmotd; addomotd; tsctl; }; + route; + kill; + tkl { shun; zline; kline; gline; }; + spamfilter; + trace; + who; + override { see; }; + }; +}; + +/* Services Admin */ +operclass services-admin { + privileges { + privacy; + chat; + channel; + client; + immune; + notice; + server { info; remote; module; rping; dns; addline; rehash; description; addmotd; addomotd; tsctl; }; + route; + kill; + tkl { shun; zline; kline; gline; }; + spamfilter; + trace; + who; + sajoin; + sapart; + samode; + override { see; }; + }; +}; + +/* Network Administrator */ +operclass netadmin { + privileges { + privacy; + chat; + channel; + client; + immune; + notice; + server { info; remote; module; rping; dns; addline; rehash; description; addmotd; addomotd; tsctl; }; + kill; + tkl { shun; zline; kline; gline; }; + route; + spamfilter; + trace; + who; + sajoin; + sapart; + samode; + servicebot { deop; kill; }; + override { see; }; + }; +}; + +/* Same as 'globop' operclass, but with OperOverride capabilities added */ +operclass globop-with-override { + parent globop; + privileges { + override; + }; +}; + +/* Same as 'admin' operclass, but with OperOverride capabilities added */ +operclass admin-with-override { + parent admin; + privileges { + override; + }; +}; + +/* Same as 'services-admin' operclass, but with OperOverride capabilities added */ +operclass services-admin-with-override { + parent services-admin; + privileges { + override; + }; +}; + +/* Same as 'netadmin' operclass, but with OperOverride capabilities added */ +operclass netadmin-with-override { + parent netadmin; + privileges { + override; + }; +}; diff --git a/doc/conf/spamfilter.conf b/doc/conf/spamfilter.conf index a0fa899da..e596190ed 100644 --- a/doc/conf/spamfilter.conf +++ b/doc/conf/spamfilter.conf @@ -14,179 +14,204 @@ */ spamfilter { - regex "\x01DCC (SEND|RESUME)[ ]+\"(.+ ){20}"; + match-type posix; + match "\x01DCC (SEND|RESUME)[ ]+\"(.+ ){20}"; target { private; channel; }; + action kill; reason "mIRC 6.0-6.11 exploit attempt"; - action kill; }; spamfilter { - regex "\x01DCC (SEND|RESUME).{225}"; + match-type posix; + match "\x01DCC (SEND|RESUME).{225}"; target { private; channel; }; - reason "Possible mIRC 6.12 exploit attempt"; action kill; + reason "Possible mIRC 6.12 exploit attempt"; }; spamfilter { - regex "Come watch me on my webcam and chat /w me :-\) http://.+:\d+/me\.mpg"; + match-type posix; + match "Come watch me on my webcam and chat /w me :-\) http://.+:\d+/me\.mpg"; target private; + action gline; reason "Infected by fyle trojan: see http://www.sophos.com/virusinfo/analyses/trojfylexa.html"; - action gline; }; spamfilter { - regex "Speed up your mIRC DCC Transfer by up to 75%.*www\.freewebs\.com/mircupdate/mircspeedup\.exe"; + match-type posix; + match "Speed up your mIRC DCC Transfer by up to 75%.*www\.freewebs\.com/mircupdate/mircspeedup\.exe"; target private; + action gline; reason "Infected by mirseed trojan: see http://www.sophos.com/virusinfo/analyses/trojmirseeda.html"; - action gline; }; spamfilter { - regex "^http://www\.angelfire\.com/[a-z0-9]+/[a-z0-9]+/[a-z_]+\.jpg <- .*!"; + match-type posix; + match "^http://www\.angelfire\.com/[a-z0-9]+/[a-z0-9]+/[a-z_]+\.jpg <- .*!"; target private; - reason "Infected by fagot worm: see http://www.f-secure.com/v-descs/fagot.shtml"; action block; + reason "Infected by fagot worm: see http://www.f-secure.com/v-descs/fagot.shtml"; }; spamfilter { - regex "^FREE PORN: http://free:porn@([0-9]{1,3}\.){3}[0-9]{1,3}:8180$"; + match-type posix; + match "^FREE PORN: http://free:porn@([0-9]{1,3}\.){3}[0-9]{1,3}:8180$"; target private; + action gline; reason "Infected by aplore worm: see http://www.f-secure.com/v-descs/aplore.shtml"; - action gline; }; spamfilter { - regex "^!login Wasszup!$"; + match-type posix; + match "^!login Wasszup!$"; target channel; + action gline; reason "Attempting to login to a GTBot"; - action gline; }; spamfilter { - regex "^!login grrrr yeah baby!$"; + match-type posix; + match "^!login grrrr yeah baby!$"; target channel; + action gline; reason "Attempting to login to a GTBot"; - action gline; }; spamfilter { - regex "^!packet ([0-9]{1,3}\.){3}[0-9]{1,3} [0-9]{1,15}"; + match-type posix; + match "^!packet ([0-9]{1,3}\.){3}[0-9]{1,3} [0-9]{1,15}"; target channel; + action gline; reason "Attempting to use a GTBot"; - action gline; }; spamfilter { - regex "^!icqpagebomb ([0-9]{1,15} ){2}.+"; + match-type posix; + match "^!icqpagebomb ([0-9]{1,15} ){2}.+"; target channel; + action gline; reason "Attempting to use a GTBot"; - action gline; }; spamfilter { - regex "^!pfast [0-9]{1,15} ([0-9]{1,3}\.){3}[0-9]{1,3} [0-9]{1,5}$"; + match-type posix; + match "^!pfast [0-9]{1,15} ([0-9]{1,3}\.){3}[0-9]{1,3} [0-9]{1,5}$"; target channel; + action gline; reason "Attempting to use a GTBot"; - action gline; }; spamfilter { - regex "^!portscan ([0-9]{1,3}\.){3}[0-9]{1,3} [0-9]{1,5} [0-9]{1,5}$"; + match-type posix; + match "^!portscan ([0-9]{1,3}\.){3}[0-9]{1,3} [0-9]{1,5} [0-9]{1,5}$"; target channel; + action gline; reason "Attempting to use a GTBot"; - action gline; }; spamfilter { - regex "^.u(dp)? ([0-9]{1,3}\.){3}[0-9]{1,3} [0-9]{1,15} [0-9]{1,15} [0-9]{1,15}( [0-9])*$"; + match-type posix; + match "^.u(dp)? ([0-9]{1,3}\.){3}[0-9]{1,3} [0-9]{1,15} [0-9]{1,15} [0-9]{1,15}( [0-9])*$"; target channel; + action gline; reason "Attempting to use an SDBot"; - action gline; }; spamfilter { - regex "^.syn ((([0-9]{1,3}\.){3}[0-9]{1,3})|([a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+\.[a-zA-Z0-9_.-]+)) [0-9]{1,5} [0-9]{1,15} [0-9]{1,15}"; + match-type posix; + match "^.syn ((([0-9]{1,3}\.){3}[0-9]{1,3})|([a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+\.[a-zA-Z0-9_.-]+)) [0-9]{1,5} [0-9]{1,15} [0-9]{1,15}"; target { channel; private; }; - reason "Attempting to use a SpyBot"; action gline; + reason "Attempting to use a SpyBot"; }; spamfilter { - regex "^porn! porno! http://.+\/sexo\.exe"; + match-type posix; + match "^porn! porno! http://.+\/sexo\.exe"; target private; action gline; reason "Infected by soex trojan: see http://www.trendmicro.com/vinfo/virusencyclo/default5.asp?VName=TROJ%5FSOEX.A"; }; spamfilter { - regex "(^wait a minute plz\. i am updating my site|.*my erotic video).*http://.+/erotic(a)?/myvideo\.exe$"; + match-type posix; + match "(^wait a minute plz\. i am updating my site|.*my erotic video).*http://.+/erotic(a)?/myvideo\.exe$"; target private; action gline; reason "Infected by some trojan (erotica?)"; }; spamfilter { - regex "^STOP SPAM, USE THIS COMMAND: //write nospam \$decode\(.+\) \| \.load -rs nospam \| //mode \$me \+R$"; + match-type posix; + match "^STOP SPAM, USE THIS COMMAND: //write nospam \$decode\(.+\) \| \.load -rs nospam \| //mode \$me \+R$"; target private; action gline; reason "Infected by nkie worm: see http://www.trojaninfo.com/nkie/nkie.htm"; }; spamfilter { - regex "^FOR MATRIX 2 DOWNLOAD, USE THIS COMMAND: //write Matrix2 \$decode\(.+=,m\) \| \.load -rs Matrix2 \| //mode \$me \+R$"; + match-type posix; + match "^FOR MATRIX 2 DOWNLOAD, USE THIS COMMAND: //write Matrix2 \$decode\(.+=,m\) \| \.load -rs Matrix2 \| //mode \$me \+R$"; target private; action gline; reason "Infected by nkie worm: see http://www.trojaninfo.com/nkie/nkie.htm"; }; spamfilter { - regex "^hey .* to get OPs use this hack in the chan but SHH! //\$decode\(.*,m\) \| \$decode\(.*,m\)$"; + match-type posix; + match "^hey .* to get OPs use this hack in the chan but SHH! //\$decode\(.*,m\) \| \$decode\(.*,m\)$"; target private; action gline; reason "Infected by nkie worm: see http://www.trojaninfo.com/nkie/nkie.htm"; }; spamfilter { - regex ".*(http://jokes\.clubdepeche\.com|http://horny\.69sexy\.net|http://private\.a123sdsdssddddgfg\.com).*"; + match-type posix; + match ".*(http://jokes\.clubdepeche\.com|http://horny\.69sexy\.net|http://private\.a123sdsdssddddgfg\.com).*"; target private; action gline; - reason "Infected by LOI trojan"; /* Name is still unsure */ + reason "Infected by LOI trojan"; }; /* This is a 'general sig' which might have a tad more false positives, hence just 'block' is used */ spamfilter { - regex "C:\\\\WINNT\\\\system32\\\\[][0-9a-z_-{|}`]+\.zip"; + match-type posix; + match "C:\\WINNT\\system32\\[][0-9a-z_-{|}`]+\.zip"; target dcc; action block; reason "Infected by Gaggle worm?"; }; spamfilter { - regex "C:\\\\WINNT\\\\system32\\\\(notes|videos|xxx|ManualSeduccion|postal|hechizos|images|sex|avril)\.zip"; + match-type posix; + match "C:\\WINNT\\system32\\(notes|videos|xxx|ManualSeduccion|postal|hechizos|images|sex|avril)\.zip"; target dcc; action dccblock; reason "Infected by Gaggle worm"; }; spamfilter { - regex "http://.+\.lycos\..+/[iy]server[0-9]/[a-z]{4,11}\.(gif|jpg|avi|txt)"; + match-type posix; + match "http://.+\.lycos\..+/[iy]server[0-9]/[a-z]{4,11}\.(gif|jpg|avi|txt)"; target { private; quit; }; action block; reason "Infected by Gaggle worm"; }; spamfilter { - regex "^Free porn pic.? and movies (www\.sexymovies\.da\.ru|www\.girlporn\.org)"; - target private; - reason "Unknown virus. Site causes Backdoor.Delf.lq infection"; - action block; + match-type posix; + match "^Free porn pic.? and movies (www\.sexymovies\.da\.ru|www\.girlporn\.org)"; + target private; + action block; + reason "Unknown virus. Site causes Backdoor.Delf.lq infection"; }; spamfilter { - regex "^LOL! //echo -a \$\(\$decode\(.+,m\),[0-9]\)$"; + match-type posix; + match "^LOL! //echo -a \$\(\$decode\(.+,m\),[0-9]\)$"; target channel; - reason "$decode exploit"; action block; + reason "$decode exploit"; }; /* @@ -199,7 +224,8 @@ spamfilter { */ spamfilter { - regex "^Want To Be An IRCOp\? Try This New Bug Type: //write \$decode\(.+=.?,m\) \| \.load -rs \$decode\(.+=.?,m\)$"; + match-type posix; + match "^Want To Be An IRCOp\? Try This New Bug Type: //write \$decode\(.+=.?,m\) \| \.load -rs \$decode\(.+=.?,m\)$"; target private; action block; reason "Spamming users with an mIRC trojan. Type '/unload -rs newb' to remove the trojan."; diff --git a/include/config.h b/include/config.h index 1f233cf0f..e51c8d1f8 100644 --- a/include/config.h +++ b/include/config.h @@ -243,7 +243,7 @@ #define LPATH LOGDIR"/debug.log" /* Where the debug file lives, if DEBUGMODE */ #define VPATH CONFDIR"/ircd.svsmotd" /* Services MOTD append. */ #define BPATH CONFDIR"/bot.motd" /* Bot MOTD */ -#define IRCDTUNE DATADIR"/ircd.tune" /* tuning .. */ +#define IRCDTUNE PERMDATADIR"/ircd.tune" /* tuning .. */ /* CHROOTDIR * @@ -404,6 +404,13 @@ * DO NOT SET THIS TO ANYTHING MORE THAN 5. BETTER YET, JUST LEAVE IT AT 2! */ #define TIMESEC 2 +/* + * Maximum delay for socket loop (in miliseconds, so 1000 = 1 second). + * This means any other events and such may be delayed up to this value + * when there is no socket data waiting for us (no clients sending anything). + * Was 2000ms in 3.2.x, 1000ms for versions below 3.4-alpha4. + */ +#define SOCKETLOOP_MAX_DELAY 500 /* * If daemon doesn't receive anything from any of its links within diff --git a/include/dynconf.h b/include/dynconf.h index f0ebb9f73..8abc854b3 100644 --- a/include/dynconf.h +++ b/include/dynconf.h @@ -32,12 +32,6 @@ struct zNetwork { char *x_ircnet005; char *x_defserv; char *x_services_name; - char *x_oper_host; - char *x_admin_host; - char *x_locop_host; - char *x_sadmin_host; - char *x_netadmin_host; - char *x_coadmin_host; char *x_hidden_host; char *x_prefix_quit; char *x_helpchan; @@ -195,12 +189,6 @@ extern MODVAR aConfiguration iConf; #define ircnet005 iConf.network.x_ircnet005 #define defserv iConf.network.x_defserv #define SERVICES_NAME iConf.network.x_services_name -#define oper_host iConf.network.x_oper_host -#define admin_host iConf.network.x_admin_host -#define locop_host iConf.network.x_locop_host -#define sadmin_host iConf.network.x_sadmin_host -#define netadmin_host iConf.network.x_netadmin_host -#define coadmin_host iConf.network.x_coadmin_host #define hidden_host iConf.network.x_hidden_host #define helpchan iConf.network.x_helpchan #define STATS_SERVER iConf.network.x_stats_server @@ -351,17 +339,10 @@ struct SetCheck { unsigned has_spamfilter_virus_help_channel:1; unsigned has_spamfilter_virus_help_channel_deny:1; unsigned has_spamfilter_except:1; - unsigned has_hosts_host_on_oper_up:1; unsigned has_network_name:1; unsigned has_default_server:1; unsigned has_services_server:1; unsigned has_sasl_server:1; - unsigned has_hosts_global:1; - unsigned has_hosts_admin:1; - unsigned has_hosts_local:1; - unsigned has_hosts_servicesadmin:1; - unsigned has_hosts_netadmin:1; - unsigned has_hosts_coadmin:1; unsigned has_hiddenhost_prefix:1; unsigned has_prefix_quit:1; unsigned has_help_channel:1; diff --git a/include/h.h b/include/h.h index 949ddd81a..9563772ec 100644 --- a/include/h.h +++ b/include/h.h @@ -102,34 +102,34 @@ extern int config_is_blankorempty(ConfigEntry *cep, const char *block); extern MODVAR int config_verbose; extern void config_progress(char *format, ...) __attribute__((format(printf,1,2))); extern void ipport_seperate(char *string, char **ip, char **port); -ConfigItem_class *Find_class(char *name); -ConfigItem_deny_dcc *Find_deny_dcc(char *name); -ConfigItem_oper *Find_oper(char *name); -ConfigItem_operclass *Find_operclass(char *name); -ConfigItem_listen *Find_listen(char *ipmask, int port); -ConfigItem_ulines *Find_uline(char *host); -ConfigItem_except *Find_except(aClient *, char *host, short type); -ConfigItem_tld *Find_tld(aClient *cptr, char *host); -ConfigItem_link *Find_link(char *servername, aClient *acptr); -ConfigItem_ban *Find_ban(aClient *, char *host, short type); -ConfigItem_ban *Find_banEx(aClient *,char *host, short type, short type2); -ConfigItem_vhost *Find_vhost(char *name); -ConfigItem_deny_channel *Find_channel_allowed(aClient *cptr, char *name); -ConfigItem_alias *Find_alias(char *name); -ConfigItem_help *Find_Help(char *command); +extern ConfigItem_class *Find_class(char *name); +extern ConfigItem_deny_dcc *Find_deny_dcc(char *name); +extern ConfigItem_oper *Find_oper(char *name); +extern ConfigItem_operclass *Find_operclass(char *name); +extern ConfigItem_listen *Find_listen(char *ipmask, int port); +extern ConfigItem_ulines *Find_uline(char *host); +extern ConfigItem_except *Find_except(aClient *, char *host, short type); +extern ConfigItem_tld *Find_tld(aClient *cptr, char *host); +extern ConfigItem_link *Find_link(char *servername, aClient *acptr); +extern ConfigItem_ban *Find_ban(aClient *, char *host, short type); +extern ConfigItem_ban *Find_banEx(aClient *,char *host, short type, short type2); +extern ConfigItem_vhost *Find_vhost(char *name); +extern ConfigItem_deny_channel *Find_channel_allowed(aClient *cptr, char *name); +extern ConfigItem_alias *Find_alias(char *name); +extern ConfigItem_help *Find_Help(char *command); -OperPermission OperClass_evaluateACLPath(char* path, aClient *sptr, aClient *victim, aChannel *channel, void* extra); +extern OperPermission OperClass_evaluateACLPath(char *path, aClient *sptr, aClient *victim, aChannel *channel, void *extra); +extern void OperClassValidatorDel(OperClassValidator *validator); -int AllowClient(aClient *cptr, struct hostent *hp, char *sockhost, char *username); -int parse_netmask(const char *text, struct irc_netmask *netmask); -int match_ip(struct IN_ADDR addr, char *uhost, char *mask, struct irc_netmask *netmask); +extern int AllowClient(aClient *cptr, struct hostent *hp, char *sockhost, char *username); +extern int parse_netmask(const char *text, struct irc_netmask *netmask); +extern int match_ip(struct IN_ADDR addr, char *uhost, char *mask, struct irc_netmask *netmask); #ifdef INET6 -int match_ipv6(struct IN_ADDR *addr, struct IN_ADDR *mask, int bits); +extern int match_ipv6(struct IN_ADDR *addr, struct IN_ADDR *mask, int bits); #endif -ConfigItem_ban *Find_ban_ip(aClient *sptr); -void add_ListItem(ListStruct *, ListStruct **); -ListStruct *del_ListItem(ListStruct *, ListStruct **); -/* Remmed out for win32 compatibility.. as stated of 467leaf win32 port.. */ +extern ConfigItem_ban *Find_ban_ip(aClient *sptr); +extern void add_ListItem(ListStruct *, ListStruct **); +extern ListStruct *del_ListItem(ListStruct *, ListStruct **); extern aClient *find_match_server(char *mask); extern MODVAR LoopStruct loop; extern int del_banid(aChannel *chptr, char *banid); @@ -325,11 +325,8 @@ extern int hunt_server(aClient *, aClient *, char *, int, int, char **); extern aClient *next_client(aClient *, char *); extern int m_server_estab(aClient *); extern void umode_init(void); -extern long umode_get(char, int, int (*)(aClient *, int)); #define UMODE_GLOBAL 1 #define UMODE_LOCAL 0 -#define umode_lget(x) umode_get(x, 0, 0); -#define umode_gget(x) umode_get(x, 1, 0); extern int umode_allow_all(aClient *sptr, int what); extern int umode_allow_opers(aClient *sptr, int what); extern int umode_allow_none(aClient *sptr, int what); @@ -400,15 +397,10 @@ extern MODVAR long UMODE_OPER; /* 0x0002 Operator */ extern MODVAR long UMODE_WALLOP; /* 0x0004 send wallops to them */ extern MODVAR long UMODE_FAILOP; /* 0x0008 Shows some global messages */ extern MODVAR long UMODE_REGNICK; /* 0x0020 Nick set by services as registered */ -extern MODVAR long UMODE_SADMIN; /* 0x0040 Services Admin */ -extern MODVAR long UMODE_ADMIN; /* 0x0080 Admin */ extern MODVAR long UMODE_SERVNOTICE;/* 0x0100 server notices such as kill */ extern MODVAR long UMODE_LOCOP; /* 0x0200 Local operator -- SRB */ extern MODVAR long UMODE_HIDE; /* 0x8000 Hide from Nukes */ -extern MODVAR long UMODE_NETADMIN; /* 0x10000 Network Admin */ -extern MODVAR long UMODE_COADMIN; /* 0x80000 Co Admin */ extern MODVAR long UMODE_SECURE; /* 0x800000 User is a secure connect */ -extern MODVAR long UMODE_VICTIM; /* 0x8000000 Intentional Victim */ extern MODVAR long UMODE_DEAF; /* 0x10000000 Deaf */ extern MODVAR long UMODE_HIDEOPER; /* 0x20000000 Hide oper mode */ extern MODVAR long UMODE_SETHOST; /* 0x40000000 used sethost */ @@ -606,7 +598,7 @@ extern MODVAR char backupbuf[]; extern void add_invite(aClient *, aClient *, aChannel *); extern void channel_modes(aClient *cptr, char *mbuf, char *pbuf, size_t mbuf_size, size_t pbuf_size, aChannel *chptr); extern MODVAR char modebuf[BUFSIZE], parabuf[BUFSIZE]; -extern int op_can_override(aClient *sptr); +extern int op_can_override(char* acl, aClient *sptr,aChannel *channel,void* extra); extern aClient *find_chasing(aClient *sptr, char *user, int *chasing); extern MODVAR long opermode; extern void add_user_to_channel(aChannel *chptr, aClient *who, int flags); @@ -719,7 +711,7 @@ extern char *unreal_time_synch_error(void); extern int unreal_time_synch(int timeout); extern int extban_is_banned_helper(char *buf); extern char *getcloak(aClient *sptr); -extern unsigned char param_to_slot_mapping[256]; +extern MODVAR unsigned char param_to_slot_mapping[256]; extern char *cm_getparameter(aChannel *chptr, char mode); extern void cm_putparameter(aChannel *chptr, char mode, char *str); extern void cm_freeparameter(aChannel *chptr, char mode); @@ -761,6 +753,6 @@ extern char *our_strcasestr(char *haystack, char *needle); extern void update_conf(void); extern MODVAR int need_34_upgrade; #ifdef _WIN32 -extern BOOL IsService; +extern MODVAR BOOL IsService; #endif extern int match_ip46(char *a, char *b); diff --git a/include/modules.h b/include/modules.h index 079edbeee..f50ad3749 100644 --- a/include/modules.h +++ b/include/modules.h @@ -112,19 +112,21 @@ typedef struct { #define MOBJ_VALIDATOR 0x4000 typedef struct { - long mode; - char flag; - int (*allowed)(aClient *sptr, int what); - char unloaded; - Module *owner; + long mode; /**< Mode mask */ + char flag; /**< Mode character */ + int unset_on_deoper; /**< When set to 1 then this user mode will be unset on de-oper */ + int (*allowed)(aClient *sptr, int what); /**< The 'is this user allowed to set this mode?' routine */ + char unloaded; /**< Internal flag to indicate module is being unloaded */ + Module *owner; /**< Module that owns this user mode */ } Umode; typedef struct { - long mode; - char flag; - int (*allowed)(aClient *sptr, int what); - char unloaded; - Module *owner; + long mode; /**< Snomask mask */ + char flag; /**< Snomask character */ + int unset_on_deoper; /**< When set to 1 then this snomask will be unset on de-oper */ + int (*allowed)(aClient *sptr, int what); /**< The 'is this user allowed to set this snomask?' routine */ + char unloaded; /**< Internal flag to indicate module is being unloaded */ + Module *owner; /**< Module that owns this snomask */ } Snomask; typedef enum ModDataType { MODDATATYPE_CLIENT=1, MODDATATYPE_CHANNEL=2, MODDATATYPE_MEMBER=3, MODDATATYPE_MEMBERSHIP=4 } ModDataType; @@ -749,6 +751,7 @@ extern char *moddata_client_get(aClient *acptr, char *varname); #define HOOKTYPE_MODE_DEOP 84 #define HOOKTYPE_PRE_KILL 85 #define HOOKTYPE_SEE_CHANNEL_IN_WHOIS 86 +#define HOOKTYPE_DCC_DENIED 87 /* Hook return values */ #define HOOK_CONTINUE 0 diff --git a/include/setup.h.in b/include/setup.h.in index 611c1b1d8..655fc8d04 100644 --- a/include/setup.h.in +++ b/include/setup.h.in @@ -310,6 +310,9 @@ /* Define if you have the header file. */ #undef PARAMH +/* Define the location of permanent data files */ +#undef PERMDATADIR + /* Define the path of the pid file */ #undef PIDFILE diff --git a/include/struct.h b/include/struct.h index df4ed01b2..c8c18ac17 100644 --- a/include/struct.h +++ b/include/struct.h @@ -354,17 +354,11 @@ typedef OperPermission (*OperClassEntryEvalCallback)(OperClassACLEntryVar* varia /* * flags macros. */ -#define IsVictim(x) ((x)->umodes & UMODE_VICTIM) #define IsDeaf(x) ((x)->umodes & UMODE_DEAF) #define IsKillsF(x) ((x)->user->snomask & SNO_KILLS) #define IsClientF(x) ((x)->user->snomask & SNO_CLIENT) #define IsFloodF(x) ((x)->user->snomask & SNO_FLOOD) #define IsEyes(x) ((x)->user->snomask & SNO_EYES) -#define IsAdmin(x) ((x)->umodes & UMODE_ADMIN) - -#define IsNetAdmin(x) ((x)->umodes & UMODE_NETADMIN) -#define IsCoAdmin(x) ((x)->umodes & UMODE_COADMIN) -#define IsSAdmin(x) ((x)->umodes & UMODE_SADMIN) #define SendFailops(x) ((x)->umodes & UMODE_FAILOP) #define IsOper(x) ((x)->umodes & UMODE_OPER) #define IsLocOp(x) ((x)->umodes & UMODE_LOCOP) @@ -374,7 +368,6 @@ typedef OperPermission (*OperClassEntryEvalCallback)(OperClassACLEntryVar* varia #define IsRegNick(x) ((x)->umodes & UMODE_REGNICK) #define IsLoggedIn(x) (IsRegNick(x) || (x->user && (*x->user->svid != '*') && !isdigit(*x->user->svid))) /* registered nick (+r) or just logged into services (may be -r) */ #define IsPerson(x) ((x)->user && IsClient(x)) -#define IsPrivileged(x) (IsAnOper(x) || IsServer(x)) #define SendWallops(x) (!IsMe(x) && IsPerson(x) && ((x)->umodes & UMODE_WALLOP)) #define SendServNotice(x) (((x)->user) && ((x)->user->snomask & SNO_SNOTICE)) #define IsListening(x) ((x)->flags & FLAGS_LISTEN) @@ -416,11 +409,6 @@ typedef OperPermission (*OperClassEntryEvalCallback)(OperClassACLEntryVar* varia #define SetClientF(x) ((x)->user->snomask |= SNO_CLIENT) #define SetFloodF(x) ((x)->user->snomask |= SNO_FLOOD) #define SetOper(x) ((x)->umodes |= UMODE_OPER) -#define SetLocOp(x) ((x)->umodes |= UMODE_LOCOP) -#define SetAdmin(x) ((x)->umodes |= UMODE_ADMIN) -#define SetSAdmin(x) ((x)->umodes |= UMODE_SADMIN) -#define SetNetAdmin(x) ((x)->umodes |= UMODE_NETADMIN) -#define SetCoAdmin(x) ((x)->umodes |= UMODE_COADMIN) #define SetInvisible(x) ((x)->umodes |= UMODE_INVISIBLE) #define SetEyes(x) ((x)->user->snomask |= SNO_EYES) #define SetWallops(x) ((x)->umodes |= UMODE_WALLOP) @@ -436,10 +424,6 @@ typedef OperPermission (*OperClassEntryEvalCallback)(OperClassACLEntryVar* varia #define SetHidden(x) ((x)->umodes |= UMODE_HIDE) #define SetHideOper(x) ((x)->umodes |= UMODE_HIDEOPER) #define IsSecureConnect(x) ((x)->umodes & UMODE_SECURE) -#define ClearAdmin(x) ((x)->umodes &= ~UMODE_ADMIN) -#define ClearNetAdmin(x) ((x)->umodes &= ~UMODE_NETADMIN) -#define ClearCoAdmin(x) ((x)->umodes &= ~UMODE_COADMIN) -#define ClearSAdmin(x) ((x)->umodes &= ~UMODE_SADMIN) #define ClearKillsF(x) ((x)->user->snomask &= ~SNO_KILLS) #define ClearClientF(x) ((x)->user->snomask &= ~SNO_CLIENT) #define ClearFloodF(x) ((x)->user->snomask &= ~SNO_FLOOD) @@ -504,114 +488,6 @@ typedef OperPermission (*OperClassEntryEvalCallback)(OperClassACLEntryVar* varia #define ClearTKLEXT(x) ((x)->proto &= ~PROTO_TKLEXT) #define ClearTKLEXT2(x) ((x)->proto &= ~PROTO_TKLEXT2) -/* - * defined operator access levels - */ -#define OFLAG_REHASH 0x00000001 /* Oper can /rehash server */ -#define OFLAG_DIE 0x00000002 /* Oper can /die the server */ -#define OFLAG_RESTART 0x00000004 /* Oper can /restart the server */ -#define OFLAG_DCCDENY 0x00000008 /* Oper can use /dccdeny and /undccdeny */ -#define OFLAG_GLOBOP 0x00000020 /* Oper can send /GlobOps */ -#define OFLAG_WALLOP 0x00000040 /* Oper can send /WallOps */ -#define OFLAG_LOCOP 0x00000080 /* Oper can send /LocOps */ -#define OFLAG_LROUTE 0x00000100 /* Oper can do local routing */ -#define OFLAG_GROUTE 0x00000200 /* Oper can do global routing */ -#define OFLAG_LKILL 0x00000400 /* Oper can do local kills */ -#define OFLAG_GKILL 0x00000800 /* Oper can do global kills */ -#define OFLAG_KLINE 0x00001000 /* Oper can /kline users */ -#define OFLAG_UNKLINE 0x00002000 /* Oper can /unkline users */ -#define OFLAG_LNOTICE 0x00004000 /* Oper can send local serv notices */ -#define OFLAG_GNOTICE 0x00008000 /* Oper can send global notices */ -#define OFLAG_ADMIN 0x00010000 /* Admin */ -#define OFLAG_ADDLINE 0x00020000 /* Oper can use /addline */ -#define OFLAG_TSCTL 0x00040000 /* Oper can use /tsctl */ -#define OFLAG_ZLINE 0x00080000 /* Oper can use /zline and /unzline */ -#define OFLAG_NETADMIN 0x00200000 /* netadmin gets +N */ -#define OFLAG_COADMIN 0x00800000 /* co admin gets +C */ -#define OFLAG_SADMIN 0x01000000 /* services admin gets +a */ -#define OFLAG_HIDE 0x04000000 /* gets auto +x on oper up */ -#define OFLAG_TKL 0x10000000 /* can use G:lines and shuns */ -#define OFLAG_GZL 0x20000000 /* can use global Z:lines */ -#define OFLAG_OVERRIDE 0x40000000 /* can use oper-override */ -#define OFLAG_LOCAL (OFLAG_REHASH|OFLAG_GLOBOP|OFLAG_WALLOP|OFLAG_LOCOP|OFLAG_LROUTE|OFLAG_LKILL|OFLAG_KLINE|OFLAG_UNKLINE|OFLAG_LNOTICE) -#define OFLAG_GLOBAL (OFLAG_LOCAL|OFLAG_GROUTE|OFLAG_GKILL|OFLAG_GNOTICE) -#define OFLAG_ISGLOBAL (OFLAG_GROUTE|OFLAG_GKILL|OFLAG_GNOTICE|OFLAG_TKL|OFLAG_GZL|OFLAG_OVERRIDE) -#define OFLAG_NADMIN (OFLAG_NETADMIN | OFLAG_SADMIN | OFLAG_ADMIN | OFLAG_GLOBAL | OFLAG_DCCDENY) -#define OFLAG_ADMIN_ (OFLAG_ADMIN | OFLAG_GLOBAL | OFLAG_DCCDENY) -#define OFLAG_COADMIN_ (OFLAG_COADMIN | OFLAG_GLOBAL | OFLAG_DCCDENY) -#define OFLAG_SADMIN_ (OFLAG_SADMIN | OFLAG_GLOBAL | OFLAG_DCCDENY) - -#define OPCanOverride(x) ((x)->oflag & OFLAG_OVERRIDE) -#define OPCanDCCDeny(x) ((x)->oflag & OFLAG_DCCDENY) -#define OPCanTKL(x) ((x)->oflag & OFLAG_TKL) -#define OPCanGZL(x) ((x)->oflag & OFLAG_GZL) -#define OPCanAddline(x) ((x)->oflag & OFLAG_ADDLINE) -#define OPCanZline(x) ((x)->oflag & OFLAG_ZLINE) -#define OPCanRehash(x) ((x)->oflag & OFLAG_REHASH) -#define OPCanDie(x) ((x)->oflag & OFLAG_DIE) -#define OPCanTSCtl(x) ((x)->oflag & OFLAG_TSCTL) -#define OPCanRestart(x) ((x)->oflag & OFLAG_RESTART) -#define OPCanGlobOps(x) ((x)->oflag & OFLAG_GLOBOP) -#define OPCanWallOps(x) ((x)->oflag & OFLAG_WALLOP) -#define OPCanLocOps(x) ((x)->oflag & OFLAG_LOCOP) -#define OPCanLRoute(x) ((x)->oflag & OFLAG_LROUTE) -#define OPCanGRoute(x) ((x)->oflag & OFLAG_GROUTE) -#define OPCanLKill(x) ((x)->oflag & OFLAG_LKILL) -#define OPCanGKill(x) ((x)->oflag & OFLAG_GKILL) -#define OPCanKline(x) ((x)->oflag & OFLAG_KLINE) -#define OPCanUnKline(x) ((x)->oflag & OFLAG_UNKLINE) -#define OPCanLNotice(x) ((x)->oflag & OFLAG_LNOTICE) -#define OPCanGNotice(x) ((x)->oflag & OFLAG_GNOTICE) -#define OPIsAdmin(x) ((x)->oflag & OFLAG_ADMIN) -#define OPIsSAdmin(x) ((x)->oflag & OFLAG_SADMIN) -#define OPIsNetAdmin(x) ((x)->oflag & OFLAG_NETADMIN) -#define OPIsCoAdmin(x) ((x)->oflag & OFLAG_COADMIN) -#ifdef SHOW_SECRET -#define OPCanSeeSecret(x) IsAnOper(x) -#else -#define OPCanSeeSecret(x) IsNetAdmin(x) -#endif - -#define OPSetRehash(x) ((x)->oflag |= OFLAG_REHASH) -#define OPSetDie(x) ((x)->oflag |= OFLAG_DIE) -#define OPSetTSCtl(x) ((x)->oflag |= OFLAG_TSCTL) -#define OPSetRestart(x) ((x)->oflag |= OFLAG_RESTART) -#define OPSetGlobOps(x) ((x)->oflag |= OFLAG_GLOBOP) -#define OPSetWallOps(x) ((x)->oflag |= OFLAG_WALLOP) -#define OPSetLocOps(x) ((x)->oflag |= OFLAG_LOCOP) -#define OPSetLRoute(x) ((x)->oflag |= OFLAG_LROUTE) -#define OPSetGRoute(x) ((x)->oflag |= OFLAG_GROUTE) -#define OPSetLKill(x) ((x)->oflag |= OFLAG_LKILL) -#define OPSetGKill(x) ((x)->oflag |= OFLAG_GKILL) -#define OPSetKline(x) ((x)->oflag |= OFLAG_KLINE) -#define OPSetUnKline(x) ((x)->oflag |= OFLAG_UNKLINE) -#define OPSetLNotice(x) ((x)->oflag |= OFLAG_LNOTICE) -#define OPSetGNotice(x) ((x)->oflag |= OFLAG_GNOTICE) -#define OPSSetAdmin(x) ((x)->oflag |= OFLAG_ADMIN) -#define OPSSetSAdmin(x) ((x)->oflag |= OFLAG_SADMIN) -#define OPSSetNetAdmin(x) ((x)->oflag |= OFLAG_NETADMIN) -#define OPSSetCoAdmin(x) ((x)->oflag |= OFLAG_COADMIN) -#define OPSetZLine(x) ((x)->oflag |= OFLAG_ZLINE) -#define OPClearRehash(x) ((x)->oflag &= ~OFLAG_REHASH) -#define OPClearDie(x) ((x)->oflag &= ~OFLAG_DIE) -#define OPClearTSCtl(x) ((x)->oflag &= ~OFLAG_TSCTL) -#define OPClearRestart(x) ((x)->oflag &= ~OFLAG_RESTART) -#define OPClearGlobOps(x) ((x)->oflag &= ~OFLAG_GLOBOP) -#define OPClearWallOps(x) ((x)->oflag &= ~OFLAG_WALLOP) -#define OPClearLocOps(x) ((x)->oflag &= ~OFLAG_LOCOP) -#define OPClearLRoute(x) ((x)->oflag &= ~OFLAG_LROUTE) -#define OPClearGRoute(x) ((x)->oflag &= ~OFLAG_GROUTE) -#define OPClearLKill(x) ((x)->oflag &= ~OFLAG_LKILL) -#define OPClearGKill(x) ((x)->oflag &= ~OFLAG_GKILL) -#define OPClearKline(x) ((x)->oflag &= ~OFLAG_KLINE) -#define OPClearUnKline(x) ((x)->oflag &= ~OFLAG_UNKLINE) -#define OPClearLNotice(x) ((x)->oflag &= ~OFLAG_LNOTICE) -#define OPClearGNotice(x) ((x)->oflag &= ~OFLAG_GNOTICE) -#define OPClearAdmin(x) ((x)->oflag &= ~OFLAG_ADMIN) -#define OPClearSAdmin(x) ((x)->oflag &= ~OFLAG_SADMIN) -#define OPClearNetAdmin(x) ((x)->oflag &= ~OFLAG_NETADMIN) -#define OPClearCoAdmin(x) ((x)->oflag &= ~OFLAG_COADMIN) -#define OPClearZLine(x) ((x)->oflag &= ~OFLAG_ZLINE) /* * defined debugging levels */ @@ -626,9 +502,6 @@ typedef OperPermission (*OperClassEntryEvalCallback)(OperClassACLEntryVar* varia #define DEBUG_MALLOC 9 /* malloc/free calls */ #define DEBUG_LIST 10 /* debug list use */ -/* blah */ -#define IsSkoAdmin(sptr) (IsAdmin(sptr) || IsNetAdmin(sptr) || IsSAdmin(sptr)) - /* * defines for curses in client */ @@ -917,10 +790,10 @@ extern MODVAR short Snomask_highest; extern MODVAR Cmode *Channelmode_Table; extern MODVAR unsigned short Channelmode_highest; -extern Umode *UmodeAdd(Module *module, char ch, int options, int (*allowed)(aClient *sptr, int what), long *mode); +extern Umode *UmodeAdd(Module *module, char ch, int options, int unset_on_deoper, int (*allowed)(aClient *sptr, int what), long *mode); extern void UmodeDel(Umode *umode); -extern Snomask *SnomaskAdd(Module *module, char ch, int (*allowed)(aClient *sptr, int what), long *mode); +extern Snomask *SnomaskAdd(Module *module, char ch, int unset_on_deoper, int (*allowed)(aClient *sptr, int what), long *mode); extern void SnomaskDel(Snomask *sno); extern Cmode *CmodeAdd(Module *reserved, CmodeInfo req, Cmode_t *mode); @@ -985,7 +858,6 @@ struct Client { struct list_head special_node; /* for special lists (server || unknown || oper) */ #if 1 - int oflag; /* oper access flags (removed from anUser for mem considerations) */ TS since; /* time they will next be allowed to send something */ TS firsttime; /* Time it was created */ TS lasttime; /* last time any message was received */ @@ -1227,16 +1099,16 @@ struct _configitem_operclass { }; struct _configitem_oper { - ConfigItem *prev, *next; - ConfigFlag flag; - char *name, *swhois, *snomask; - anAuthStruct *auth; + ConfigItem *prev, *next; + ConfigFlag flag; + char *name, *swhois, *snomask; + anAuthStruct *auth; char *operclass; ConfigItem_class *class; ConfigItem_mask *mask; - unsigned long modes, require_modes; - long oflags; - int maxlogins; + unsigned long modes, require_modes; + char *vhost; + int maxlogins; }; struct _configitem_mask { @@ -1723,7 +1595,6 @@ struct liststruct { */ #define MyConnect(x) ((x)->fd != -256) #define MyClient(x) (MyConnect(x) && IsClient(x)) -#define MyOper(x) (MyConnect(x) && IsAnOper(x)) #ifdef CLEAN_COMPILE #define TStime() (time(NULL) + TSoffset) diff --git a/include/win32/setup.h b/include/win32/setup.h index 87ebec859..df13768cc 100644 --- a/include/win32/setup.h +++ b/include/win32/setup.h @@ -47,9 +47,10 @@ #define CONFDIR "conf" #define MODULESDIR "modules" #define LOGDIR "logs" -#define DATADIR "data" +#define PERMDATADIR "data" #define CACHEDIR "cache" #define TMPDIR "tmp" +#define PIDFILE PERMDATADIR"/unrealircd.pid" #define NO_U_TYPES #define NEED_U_INT32_T #define PREFIX_AQ @@ -82,6 +83,6 @@ /* Version suffix such as a beta marker or release candidate marker. (e.g.: -rc2 for unrealircd-3.2.9-rc2) */ -#define UNREAL_VERSION_SUFFIX "-alpha3" +#define UNREAL_VERSION_SUFFIX "-alpha4" #endif diff --git a/makefile.win32 b/makefile.win32 index 38b451368..b3a3195de 100644 --- a/makefile.win32 +++ b/makefile.win32 @@ -167,10 +167,10 @@ DLL_FILES=SRC/MODULES/M_CHGHOST.DLL SRC/MODULES/M_SDESC.DLL SRC/MODULES/M_SETIDE SRC/MODULES/M_SETNAME.DLL SRC/MODULES/M_SETHOST.DLL SRC/MODULES/M_CHGIDENT.DLL \ SRC/MODULES/M_SVSMOTD.DLL SRC/MODULES/M_SVSNLINE.DLL SRC/MODULES/M_WHO.DLL \ SRC/MODULES/M_SWHOIS.DLL SRC/MODULES/M_SVSMODE.DLL SRC/MODULES/M_AWAY.DLL \ - SRC/MODULES/M_SVSNOOP.DLL SRC/MODULES/M_MKPASSWD.DLL SRC/MODULES/M_SVSO.DLL \ - SRC/MODULES/M_SVSNICK.DLL SRC/MODULES/M_ADMINCHAT.DLL \ + SRC/MODULES/M_SVSNOOP.DLL SRC/MODULES/M_MKPASSWD.DLL \ + SRC/MODULES/M_SVSNICK.DLL \ SRC/MODULES/M_CHGNAME.DLL SRC/MODULES/M_GUEST.DLL \ - SRC/MODULES/M_LAG.DLL SRC/MODULES/M_MESSAGE.DLL SRC/MODULES/M_NACHAT.DLL \ + SRC/MODULES/M_LAG.DLL SRC/MODULES/M_MESSAGE.DLL \ SRC/MODULES/M_OPER.DLL SRC/MODULES/M_PINGPONG.DLL SRC/MODULES/M_QUIT.DLL \ SRC/MODULES/M_RPING.DLL SRC/MODULES/M_SENDUMODE.DLL \ SRC/MODULES/M_SQLINE.DLL SRC/MODULES/M_KILL.DLL SRC/MODULES/M_TSCTL.DLL \ @@ -204,7 +204,7 @@ DLL_FILES=SRC/MODULES/M_CHGHOST.DLL SRC/MODULES/M_SDESC.DLL SRC/MODULES/M_SETIDE SRC/MODULES/M_MD.DLL \ SRC/MODULES/CERTFP.DLL \ SRC/MODULES/CLOAK.DLL \ - SRC/MODULES/CHANMODES/ADMINONLY.DLL \ + SRC/MODULES/WEBIRC.DLL \ SRC/MODULES/CHANMODES/CENSOR.DLL \ SRC/MODULES/CHANMODES/DELAYJOIN.DLL \ SRC/MODULES/CHANMODES/FLOODPROT.DLL \ @@ -226,13 +226,21 @@ DLL_FILES=SRC/MODULES/M_CHGHOST.DLL SRC/MODULES/M_SDESC.DLL SRC/MODULES/M_SETIDE SRC/MODULES/CHANMODES/STRIPCOLOR.DLL \ SRC/MODULES/USERMODES/CENSOR.DLL \ SRC/MODULES/USERMODES/NOCTCP.DLL \ + SRC/MODULES/USERMODES/BOT.DLL \ + SRC/MODULES/USERMODES/SERVICEBOT.DLL \ + SRC/MODULES/USERMODES/SHOWWHOIS.DLL \ + SRC/MODULES/USERMODES/PRIVACY.DLL \ + SRC/MODULES/USERMODES/NOKICK.DLL \ + SRC/MODULES/USERMODES/REGONLYMSG.DLL \ + SRC/MODULES/SNOMASKS/DCCREJECT.DLL \ SRC/MODULES/EXTBANS/ACCOUNT.DLL \ SRC/MODULES/EXTBANS/INCHANNEL.DLL \ SRC/MODULES/EXTBANS/JOIN.DLL \ SRC/MODULES/EXTBANS/NICKCHANGE.DLL \ SRC/MODULES/EXTBANS/QUIET.DLL \ SRC/MODULES/EXTBANS/REALNAME.DLL \ - SRC/MODULES/EXTBANS/REGNICK.DLL + SRC/MODULES/EXTBANS/REGNICK.DLL \ + SRC/MODULES/EXTBANS/OPERCLASS.DLL ALL: CONF UNREAL.EXE WIRCD.EXE MODULES @@ -245,6 +253,7 @@ CLEAN: -@erase src\modules\*.dll >NUL -@erase src\modules\chanmodes\*.dll >NUL -@erase src\modules\usermodes\*.dll >NUL + -@erase src\modules\snomasks\*.dll >NUL -@erase src\modules\extbans\*.dll >NUL -@erase .\*.exe >NUL -@erase wircd.lib >NUL @@ -537,15 +546,9 @@ src/modules/m_mkpasswd.dll: src/modules/m_mkpasswd.c $(INCLUDES) src/modules/m_svsnoop.dll: src/modules/m_svsnoop.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/m_svsnoop.c $(MODLFLAGS) -src/modules/m_svso.dll: src/modules/m_svso.c $(INCLUDES) - $(CC) $(MODCFLAGS) src/modules/m_svso.c $(MODLFLAGS) - src/modules/m_svsnick.dll: src/modules/m_svsnick.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/m_svsnick.c $(MODLFLAGS) -src/modules/m_adminchat.dll: src/modules/m_adminchat.c $(INCLUDES) - $(CC) $(MODCFLAGS) src/modules/m_adminchat.c $(MODLFLAGS) - src/modules/m_chgname.dll: src/modules/m_chgname.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/m_chgname.c $(MODLFLAGS) @@ -561,9 +564,6 @@ src/modules/m_lag.dll: src/modules/m_lag.c $(INCLUDES) src/modules/m_message.dll: src/modules/m_message.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/m_message.c $(MODLFLAGS) -src/modules/m_nachat.dll: src/modules/m_nachat.c $(INCLUDES) - $(CC) $(MODCFLAGS) src/modules/m_nachat.c $(MODLFLAGS) - src/modules/m_oper.dll: src/modules/m_oper.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/m_oper.c $(MODLFLAGS) @@ -795,6 +795,9 @@ src/modules/certfp.dll: src/modules/certfp.c $(INCLUDES) src/modules/cloak.dll: src/modules/cloak.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/cloak.c $(MODLFLAGS) +src/modules/webirc.dll: src/modules/webirc.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/webirc.c $(MODLFLAGS) + src/modules/m_svsnolag.dll: src/modules/m_svsnolag.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/m_svsnolag.c $(MODLFLAGS) @@ -816,9 +819,6 @@ src/modules/cap_invitenotify.dll: src/modules/cap_invitenotify.c $(INCLUDES) src/modules/ssl_antidos.dll: src/modules/ssl_antidos.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/ssl_antidos.c $(MODLFLAGS) -src/modules/chanmodes/adminonly.dll: src/modules/chanmodes/adminonly.c $(INCLUDES) - $(CC) $(MODCFLAGS) /Fosrc/modules/chanmodes/ /Fesrc/modules/chanmodes/ src/modules/chanmodes/adminonly.c $(MODLFLAGS) - src/modules/chanmodes/censor.dll: src/modules/chanmodes/censor.c $(INCLUDES) $(CC) $(MODCFLAGS) /Fosrc/modules/chanmodes/ /Fesrc/modules/chanmodes/ src/modules/chanmodes/censor.c $(MODLFLAGS) @@ -882,6 +882,27 @@ src/modules/usermodes/censor.dll: src/modules/usermodes/censor.c $(INCLUDES) src/modules/usermodes/noctcp.dll: src/modules/usermodes/noctcp.c $(INCLUDES) $(CC) $(MODCFLAGS) /Fosrc/modules/usermodes/ /Fesrc/modules/usermodes/ src/modules/usermodes/noctcp.c $(MODLFLAGS) +src/modules/usermodes/bot.dll: src/modules/usermodes/bot.c $(INCLUDES) + $(CC) $(MODCFLAGS) /Fosrc/modules/usermodes/ /Fesrc/modules/usermodes/ src/modules/usermodes/bot.c $(MODLFLAGS) + +src/modules/usermodes/servicebot.dll: src/modules/usermodes/servicebot.c $(INCLUDES) + $(CC) $(MODCFLAGS) /Fosrc/modules/usermodes/ /Fesrc/modules/usermodes/ src/modules/usermodes/servicebot.c $(MODLFLAGS) + +src/modules/usermodes/showwhois.dll: src/modules/usermodes/showwhois.c $(INCLUDES) + $(CC) $(MODCFLAGS) /Fosrc/modules/usermodes/ /Fesrc/modules/usermodes/ src/modules/usermodes/showwhois.c $(MODLFLAGS) + +src/modules/usermodes/privacy.dll: src/modules/usermodes/privacy.c $(INCLUDES) + $(CC) $(MODCFLAGS) /Fosrc/modules/usermodes/ /Fesrc/modules/usermodes/ src/modules/usermodes/privacy.c $(MODLFLAGS) + +src/modules/usermodes/nokick.dll: src/modules/usermodes/nokick.c $(INCLUDES) + $(CC) $(MODCFLAGS) /Fosrc/modules/usermodes/ /Fesrc/modules/usermodes/ src/modules/usermodes/nokick.c $(MODLFLAGS) + +src/modules/usermodes/regonlymsg.dll: src/modules/usermodes/regonlymsg.c $(INCLUDES) + $(CC) $(MODCFLAGS) /Fosrc/modules/usermodes/ /Fesrc/modules/usermodes/ src/modules/usermodes/regonlymsg.c $(MODLFLAGS) + +src/modules/snomasks/dccreject.dll: src/modules/snomasks/dccreject.c $(INCLUDES) + $(CC) $(MODCFLAGS) /Fosrc/modules/snomasks/ /Fesrc/modules/snomasks/ src/modules/snomasks/dccreject.c $(MODLFLAGS) + src/modules/extbans/account.dll: src/modules/extbans/account.c $(INCLUDES) $(CC) $(MODCFLAGS) /Fosrc/modules/extbans/ /Fesrc/modules/extbans/ src/modules/extbans/account.c $(MODLFLAGS) @@ -903,4 +924,7 @@ src/modules/extbans/realname.dll: src/modules/extbans/realname.c $(INCLUDES) src/modules/extbans/regnick.dll: src/modules/extbans/regnick.c $(INCLUDES) $(CC) $(MODCFLAGS) /Fosrc/modules/extbans/ /Fesrc/modules/extbans/ src/modules/extbans/regnick.c $(MODLFLAGS) +src/modules/extbans/operclass.dll: src/modules/extbans/operclass.c $(INCLUDES) + $(CC) $(MODCFLAGS) /Fosrc/modules/extbans/ /Fesrc/modules/extbans/ src/modules/extbans/operclass.c $(MODLFLAGS) + dummy: diff --git a/src/channel.c b/src/channel.c index 70ab4240f..2d38134e3 100644 --- a/src/channel.c +++ b/src/channel.c @@ -73,7 +73,7 @@ MODVAR char modebuf[BUFSIZE], parabuf[BUFSIZE]; #define MODESYS_LINKOK /* We do this for a TEST */ aCtab cFlagTab[] = { - {MODE_LIMIT, 'l', 0, 1}, + {MODE_LIMIT, 'l', 1, 1}, {MODE_VOICE, 'v', 1, 1}, {MODE_HALFOP, 'h', 0, 1}, {MODE_CHANOP, 'o', 0, 1}, @@ -101,12 +101,10 @@ aCtab cFlagTab[] = { char cmodestring[512]; -inline int op_can_override(aClient *sptr) +inline int op_can_override(char* acl, aClient *sptr,aChannel *channel,void* extra) { #ifndef NO_OPEROVERRIDE - if (!IsOper(sptr)) - return 0; - if (MyClient(sptr) && !OPCanOverride(sptr)) + if (MyClient(sptr) && !(OperClass_evaluateACLPath(acl,sptr,NULL,channel,extra))) return 0; return 1; #else @@ -752,7 +750,7 @@ int can_send(aClient *cptr, aChannel *chptr, char *msgtext, int notice) return (CANNOT_SEND_NOPRIVMSGS); lp = find_membership_link(cptr->user->channel, chptr); - if (chptr->mode.mode & MODE_MODERATED && !op_can_override(cptr) && + if (chptr->mode.mode & MODE_MODERATED && !op_can_override("override:message:moderated",cptr,chptr,NULL) && (!lp || !(lp->flags & (CHFL_CHANOP | CHFL_VOICE | CHFL_CHANOWNER | CHFL_HALFOP | CHFL_CHANPROT)))) @@ -772,7 +770,7 @@ int can_send(aClient *cptr, aChannel *chptr, char *msgtext, int notice) return i; /* Makes opers able to talk thru bans -Stskeeps suggested by The_Cat */ - if (IsOper(cptr) && OPCanOverride(cptr)) + if (op_can_override("override:message:ban",cptr,chptr,NULL)) return 0; if ((!lp @@ -955,7 +953,7 @@ char *clean_ban_mask(char *mask, int what, aClient *cptr) /* Extended ban? */ if ((*mask == '~') && mask[1] && (mask[2] == ':')) { - if (RESTRICT_EXTENDEDBANS && MyClient(cptr) && !IsAnOper(cptr)) + if (RESTRICT_EXTENDEDBANS && MyClient(cptr) && !OperClass_evaluateACLPath("channel:extbans",cptr,NULL,NULL,NULL)) { if (!strcmp(RESTRICT_EXTENDEDBANS, "*")) { diff --git a/src/crule.c b/src/crule.c index 03d24c079..ef5c7b523 100644 --- a/src/crule.c +++ b/src/crule.c @@ -205,7 +205,7 @@ int crule_directop(int numargs, void *crulearg[]) /* adapted from m_trace */ list_for_each_entry(acptr, &lclient_list, lclient_node) { - if (!IsAnOper(acptr)) + if (!IsOper(acptr)) continue; return (1); diff --git a/src/crypt_blowfish.c b/src/crypt_blowfish.c index 9d3f3be82..7e7401b87 100644 --- a/src/crypt_blowfish.c +++ b/src/crypt_blowfish.c @@ -54,7 +54,7 @@ #include "crypt_blowfish.h" #ifdef __i386__ -#define BF_ASM 1 +#define BF_ASM 0 /* old x86 asm not included in UnrealIRCd */ #define BF_SCALE 1 #elif defined(__x86_64__) || defined(__alpha__) || defined(__hppa__) #define BF_ASM 0 diff --git a/src/extbans.c b/src/extbans.c index 90db1b5c1..504fd4c4f 100644 --- a/src/extbans.c +++ b/src/extbans.c @@ -166,7 +166,7 @@ int extban_is_ok_nuh_extban(aClient* sptr, aChannel* chptr, char* para, int chec return 0; /* Fail: more than one stacked extban */ /* We can be sure RESTRICT_EXTENDEDBANS is not *. Else this extended ban wouldn't be happening at all. */ - if (what == EXBCHK_PARAM && RESTRICT_EXTENDEDBANS && !IsAnOper(sptr)) + if (what == EXBCHK_PARAM && RESTRICT_EXTENDEDBANS && !OperClass_evaluateACLPath("channel:extbans",sptr,NULL,chptr,NULL)) { if (strchr(RESTRICT_EXTENDEDBANS, mask[1])) { diff --git a/src/extcmodes.c b/src/extcmodes.c index 34fc93c66..e23403a67 100644 --- a/src/extcmodes.c +++ b/src/extcmodes.c @@ -45,7 +45,7 @@ extern char cmodestring[512]; /* Channel parameter to slot# mapping */ -unsigned char param_to_slot_mapping[256]; +MODVAR unsigned char param_to_slot_mapping[256]; extern void make_cmodestr(void); diff --git a/src/ircd.c b/src/ircd.c index a07b3e36b..4d88f4e25 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -104,7 +104,7 @@ extern SERVICE_STATUS_HANDLE IRCDStatusHandle; extern SERVICE_STATUS IRCDStatus; #endif -unsigned char conf_debuglevel = 0; +MODVAR unsigned char conf_debuglevel = 0; #ifdef USE_LIBCURL extern void url_init(void); @@ -485,7 +485,7 @@ int check_tkls(aClient *cptr) if (bconf) killflag++; - else if (!IsAnOper(cptr) && (bconf = Find_ban(NULL, cptr->info, CONF_BAN_REALNAME))) + else if (!OperClass_evaluateACLPath("immune",cptr,NULL,NULL,NULL) && (bconf = Find_ban(NULL, cptr->info, CONF_BAN_REALNAME))) killflag++; } @@ -561,114 +561,116 @@ EVENT(check_unknowns) } } +/** Ping individual user, and check for ping timeout */ +int check_ping(aClient *cptr) +{ + char scratch[64]; + int ping = 0; + + ping = cptr->class ? cptr->class->pingfreq : CONNECTTIMEOUT; + Debug((DEBUG_DEBUG, "c(%s)=%d p %d a %d", cptr->name, + cptr->status, ping, + TStime() - cptr->lasttime)); + + /* If ping is less than or equal to the last time we received a command from them */ + if (ping > (TStime() - cptr->lasttime)) + return 0; /* some recent command was executed */ + + if ( + /* If we have sent a ping */ + ((cptr->flags & FLAGS_PINGSENT) + /* And they had 2x ping frequency to respond */ + && ((TStime() - cptr->lasttime) >= (2 * ping))) + || + /* Or isn't registered and time spent is larger than ping .. */ + (!IsRegistered(cptr) && (TStime() - cptr->since >= ping)) + ) + { + /* if it's registered and doing dns/auth, timeout */ + if (!IsRegistered(cptr) && (DoingDNS(cptr) || DoingAuth(cptr))) + { + if (cptr->authfd >= 0) { + fd_close(cptr->authfd); + --OpenFiles; + cptr->authfd = -1; + cptr->count = 0; + *cptr->buffer = '\0'; + } + if (SHOWCONNECTINFO && !cptr->serv) { + if (DoingDNS(cptr)) + sendto_one(cptr, "%s", REPORT_FAIL_DNS); + else if (DoingAuth(cptr)) + sendto_one(cptr, "%s", REPORT_FAIL_ID); + } + Debug((DEBUG_NOTICE, + "DNS/AUTH timeout %s", + get_client_name(cptr, TRUE))); + unrealdns_delreq_bycptr(cptr); + ClearAuth(cptr); + ClearDNS(cptr); + SetAccess(cptr); + cptr->firsttime = TStime(); + cptr->lasttime = TStime(); + return -5; + } + if (IsServer(cptr) || IsConnecting(cptr) || + IsHandshake(cptr) + || IsSSLConnectHandshake(cptr) + ) { + sendto_realops + ("No response from %s, closing link", + get_client_name(cptr, FALSE)); + sendto_server(&me, 0, 0, + ":%s GLOBOPS :No response from %s, closing link", + me.name, get_client_name(cptr, + FALSE)); + } + if (IsSSLAcceptHandshake(cptr)) + Debug((DEBUG_DEBUG, "ssl accept handshake timeout: %s (%li-%li > %li)", cptr->sockhost, + TStime(), cptr->since, ping)); + (void)ircsnprintf(scratch, sizeof(scratch), "Ping timeout: %ld seconds", + (long) (TStime() - cptr->lasttime)); + return exit_client(cptr, cptr, &me, scratch); + } + else if (IsRegistered(cptr) && + ((cptr->flags & FLAGS_PINGSENT) == 0)) { + /* + * if we havent PINGed the connection and we havent + * heard from it in a while, PING it to make sure + * it is still alive. + */ + cptr->flags |= FLAGS_PINGSENT; + /* + * not nice but does the job + */ + cptr->lasttime = TStime() - ping; + sendto_one(cptr, "PING :%s", me.name); + } + + return 0; +} + /* * Check registered connections for PING timeout. * XXX: also does some other stuff still, need to sort this. --nenolod + * Perhaps it would be wise to ping servers as well mr nenolod, just an idea -- Syzop */ EVENT(check_pings) { aClient *cptr, *cptr2; - ConfigItem_ban *bconf = NULL; - int i = 0; - char banbuf[1024]; - char scratch[64]; - int ping = 0; - TS currenttime = TStime(); - list_for_each_entry_safe(cptr, cptr2, &lclient_list, lclient_node) { - - // Check TKLs for this user + /* Check TKLs for this user (huh, always?) */ if (!check_tkls(cptr)) - { continue; - } + check_ping(cptr); + /* don't touch 'cptr' after this as it may have been killed */ + } - - ping = - IsRegistered(cptr) ? (cptr->class ? cptr-> - class->pingfreq : CONNECTTIMEOUT) : CONNECTTIMEOUT; - Debug((DEBUG_DEBUG, "c(%s)=%d p %d a %d", cptr->name, - cptr->status, ping, - currenttime - cptr->lasttime)); - - /* If ping is less than or equal to the last time we received a command from them */ - if (ping <= (currenttime - cptr->lasttime)) - { - if ( - /* If we have sent a ping */ - ((cptr->flags & FLAGS_PINGSENT) - /* And they had 2x ping frequency to respond */ - && ((currenttime - cptr->lasttime) >= (2 * ping))) - || - /* Or isn't registered and time spent is larger than ping .. */ - (!IsRegistered(cptr) && (currenttime - cptr->since >= ping)) - ) - { - /* if it's registered and doing dns/auth, timeout */ - if (!IsRegistered(cptr) && (DoingDNS(cptr) || DoingAuth(cptr))) - { - if (cptr->authfd >= 0) { - fd_close(cptr->authfd); - --OpenFiles; - cptr->authfd = -1; - cptr->count = 0; - *cptr->buffer = '\0'; - } - if (SHOWCONNECTINFO && !cptr->serv) { - if (DoingDNS(cptr)) - sendto_one(cptr, "%s", REPORT_FAIL_DNS); - else if (DoingAuth(cptr)) - sendto_one(cptr, "%s", REPORT_FAIL_ID); - } - Debug((DEBUG_NOTICE, - "DNS/AUTH timeout %s", - get_client_name(cptr, TRUE))); - unrealdns_delreq_bycptr(cptr); - ClearAuth(cptr); - ClearDNS(cptr); - SetAccess(cptr); - cptr->firsttime = currenttime; - cptr->lasttime = currenttime; - continue; - } - if (IsServer(cptr) || IsConnecting(cptr) || - IsHandshake(cptr) - || IsSSLConnectHandshake(cptr) - ) { - sendto_realops - ("No response from %s, closing link", - get_client_name(cptr, FALSE)); - sendto_server(&me, 0, 0, - ":%s GLOBOPS :No response from %s, closing link", - me.name, get_client_name(cptr, - FALSE)); - } - if (IsSSLAcceptHandshake(cptr)) - Debug((DEBUG_DEBUG, "ssl accept handshake timeout: %s (%li-%li > %li)", cptr->sockhost, - currenttime, cptr->since, ping)); - (void)ircsnprintf(scratch, sizeof(scratch), "Ping timeout: %ld seconds", - (long) (TStime() - cptr->lasttime)); - exit_client(cptr, cptr, &me, scratch); - continue; - - } - else if (IsRegistered(cptr) && - ((cptr->flags & FLAGS_PINGSENT) == 0)) { - /* - * if we havent PINGed the connection and we havent - * heard from it in a while, PING it to make sure - * it is still alive. - */ - cptr->flags |= FLAGS_PINGSENT; - /* - * not nice but does the job - */ - cptr->lasttime = TStime() - ping; - sendto_one(cptr, "PING :%s", me.name); - } - } + list_for_each_entry_safe(cptr, cptr2, &server_list, special_node) + { + check_ping(cptr); } } @@ -1349,7 +1351,7 @@ int InitwIRCD(int argc, char *argv[]) do_version_check(); -#ifndef CHROOTDIR +#if !defined(CHROOTDIR) && !defined(_WIN32) if (chdir(CONFDIR)) { # ifndef _WIN32 perror("chdir"); @@ -1644,21 +1646,7 @@ void SocketLoop(void *dummy) if (IRCstats.me_clients > IRCstats.me_max) IRCstats.me_max = IRCstats.me_clients; - /* - * ** Adjust delay to something reasonable [ad hoc values] - * ** (one might think something more clever here... --msa) - * ** We don't really need to check that often and as long - * ** as we don't delay too long, everything should be ok. - * ** waiting too long can cause things to timeout... - * ** i.e. PINGS -> a disconnection :( - * ** - avalon - */ - if (delay < 1) - delay = 1; - else - delay = MIN(delay, TIMESEC); - - fd_select(delay * 1000); + fd_select(SOCKETLOOP_MAX_DELAY); process_clients(); diff --git a/src/macosx/UnrealIRCd.xcodeproj/project.pbxproj b/src/macosx/UnrealIRCd.xcodeproj/project.pbxproj new file mode 100644 index 000000000..3cdc9f7bb --- /dev/null +++ b/src/macosx/UnrealIRCd.xcodeproj/project.pbxproj @@ -0,0 +1,421 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1FC660CF1B3EA90B008EFAD1 /* bat23.png in Resources */ = {isa = PBXBuildFile; fileRef = 1FC660CE1B3EA90B008EFAD1 /* bat23.png */; }; + 1FE784F51B3DF0DD006CB6DD /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FE784F41B3DF0DD006CB6DD /* AppDelegate.swift */; }; + 1FE784F71B3DF0DD006CB6DD /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FE784F61B3DF0DD006CB6DD /* ViewController.swift */; }; + 1FE784F91B3DF0DD006CB6DD /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1FE784F81B3DF0DD006CB6DD /* Images.xcassets */; }; + 1FE784FC1B3DF0DD006CB6DD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1FE784FA1B3DF0DD006CB6DD /* Main.storyboard */; }; + 1FE785081B3DF0DD006CB6DD /* UnrealIRCdTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FE785071B3DF0DD006CB6DD /* UnrealIRCdTests.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 1FE785021B3DF0DD006CB6DD /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 1FE784E71B3DF0DD006CB6DD /* Project object */; + proxyType = 1; + remoteGlobalIDString = 1FE784EE1B3DF0DD006CB6DD; + remoteInfo = UnrealIRCd; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 1FC660CE1B3EA90B008EFAD1 /* bat23.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = bat23.png; sourceTree = ""; }; + 1FE784EF1B3DF0DD006CB6DD /* UnrealIRCd.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UnrealIRCd.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 1FE784F31B3DF0DD006CB6DD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 1FE784F41B3DF0DD006CB6DD /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 1FE784F61B3DF0DD006CB6DD /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 1FE784F81B3DF0DD006CB6DD /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + 1FE784FB1B3DF0DD006CB6DD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 1FE785011B3DF0DD006CB6DD /* UnrealIRCdTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UnrealIRCdTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 1FE785061B3DF0DD006CB6DD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 1FE785071B3DF0DD006CB6DD /* UnrealIRCdTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnrealIRCdTests.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1FE784EC1B3DF0DD006CB6DD /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1FE784FE1B3DF0DD006CB6DD /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1FE784E61B3DF0DD006CB6DD = { + isa = PBXGroup; + children = ( + 1FE784F11B3DF0DD006CB6DD /* UnrealIRCd */, + 1FE785041B3DF0DD006CB6DD /* UnrealIRCdTests */, + 1FE784F01B3DF0DD006CB6DD /* Products */, + ); + sourceTree = ""; + }; + 1FE784F01B3DF0DD006CB6DD /* Products */ = { + isa = PBXGroup; + children = ( + 1FE784EF1B3DF0DD006CB6DD /* UnrealIRCd.app */, + 1FE785011B3DF0DD006CB6DD /* UnrealIRCdTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 1FE784F11B3DF0DD006CB6DD /* UnrealIRCd */ = { + isa = PBXGroup; + children = ( + 1FE784F41B3DF0DD006CB6DD /* AppDelegate.swift */, + 1FE784F61B3DF0DD006CB6DD /* ViewController.swift */, + 1FE784F81B3DF0DD006CB6DD /* Images.xcassets */, + 1FE784FA1B3DF0DD006CB6DD /* Main.storyboard */, + 1FE784F21B3DF0DD006CB6DD /* Supporting Files */, + ); + path = UnrealIRCd; + sourceTree = ""; + }; + 1FE784F21B3DF0DD006CB6DD /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 1FC660CE1B3EA90B008EFAD1 /* bat23.png */, + 1FE784F31B3DF0DD006CB6DD /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 1FE785041B3DF0DD006CB6DD /* UnrealIRCdTests */ = { + isa = PBXGroup; + children = ( + 1FE785071B3DF0DD006CB6DD /* UnrealIRCdTests.swift */, + 1FE785051B3DF0DD006CB6DD /* Supporting Files */, + ); + path = UnrealIRCdTests; + sourceTree = ""; + }; + 1FE785051B3DF0DD006CB6DD /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 1FE785061B3DF0DD006CB6DD /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 1FE784EE1B3DF0DD006CB6DD /* UnrealIRCd */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1FE7850B1B3DF0DD006CB6DD /* Build configuration list for PBXNativeTarget "UnrealIRCd" */; + buildPhases = ( + 1FE784EB1B3DF0DD006CB6DD /* Sources */, + 1FE784EC1B3DF0DD006CB6DD /* Frameworks */, + 1FE784ED1B3DF0DD006CB6DD /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = UnrealIRCd; + productName = UnrealIRCd; + productReference = 1FE784EF1B3DF0DD006CB6DD /* UnrealIRCd.app */; + productType = "com.apple.product-type.application"; + }; + 1FE785001B3DF0DD006CB6DD /* UnrealIRCdTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1FE7850E1B3DF0DD006CB6DD /* Build configuration list for PBXNativeTarget "UnrealIRCdTests" */; + buildPhases = ( + 1FE784FD1B3DF0DD006CB6DD /* Sources */, + 1FE784FE1B3DF0DD006CB6DD /* Frameworks */, + 1FE784FF1B3DF0DD006CB6DD /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 1FE785031B3DF0DD006CB6DD /* PBXTargetDependency */, + ); + name = UnrealIRCdTests; + productName = UnrealIRCdTests; + productReference = 1FE785011B3DF0DD006CB6DD /* UnrealIRCdTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 1FE784E71B3DF0DD006CB6DD /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0630; + ORGANIZATIONNAME = "UnrealIRCd Team"; + TargetAttributes = { + 1FE784EE1B3DF0DD006CB6DD = { + CreatedOnToolsVersion = 6.3.2; + }; + 1FE785001B3DF0DD006CB6DD = { + CreatedOnToolsVersion = 6.3.2; + TestTargetID = 1FE784EE1B3DF0DD006CB6DD; + }; + }; + }; + buildConfigurationList = 1FE784EA1B3DF0DD006CB6DD /* Build configuration list for PBXProject "UnrealIRCd" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 1FE784E61B3DF0DD006CB6DD; + productRefGroup = 1FE784F01B3DF0DD006CB6DD /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 1FE784EE1B3DF0DD006CB6DD /* UnrealIRCd */, + 1FE785001B3DF0DD006CB6DD /* UnrealIRCdTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 1FE784ED1B3DF0DD006CB6DD /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1FC660CF1B3EA90B008EFAD1 /* bat23.png in Resources */, + 1FE784F91B3DF0DD006CB6DD /* Images.xcassets in Resources */, + 1FE784FC1B3DF0DD006CB6DD /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1FE784FF1B3DF0DD006CB6DD /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1FE784EB1B3DF0DD006CB6DD /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1FE784F71B3DF0DD006CB6DD /* ViewController.swift in Sources */, + 1FE784F51B3DF0DD006CB6DD /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1FE784FD1B3DF0DD006CB6DD /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1FE785081B3DF0DD006CB6DD /* UnrealIRCdTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 1FE785031B3DF0DD006CB6DD /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 1FE784EE1B3DF0DD006CB6DD /* UnrealIRCd */; + targetProxy = 1FE785021B3DF0DD006CB6DD /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 1FE784FA1B3DF0DD006CB6DD /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 1FE784FB1B3DF0DD006CB6DD /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 1FE785091B3DF0DD006CB6DD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 1FE7850A1B3DF0DD006CB6DD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + 1FE7850C1B3DF0DD006CB6DD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = UnrealIRCd/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 1FE7850D1B3DF0DD006CB6DD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = UnrealIRCd/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 1FE7850F1B3DF0DD006CB6DD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(DEVELOPER_FRAMEWORKS_DIR)", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = UnrealIRCdTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UnrealIRCd.app/Contents/MacOS/UnrealIRCd"; + }; + name = Debug; + }; + 1FE785101B3DF0DD006CB6DD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(DEVELOPER_FRAMEWORKS_DIR)", + "$(inherited)", + ); + INFOPLIST_FILE = UnrealIRCdTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UnrealIRCd.app/Contents/MacOS/UnrealIRCd"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1FE784EA1B3DF0DD006CB6DD /* Build configuration list for PBXProject "UnrealIRCd" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1FE785091B3DF0DD006CB6DD /* Debug */, + 1FE7850A1B3DF0DD006CB6DD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1FE7850B1B3DF0DD006CB6DD /* Build configuration list for PBXNativeTarget "UnrealIRCd" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1FE7850C1B3DF0DD006CB6DD /* Debug */, + 1FE7850D1B3DF0DD006CB6DD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1FE7850E1B3DF0DD006CB6DD /* Build configuration list for PBXNativeTarget "UnrealIRCdTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1FE7850F1B3DF0DD006CB6DD /* Debug */, + 1FE785101B3DF0DD006CB6DD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 1FE784E71B3DF0DD006CB6DD /* Project object */; +} diff --git a/src/macosx/UnrealIRCd.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/src/macosx/UnrealIRCd.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..0558e4d05 --- /dev/null +++ b/src/macosx/UnrealIRCd.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/src/macosx/UnrealIRCd/AppDelegate.swift b/src/macosx/UnrealIRCd/AppDelegate.swift new file mode 100644 index 000000000..038bff23a --- /dev/null +++ b/src/macosx/UnrealIRCd/AppDelegate.swift @@ -0,0 +1,32 @@ +// +// AppDelegate.swift +// UnrealIRCd +// +// Created by Travis McArthur on 6/26/15. +// Copyright (c) 2015 UnrealIRCd Team. All rights reserved. +// + +import Cocoa +import AppKit + +@NSApplicationMain +class AppDelegate: NSObject, NSApplicationDelegate { + + + + var menuItem : NSStatusItem!; + + func applicationDidFinishLaunching(aNotification: NSNotification) { + println("App did finish launching!") + // Compiler error - hack below + menuItem = NSStatusBar.systemStatusBar().statusItemWithLength(-1/*NSVariableStatusItemLength*/) + menuItem.image = NSImage(named: "bat23.png") + } + + func applicationWillTerminate(aNotification: NSNotification) { + + } + + +} + diff --git a/src/macosx/UnrealIRCd/Base.lproj/Main.storyboard b/src/macosx/UnrealIRCd/Base.lproj/Main.storyboard new file mode 100644 index 000000000..c2f434abd --- /dev/null +++ b/src/macosx/UnrealIRCd/Base.lproj/Main.storyboard @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/macosx/UnrealIRCd/Images.xcassets/AppIcon.appiconset/Contents.json b/src/macosx/UnrealIRCd/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..2db2b1c7c --- /dev/null +++ b/src/macosx/UnrealIRCd/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/macosx/UnrealIRCd/Info.plist b/src/macosx/UnrealIRCd/Info.plist new file mode 100644 index 000000000..3e6882bcb --- /dev/null +++ b/src/macosx/UnrealIRCd/Info.plist @@ -0,0 +1,36 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + com.unrealircd.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + Copyright © 2015 UnrealIRCd Team. All rights reserved. + NSMainStoryboardFile + Main + LSUIElement + + NSPrincipalClass + NSApplication + + diff --git a/src/macosx/UnrealIRCd/ViewController.swift b/src/macosx/UnrealIRCd/ViewController.swift new file mode 100644 index 000000000..937b1b6bf --- /dev/null +++ b/src/macosx/UnrealIRCd/ViewController.swift @@ -0,0 +1,27 @@ +// +// ViewController.swift +// UnrealIRCd +// +// Created by Travis McArthur on 6/26/15. +// Copyright (c) 2015 UnrealIRCd Team. All rights reserved. +// + +import Cocoa + +class ViewController: NSViewController { + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + override var representedObject: AnyObject? { + didSet { + // Update the view, if already loaded. + } + } + + +} + diff --git a/src/macosx/UnrealIRCdTests/Info.plist b/src/macosx/UnrealIRCdTests/Info.plist new file mode 100644 index 000000000..b76591a31 --- /dev/null +++ b/src/macosx/UnrealIRCdTests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.unrealircd.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/src/macosx/UnrealIRCdTests/UnrealIRCdTests.swift b/src/macosx/UnrealIRCdTests/UnrealIRCdTests.swift new file mode 100644 index 000000000..c6fd629a7 --- /dev/null +++ b/src/macosx/UnrealIRCdTests/UnrealIRCdTests.swift @@ -0,0 +1,36 @@ +// +// UnrealIRCdTests.swift +// UnrealIRCdTests +// +// Created by Travis McArthur on 6/26/15. +// Copyright (c) 2015 UnrealIRCd Team. All rights reserved. +// + +import Cocoa +import XCTest + +class UnrealIRCdTests: XCTestCase { + + override func setUp() { + super.setUp() + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testExample() { + // This is an example of a functional test case. + XCTAssert(true, "Pass") + } + + func testPerformanceExample() { + // This is an example of a performance test case. + self.measureBlock() { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/src/modules.c b/src/modules.c index 0c2f87f28..2236e6b83 100644 --- a/src/modules.c +++ b/src/modules.c @@ -979,7 +979,7 @@ int m_module(aClient *cptr, aClient *sptr, int parc, char *parv[]) strncat(tmp, "[PERM] ", sizeof(tmp)-strlen(tmp)-1); if (!(mi->options & MOD_OPT_OFFICIAL)) strncat(tmp, "[3RD] ", sizeof(tmp)-strlen(tmp)-1); - if (!IsOper(sptr)) + if (!OperClass_evaluateACLPath("server:module",sptr,NULL,NULL,NULL)) sendto_one(sptr, ":%s NOTICE %s :*** %s (%s)%s", me.name, sptr->name, mi->header->name, mi->header->description, mi->options & MOD_OPT_OFFICIAL ? "" : " [3RD]"); @@ -988,7 +988,7 @@ int m_module(aClient *cptr, aClient *sptr, int parc, char *parv[]) mi->header->name, mi->header->version, mi->header->description, tmp); } - if (!IsOper(sptr)) + if (!OperClass_evaluateACLPath("server:module",sptr,NULL,NULL,NULL)) return 0; tmp[0] = '\0'; @@ -1616,7 +1616,7 @@ int i, n, errors=0; if (n < 1) { config_error("ERROR: efunction '%s' not found, you probably did not " - "load all required modules! (hint: see modules.full.conf)", + "load all required modules! (hint: see modules.default.conf)", efunction_table[i].name); errors++; } else diff --git a/src/modules/Makefile.in b/src/modules/Makefile.in index 128f4ec23..d83f3bf65 100644 --- a/src/modules/Makefile.in +++ b/src/modules/Makefile.in @@ -36,9 +36,9 @@ R_MODULES= \ m_sethost.so m_chghost.so m_chgident.so m_setname.so \ m_setident.so m_sdesc.so m_svsmode.so m_swhois.so\ m_svsmotd.so m_svsnline.so m_who.so m_mkpasswd.so \ - m_away.so m_svsnoop.so m_svso.so m_svsnick.so \ - m_adminchat.so m_chgname.so m_guest.so m_kill.so \ - m_lag.so m_message.so m_nachat.so m_oper.so m_pingpong.so \ + m_away.so m_svsnoop.so m_svsnick.so \ + m_chgname.so m_guest.so m_kill.so \ + m_lag.so m_message.so m_oper.so m_pingpong.so \ m_quit.so m_rping.so m_sendumode.so m_sqline.so \ m_tsctl.so m_unkline.so m_unsqline.so m_unzline.so m_whois.so \ m_tkl.so m_vhost.so m_cycle.so m_svsjoin.so m_svspart.so \ @@ -68,6 +68,7 @@ all: build build: $(MODULES) cd chanmodes; $(MAKE) all cd usermodes; $(MAKE) all + cd snomasks; $(MAKE) all cd extbans; $(MAKE) all custommodule: $(MODULEFILE).c @@ -78,10 +79,6 @@ custommodule: $(MODULEFILE).c # .so's section ############################################################################# -m_adminchat.so: m_adminchat.c $(INCLUDES) - $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ - -o m_adminchat.so m_adminchat.c - m_chgname.so: m_chgname.c $(INCLUDES) $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ -o m_chgname.so m_chgname.c @@ -102,10 +99,6 @@ m_message.so: m_message.c $(INCLUDES) $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ -o m_message.so m_message.c -m_nachat.so: m_nachat.c $(INCLUDES) - $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ - -o m_nachat.so m_nachat.c - m_oper.so: m_oper.c $(INCLUDES) $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ -o m_oper.so m_oper.c @@ -206,10 +199,6 @@ m_svsnoop.so: m_svsnoop.c $(INCLUDES) $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ -o m_svsnoop.so m_svsnoop.c -m_svso.so: m_svso.c $(INCLUDES) - $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ - -o m_svso.so m_svso.c - m_svsnick.so: m_svsnick.c $(INCLUDES) $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ -o m_svsnick.so m_svsnick.c @@ -524,3 +513,7 @@ cloak.so: cloak.c $(INCLUDES) clean: $(RM) -f *.o *.so *~ core + cd chanmodes; $(MAKE) clean + cd usermodes; $(MAKE) clean + cd snomasks; $(MAKE) clean + cd extbans; $(MAKE) clean diff --git a/src/modules/certfp.c b/src/modules/certfp.c index 4f59da2d0..51b89efd3 100644 --- a/src/modules/certfp.c +++ b/src/modules/certfp.c @@ -35,6 +35,8 @@ DLLFUNC int MOD_INIT(certfp)(ModuleInfo *modinfo) { ModDataInfo mreq; + MARK_AS_OFFICIAL_MODULE(modinfo); + memset(&mreq, 0, sizeof(mreq)); mreq.name = "certfp"; mreq.free = certfp_free; diff --git a/src/modules/chanmodes/Makefile.in b/src/modules/chanmodes/Makefile.in index a1897aee7..f18aa67c2 100644 --- a/src/modules/chanmodes/Makefile.in +++ b/src/modules/chanmodes/Makefile.in @@ -1,6 +1,6 @@ #************************************************************************ #* IRC - Internet Relay Chat, src/modules/chanmodes/Makefile -#* Copyright (C) Carsten V. Munk 2001 & The UnrealIRCd Team +#* Copyright (C) The UnrealIRCd Team #* #* This program is free software; you can redistribute it and/or modify #* it under the terms of the GNU General Public License as published by @@ -32,7 +32,7 @@ INCLUDES = ../../include/auth.h ../../include/channel.h \ R_MODULES= \ nocolor.so stripcolor.so issecure.so permanent.so jointhrottle.so floodprot.so \ noctcp.so link.so censor.so delayjoin.so noknock.so noinvite.so operonly.so \ - adminonly.so nonotice.so regonly.so nonickchange.so nokick.so regonlyspeak.so \ + nonotice.so regonly.so nonickchange.so nokick.so regonlyspeak.so \ secureonly.so MODULES=$(R_MODULES) @@ -107,10 +107,6 @@ operonly.so: operonly.c $(INCLUDES) $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ -o operonly.so operonly.c -adminonly.so: adminonly.c $(INCLUDES) - $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ - -o adminonly.so adminonly.c - nonotice.so: nonotice.c $(INCLUDES) $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ -o nonotice.so nonotice.c diff --git a/src/modules/chanmodes/adminonly.c b/src/modules/chanmodes/adminonly.c deleted file mode 100644 index 7e1503a6e..000000000 --- a/src/modules/chanmodes/adminonly.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Disallow knocks UnrealIRCd Module (Channel Mode +K) - * (C) Copyright 2014 Travis McArthur (Heero) and the UnrealIRCd team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 1, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "config.h" -#include "struct.h" -#include "common.h" -#include "sys.h" -#include "numeric.h" -#include "msg.h" -#include "proto.h" -#include "channel.h" -#include -#include -#include -#include -#include -#ifdef _WIN32 -#include -#endif -#include -#include "h.h" -#ifdef _WIN32 -#include "version.h" -#endif - -DLLFUNC CMD_FUNC(adminonly); - -ModuleHeader MOD_HEADER(adminonly) - = { - "chanmodes/adminonly", - "$Id$", - "Channel Mode +V", - "3.2-b8-1", - NULL - }; - -Cmode_t EXTCMODE_ADMINONLY; - -#define IsAdminOnly(chptr) (chptr->mode.extmode & EXTCMODE_ADMINONLY) - -DLLFUNC int adminonly_require_admin(aClient *cptr, aChannel *chptr, char mode, char *para, int checkt, int what); -DLLFUNC int adminonly_check (aClient *cptr, aChannel *chptr, char *key, char *parv[]); -DLLFUNC int adminonly_topic_allow (aClient *sptr, aChannel *chptr); -DLLFUNC int adminonly_check_ban(aClient *cptr, aChannel *chptr); - -DLLFUNC int MOD_TEST(adminonly)(ModuleInfo *modinfo) -{ - return MOD_SUCCESS; -} - -DLLFUNC int MOD_INIT(adminonly)(ModuleInfo *modinfo) -{ -CmodeInfo req; - - memset(&req, 0, sizeof(req)); - req.paracount = 0; - req.flag = 'A'; - req.is_ok = adminonly_require_admin; - CmodeAdd(modinfo->handle, req, &EXTCMODE_ADMINONLY); - - HookAddEx(modinfo->handle, HOOKTYPE_CAN_JOIN, adminonly_check); - HookAddEx(modinfo->handle, HOOKTYPE_OPER_INVITE_BAN, adminonly_check_ban); - HookAddEx(modinfo->handle, HOOKTYPE_VIEW_TOPIC_OUTSIDE_CHANNEl, adminonly_topic_allow); - - - MARK_AS_OFFICIAL_MODULE(modinfo); - return MOD_SUCCESS; -} - -DLLFUNC int MOD_LOAD(noctcp)(int module_load) -{ - return MOD_SUCCESS; -} - -DLLFUNC int MOD_UNLOAD(noctcp)(int module_unload) -{ - return MOD_SUCCESS; -} - -DLLFUNC int adminonly_check (aClient *cptr, aChannel *chptr, char *key, char *parv[]) -{ - if ((chptr->mode.extmode & EXTCMODE_ADMINONLY) && !IsSkoAdmin(cptr)) - return ERR_ADMONLY; - return 0; -} - - -DLLFUNC int adminonly_check_ban(aClient *cptr, aChannel *chptr) -{ - - if ((chptr->mode.extmode & EXTCMODE_ADMINONLY) && IsAnOper(cptr) && !IsNetAdmin(cptr) && !IsSAdmin(cptr)) - return HOOK_DENY; - - return HOOK_CONTINUE; -} - -DLLFUNC int adminonly_topic_allow (aClient *sptr, aChannel *chptr) -{ - if (chptr->mode.extmode & EXTCMODE_ADMINONLY && !IsAdmin(sptr)) - return HOOK_DENY; - - return HOOK_CONTINUE; -} - -DLLFUNC int adminonly_require_admin(aClient *cptr, aChannel *chptr, char mode, char *para, int checkt, int what) -{ - if (!MyClient(cptr) || IsSkoAdmin(cptr)) - return EX_ALLOW; - - - sendto_one(cptr, err_str(ERR_CANNOTCHANGECHANMODE), - me.name, cptr->name, 'A', "You are not an Admin"); - return EX_DENY; -} - diff --git a/src/modules/chanmodes/censor.c b/src/modules/chanmodes/censor.c index 5f9577c98..bc914964c 100644 --- a/src/modules/chanmodes/censor.c +++ b/src/modules/chanmodes/censor.c @@ -133,7 +133,7 @@ DLLFUNC int censor_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *e { config_error("%s:%i: badword quit has been removed. We just use the bad words from " "badword channel { } instead.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + ce->ce_fileptr->cf_filename, ce->ce_varlinenum); return 0; /* pretend unhandled.. ok not just pretend.. ;) */ } diff --git a/src/modules/chanmodes/noctcp.c b/src/modules/chanmodes/noctcp.c index ac2120aa7..dbb69dacd 100644 --- a/src/modules/chanmodes/noctcp.c +++ b/src/modules/chanmodes/noctcp.c @@ -68,7 +68,7 @@ CmodeInfo req; memset(&req, 0, sizeof(req)); req.paracount = 0; req.flag = 'C'; - req.is_ok = extcmode_default_requirechop; + req.is_ok = extcmode_default_requirehalfop; CmodeAdd(modinfo->handle, req, &EXTCMODE_NOCTCP); HookAddPCharEx(modinfo->handle, HOOKTYPE_PRE_CHANMSG, noctcp_prechanmsg); diff --git a/src/modules/chanmodes/noknock.c b/src/modules/chanmodes/noknock.c index 9069ec2eb..1148196ee 100644 --- a/src/modules/chanmodes/noknock.c +++ b/src/modules/chanmodes/noknock.c @@ -122,6 +122,6 @@ DLLFUNC int noknock_mode_allow(aClient *cptr, aChannel *chptr, char mode, char * return EX_DENY; } - return extcmode_default_requirechop(cptr,chptr,mode,para,checkt,what); + return extcmode_default_requirehalfop(cptr,chptr,mode,para,checkt,what); } diff --git a/src/modules/chanmodes/nonickchange.c b/src/modules/chanmodes/nonickchange.c index 4297cba5d..6ba0f16d3 100644 --- a/src/modules/chanmodes/nonickchange.c +++ b/src/modules/chanmodes/nonickchange.c @@ -67,7 +67,7 @@ CmodeInfo req; memset(&req, 0, sizeof(req)); req.paracount = 0; req.flag = 'N'; - req.is_ok = extcmode_default_requirechop; + req.is_ok = extcmode_default_requirehalfop; CmodeAdd(modinfo->handle, req, &EXTCMODE_NONICKCHANGE); HookAddEx(modinfo->handle, HOOKTYPE_CHAN_PERMIT_NICK_CHANGE, nonickchange_check); diff --git a/src/modules/chanmodes/operonly.c b/src/modules/chanmodes/operonly.c index 612d9284b..c4efe8262 100644 --- a/src/modules/chanmodes/operonly.c +++ b/src/modules/chanmodes/operonly.c @@ -52,8 +52,6 @@ ModuleHeader MOD_HEADER(operonly) Cmode_t EXTCMODE_OPERONLY; -#define IsOperOnly(chptr) (chptr->mode.extmode & EXTCMODE_OPERONLY) - DLLFUNC int operonly_require_oper(aClient *cptr, aChannel *chptr, char mode, char *para, int checkt, int what); DLLFUNC int operonly_check (aClient *cptr, aChannel *chptr, char *key, char *parv[]); DLLFUNC int operonly_topic_allow (aClient *sptr, aChannel *chptr); @@ -95,7 +93,7 @@ DLLFUNC int MOD_UNLOAD(noctcp)(int module_unload) DLLFUNC int operonly_check (aClient *cptr, aChannel *chptr, char *key, char *parv[]) { - if ((chptr->mode.extmode & EXTCMODE_OPERONLY) && !IsAnOper(cptr)) + if ((chptr->mode.extmode & EXTCMODE_OPERONLY) && OperClass_evaluateACLPath("channel:operonly",cptr,NULL,chptr,NULL)) return ERR_OPERONLY; return 0; } @@ -103,7 +101,7 @@ DLLFUNC int operonly_check (aClient *cptr, aChannel *chptr, char *key, char *par DLLFUNC int operonly_check_ban(aClient *cptr, aChannel *chptr) { if ((chptr->mode.extmode & EXTCMODE_OPERONLY) && - IsAnOper(cptr) && !IsSkoAdmin(cptr) && !IsCoAdmin(cptr)) + !OperClass_evaluateACLPath("override:ban:operonly",cptr,NULL,NULL,NULL)) return HOOK_DENY; return HOOK_CONTINUE; @@ -111,7 +109,7 @@ DLLFUNC int operonly_check_ban(aClient *cptr, aChannel *chptr) DLLFUNC int operonly_topic_allow (aClient *sptr, aChannel *chptr) { - if (chptr->mode.extmode & EXTCMODE_OPERONLY && !IsAnOper(sptr)) + if (chptr->mode.extmode & EXTCMODE_OPERONLY && !OperClass_evaluateACLPath("channel:operonly:topic",sptr,NULL,chptr,NULL)) return HOOK_DENY; return HOOK_CONTINUE; @@ -119,7 +117,7 @@ DLLFUNC int operonly_topic_allow (aClient *sptr, aChannel *chptr) DLLFUNC int operonly_require_oper(aClient *cptr, aChannel *chptr, char mode, char *para, int checkt, int what) { - if (!MyClient(cptr) || IsAnOper(cptr)) + if (!MyClient(cptr) || OperClass_evaluateACLPath("channel:operonly",cptr,NULL,chptr,NULL)) return EX_ALLOW; diff --git a/src/modules/chanmodes/regonly.c b/src/modules/chanmodes/regonly.c index ace697992..3186b6025 100644 --- a/src/modules/chanmodes/regonly.c +++ b/src/modules/chanmodes/regonly.c @@ -68,7 +68,7 @@ CmodeInfo req; memset(&req, 0, sizeof(req)); req.paracount = 0; req.flag = 'R'; - req.is_ok = extcmode_default_requirechop; + req.is_ok = extcmode_default_requirehalfop; CmodeAdd(modinfo->handle, req, &EXTCMODE_REGONLY); HookAddEx(modinfo->handle, HOOKTYPE_CAN_JOIN, regonly_check); diff --git a/src/modules/chanmodes/regonlyspeak.c b/src/modules/chanmodes/regonlyspeak.c index b9d30e406..dfd817a9d 100644 --- a/src/modules/chanmodes/regonlyspeak.c +++ b/src/modules/chanmodes/regonlyspeak.c @@ -69,7 +69,7 @@ DLLFUNC int MOD_INIT(regonlyspeak)(ModuleInfo *modinfo) memset(&req, 0, sizeof(req)); req.paracount = 0; req.flag = 'M'; - req.is_ok = extcmode_default_requirechop; + req.is_ok = extcmode_default_requirehalfop; CmodeAdd(modinfo->handle, req, &EXTCMODE_REGONLYSPEAK); HookAddEx(modinfo->handle, HOOKTYPE_CAN_SEND, regonlyspeak_can_send); @@ -102,7 +102,7 @@ DLLFUNC char * regonlyspeak_part_message (aClient* sptr, aChannel *chptr, char* DLLFUNC int regonlyspeak_can_send (aClient* cptr, aChannel *chptr, char* message, Membership* lp, int notice) { - if (IsRegOnlySpeak(chptr) && !op_can_override(cptr) && !IsLoggedIn(cptr) && + if (IsRegOnlySpeak(chptr) && !op_can_override("override:message:regonlyspeak",cptr,chptr,NULL) && !IsLoggedIn(cptr) && (!lp || !(lp->flags & (CHFL_CHANOP | CHFL_VOICE | CHFL_CHANOWNER | CHFL_HALFOP | CHFL_CHANPROT)))) diff --git a/src/modules/extbans/Makefile.in b/src/modules/extbans/Makefile.in index dc6b1aee1..f9e72e8a6 100644 --- a/src/modules/extbans/Makefile.in +++ b/src/modules/extbans/Makefile.in @@ -30,7 +30,8 @@ INCLUDES = ../../include/auth.h ../../include/channel.h \ ../../include/version.h ../../include/whowas.h R_MODULES= \ - join.so quiet.so nickchange.so inchannel.so realname.so regnick.so account.so + join.so quiet.so nickchange.so inchannel.so realname.so regnick.so \ + account.so operclass.so MODULES=$(R_MODULES) MODULEFLAGS=@MODULEFLAGS@ @@ -83,3 +84,7 @@ regnick.so: regnick.c $(INCLUDES) account.so: account.c $(INCLUDES) $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ -o account.so account.c + +operclass.so: operclass.c $(INCLUDES) + $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ + -o operclass.so operclass.c diff --git a/src/modules/extbans/operclass.c b/src/modules/extbans/operclass.c new file mode 100644 index 000000000..375e54e23 --- /dev/null +++ b/src/modules/extbans/operclass.c @@ -0,0 +1,104 @@ +/* + * Extended ban type: ban (or rather: exempt or invex) an operclass. + * (C) Copyright 2003-.. Bram Matthys (Syzop) and the UnrealIRCd team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 1, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include "unrealircd.h" + +ModuleHeader MOD_HEADER(operclass) += { + "chanmodes/extbans/operclass", + "$Id$", + "ExtBan ~O - Ban/exempt operclass", + "3.2-b8-1", + NULL +}; + +/* Forward declarations */ +char *extban_operclass_conv_param(char *para); +int extban_operclass_is_banned(aClient *sptr, aChannel *chptr, char *banin, int type); + +/** Called upon module init */ +DLLFUNC int MOD_INIT(operclass)(ModuleInfo *modinfo) +{ + ExtbanInfo req; + + req.flag = 'O'; + req.is_ok = NULL; + req.conv_param = extban_operclass_conv_param; + req.is_banned = extban_operclass_is_banned; + req.options = EXTBOPT_INVEX; + if (!ExtbanAdd(modinfo->handle, req)) + { + config_error("could not register extended ban type"); + return MOD_FAILED; + } + + MARK_AS_OFFICIAL_MODULE(modinfo); + + return MOD_SUCCESS; +} + +/** Called upon module load */ +DLLFUNC int MOD_LOAD(operclass)(int module_load) +{ + return MOD_SUCCESS; +} + +/** Called upon unload */ +DLLFUNC int MOD_UNLOAD(operclass)(int module_unload) +{ + return MOD_SUCCESS; +} + + +#define OPERCLASSLEN 64 + +char *extban_operclass_conv_param(char *para) +{ + static char retbuf[OPERCLASSLEN + 4]; + char *p; + + strlcpy(retbuf, para, sizeof(retbuf)); + + /* allow alpha, numeric, -, _, * and ? wildcards */ + for (p = retbuf+3; *p; p++) + if (!strchr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_?*", *p)) + *p = '\0'; + + if (retbuf[3] == '\0') + return NULL; /* just "~O:" is invalid */ + + return retbuf; +} + +int extban_operclass_is_banned(aClient *sptr, aChannel *chptr, char *banin, int type) +{ + char *ban = banin+3; + + if (MyClient(sptr) && IsAnOper(sptr)) + { + char *operclass = NULL; + ConfigItem_oper *oper = Find_oper(sptr->user->operlogin); + if (oper && oper->operclass) + operclass = oper->operclass; + + if (operclass && !match(ban, operclass)) + return 1; + } + + return 0; +} diff --git a/src/modules/m_addline.c b/src/modules/m_addline.c index e0a3b8429..8a4a81654 100644 --- a/src/modules/m_addline.c +++ b/src/modules/m_addline.c @@ -82,7 +82,7 @@ DLLFUNC CMD_FUNC(m_addline) char *text; text = parc > 1 ? parv[1] : NULL; - if (!MyClient(sptr) || !IsAnOper(sptr) || !OPCanAddline(sptr)) + if (!MyClient(sptr) || !IsAnOper(sptr) || OperClass_evaluateACLPath("server:addline",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; diff --git a/src/modules/m_addmotd.c b/src/modules/m_addmotd.c index 2a0b0f155..f21be837b 100644 --- a/src/modules/m_addmotd.c +++ b/src/modules/m_addmotd.c @@ -86,7 +86,7 @@ DLLFUNC CMD_FUNC(m_addmotd) if (!MyConnect(sptr)) return 0; - if (!IsAdmin(sptr) && !IsCoAdmin(sptr) && !OperClass_evaluateACLPath("add:motd",sptr,NULL,NULL,NULL)) + if (!OperClass_evaluateACLPath("server:addmotd",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; diff --git a/src/modules/m_addomotd.c b/src/modules/m_addomotd.c index 8445a6979..dd3e806ad 100644 --- a/src/modules/m_addomotd.c +++ b/src/modules/m_addomotd.c @@ -86,7 +86,7 @@ DLLFUNC CMD_FUNC(m_addomotd) if (!MyConnect(sptr)) return 0; - if (!IsAdmin(sptr) && !IsCoAdmin(sptr) && !OperClass_evaluateACLPath("add:omotd",sptr,NULL,NULL,NULL)) + if (!OperClass_evaluateACLPath("server:addomotd",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; @@ -94,7 +94,7 @@ DLLFUNC CMD_FUNC(m_addomotd) if (parc < 2) { sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), - me.name, parv[0], "ADDMOTD"); + me.name, parv[0], "ADDOMOTD"); return 0; } conf = fopen(conf_files->opermotd_file, "a"); diff --git a/src/modules/m_adminchat.c b/src/modules/m_adminchat.c deleted file mode 100644 index 8d8b62c3a..000000000 --- a/src/modules/m_adminchat.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Unreal Internet Relay Chat Daemon, src/modules/m_adminchat.c - * (C) 2000-2001 Carsten V. Munk and the UnrealIRCd Team - * Moved to modules by Fish (Justin Hammond) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 1, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "config.h" -#include "struct.h" -#include "common.h" -#include "sys.h" -#include "numeric.h" -#include "msg.h" -#include "channel.h" -#include -#include -#include -#include -#include -#ifdef _WIN32 -#include -#endif -#include -#include "h.h" -#include "proto.h" -#ifdef _WIN32 -#include "version.h" -#endif - -DLLFUNC int m_admins(aClient *cptr, aClient *sptr, int parc, char *parv[]); - -/* Place includes here */ -#define MSG_ADMINCHAT "ADCHAT" - - -ModuleHeader MOD_HEADER(m_adminchat) - = { - "adminchat", /* Name of module */ - "$Id$", /* Version */ - "command /adchat", /* Short description of module */ - "3.2-b8-1", - NULL - }; - - -/* This is called on module init, before Server Ready */ -DLLFUNC int MOD_INIT(m_adminchat)(ModuleInfo *modinfo) -{ - CommandAdd(modinfo->handle, MSG_ADMINCHAT, m_admins, 1, 0); - MARK_AS_OFFICIAL_MODULE(modinfo); - return MOD_SUCCESS; -} - -/* Is first run when server is 100% ready */ -DLLFUNC int MOD_LOAD(m_adminchat)(int module_load) -{ - return MOD_SUCCESS; -} - - -/* Called when module is unloaded */ -DLLFUNC int MOD_UNLOAD(m_adminchat)(int module_unload) -{ - return MOD_SUCCESS; -} - -/* -** m_admins (Admin chat only) -Potvin -** parv[0] = sender prefix -** parv[1] = message text -*/ -DLLFUNC int m_admins(aClient *cptr, aClient *sptr, int parc, char *parv[]) -{ - char *message; - - - message = parc > 1 ? parv[1] : NULL; - - if (BadPtr(message)) - { - sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), - me.name, parv[0], "ADCHAT"); - return 0; - } -#ifdef ADMINCHAT - if (MyClient(sptr) && !IsAdmin(sptr) && !IsCoAdmin(sptr) && !OperClass_evaluateACLPath("chat:admin",sptr,NULL,NULL,NULL)) -#else - if (MyClient(sptr)) -#endif - { - sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); - return 0; - } - sendto_server(IsServer(cptr) ? cptr : NULL, 0, 0, ":%s ADCHAT :%s", - parv[0], message); -#ifdef ADMINCHAT - sendto_umode(UMODE_ADMIN, "*** AdminChat -- from %s: %s", - parv[0], message); - sendto_umode(UMODE_COADMIN, "*** AdminChat -- from %s: %s", - parv[0], message); -#endif - return 0; -} diff --git a/src/modules/m_connect.c b/src/modules/m_connect.c index 988be795d..e2e2abba6 100644 --- a/src/modules/m_connect.c +++ b/src/modules/m_connect.c @@ -86,19 +86,13 @@ DLLFUNC CMD_FUNC(m_connect) aClient *acptr; - if (!IsPrivileged(sptr)) - { - sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); - return -1; - } - - if (MyClient(sptr) && !OPCanGRoute(sptr) && parc > 3) + if (!IsServer(sptr) && MyClient(sptr) && !OperClass_evaluateACLPath("route:global",sptr,NULL,NULL,NULL) && parc > 3) { /* Only allow LocOps to make */ /* local CONNECTS --SRB */ sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; } - if (MyClient(sptr) && !OPCanLRoute(sptr) && parc <= 3) + if (!IsServer(sptr) && MyClient(sptr) && !OperClass_evaluateACLPath("route:local",sptr,NULL,NULL,NULL) && parc <= 3) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; diff --git a/src/modules/m_dccdeny.c b/src/modules/m_dccdeny.c index d6f0531d5..c9e772f5d 100644 --- a/src/modules/m_dccdeny.c +++ b/src/modules/m_dccdeny.c @@ -82,7 +82,7 @@ DLLFUNC CMD_FUNC(m_dccdeny) if (!MyClient(sptr)) return 0; - if (!IsAnOper(sptr) || !OPCanDCCDeny(sptr)) + if (!IsAnOper(sptr) || !OperClass_evaluateACLPath("client:dcc",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; diff --git a/src/modules/m_globops.c b/src/modules/m_globops.c index 6ca0c8a07..7b8d721d0 100644 --- a/src/modules/m_globops.c +++ b/src/modules/m_globops.c @@ -88,7 +88,7 @@ DLLFUNC CMD_FUNC(m_globops) me.name, parv[0], "GLOBOPS"); return 0; } - if (MyClient(sptr) && !OPCanGlobOps(sptr)) + if (MyClient(sptr) && !OperClass_evaluateACLPath("chat:globops",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; diff --git a/src/modules/m_invite.c b/src/modules/m_invite.c index 1170325bc..60410a135 100644 --- a/src/modules/m_invite.c +++ b/src/modules/m_invite.c @@ -135,7 +135,7 @@ DLLFUNC CMD_FUNC(m_invite) if (i == HOOK_DENY && !IsULine(sptr)) { #ifndef NO_OPEROVERRIDE - if ((MyClient(sptr) ? (IsOper(sptr) && OPCanOverride(sptr)) : + if ((MyClient(sptr) ? (IsOper(sptr) && (OperClass_evaluateACLPath("override:invite:nopermissions",sptr,NULL,chptr,NULL))) : IsOper(sptr)) && sptr == acptr) over = 1; else { @@ -151,7 +151,7 @@ DLLFUNC CMD_FUNC(m_invite) if (!IsMember(sptr, chptr) && !IsULine(sptr)) { #ifndef NO_OPEROVERRIDE - if ((MyClient(sptr) ? (IsOper(sptr) && OPCanOverride(sptr)) : + if ((MyClient(sptr) ? (IsOper(sptr) && (OperClass_evaluateACLPath("override:invite:notinchannel",sptr,NULL,chptr,NULL))) : IsOper(sptr)) && sptr == acptr) over = 1; else { @@ -176,7 +176,7 @@ DLLFUNC CMD_FUNC(m_invite) if (!is_chan_op(sptr, chptr) && !IsULine(sptr)) { #ifndef NO_OPEROVERRIDE - if ((MyClient(sptr) ? (IsOper(sptr) && OPCanOverride(sptr)) : + if ((MyClient(sptr) ? (IsOper(sptr) && (OperClass_evaluateACLPath("override:invite:nopermissions",sptr,NULL,chptr,NULL))) : IsOper(sptr)) && sptr == acptr) over = 1; else { @@ -191,7 +191,7 @@ DLLFUNC CMD_FUNC(m_invite) else if (!IsMember(sptr, chptr) && !IsULine(sptr)) { #ifndef NO_OPEROVERRIDE - if ((MyClient(sptr) ? (IsOper(sptr) && OPCanOverride(sptr)) : + if ((MyClient(sptr) ? (IsOper(sptr) && (OperClass_evaluateACLPath("override:invite:nopermissions",sptr,NULL,chptr,NULL))) : IsOper(sptr)) && sptr == acptr) over = 1; else { diff --git a/src/modules/m_join.c b/src/modules/m_join.c index fdc644319..b0c889c5a 100644 --- a/src/modules/m_join.c +++ b/src/modules/m_join.c @@ -536,14 +536,14 @@ DLLFUNC CMD_FUNC(_do_join) (i = can_join(cptr, sptr, chptr, key, parv))) { #ifndef NO_OPEROVERRIDE - if (i != -1 && !OPCanOverride(sptr)) + if (i != -1 && !OperClass_evaluateACLPath("override:join",sptr,NULL,chptr,NULL)) #else if (i != -1) #endif sendto_one(sptr, err_str(i), me.name, parv[0], name); #ifndef NO_OPEROVERRIDE - else if (i != -1 && OPCanOverride(sptr)) + else if (i != -1 && OperClass_evaluateACLPath("override:join",sptr,NULL,chptr,NULL) ) { sendto_snomask(SNO_EYES, "*** OperOverride -- %s (%s@%s) JOIN %s", sptr->name, sptr->user->username, sptr->user->realhost, chptr->chname); diff --git a/src/modules/m_kick.c b/src/modules/m_kick.c index cdbf5ef28..10657f29d 100644 --- a/src/modules/m_kick.c +++ b/src/modules/m_kick.c @@ -121,7 +121,7 @@ CMD_FUNC(m_kick) /* Store "sptr" access flags */ if (IsPerson(sptr)) sptr_flags = get_access(sptr, chptr); - if (!IsServer(cptr) && !IsULine(sptr) && !op_can_override(sptr) + if (!IsServer(cptr) && !IsULine(sptr) && !op_can_override("override:kick",sptr,chptr,NULL) && !(sptr_flags & CHFL_ISOP) && !(sptr_flags & CHFL_HALFOP)) { sendto_one(sptr, err_str(ERR_CHANOPRIVSNEEDED), @@ -177,7 +177,7 @@ CMD_FUNC(m_kick) if (ret == EX_DENY) { /* If set it means 'not allowed to kick'.. now check if (s)he can override that.. */ - if (op_can_override(sptr)) + if (op_can_override("override:kick",sptr,chptr,NULL)) { sendto_snomask(SNO_EYES, "*** OperOverride -- %s (%s@%s) KICK %s %s (%s)", @@ -200,7 +200,7 @@ CMD_FUNC(m_kick) * we are +h but victim is +o, OR... * we are +h and victim is +h */ - if (op_can_override(sptr)) + if (op_can_override("override:kick",sptr,chptr,NULL)) { if ((!(sptr_flags & CHFL_ISOP) && !(sptr_flags & CHFL_HALFOP)) || ((sptr_flags & CHFL_HALFOP) && (who_flags & CHFL_ISOP)) || @@ -225,7 +225,7 @@ CMD_FUNC(m_kick) && !(sptr_flags & CHFL_CHANOWNER)) { if (sptr == who) goto attack; /* kicking self == ok */ - if (op_can_override(sptr)) /* (and f*ck local ops) */ + if (op_can_override("override:kick:owner",sptr,chptr,NULL)) /* (and f*ck local ops) */ { /* IRCop kicking owner/prot */ sendto_snomask(SNO_EYES, "*** OperOverride -- %s (%s@%s) KICK %s %s (%s)", diff --git a/src/modules/m_kill.c b/src/modules/m_kill.c index b9ec01d87..b79fb3dba 100644 --- a/src/modules/m_kill.c +++ b/src/modules/m_kill.c @@ -110,7 +110,7 @@ DLLFUNC int m_kill(aClient *cptr, aClient *sptr, int parc, char *parv[]) *s = '\0'; /* Truncate at first "." */ #endif - if (!IsPrivileged(cptr)) + if (!IsServer(cptr) && !OperClass_evaluateACLPath("kill:global",sptr,NULL,NULL,NULL) && !OperClass_evaluateACLPath("kill:local",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; @@ -155,9 +155,9 @@ DLLFUNC int m_kill(aClient *cptr, aClient *sptr, int parc, char *parv[]) nick, acptr->name); chasing = 1; } - if ((!MyConnect(acptr) && MyClient(cptr) && !OPCanGKill(cptr)) + if ((!MyConnect(acptr) && MyClient(cptr) && !OperClass_evaluateACLPath("kill:global",sptr,acptr,NULL,NULL)) || (MyConnect(acptr) && MyClient(cptr) - && !OPCanLKill(cptr))) + && !OperClass_evaluateACLPath("kill:local",sptr,acptr,NULL,NULL))) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); diff --git a/src/modules/m_list.c b/src/modules/m_list.c index 32efb832a..55ccdf593 100644 --- a/src/modules/m_list.c +++ b/src/modules/m_list.c @@ -249,7 +249,7 @@ DLLFUNC CMD_FUNC(m_list) else /* Just a normal channel */ { chptr = find_channel(name, NullChn); - if (chptr && (ShowChannel(sptr, chptr) || OPCanSeeSecret(sptr))) { + if (chptr && (ShowChannel(sptr, chptr) || OperClass_evaluateACLPath("override:see:list:secret",sptr,NULL,chptr,NULL))) { #ifdef LIST_SHOW_MODES modebuf[0] = '['; channel_modes(sptr, modebuf+1, parabuf, sizeof(modebuf)-1, sizeof(parabuf), chptr); @@ -344,7 +344,7 @@ void _send_list(aClient *cptr, int numsend) { if (SecretChannel(chptr) && !IsMember(cptr, chptr) - && !OPCanSeeSecret(cptr)) + && !OperClass_evaluateACLPath("override:see:list:secret",cptr,NULL,chptr,NULL)) continue; /* Much more readable like this -- codemastr */ @@ -385,7 +385,7 @@ void _send_list(aClient *cptr, int numsend) else strlcat(modebuf, "]", sizeof modebuf); #endif - if (!OPCanSeeSecret(cptr)) + if (!OperClass_evaluateACLPath("override:see:list:secret",cptr,NULL,chptr,NULL)) sendto_one(cptr, rpl_str(RPL_LIST), me.name, cptr->name, diff --git a/src/modules/m_locops.c b/src/modules/m_locops.c index 9c0b0048a..d6967f5c5 100644 --- a/src/modules/m_locops.c +++ b/src/modules/m_locops.c @@ -88,7 +88,7 @@ DLLFUNC CMD_FUNC(m_locops) me.name, parv[0], "LOCOPS"); return 0; } - if (MyClient(sptr) && !OPCanLocOps(sptr)) + if (MyClient(sptr) && !OperClass_evaluateACLPath("chat:locops",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; diff --git a/src/modules/m_map.c b/src/modules/m_map.c index 86dd5761d..b08024223 100644 --- a/src/modules/m_map.c +++ b/src/modules/m_map.c @@ -108,7 +108,7 @@ static void dump_map(aClient *cptr, aClient *server, char *mask, int prompt_leng list_for_each_entry(acptr, &global_server_list, client_node) { if (acptr->srvptr != server || - (IsULine(acptr) && !IsOper(cptr) && HIDE_ULINES)) + (IsULine(acptr) && HIDE_ULINES && !OperClass_evaluateACLPath("map:ulines",cptr,NULL,NULL,NULL))) continue; acptr->flags |= FLAGS_MAP; cnt++; @@ -116,7 +116,7 @@ static void dump_map(aClient *cptr, aClient *server, char *mask, int prompt_leng list_for_each_entry(acptr, &global_server_list, client_node) { - if (IsULine(acptr) && HIDE_ULINES && !IsAnOper(cptr)) + if (IsULine(acptr) && HIDE_ULINES && !OperClass_evaluateACLPath("map:ulines",cptr,NULL,NULL,NULL)) continue; if (acptr->srvptr != server) continue; @@ -137,7 +137,7 @@ char buf[4]; aClient *acptr; int cnt = 0, hide_ulines; - hide_ulines = (HIDE_ULINES && !IsOper(cptr)) ? 1 : 0; + hide_ulines = (HIDE_ULINES && !OperClass_evaluateACLPath("map:ulines",cptr,NULL,NULL,NULL)) ? 1 : 0; sendto_one(cptr, rpl_str(RPL_MAP), me.name, cptr->name, "", length, server->name, server->serv->users); @@ -184,7 +184,7 @@ DLLFUNC CMD_FUNC(m_map) if (longest > 60) longest = 60; longest += 2; - if (FLAT_MAP && !IsAnOper(sptr)) + if (FLAT_MAP && !OperClass_evaluateACLPath("map:real-map",sptr,NULL,NULL,NULL)) dump_flat_map(sptr, &me, longest); else dump_map(sptr, &me, "*", 0, longest); diff --git a/src/modules/m_message.c b/src/modules/m_message.c index 03d4c616c..414795453 100644 --- a/src/modules/m_message.c +++ b/src/modules/m_message.c @@ -313,7 +313,7 @@ DLLFUNC int m_message(aClient *cptr, aClient *sptr, int parc, char *parv[], int if (prefix) { - if (MyClient(sptr) && !op_can_override(sptr)) + if (MyClient(sptr) && !op_can_override("override:message:prefix",sptr,chptr,NULL)) { Membership *lp = find_membership_link(sptr->user->channel, chptr); /* Check if user is allowed to send. RULES: @@ -665,13 +665,10 @@ int size_string, ret; sptr->name, displayfile, target, fl->reason); sendto_one(sptr, ":%s NOTICE %s :*** You have been blocked from sending files, reconnect to regain permission to send files", me.name, sptr->name); - - sendto_umode(UMODE_VICTIM, - "%s tried to send forbidden file %s (%s) to %s (is blocked now)", - sptr->name, displayfile, fl->reason, target); - sendto_server(NULL, 0, 0, ":%s SMO v :%s tried to send forbidden file %s (%s) to %s (is blocked now)", - me.name, sptr->name, displayfile, fl->reason, target); sptr->flags |= FLAGS_DCCBLOCK; + + RunHook5(HOOKTYPE_DCC_DENIED, sptr, target, realfile, displayfile, fl); + return 0; /* block */ } @@ -751,13 +748,6 @@ int size_string; "more information on using the dccallow system by typing '/DCCALLOW HELP'", from->name); } - /* if (SHOW_ALLDENIEDDCCS) */ - if (0) - { - sendto_umode(UMODE_VICTIM, - "[DCCALLOW] %s tried to send forbidden file %s (%s) to %s", - from->name, displayfile, fl->reason, to->name); - } return 0; } } diff --git a/src/modules/m_mode.c b/src/modules/m_mode.c index a1e18aed5..315c2e271 100644 --- a/src/modules/m_mode.c +++ b/src/modules/m_mode.c @@ -265,7 +265,7 @@ CMD_FUNC(m_mode) #ifndef NO_OPEROVERRIDE if (IsPerson(sptr) && !IsULine(sptr) && !is_chan_op(sptr, chptr) && !is_half_op(sptr, chptr) && (MyClient(sptr) ? (IsOper(sptr) && - OPCanOverride(sptr)) : IsOper(sptr))) + OperClass_evaluateACLPath("override:mode",sptr,NULL,chptr,NULL)) : IsOper(sptr))) { sendts = 0; opermode = 1; @@ -274,7 +274,7 @@ CMD_FUNC(m_mode) if (IsPerson(sptr) && !IsULine(sptr) && !is_chan_op(sptr, chptr) && is_half_op(sptr, chptr) && (MyClient(sptr) ? (IsOper(sptr) && - OPCanOverride(sptr)) : IsOper(sptr))) + OperClass_evaluateACLPath("override:mode",sptr,NULL,chptr,NULL)) : IsOper(sptr))) { opermode = 2; goto aftercheck; @@ -283,7 +283,7 @@ CMD_FUNC(m_mode) if (IsPerson(sptr) && !IsULine(sptr) && !is_chan_op(sptr, chptr) && !is_half_op(sptr, chptr) - && (cptr == sptr || !IsSAdmin(sptr) || !IsOper(sptr))) + && (cptr == sptr || !OperClass_evaluateACLPath("override:mode",sptr,NULL,chptr,NULL) || !IsOper(sptr))) { if (cptr == sptr) { @@ -768,8 +768,6 @@ int do_mode_char(aChannel *chptr, long modetype, char modechar, char *param, u_int *pcount, char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], char bounce, long my_access) { aCtab *tab = &cFlagTab[0]; - - int retval = 0; Member *member = NULL; Membership *membership = NULL; @@ -777,15 +775,14 @@ int do_mode_char(aChannel *chptr, long modetype, char modechar, char *param, unsigned int tmp = 0; char tmpbuf[512], *tmpstr; char tc = ' '; /* */ - int chasing, x; + int chasing = 0, x; int xxi, xyi, xzi, hascolon; char *xp; int notsecure; - chasing = 0; Hook *h; if ((my_access & CHFL_HALFOP) && !is_xchanop(my_access) && !IsULine(cptr) - && !op_can_override(cptr) && !samode_in_progress) + && !op_can_override("override:mode",cptr,chptr,&modetype) && !samode_in_progress) { if (MyClient(cptr) && (modetype == MODE_HALFOP) && (what == MODE_DEL) && param && (find_client(param, NULL) == cptr)) @@ -857,7 +854,7 @@ int do_mode_char(aChannel *chptr, long modetype, char modechar, char *param, REQUIRE_PARAMETER() if (!IsULine(cptr) && !IsServer(cptr) && !is_chanowner(cptr, chptr) && !samode_in_progress) { - if (MyClient(cptr) && !op_can_override(cptr)) + if (MyClient(cptr) && !op_can_override("override:mode",cptr,chptr,&modetype)) { sendto_one(cptr, err_str(ERR_CHANOWNPRIVNEEDED), me.name, cptr->name, chptr->chname); break; @@ -874,7 +871,7 @@ int do_mode_char(aChannel *chptr, long modetype, char modechar, char *param, if (!IsULine(cptr) && !IsServer(cptr) && !is_chanowner(cptr, chptr) && !samode_in_progress && !(param && (what == MODE_DEL) && (find_client(param, NULL) == cptr))) { - if (MyClient(cptr) && !op_can_override(cptr)) + if (MyClient(cptr) && !op_can_override("override:mode",cptr,chptr,&modetype)) { sendto_one(cptr, err_str(ERR_CHANOWNPRIVNEEDED), me.name, cptr->name, chptr->chname); break; @@ -943,7 +940,7 @@ int do_mode_char(aChannel *chptr, long modetype, char modechar, char *param, /* This probably should work but is completely untested (the operoverride stuff, I mean): */ if (ret == EX_DENY) { - if (!op_can_override(cptr)) + if (!op_can_override("override:mode:del",cptr,chptr,&modetype)) { if (MyClient(cptr) && badmode) sendto_one(cptr, "%s", badmode); /* send error message, if any */ @@ -970,7 +967,7 @@ int do_mode_char(aChannel *chptr, long modetype, char modechar, char *param, /* Need this !op_can_override() here again, even with the !opermode * check a few lines up, all due to halfops. -- Syzop */ - if (!op_can_override(cptr)) + if (!op_can_override("override:mode:del",cptr,chptr,&modetype)) { char errbuf[NICKLEN+30]; ircsnprintf(errbuf, sizeof(errbuf), "%s is a channel owner", member->cptr->name); @@ -996,7 +993,7 @@ int do_mode_char(aChannel *chptr, long modetype, char modechar, char *param, /* Need this !op_can_override() here again, even with the !opermode * check a few lines up, all due to halfops. -- Syzop */ - if (!op_can_override(cptr)) + if (!op_can_override("override:mode:del",cptr,chptr,&modetype)) { char errbuf[NICKLEN+30]; ircsnprintf(errbuf, sizeof(errbuf), "%s is a channel admin", member->cptr->name); @@ -1256,7 +1253,7 @@ char *morphed; { x = handler->is_ok(cptr, chptr, mode, param, EXCHK_ACCESS, what); if ((x == EX_ALWAYS_DENY) || - ((x == EX_DENY) && !op_can_override(cptr) && !samode_in_progress)) + ((x == EX_DENY) && !op_can_override("override:mode:del",cptr,chptr,handler) && !samode_in_progress)) { handler->is_ok(cptr, chptr, mode, param, EXCHK_ACCESS_ERR, what); return paracnt; /* Denied & error msg sent */ @@ -1265,7 +1262,7 @@ char *morphed; opermode = 1; /* override in progress... */ } else { /* remote user: we only need to check if we need to generate an operoverride msg */ - if (!IsULine(cptr) && IsPerson(cptr) && op_can_override(cptr) && + if (!IsULine(cptr) && IsPerson(cptr) && op_can_override("override:mode:del",cptr,chptr,handler) && (handler->is_ok(cptr, chptr, mode, param, EXCHK_ACCESS, what) != EX_ALLOW)) opermode = 1; /* override in progress... */ } @@ -1741,64 +1738,24 @@ DLLFUNC CMD_FUNC(_m_umode) break; } /* switch */ } /* for */ - /* - * stop users making themselves operators too easily - */ - if (!(setflags & UMODE_OPER) && IsOper(sptr) && !IsServer(cptr)) - ClearOper(sptr); - if (!(setflags & UMODE_LOCOP) && IsLocOp(sptr) && !IsServer(cptr)) - sptr->umodes &= ~UMODE_LOCOP; - - /* - * Let only operators set FloodF, ClientF; also - * remove those flags if they've gone -o/-O. - * FloodF sends notices about possible flooding -Cabal95 - * ClientF sends notices about clients connecting or exiting - * Admin is for server admins - */ - if (!IsAnOper(sptr) && !IsServer(cptr)) + /* Don't let non-ircops set ircop-only modes or snomasks */ + if (MyClient(sptr) && !IsAnOper(sptr)) { - ClearAdmin(sptr); - ClearSAdmin(sptr); - ClearNetAdmin(sptr); - ClearHideOper(sptr); - ClearCoAdmin(sptr); - ClearFailops(sptr); + remove_oper_modes(sptr); + remove_oper_snomasks(sptr); } - /* - * New oper access flags - Only let them set certian usermodes on - * themselves IF they have access to set that specific mode in their - * O:Line. - */ + /* Below can be removed after Heero is done with the new oper system and this shit is gone :D */ if (MyClient(sptr)) { if (IsAnOper(sptr)) { - if (IsAdmin(sptr) && !OPIsAdmin(sptr)) - ClearAdmin(sptr); - if (IsSAdmin(sptr) && !OPIsSAdmin(sptr)) - ClearSAdmin(sptr); - if (IsNetAdmin(sptr) && !OPIsNetAdmin(sptr)) - ClearNetAdmin(sptr); - if (IsCoAdmin(sptr) && !OPIsCoAdmin(sptr)) - ClearCoAdmin(sptr); if (MyClient(sptr) && (sptr->umodes & UMODE_SECURE) && !IsSecure(sptr)) sptr->umodes &= ~UMODE_SECURE; } - /* - This is to remooove the kix bug.. and to protect some stuffie - -techie - */ - if (MyClient(sptr)) - { - if ((sptr->umodes & UMODE_SECURE) && !IsSecure(sptr)) - sptr->umodes &= ~UMODE_SECURE; - if (!(sptr->umodes & UMODE_SECURE) && IsSecure(sptr)) - sptr->umodes |= UMODE_SECURE; - } } + /* If user was +x and does MODE -x then set -t as well */ if ((setflags & UMODE_HIDE) && !IsHidden(sptr)) sptr->umodes &= ~UMODE_SETHOST; @@ -1863,7 +1820,6 @@ DLLFUNC CMD_FUNC(_m_umode) MyConnect(sptr)) { list_del(&sptr->special_node); - sptr->oflag = 0; remove_oper_snomasks(sptr); RunHook2(HOOKTYPE_LOCAL_OPER, sptr, 0); } diff --git a/src/modules/m_nachat.c b/src/modules/m_nachat.c deleted file mode 100644 index 411002e07..000000000 --- a/src/modules/m_nachat.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Unreal Internet Relay Chat Daemon, src/modules/m_nachat.c - * (C) 2000-2001 Carsten V. Munk and the UnrealIRCd Team - * Moved to modules by Fish (Justin Hammond) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 1, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "config.h" -#include "struct.h" -#include "common.h" -#include "sys.h" -#include "numeric.h" -#include "msg.h" -#include "channel.h" -#include -#include -#include -#include -#include -#ifdef _WIN32 -#include -#endif -#include -#include "h.h" -#include "proto.h" -#ifdef _WIN32 -#include "version.h" -#endif - -DLLFUNC int m_nachat(aClient *cptr, aClient *sptr, int parc, char *parv[]); - -/* Place includes here */ -#define MSG_NACHAT "NACHAT" /* netadmin chat */ - -ModuleHeader MOD_HEADER(m_nachat) - = { - "Nachat", /* Name of module */ - "$Id$", /* Version */ - "command /nachat", /* Short description of module */ - "3.2-b8-1", - NULL - }; - -/* This is called on module init, before Server Ready */ -DLLFUNC int MOD_INIT(m_nachat)(ModuleInfo *modinfo) -{ - CommandAdd(modinfo->handle, MSG_NACHAT, m_nachat, 1, 0); - MARK_AS_OFFICIAL_MODULE(modinfo); - return MOD_SUCCESS; -} - -/* Is first run when server is 100% ready */ -DLLFUNC int MOD_LOAD(m_nachat)(int module_load) -{ - return MOD_SUCCESS; -} - -/* Called when module is unloaded */ -DLLFUNC int MOD_UNLOAD(m_nachat)(int module_unload) -{ - return MOD_SUCCESS; -} - -/* -** m_nachat (netAdmin chat only) -Potvin - another sts cloning -** parv[0] = sender prefix -** parv[1] = message text -*/ -DLLFUNC int m_nachat(aClient *cptr, aClient *sptr, int parc, char *parv[]) -{ - char *message; - - - message = parc > 1 ? parv[1] : NULL; - - if (BadPtr(message)) - { - sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), - me.name, parv[0], "NACHAT"); - return 0; - } -#ifdef ADMINCHAT - if (MyClient(sptr)) - if (!IsNetAdmin(sptr)) -#else - if (MyClient(sptr)) -#endif - { - sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); - return 0; - } - - sendto_server(IsServer(cptr) ? cptr : NULL, 0, 0, ":%s NACHAT :%s", - parv[0], message); -#ifdef ADMINCHAT - sendto_umode(UMODE_NETADMIN, "*** NetAdmin.Chat -- from %s: %s", - parv[0], message); -#endif - return 0; -} diff --git a/src/modules/m_names.c b/src/modules/m_names.c index 6a0681b05..14c68850e 100644 --- a/src/modules/m_names.c +++ b/src/modules/m_names.c @@ -123,7 +123,7 @@ DLLFUNC CMD_FUNC(m_names) chptr = find_channel(para, (aChannel *)NULL); - if (!chptr || (!ShowChannel(sptr, chptr) && !OPCanSeeSecret(sptr))) + if (!chptr || (!ShowChannel(sptr, chptr) && !OperClass_evaluateACLPath("override:see:names:secret",sptr,NULL,chptr,NULL))) { sendto_one(sptr, rpl_str(RPL_ENDOFNAMES), me.name, parv[0], para); @@ -157,7 +157,7 @@ DLLFUNC CMD_FUNC(m_names) for (cm = chptr->members; cm; cm = cm->next) { acptr = cm->cptr; - if (IsInvisible(acptr) && !member && !IsNetAdmin(sptr)) + if (IsInvisible(acptr) && !member && !OperClass_evaluateACLPath("override:see:names:invisible",sptr,acptr,chptr,NULL)) continue; for (h = Hooks[HOOKTYPE_VISIBLE_IN_CHANNEL]; h; h = h->next) diff --git a/src/modules/m_nick.c b/src/modules/m_nick.c index 65bbd9e11..87c64499d 100644 --- a/src/modules/m_nick.c +++ b/src/modules/m_nick.c @@ -421,7 +421,7 @@ DLLFUNC CMD_FUNC(m_nick) else strlcpy(nick, parv[1], NICKLEN + 1); - if (MyConnect(sptr) && sptr->user && !IsAnOper(sptr)) + if (MyConnect(sptr) && sptr->user && !OperClass_evaluateACLPath("immune:limits",sptr,NULL,NULL,NULL)) { if ((sptr->user->flood.nick_c >= NICK_COUNT) && (TStime() - sptr->user->flood.nick_t < NICK_PERIOD)) diff --git a/src/modules/m_oper.c b/src/modules/m_oper.c index 9e5d5bbc7..4266bbeb7 100644 --- a/src/modules/m_oper.c +++ b/src/modules/m_oper.c @@ -47,52 +47,6 @@ DLLFUNC int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[]); /* Place includes here */ #define MSG_OPER "OPER" /* OPER */ -typedef struct oper_oflag_ { - unsigned long oflag; - long* umode; /* you just HAD to make them variables */ - char** host; - char* announce; -} oper_oflag_t; - -static oper_oflag_t oper_oflags[10]; - -static void init_operflags() -{ - oper_oflags[0].oflag = OFLAG_NETADMIN; - oper_oflags[0].umode = &UMODE_NETADMIN; - oper_oflags[0].host = &netadmin_host; - oper_oflags[0].announce = "is now a network administrator (N)"; - oper_oflags[1].oflag = OFLAG_SADMIN; - oper_oflags[1].umode = &UMODE_SADMIN; - oper_oflags[1].host = &sadmin_host; - oper_oflags[1].announce = "is now a services administrator (a)"; - oper_oflags[2].oflag = OFLAG_ADMIN; - oper_oflags[2].umode = &UMODE_ADMIN; - oper_oflags[2].host = &admin_host; - oper_oflags[2].announce = "is now a server admin (A)"; - oper_oflags[3].oflag = OFLAG_COADMIN; - oper_oflags[3].umode = &UMODE_COADMIN; - oper_oflags[3].host = &coadmin_host; - oper_oflags[3].announce = "is now a co administrator (C)"; - oper_oflags[4].oflag = OFLAG_ISGLOBAL; - oper_oflags[4].umode = &UMODE_OPER; - oper_oflags[4].host = &oper_host; - oper_oflags[4].announce = "is now an operator (O)"; - oper_oflags[5].oflag= OFLAG_GLOBOP; - oper_oflags[5].umode = &UMODE_FAILOP; - oper_oflags[5].host = NULL; - oper_oflags[5].announce = NULL; - oper_oflags[6].oflag = OFLAG_WALLOP; - oper_oflags[6].umode = &UMODE_WALLOP; - oper_oflags[6].host = NULL; - oper_oflags[6].announce = NULL; - oper_oflags[7].oflag = 0; - oper_oflags[7].umode = NULL; - oper_oflags[7].host = NULL; - oper_oflags[7].announce = NULL; -} - - ModuleHeader MOD_HEADER(m_oper) = { "oper", /* Name of module */ @@ -113,7 +67,6 @@ DLLFUNC int MOD_INIT(m_oper)(ModuleInfo *modinfo) /* Is first run when server is 100% ready */ DLLFUNC int MOD_LOAD(m_oper)(int module_load) { - init_operflags(); return MOD_SUCCESS; } @@ -149,12 +102,12 @@ void set_oper_host(aClient *sptr, char *host) ** parv[2] = oper password */ -DLLFUNC int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[]) { +DLLFUNC int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[]) +{ ConfigItem_oper *aconf; char *name, *password; - char* host = 0; int i = 0, j = 0; - char* announce = 0; + long old; /* old user modes */ if (!MyClient(sptr)) return 0; @@ -174,13 +127,15 @@ DLLFUNC int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[]) { if (IsAnOper(sptr)) { sendto_one(sptr, rpl_str(RPL_YOUREOPER), me.name, parv[0]); + // TODO: de-confuse this ? ;) return 0; } name = parv[1]; password = (parc >= 2) ? parv[2] : ""; - if (!(aconf = Find_oper(name))) { + if (!(aconf = Find_oper(name))) + { sendto_one(sptr, err_str(ERR_NOOPERHOST), me.name, parv[0]); sendto_snomask_global (SNO_OPER, "Failed OPER attempt by %s (%s@%s) [unknown oper]", @@ -204,152 +159,6 @@ DLLFUNC int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[]) { } i = Auth_Check(cptr, aconf->auth, password); - if (i > 1) - { - int old = (sptr->umodes & ALL_UMODES); - - /* Check oper::require_modes */ - if (aconf->require_modes & ~sptr->umodes) - { - sendto_one(sptr, ":%s %d %s :You are missing user modes required to OPER", me.name, ERR_NOOPERHOST, parv[0]); - sendto_snomask_global - (SNO_OPER, "Failed OPER attempt by %s (%s@%s) [lacking modes '%s' in oper::require-modes]", - parv[0], sptr->user->username, sptr->sockhost, get_modestr(aconf->require_modes & ~sptr->umodes)); - ircd_log(LOG_OPER, "OPER MISSINGMODES (%s) by (%s!%s@%s), needs modes=%s", - name, parv[0], sptr->user->username, sptr->sockhost, - get_modestr(aconf->require_modes & ~sptr->umodes)); - sptr->since += 7; - return 0; - } - - if (aconf->maxlogins && (count_oper_sessions(aconf->name) >= aconf->maxlogins)) - { - sendto_one(sptr, err_str(ERR_NOOPERHOST), me.name, parv[0]); - sendto_one(sptr, ":%s NOTICE %s :Your maximum number of concurrent oper logins has been reached (%d)", - me.name, sptr->name, aconf->maxlogins); - sendto_snomask_global - (SNO_OPER, "Failed OPER attempt by %s (%s@%s) using UID %s [maxlogins reached]", - parv[0], sptr->user->username, sptr->sockhost, name); - ircd_log(LOG_OPER, "OPER TOOMANYLOGINS (%s) by (%s!%s@%s)", name, parv[0], - sptr->user->username, sptr->sockhost); - sptr->since += 4; - return 0; - } - - if (sptr->user->operlogin) - MyFree(sptr->user->operlogin); - sptr->user->operlogin = strdup(aconf->name); - - /* Put in the right class */ - if (sptr->class) - sptr->class->clients--; - - sptr->class = aconf->class; - sptr->class->clients++; - sptr->oflag = 0; - if (aconf->swhois) { - if (sptr->user->swhois) - MyFree(sptr->user->swhois); - sptr->user->swhois = strdup(aconf->swhois); - sendto_server(cptr, 0, 0, ":%s SWHOIS %s :%s", - me.name, sptr->name, aconf->swhois); - } - -/* new oper code */ - - if (aconf->modes) - sptr->umodes |= aconf->modes; - else - sptr->umodes |= OPER_MODES; - -/* handle oflags that trigger umodes */ - - while(oper_oflags[j].umode) { - if(aconf->oflags & oper_oflags[j].oflag) { /* we match this oflag */ - if (!announce && oper_oflags[j].announce) { /* we haven't matched an oper_type yet */ - host = *oper_oflags[j].host; /* set the iNAH host */ - announce = oper_oflags[j].announce; /* set the announcement */ - } - sptr->umodes |= - *oper_oflags[j].umode; /* add the umode for this oflag */ - } - j++; - } - - sptr->oflag = aconf->oflags; - if ((aconf->oflags & OFLAG_HIDE) && iNAH && !BadPtr(host)) { - set_oper_host(sptr, host); - } else - if (IsHidden(sptr) && !sptr->user->virthost) { - /* +x has just been set by modes-on-oper and iNAH is off */ - sptr->user->virthost = strdup(sptr->user->cloakedhost); - } - - if (!IsOper(sptr)) - { - sptr->umodes |= UMODE_LOCOP; - if ((aconf->oflags & OFLAG_HIDE) && iNAH && !BadPtr(locop_host)) { - set_oper_host(sptr, locop_host); - } else - if (IsHidden(sptr) && !sptr->user->virthost) { - /* +x has just been set by modes-on-oper and iNAH is off */ - sptr->user->virthost = strdup(sptr->user->cloakedhost); - } - sendto_snomask(SNO_OPER, "%s (%s@%s) is now a local operator (o)", - parv[0], sptr->user->username, sptr->sockhost); - } - - - if (announce != NULL) - sendto_snomask_global(SNO_OPER, - "%s (%s@%s) [%s] %s", - parv[0], sptr->user->username, sptr->sockhost, - parv[1], announce); - if (aconf->snomask) - set_snomask(sptr, aconf->snomask); - else - set_snomask(sptr, OPER_SNOMASK); - if (sptr->user->snomask) - { - sptr->user->snomask |= SNO_SNOTICE; /* set +s if needed */ - sptr->umodes |= UMODE_SERVNOTICE; - } - /* This is for users who have both 'admin' and 'coadmin' in their conf */ - if (IsCoAdmin(sptr) && IsAdmin(sptr)) - { - sptr->umodes &= ~UMODE_COADMIN; - sptr->oflag &= ~OFLAG_COADMIN; - } - send_umode_out(cptr, sptr, old); - sendto_one(sptr, rpl_str(RPL_SNOMASK), - me.name, parv[0], get_sno_str(sptr)); - - list_add(&sptr->special_node, &oper_list); - - RunHook2(HOOKTYPE_LOCAL_OPER, sptr, 1); - sendto_one(sptr, rpl_str(RPL_YOUREOPER), me.name, parv[0]); - if (IsInvisible(sptr) && !(old & UMODE_INVISIBLE)) - IRCstats.invisible++; - if (IsOper(sptr) && !IsHideOper(sptr)) - IRCstats.operators++; - - if (SHOWOPERMOTD == 1) - do_cmd(cptr, sptr, "OPERMOTD", parc, parv); - if (!BadPtr(OPER_AUTO_JOIN_CHANS) - && strcmp(OPER_AUTO_JOIN_CHANS, "0")) - { - char *chans[3] = { - sptr->name, - OPER_AUTO_JOIN_CHANS, - NULL - }; - if (do_cmd(cptr, sptr, "JOIN", 3, chans) == FLUSH_BUFFER) - return FLUSH_BUFFER; - } - ircd_log(LOG_OPER, "OPER (%s) by (%s!%s@%s)", name, parv[0], sptr->user->username, - sptr->sockhost); - - } if (i == -1) { sendto_one(sptr, err_str(ERR_PASSWDMISMATCH), me.name, parv[0]); @@ -362,7 +171,135 @@ DLLFUNC int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[]) { (SNO_OPER, "Failed OPER attempt by %s (%s@%s) using UID %s [FAILEDAUTH]", parv[0], sptr->user->username, sptr->sockhost, name); sptr->since += 7; + return 0; } - /* Belay that order, number One. (-2) */ + + if (i < 2) + return 0; /* anything below 2 means 'not really authenticated' */ + + /* Authentication of the oper succeeded (like, password, ssl cert), + * but we still have some other restrictions to check below as well, + * like 'require-modes' and 'maxlogins'... + */ + + /* Check oper::require_modes */ + if (aconf->require_modes & ~sptr->umodes) + { + sendto_one(sptr, ":%s %d %s :You are missing user modes required to OPER", me.name, ERR_NOOPERHOST, parv[0]); + sendto_snomask_global + (SNO_OPER, "Failed OPER attempt by %s (%s@%s) [lacking modes '%s' in oper::require-modes]", + parv[0], sptr->user->username, sptr->sockhost, get_modestr(aconf->require_modes & ~sptr->umodes)); + ircd_log(LOG_OPER, "OPER MISSINGMODES (%s) by (%s!%s@%s), needs modes=%s", + name, parv[0], sptr->user->username, sptr->sockhost, + get_modestr(aconf->require_modes & ~sptr->umodes)); + sptr->since += 7; + return 0; + } + + if (aconf->maxlogins && (count_oper_sessions(aconf->name) >= aconf->maxlogins)) + { + sendto_one(sptr, err_str(ERR_NOOPERHOST), me.name, parv[0]); + sendto_one(sptr, ":%s NOTICE %s :Your maximum number of concurrent oper logins has been reached (%d)", + me.name, sptr->name, aconf->maxlogins); + sendto_snomask_global + (SNO_OPER, "Failed OPER attempt by %s (%s@%s) using UID %s [maxlogins reached]", + parv[0], sptr->user->username, sptr->sockhost, name); + ircd_log(LOG_OPER, "OPER TOOMANYLOGINS (%s) by (%s!%s@%s)", name, parv[0], + sptr->user->username, sptr->sockhost); + sptr->since += 4; + return 0; + } + + /* /OPER really succeeded now. Start processing it. */ + + /* Store which oper block was used to become IRCOp (for maxlogins and whois) */ + safefree(sptr->user->operlogin); + sptr->user->operlogin = strdup(aconf->name); + + /* Put in the right class */ + if (sptr->class) + sptr->class->clients--; + sptr->class = aconf->class; + sptr->class->clients++; + + /* oper::swhois */ + if (aconf->swhois) + { + safefree(sptr->user->swhois); + sptr->user->swhois = strdup(aconf->swhois); + sendto_server(cptr, 0, 0, ":%s SWHOIS %s :%s", + me.name, sptr->name, aconf->swhois); + } + + /* set oper user modes */ + sptr->umodes |= UMODE_OPER; + if (aconf->modes) + sptr->umodes |= aconf->modes; /* oper::modes */ + else + sptr->umodes |= OPER_MODES; /* set::modes-on-oper */ + + /* oper::vhost */ + if (aconf->vhost) + { + set_oper_host(sptr, aconf->vhost); + } else + if (IsHidden(sptr) && !sptr->user->virthost) + { + /* +x has just been set by modes-on-oper and no vhost. cloak the oper! */ + sptr->user->virthost = strdup(sptr->user->cloakedhost); + } + + sendto_snomask_global(SNO_OPER, + "%s (%s@%s) [%s] is now an operator", + parv[0], sptr->user->username, sptr->sockhost, + parv[1]); + + ircd_log(LOG_OPER, "OPER (%s) by (%s!%s@%s)", name, parv[0], sptr->user->username, + sptr->sockhost); + + /* set oper snomasks */ + if (aconf->snomask) + set_snomask(sptr, aconf->snomask); /* oper::snomask */ + else + set_snomask(sptr, OPER_SNOMASK); /* set::snomask-on-oper */ + + /* some magic to set user mode +s (and snomask +s) if you have any snomasks set */ + if (sptr->user->snomask) + { + sptr->user->snomask |= SNO_SNOTICE; + sptr->umodes |= UMODE_SERVNOTICE; + } + + old = (sptr->umodes & ALL_UMODES); + send_umode_out(cptr, sptr, old); + sendto_one(sptr, rpl_str(RPL_SNOMASK), + me.name, parv[0], get_sno_str(sptr)); + + list_add(&sptr->special_node, &oper_list); + + RunHook2(HOOKTYPE_LOCAL_OPER, sptr, 1); + + sendto_one(sptr, rpl_str(RPL_YOUREOPER), me.name, parv[0]); + + /* Update statistics */ + if (IsInvisible(sptr) && !(old & UMODE_INVISIBLE)) + IRCstats.invisible++; + if (IsOper(sptr) && !IsHideOper(sptr)) + IRCstats.operators++; + + if (SHOWOPERMOTD == 1) + do_cmd(cptr, sptr, "OPERMOTD", parc, parv); + + if (!BadPtr(OPER_AUTO_JOIN_CHANS) && strcmp(OPER_AUTO_JOIN_CHANS, "0")) + { + char *chans[3] = { + sptr->name, + OPER_AUTO_JOIN_CHANS, + NULL + }; + if (do_cmd(cptr, sptr, "JOIN", 3, chans) == FLUSH_BUFFER) + return FLUSH_BUFFER; + } + return 0; } diff --git a/src/modules/m_rping.c b/src/modules/m_rping.c index b6f675d95..7c629aa85 100644 --- a/src/modules/m_rping.c +++ b/src/modules/m_rping.c @@ -99,7 +99,7 @@ DLLFUNC int m_rping(aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; - if (!IsPrivileged(sptr)) + if (!IsServer(sptr) && !OperClass_evaluateACLPath("server:rping",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; diff --git a/src/modules/m_sajoin.c b/src/modules/m_sajoin.c index 2d9a452a3..47d25f3af 100644 --- a/src/modules/m_sajoin.c +++ b/src/modules/m_sajoin.c @@ -98,7 +98,7 @@ DLLFUNC CMD_FUNC(m_sajoin) } /* Is this user disallowed from operating on this victim at all? */ - if (!IsSAdmin(sptr) && !IsULine(sptr) && !OperClass_evaluateACLPath("sajoin",sptr,acptr,NULL,NULL)) + if (!IsULine(sptr) && !OperClass_evaluateACLPath("sajoin",sptr,acptr,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; @@ -139,7 +139,7 @@ DLLFUNC CMD_FUNC(m_sajoin) chptr = get_channel(acptr, name, 0); /* If this _specific_ channel is not permitted, skip it */ - if (!IsSAdmin(sptr) && !IsULine(sptr) && !OperClass_evaluateACLPath("sajoin",sptr,acptr,chptr,NULL)) + if (!IsULine(sptr) && !OperClass_evaluateACLPath("sajoin",sptr,acptr,chptr,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); continue; diff --git a/src/modules/m_samode.c b/src/modules/m_samode.c index fc2f2004d..f448239aa 100644 --- a/src/modules/m_samode.c +++ b/src/modules/m_samode.c @@ -95,7 +95,7 @@ DLLFUNC CMD_FUNC(m_samode) return 0; } - if ((!IsPrivileged(cptr) || !IsSAdmin(sptr)) && !OperClass_evaluateACLPath("samode",sptr,NULL,chptr,NULL)) + if (!OperClass_evaluateACLPath("samode",sptr,NULL,chptr,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; diff --git a/src/modules/m_sapart.c b/src/modules/m_sapart.c index a5421c87b..c7a113abe 100644 --- a/src/modules/m_sapart.c +++ b/src/modules/m_sapart.c @@ -105,7 +105,7 @@ DLLFUNC CMD_FUNC(m_sapart) } /* See if we can operate on this vicim/this command */ - if (!IsSAdmin(sptr) && !IsULine(sptr) && !OperClass_evaluateACLPath("sapart",sptr,acptr,NULL,NULL)) + if (!IsULine(sptr) && !OperClass_evaluateACLPath("sapart",sptr,acptr,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; @@ -127,7 +127,7 @@ DLLFUNC CMD_FUNC(m_sapart) } /* Validate oper can do this on chan/victim */ - if (!IsSAdmin(sptr) && !IsULine(sptr) && !OperClass_evaluateACLPath("sapart",sptr,acptr,chptr,NULL)) + if (!IsULine(sptr) && !OperClass_evaluateACLPath("sapart",sptr,acptr,chptr,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); continue; diff --git a/src/modules/m_sdesc.c b/src/modules/m_sdesc.c index 60724bc44..9bc2e40f4 100644 --- a/src/modules/m_sdesc.c +++ b/src/modules/m_sdesc.c @@ -81,7 +81,7 @@ DLLFUNC int MOD_UNLOAD(m_sdesc)(int module_unload) int m_sdesc(aClient *cptr, aClient *sptr, int parc, char *parv[]) { - if (!IsAdmin(sptr) && !IsCoAdmin(sptr) && !OperClass_evaluateACLPath("add:description",sptr,NULL,NULL,NULL)) + if (!OperClass_evaluateACLPath("server:description",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name); return 0; diff --git a/src/modules/m_server.c b/src/modules/m_server.c index 45f7bc06f..2b7cbdd42 100644 --- a/src/modules/m_server.c +++ b/src/modules/m_server.c @@ -670,7 +670,7 @@ int m_server_synch(aClient *cptr, ConfigItem_link *aconf) * Yeah.. there are still other cases when non-SSL links are fine (eg: local IP * of the same machine), we won't bother with detecting that. -- Syzop */ - if (strcmp(cptr->sockhost, "localhost")) + if (!IsLocal(cptr)) { sendto_realops("\002WARNING:\002 This link is unencrypted (non-SSL). We highly recommend to use " "SSL server linking. See https://www.unrealircd.org/docs/Linking_servers"); diff --git a/src/modules/m_squit.c b/src/modules/m_squit.c index 010df8f83..c28028ea3 100644 --- a/src/modules/m_squit.c +++ b/src/modules/m_squit.c @@ -85,7 +85,7 @@ CMD_FUNC(m_squit) parv[parc - 1] : cptr->name; - if (!IsPrivileged(sptr)) + if (!IsServer(sptr) && !OperClass_evaluateACLPath("route:local",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; @@ -146,8 +146,8 @@ CMD_FUNC(m_squit) me.name, parv[0], server); return 0; } - if (MyClient(sptr) && ((!OPCanGRoute(sptr) && !MyConnect(acptr)) || - (!OPCanLRoute(sptr) && MyConnect(acptr)))) + if (MyClient(sptr) && ((!OperClass_evaluateACLPath("route:global",sptr,NULL,NULL,NULL) && !MyConnect(acptr)) || + (!OperClass_evaluateACLPath("route:local",sptr,NULL,NULL,NULL) && MyConnect(acptr)))) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; diff --git a/src/modules/m_stats.c b/src/modules/m_stats.c index 8e9142b0a..e76d3aa74 100644 --- a/src/modules/m_stats.c +++ b/src/modules/m_stats.c @@ -615,7 +615,7 @@ int stats_oper(aClient *sptr, char *para) sendto_one(sptr, rpl_str(RPL_STATSOLINE), me.name, sptr->name, 'O', m->mask, oper_p->name, - oflagstr(oper_p->oflags), + "-", oper_p->class->name? oper_p->class->name : ""); } } @@ -1320,20 +1320,6 @@ int stats_set(aClient *sptr, char *para) sptr->name, SPAMFILTER_EXCEPT); sendto_one(sptr, ":%s %i %s :check-target-nick-bans: %s", me.name, RPL_TEXT, sptr->name, CHECK_TARGET_NICK_BANS ? "yes" : "no"); - sendto_one(sptr, ":%s %i %s :hosts::global: %s", me.name, RPL_TEXT, - sptr->name, oper_host); - sendto_one(sptr, ":%s %i %s :hosts::admin: %s", me.name, RPL_TEXT, - sptr->name, admin_host); - sendto_one(sptr, ":%s %i %s :hosts::local: %s", me.name, RPL_TEXT, - sptr->name, locop_host); - sendto_one(sptr, ":%s %i %s :hosts::servicesadmin: %s", me.name, RPL_TEXT, - sptr->name, sadmin_host); - sendto_one(sptr, ":%s %i %s :hosts::netadmin: %s", me.name, RPL_TEXT, - sptr->name, netadmin_host); - sendto_one(sptr, ":%s %i %s :hosts::coadmin: %s", me.name, RPL_TEXT, - sptr->name, coadmin_host); - sendto_one(sptr, ":%s %i %s :hosts::host-on-oper-up: %i", me.name, RPL_TEXT, sptr->name, - iNAH); RunHook2(HOOKTYPE_STATS, sptr, "S"); return 1; } diff --git a/src/modules/m_svsmode.c b/src/modules/m_svsmode.c index 688bc6b0e..91a87f1d5 100644 --- a/src/modules/m_svsmode.c +++ b/src/modules/m_svsmode.c @@ -469,6 +469,12 @@ int what, setflags; if (MyClient(acptr) && !list_empty(&acptr->special_node)) list_del(&acptr->special_node); + + /* User is no longer oper (after the goto below, anyway)... + * so remove all oper-only modes and snomasks. + */ + remove_oper_modes(acptr); + remove_oper_snomasks(acptr); } goto setmodex; case 'H': diff --git a/src/modules/m_svsnoop.c b/src/modules/m_svsnoop.c index 1f9e4d0be..81463ee7d 100644 --- a/src/modules/m_svsnoop.c +++ b/src/modules/m_svsnoop.c @@ -101,12 +101,7 @@ long oldumodes; list_del(&acptr->special_node); oldumodes = acptr->umodes; - acptr->umodes &= ~(UMODE_OPER | UMODE_LOCOP | - UMODE_SADMIN | UMODE_ADMIN | - UMODE_NETADMIN | - UMODE_DEAF | UMODE_HIDEOPER | UMODE_FAILOP | - UMODE_COADMIN | UMODE_VICTIM); - acptr->oflag = 0; + remove_oper_modes(acptr); remove_oper_snomasks(acptr); send_umode_out(acptr, acptr, oldumodes); RunHook2(HOOKTYPE_LOCAL_OPER, acptr, 0); diff --git a/src/modules/m_svso.c b/src/modules/m_svso.c deleted file mode 100644 index 92b60781a..000000000 --- a/src/modules/m_svso.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * IRC - Internet Relay Chat, src/modules/m_svso.c - * (C) 2001 The UnrealIRCd Team - * - * svso command - * - * See file AUTHORS in IRC package for additional names of - * the programmers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 1, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#include "config.h" -#include "struct.h" -#include "common.h" -#include "sys.h" -#include "numeric.h" -#include "msg.h" -#include "channel.h" -#include -#include -#include -#include -#include -#ifdef _WIN32 -#include -#endif -#include -#include "h.h" -#include "proto.h" -#ifdef _WIN32 -#include "version.h" -#endif - -DLLFUNC int m_svso(aClient *cptr, aClient *sptr, int parc, char *parv[]); - -#define MSG_SVSO "SVSO" - -#define STAR1 OFLAG_SADMIN|OFLAG_ADMIN|OFLAG_NETADMIN|OFLAG_COADMIN -#define STAR2 OFLAG_ZLINE|OFLAG_HIDE -static int oper_access[] = { - ~(STAR1 | STAR2), '*', - OFLAG_LOCAL, 'o', - OFLAG_GLOBAL, 'O', - OFLAG_REHASH, 'r', - OFLAG_DIE, 'D', - OFLAG_RESTART, 'R', - OFLAG_GLOBOP, 'g', - OFLAG_WALLOP, 'w', - OFLAG_LOCOP, 'l', - OFLAG_LROUTE, 'c', - OFLAG_GROUTE, 'L', - OFLAG_LKILL, 'k', - OFLAG_GKILL, 'K', - OFLAG_KLINE, 'b', - OFLAG_UNKLINE, 'B', - OFLAG_LNOTICE, 'n', - OFLAG_GNOTICE, 'G', - OFLAG_ADMIN, 'A', - OFLAG_SADMIN, 'a', - OFLAG_NETADMIN, 'N', - OFLAG_COADMIN, 'C', - OFLAG_ZLINE, 'z', - OFLAG_HIDE, 'H', - OFLAG_TKL, 't', - OFLAG_GZL, 'Z', - OFLAG_OVERRIDE, 'v', - OFLAG_DCCDENY, 'd', - OFLAG_ADDLINE, 'X', - OFLAG_TSCTL, 'T', - 0, 0 -}; - -ModuleHeader MOD_HEADER(m_svso) - = { - "m_svso", - "$Id$", - "command /svso", - "3.2-b8-1", - NULL - }; - -DLLFUNC int MOD_INIT(m_svso)(ModuleInfo *modinfo) -{ - CommandAdd(modinfo->handle, MSG_SVSO, m_svso, MAXPARA, 0); - MARK_AS_OFFICIAL_MODULE(modinfo); - return MOD_SUCCESS; -} - -DLLFUNC int MOD_LOAD(m_svso)(int module_load) -{ - return MOD_SUCCESS; -} - -DLLFUNC int MOD_UNLOAD(m_svso)(int module_unload) -{ - return MOD_SUCCESS; -} -/* -** m_svso - Stskeeps -** parv[0] = sender prefix -** parv[1] = nick -** parv[2] = options -*/ - -int m_svso(aClient *cptr, aClient *sptr, int parc, char *parv[]) -{ - aClient *acptr; - long fLag; - - if (!IsULine(sptr)) - return 0; - - if (parc < 3) - return 0; - - if (!(acptr = find_person(parv[1], (aClient *)NULL))) - return 0; - - if (!MyClient(acptr)) - { - sendto_one(acptr, ":%s SVSO %s %s", parv[0], parv[1], parv[2]); - return 0; - } - - if (*parv[2] == '+') - { - int *i, flag; - char *m = NULL; - for (m = (parv[2] + 1); *m; m++) - { - for (i = oper_access; (flag = *i); i += 2) - { - if (*m == (char) *(i + 1)) - { - acptr->oflag |= flag; - break; - } - } - } - } - if (*parv[2] == '-') - { - fLag = acptr->umodes; - if (IsOper(acptr) && !IsHideOper(acptr)) - { - IRCstats.operators--; - VERIFY_OPERCOUNT(acptr, "svso"); - } - - if (!list_empty(&acptr->special_node)) - list_del(&acptr->special_node); - - acptr->umodes &= ~(UMODE_OPER | UMODE_LOCOP | UMODE_SADMIN | UMODE_ADMIN | UMODE_COADMIN); - acptr->umodes &= ~(UMODE_NETADMIN); - acptr->umodes &= ~(UMODE_DEAF | UMODE_HIDEOPER | UMODE_VICTIM); - acptr->oflag = 0; - remove_oper_snomasks(acptr); - RunHook2(HOOKTYPE_LOCAL_OPER, acptr, 0); - send_umode_out(acptr, acptr, fLag); - } - return 0; -} diff --git a/src/modules/m_tkl.c b/src/modules/m_tkl.c index e8de902f4..496464ded 100644 --- a/src/modules/m_tkl.c +++ b/src/modules/m_tkl.c @@ -193,7 +193,7 @@ DLLFUNC int m_gline(aClient *cptr, aClient *sptr, int parc, char *parv[]) { if (IsServer(sptr)) return 0; - if ((!OPCanTKL(sptr) || !IsOper(sptr)) && !OperClass_evaluateACLPath("gline",sptr,NULL,NULL,NULL)) + if (!OperClass_evaluateACLPath("tkl:gline",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, @@ -220,7 +220,7 @@ DLLFUNC int m_gzline(aClient *cptr, aClient *sptr, int parc, char *parv[]) if (IsServer(sptr)) return 0; - if ((!OPCanGZL(sptr) || !IsOper(sptr)) && !OperClass_evaluateACLPath("zline:global",sptr,NULL,NULL,NULL)) + if (!OperClass_evaluateACLPath("tkl:zline:global",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name); @@ -246,7 +246,7 @@ DLLFUNC int m_shun(aClient *cptr, aClient *sptr, int parc, char *parv[]) if (IsServer(sptr)) return 0; - if ((!OPCanTKL(sptr) || !IsOper(sptr)) && !OperClass_evaluateACLPath("shun",sptr,NULL,NULL,NULL)) + if (!OperClass_evaluateACLPath("tkl:shun",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name); @@ -273,7 +273,7 @@ char *comment = ((parc > 2) && !BadPtr(parv[2])) ? parv[2] : "no reason"; char *name; int remove = 0; - if (MyClient(sptr) && ((!OPCanTKL(sptr) || !IsOper(sptr))) && !OperClass_evaluateACLPath("shun:temporary",sptr,NULL,NULL,NULL)) + if (MyClient(sptr) && (!OperClass_evaluateACLPath("tkl:shun:temporary",sptr,NULL,NULL,NULL))) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name); @@ -310,9 +310,9 @@ int remove = 0; if (IsShunned(acptr)) { sendnotice(sptr, "User '%s' already shunned", acptr->name); - } else if (IsAnOper(acptr)) + } else if (OperClass_evaluateACLPath("immune:shun",acptr,NULL,NULL,NULL)) { - sendnotice(sptr, "You cannot tempshun '%s' because (s)he is an oper", acptr->name); + sendnotice(sptr, "You cannot tempshun '%s' because (s)he is an oper with 'immune:shun' privilege", acptr->name); } else { SetShunned(acptr); @@ -344,7 +344,7 @@ DLLFUNC int m_tkline(aClient *cptr, aClient *sptr, int parc, char *parv[]) if (IsServer(sptr)) return 0; - if ((!OPCanKline(sptr) || !IsAnOper(sptr)) && !OperClass_evaluateACLPath("kline:local",sptr,NULL,NULL,NULL)) + if (!OperClass_evaluateACLPath("tkl:kline:local:add",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name); @@ -393,7 +393,7 @@ DLLFUNC int m_tkline(aClient *cptr, aClient *sptr, int parc, char *parv[]) sptr->name, sptr->user->username, GetHost(sptr)); return 0; } - if (!OPCanUnKline(sptr) && *parv[1] == '-') + if (!OperClass_evaluateACLPath("tkl:kline:remove",sptr,NULL,NULL,NULL) && *parv[1] == '-') { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; @@ -407,7 +407,7 @@ DLLFUNC int m_tzline(aClient *cptr, aClient *sptr, int parc, char *parv[]) if (IsServer(sptr)) return 0; - if ((!OPCanZline(sptr) || !IsAnOper(sptr)) && !OperClass_evaluateACLPath("zline:local",sptr,NULL,NULL,NULL)) + if (!OperClass_evaluateACLPath("tkl:zline:local:add",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name); @@ -764,7 +764,7 @@ char *err = NULL; if (IsServer(sptr)) return 0; - if ((!OPCanTKL(sptr) || !IsOper(sptr)) && !OperClass_evaluateACLPath("spamfilter",sptr,NULL,NULL,NULL)) + if (!OperClass_evaluateACLPath("spamfilter",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name); return 0; @@ -1363,7 +1363,7 @@ int _find_shun(aClient *cptr) if (IsShunned(cptr)) return 1; - if (IsAdmin(cptr)) + if (OperClass_evaluateACLPath("immune:shun",cptr,NULL,NULL,NULL)) return 1; nowtime = TStime(); @@ -1456,7 +1456,7 @@ int _find_spamfilter_user(aClient *sptr, int flags) { char spamfilter_user[NICKLEN + USERLEN + HOSTLEN + REALLEN + 64]; /* n!u@h:r */ - if (IsAnOper(sptr)) + if (OperClass_evaluateACLPath("immune:spamfilter",sptr,NULL,NULL,NULL)) return 0; spamfilter_build_user_string(spamfilter_user, sptr->name, sptr); @@ -2403,7 +2403,7 @@ int _m_tkl(aClient *cptr, aClient *sptr, int parc, char *parv[]) break; case '?': - if (IsAnOper(sptr)) + if (OperClass_evaluateACLPath("server:info",sptr,NULL,NULL,NULL)) tkl_stats(sptr,0,NULL); } return 0; @@ -2621,7 +2621,7 @@ long ms_past; /* (note: using sptr->user check here instead of IsPerson() * due to SPAMF_USER where user isn't marked as client/person yet. */ - if (!sptr->user || IsAnOper(sptr) || IsULine(sptr)) + if (!sptr->user || OperClass_evaluateACLPath("immune:spamfilter",sptr,NULL,NULL,NULL) || IsULine(sptr)) return 0; for (tk = tklines[tkl_hash('F')]; tk; tk = tk->next) diff --git a/src/modules/m_topic.c b/src/modules/m_topic.c index f29f44548..f03332f8d 100644 --- a/src/modules/m_topic.c +++ b/src/modules/m_topic.c @@ -139,7 +139,7 @@ long flags = 0; /* cache: membership flags */ if (parc > 2 || SecretChannel(chptr)) { if (!ismember && !IsServer(sptr) - && !OPCanSeeSecret(sptr) && !IsULine(sptr)) + && !OperClass_evaluateACLPath("override:see:list:secret",sptr,NULL,chptr,NULL) && !IsULine(sptr)) { sendto_one(sptr, err_str(ERR_NOTONCHANNEL), me.name, parv[0], name); @@ -241,7 +241,7 @@ long flags = 0; /* cache: membership flags */ is_chan_op(sptr, chptr)) { #ifndef NO_OPEROVERRIDE - if ((MyClient(sptr) ? (!IsOper(sptr) || !OPCanOverride(sptr)) : !IsOper(sptr))) + if ((MyClient(sptr) ? (!IsOper(sptr) || !OperClass_evaluateACLPath("override:topic",sptr,NULL,chptr,NULL)) : !IsOper(sptr))) { #endif sendto_one(sptr, err_str(ERR_CHANOPRIVSNEEDED), @@ -258,7 +258,7 @@ long flags = 0; /* cache: membership flags */ { char buf[512]; - if (IsOper(sptr) && OPCanOverride(sptr)) + if (IsOper(sptr) && OperClass_evaluateACLPath("override:topic",sptr,NULL,chptr,NULL)) { topicoverride(sptr, chptr, topic); } else { @@ -271,7 +271,7 @@ long flags = 0; /* cache: membership flags */ { char buf[512]; - if (IsOper(sptr) && OPCanOverride(sptr)) + if (IsOper(sptr) && OperClass_evaluateACLPath("override:topic",sptr,NULL,chptr,NULL)) { topicoverride(sptr, chptr, topic); } else { diff --git a/src/modules/m_trace.c b/src/modules/m_trace.c index c6b80aede..c5189e0a3 100644 --- a/src/modules/m_trace.c +++ b/src/modules/m_trace.c @@ -96,9 +96,9 @@ DLLFUNC CMD_FUNC(m_trace) else tname = me.name; - if (!IsOper(sptr) && !OperClass_evaluateACLPath("trace:global",sptr,NULL,NULL,NULL)) + if (!OperClass_evaluateACLPath("trace:global",sptr,NULL,NULL,NULL)) { - if (IsAnOper(sptr) || OperClass_evaluateACLPath("trace:local",sptr,NULL,NULL,NULL)) + if (OperClass_evaluateACLPath("trace:local",sptr,NULL,NULL,NULL)) { /* local opers may not /TRACE remote servers! */ if (strcasecmp(tname, me.name)) @@ -145,7 +145,7 @@ DLLFUNC CMD_FUNC(m_trace) link_u[acptr->from->fd]++; #else if (IsPerson(acptr) && - (!IsInvisible(acptr) || IsOper(sptr) || OperClass_evaluateACLPath("trace:invisible_users",sptr,acptr,NULL,NULL))) + (!IsInvisible(acptr) || OperClass_evaluateACLPath("trace:invisible-users",sptr,acptr,NULL,NULL))) link_u[acptr->from->fd]++; #endif else if (IsServer(acptr)) @@ -160,11 +160,7 @@ DLLFUNC CMD_FUNC(m_trace) char *name; char *class; -/* More bits of code to allow oers to see all users on remote traces - * if (IsInvisible(acptr) && dow && - * if (dow && - * !(MyConnect(sptr) && IsOper(sptr)) && */ - if (!IsOper(sptr) && !OperClass_evaluateACLPath("trace:invisible_users",sptr,acptr,NULL,NULL) && !IsAnOper(acptr) && (acptr != sptr)) + if (!OperClass_evaluateACLPath("trace:invisible-users",sptr,acptr,NULL,NULL) && (acptr != sptr)) continue; if (!doall && wilds && match(tname, acptr->name)) continue; @@ -195,15 +191,10 @@ DLLFUNC CMD_FUNC(m_trace) /* Only opers see users if there is a wildcard * but anyone can see all the opers. */ -/* if (IsOper(sptr) && - * Allow opers to see invisible users on a remote trace or wildcard - * search ... sure as hell helps to find clonebots. --Russell - * (MyClient(sptr) || !(dow && IsInvisible(acptr))) - * || !dow || IsAnOper(acptr)) */ - if (IsOper(sptr) || OperClass_evaluateACLPath("trace:invisible_users",sptr,acptr,NULL,NULL) || - (IsAnOper(acptr) && !IsInvisible(acptr))) + if (OperClass_evaluateACLPath("trace:invisible-users",sptr,acptr,NULL,NULL) || + (!IsInvisible(acptr) && OperClass_evaluateACLPath("trace",sptr,acptr,NULL,NULL))) { - if (IsAnOper(acptr)) + if (OperClass_evaluateACLPath("trace",sptr,acptr,NULL,NULL) || OperClass_evaluateACLPath("trace:invisible-users",sptr,acptr,NULL,NULL)) sendto_one(sptr, rpl_str(RPL_TRACEOPERATOR), me.name, @@ -263,7 +254,7 @@ DLLFUNC CMD_FUNC(m_trace) * Add these lines to summarize the above which can get rather long * and messy when done remotely - Avalon */ - if (!IsAnOper(sptr) || !cnt) + if (!OperClass_evaluateACLPath("trace",sptr,acptr,NULL,NULL) || !cnt) { if (cnt) return 0; diff --git a/src/modules/m_tsctl.c b/src/modules/m_tsctl.c index 55b59187f..04a6ad50e 100644 --- a/src/modules/m_tsctl.c +++ b/src/modules/m_tsctl.c @@ -91,7 +91,7 @@ DLLFUNC int m_tsctl(aClient *cptr, aClient *sptr, int parc, char *parv[]) if (!MyClient(sptr)) goto doit; - if (!IsAdmin(sptr) && !IsCoAdmin(sptr) && !OperClass_evaluateACLPath("tsctl",sptr,NULL,NULL,NULL)) + if (!OperClass_evaluateACLPath("server:tsctl",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; @@ -108,7 +108,7 @@ DLLFUNC int m_tsctl(aClient *cptr, aClient *sptr, int parc, char *parv[]) if (stricmp(parv[1], "offset") == 0) { - if (!OPCanTSCtl(sptr)) + if (!OperClass_evaluateACLPath("server:tsctl:set",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; diff --git a/src/modules/m_undccdeny.c b/src/modules/m_undccdeny.c index 80417580c..65e19d45c 100644 --- a/src/modules/m_undccdeny.c +++ b/src/modules/m_undccdeny.c @@ -81,7 +81,7 @@ DLLFUNC CMD_FUNC(m_undccdeny) if (!MyClient(sptr)) return 0; - if (!IsAnOper(sptr) || !OPCanDCCDeny(sptr)) + if (!IsAnOper(sptr) || !OperClass_evaluateACLPath("client:dcc",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; diff --git a/src/modules/m_unkline.c b/src/modules/m_unkline.c index e480a2b15..4f20f5ff1 100644 --- a/src/modules/m_unkline.c +++ b/src/modules/m_unkline.c @@ -82,7 +82,7 @@ DLLFUNC int MOD_UNLOAD(m_unkline)(int module_unload) DLLFUNC int m_unkline(aClient *cptr, aClient *sptr, int parc, char *parv[]) { - if (!MyClient(sptr) || !OPCanUnKline(sptr)) + if (!MyClient(sptr) || !OperClass_evaluateACLPath("tkl:kline:remove",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; diff --git a/src/modules/m_unzline.c b/src/modules/m_unzline.c index 5c25fe3a8..5d70a3021 100644 --- a/src/modules/m_unzline.c +++ b/src/modules/m_unzline.c @@ -83,7 +83,7 @@ DLLFUNC int MOD_UNLOAD(m_unzline)(int module_unload) DLLFUNC int m_unzline(aClient *cptr, aClient *sptr, int parc, char *parv[]) { - if (!MyClient(sptr) || !OPCanZline(sptr)) + if (!MyClient(sptr) || !OperClass_evaluateACLPath("tkl:zline:local:remove",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; diff --git a/src/modules/m_wallops.c b/src/modules/m_wallops.c index 3315e13c2..0746d40d2 100644 --- a/src/modules/m_wallops.c +++ b/src/modules/m_wallops.c @@ -87,7 +87,7 @@ DLLFUNC CMD_FUNC(m_wallops) me.name, parv[0], "WALLOPS"); return 0; } - if (MyClient(sptr) && !OPCanWallOps(sptr) && !OperClass_evaluateACLPath("chat:wallops",sptr,NULL,NULL,NULL)) + if (MyClient(sptr) && !OperClass_evaluateACLPath("chat:wallops",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; diff --git a/src/modules/m_who.c b/src/modules/m_who.c index 255e9a6f8..6a5848e1a 100644 --- a/src/modules/m_who.c +++ b/src/modules/m_who.c @@ -356,7 +356,7 @@ int i = 1; } if (!IsAnOper(sptr)) - *umodes = *umodes & (UMODE_OPER | UMODE_LOCOP | UMODE_SADMIN | UMODE_ADMIN | UMODE_COADMIN | UMODE_NETADMIN); + *umodes = *umodes & UMODE_OPER; /* these are usermodes regular users may search for. just oper now. */ if (*umodes == 0) return -1; } @@ -614,7 +614,7 @@ char has_common_chan = 0; static void do_channel_who(aClient *sptr, aChannel *channel, char *mask) { Member *cm = channel->members; - if (IsMember(sptr, channel) || IsNetAdmin(sptr)) + if (IsMember(sptr, channel) || OperClass_evaluateACLPath("override:see:who:onchannel",sptr,NULL,channel,NULL)) who_flags |= WF_ONCHANNEL; for (cm = channel->members; cm; cm = cm->next) @@ -777,7 +777,7 @@ static void send_who_reply(aClient *sptr, aClient *acptr, host = GetHost(acptr); - if (IsULine(acptr) && !IsOper(sptr) && !OperClass_evaluateACLPath("who:ulines",sptr,acptr,NULL,NULL) && HIDE_ULINES) + if (IsULine(acptr) && !IsOper(sptr) && !OperClass_evaluateACLPath("map:ulines",sptr,acptr,NULL,NULL) && HIDE_ULINES) sendto_one(sptr, getreply(RPL_WHOREPLY), me.name, sptr->name, channel, /* channel name */ acptr->user->username, /* user name */ @@ -845,7 +845,7 @@ static char *first_visible_channel(aClient *sptr, aClient *acptr, int *flg) if (ret == EX_DENY) showchannel = 0; - if (!showchannel && (OPCanSeeSecret(sptr) || OperClass_evaluateACLPath("override:whois",sptr,NULL,chptr,NULL))) + if (!showchannel && (OperClass_evaluateACLPath("override:see:who:secret",sptr,NULL,chptr,NULL) || OperClass_evaluateACLPath("override:see:whois",sptr,NULL,chptr,NULL))) { showchannel = 1; /* OperOverride */ operoverride = 1; diff --git a/src/modules/m_whois.c b/src/modules/m_whois.c index 332a417a3..639cedd02 100644 --- a/src/modules/m_whois.c +++ b/src/modules/m_whois.c @@ -217,7 +217,7 @@ DLLFUNC int m_whois(aClient *cptr, aClient *sptr, int parc, char *parv[]) if (ret == EX_DENY) showchannel = 0; - if (!showchannel && (OPCanSeeSecret(sptr) || OperClass_evaluateACLPath("override:whois",sptr,NULL,chptr,NULL))) + if (!showchannel && (OperClass_evaluateACLPath("override:see:whois",sptr,NULL,chptr,NULL))) { showchannel = 1; /* OperOverride */ operoverride = 1; @@ -316,15 +316,7 @@ DLLFUNC int m_whois(aClient *cptr, aClient *sptr, int parc, char *parv[]) if (IsAnOper(acptr) && !hideoper) { buf[0] = '\0'; - if (IsNetAdmin(acptr)) - strlcat(buf, "a Network Administrator", sizeof buf); - else if (IsSAdmin(acptr)) - strlcat(buf, "a Services Administrator", sizeof buf); - else if (IsAdmin(acptr) && !IsCoAdmin(acptr)) - strlcat(buf, "a Server Administrator", sizeof buf); - else if (IsCoAdmin(acptr)) - strlcat(buf, "a Co Administrator", sizeof buf); - else if (IsOper(acptr)) + if (IsOper(acptr)) strlcat(buf, "an IRC Operator", sizeof buf); else @@ -332,9 +324,15 @@ DLLFUNC int m_whois(aClient *cptr, aClient *sptr, int parc, char *parv[]) if (buf[0]) { if (IsOper(sptr) && MyClient(acptr)) + { + char *operclass = "???"; + ConfigItem_oper *oper = Find_oper(acptr->user->operlogin); + if (oper && oper->operclass) + operclass = oper->operclass; sendto_one(sptr, - ":%s 313 %s %s :is %s (%s)", me.name, - parv[0], name, buf, acptr->user->operlogin); + ":%s 313 %s %s :is %s (%s) [%s]", me.name, + parv[0], name, buf, acptr->user->operlogin, operclass); + } else sendto_one(sptr, rpl_str(RPL_WHOISOPERATOR), me.name, diff --git a/src/modules/snomasks/Makefile.in b/src/modules/snomasks/Makefile.in new file mode 100644 index 000000000..1f95f7281 --- /dev/null +++ b/src/modules/snomasks/Makefile.in @@ -0,0 +1,58 @@ +#************************************************************************ +#* IRC - Internet Relay Chat, src/modules/snomasks/Makefile +#* Copyright (C) The UnrealIRCd team +#* +#* This program is free software; you can redistribute it and/or modify +#* it under the terms of the GNU General Public License as published by +#* the Free Software Foundation; either version 1, or (at your option) +#* any later version. +#* +#* This program is distributed in the hope that it will be useful, +#* but WITHOUT ANY WARRANTY; without even the implied warranty of +#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#* GNU General Public License for more details. +#* +#* You should have received a copy of the GNU General Public License +#* along with this program; if not, write to the Free Software +#* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#*/ + +INCLUDES = ../../include/auth.h ../../include/badwords.h ../../include/channel.h \ + ../../include/class.h ../../include/common.h ../../include/config.h ../../include/dbuf.h \ + ../../include/dynconf.h ../../include/events.h ../../include/fdlist.h ../../include/h.h \ + ../../include/hash.h ../../include/inet.h ../../include/ircsprintf.h \ + ../../include/license.h ../../include/macros.h \ + ../../include/modules.h ../../include/modversion.h ../../include/msg.h \ + ../../include/numeric.h ../../include/proto.h ../../include/res.h \ + ../../include/resource.h ../../include/setup.h ../../include/sjoin.h \ + ../../include/sock.h ../../include/ssl.h ../../include/struct.h ../../include/sys.h \ + ../../include/threads.h ../../include/types.h ../../include/url.h \ + ../../include/version.h ../../include/whowas.h + +R_MODULES=\ + dccreject.so + +MODULES=$(R_MODULES) +MODULEFLAGS=@MODULEFLAGS@ +CC=@CC@ +RM=@RM@ + +all: build + +build: $(MODULES) + +custommodule: $(MODULEFILE).c + $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ + -o $(MODULEFILE).so $(MODULEFILE).c $(EXLIBS) + +clean: + $(RM) -f *.o *.so *~ core + +############################################################################# +# .so's section +############################################################################# + +dccreject.so: dccreject.c $(INCLUDES) + $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ + -o dccreject.so dccreject.c + diff --git a/src/modules/snomasks/dccreject.c b/src/modules/snomasks/dccreject.c new file mode 100644 index 000000000..fc40b8121 --- /dev/null +++ b/src/modules/snomasks/dccreject.c @@ -0,0 +1,70 @@ +/* + * Show DCC SEND rejection notices (Snomask +D) + * (C) Copyright 2000-.. Bram Matthys (Syzop) and the UnrealIRCd team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 1, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "unrealircd.h" + +/* Module header */ +ModuleHeader MOD_HEADER(dccreject) + = { + "snomasks/dccreject", + "$Id$", + "Snomask +D", + "3.2-b8-1", + NULL + }; + +/* Global variables */ +long SNO_DCCREJECT = 0L; + +/* Forward declarations */ +int dccreject_dcc_denied(aClient *sptr, aClient *target, char *realfile, char *displayfile, ConfigItem_deny_dcc *dccdeny); + +DLLFUNC int MOD_TEST(dccreject)(ModuleInfo *modinfo) +{ + return MOD_SUCCESS; +} + +DLLFUNC int MOD_INIT(dccreject)(ModuleInfo *modinfo) +{ + SnomaskAdd(modinfo->handle, 'D', 1, umode_allow_opers, &SNO_DCCREJECT); + + HookAddEx(modinfo->handle, HOOKTYPE_DCC_DENIED, dccreject_dcc_denied); + + MARK_AS_OFFICIAL_MODULE(modinfo); + return MOD_SUCCESS; +} + +DLLFUNC int MOD_LOAD(dccreject)(int module_load) +{ + return MOD_SUCCESS; +} + +DLLFUNC int MOD_UNLOAD(dccreject)(int module_unload) +{ + return MOD_SUCCESS; +} + +int dccreject_dcc_denied(aClient *sptr, aClient *target, char *realfile, char *displayfile, ConfigItem_deny_dcc *dccdeny) +{ + sendto_snomask_global(SNO_DCCREJECT, + "%s tried to send forbidden file %s (%s) to %s (is blocked now)", + sptr->name, displayfile, dccdeny->reason, target->name); + + return 0; +} diff --git a/src/modules/ssl_antidos.c b/src/modules/ssl_antidos.c index 686f1aecd..d1c605d26 100644 --- a/src/modules/ssl_antidos.c +++ b/src/modules/ssl_antidos.c @@ -40,6 +40,8 @@ DLLFUNC int MOD_INIT(ssl_antidos)(ModuleInfo *modinfo) { HookAddEx(modinfo->handle, HOOKTYPE_HANDSHAKE, ssl_antidos_handshake); + MARK_AS_OFFICIAL_MODULE(modinfo); + ModuleSetOptions(modinfo->handle, MOD_OPT_PERM, 1); /* Note that we cannot be MOD_OPT_PERM_RELOADABLE as we use OpenSSL functions to register * an index and callback function. diff --git a/src/modules/usermodes/Makefile.in b/src/modules/usermodes/Makefile.in index f8eafe751..9984c0788 100644 --- a/src/modules/usermodes/Makefile.in +++ b/src/modules/usermodes/Makefile.in @@ -1,6 +1,6 @@ #************************************************************************ #* IRC - Internet Relay Chat, src/modules/usermodes/Makefile -#* Copyright (C) Carsten V. Munk 2001 & The UnrealIRCd team +#* Copyright (C) The UnrealIRCd team #* #* This program is free software; you can redistribute it and/or modify #* it under the terms of the GNU General Public License as published by diff --git a/src/modules/usermodes/bot.c b/src/modules/usermodes/bot.c index 30f4d4347..6689b52d8 100644 --- a/src/modules/usermodes/bot.c +++ b/src/modules/usermodes/bot.c @@ -48,7 +48,7 @@ DLLFUNC int MOD_TEST(bot)(ModuleInfo *modinfo) DLLFUNC int MOD_INIT(bot)(ModuleInfo *modinfo) { - UmodeAdd(modinfo->handle, 'B', UMODE_GLOBAL, NULL, &UMODE_BOT); + UmodeAdd(modinfo->handle, 'B', UMODE_GLOBAL, 0, NULL, &UMODE_BOT); HookAddEx(modinfo->handle, HOOKTYPE_WHOIS, bot_whois); HookAddEx(modinfo->handle, HOOKTYPE_WHO_STATUS, bot_who_status); diff --git a/src/modules/usermodes/censor.c b/src/modules/usermodes/censor.c index 7acb978b3..6635ae316 100644 --- a/src/modules/usermodes/censor.c +++ b/src/modules/usermodes/censor.c @@ -65,7 +65,7 @@ DLLFUNC int MOD_INIT(censor)(ModuleInfo *modinfo) MARK_AS_OFFICIAL_MODULE(modinfo); - UmodeAdd(modinfo->handle, 'G', UMODE_GLOBAL, NULL, &UMODE_CENSOR); + UmodeAdd(modinfo->handle, 'G', UMODE_GLOBAL, 0, NULL, &UMODE_CENSOR); HookAddPCharEx(modinfo->handle, HOOKTYPE_PRE_USERMSG, censor_pre_usermsg); diff --git a/src/modules/usermodes/noctcp.c b/src/modules/usermodes/noctcp.c index f11291027..978549320 100644 --- a/src/modules/usermodes/noctcp.c +++ b/src/modules/usermodes/noctcp.c @@ -65,7 +65,7 @@ DLLFUNC int MOD_INIT(noctcp)(ModuleInfo *modinfo) { CmodeInfo req; - UmodeAdd(modinfo->handle, 'T', UMODE_GLOBAL, NULL, &UMODE_NOCTCP); + UmodeAdd(modinfo->handle, 'T', UMODE_GLOBAL, 0, NULL, &UMODE_NOCTCP); HookAddPCharEx(modinfo->handle, HOOKTYPE_PRE_USERMSG, noctcp_preusermsg); diff --git a/src/modules/usermodes/nokick.c b/src/modules/usermodes/nokick.c index 5ffa262e3..842942104 100644 --- a/src/modules/usermodes/nokick.c +++ b/src/modules/usermodes/nokick.c @@ -45,7 +45,7 @@ DLLFUNC int MOD_TEST(nokick)(ModuleInfo *modinfo) DLLFUNC int MOD_INIT(nokick)(ModuleInfo *modinfo) { - UmodeAdd(modinfo->handle, 'q', UMODE_GLOBAL, umode_allow_opers, &UMODE_NOKICK); // TODO: limit more!! + UmodeAdd(modinfo->handle, 'q', UMODE_GLOBAL, 1, umode_allow_opers, &UMODE_NOKICK); // TODO: limit more!! HookAddEx(modinfo->handle, HOOKTYPE_CAN_KICK, nokick_can_kick); @@ -68,7 +68,7 @@ int nokick_can_kick(aClient *sptr, aClient *target, aChannel *chptr, char *comme { static char errmsg[NICKLEN+32]; - if (IsNokick(target) && !IsULine(sptr) && MyClient(sptr) && !IsNetAdmin(sptr)) + if (IsNokick(target) && !IsULine(sptr) && MyClient(sptr) && !OperClass_evaluateACLPath("override:kick:nokick",sptr,target,chptr,NULL)) { ircsnprintf(errmsg, sizeof(errmsg), err_str(ERR_CANNOTDOCOMMAND), me.name, sptr->name, "KICK", diff --git a/src/modules/usermodes/privacy.c b/src/modules/usermodes/privacy.c index 97b617245..8b9fb8bf5 100644 --- a/src/modules/usermodes/privacy.c +++ b/src/modules/usermodes/privacy.c @@ -39,7 +39,7 @@ int privacy_see_channel_in_whois(aClient *sptr, aClient *target, aChannel *chptr DLLFUNC int MOD_INIT(privacy)(ModuleInfo *modinfo) { - UmodeAdd(modinfo->handle, 'p', UMODE_GLOBAL, umode_allow_all, &UMODE_PRIVACY); + UmodeAdd(modinfo->handle, 'p', UMODE_GLOBAL, 0, umode_allow_all, &UMODE_PRIVACY); HookAddEx(modinfo->handle, HOOKTYPE_SEE_CHANNEL_IN_WHOIS, privacy_see_channel_in_whois); diff --git a/src/modules/usermodes/regonlymsg.c b/src/modules/usermodes/regonlymsg.c index 2c19123fc..affd3bced 100644 --- a/src/modules/usermodes/regonlymsg.c +++ b/src/modules/usermodes/regonlymsg.c @@ -39,7 +39,7 @@ char *regonlymsg_pre_usermsg(aClient *sptr, aClient *target, char *text, int not DLLFUNC int MOD_INIT(regonlymsg)(ModuleInfo *modinfo) { - UmodeAdd(modinfo->handle, 'R', UMODE_GLOBAL, umode_allow_all, &UMODE_REGONLYMSG); + UmodeAdd(modinfo->handle, 'R', UMODE_GLOBAL, 0, umode_allow_all, &UMODE_REGONLYMSG); HookAddPCharEx(modinfo->handle, HOOKTYPE_PRE_USERMSG, regonlymsg_pre_usermsg); diff --git a/src/modules/usermodes/servicebot.c b/src/modules/usermodes/servicebot.c index 3a43b5deb..d4e69901c 100644 --- a/src/modules/usermodes/servicebot.c +++ b/src/modules/usermodes/servicebot.c @@ -52,7 +52,7 @@ DLLFUNC int MOD_TEST(servicebot)(ModuleInfo *modinfo) DLLFUNC int MOD_INIT(servicebot)(ModuleInfo *modinfo) { - UmodeAdd(modinfo->handle, 'S', UMODE_GLOBAL, umode_allow_none, &UMODE_SERVICEBOT); + UmodeAdd(modinfo->handle, 'S', UMODE_GLOBAL, 1, umode_allow_none, &UMODE_SERVICEBOT); HookAddEx(modinfo->handle, HOOKTYPE_CAN_KICK, servicebot_can_kick); HookAddEx(modinfo->handle, HOOKTYPE_MODE_DEOP, servicebot_mode_deop); @@ -100,7 +100,7 @@ int servicebot_mode_deop(aClient *sptr, aClient *target, aChannel *chptr, { static char errmsg[NICKLEN+32]; - if (IsServiceBot(target) && MyClient(sptr) && !IsNetAdmin(sptr) && (what == MODE_DEL)) + if (IsServiceBot(target) && MyClient(sptr) && !OperClass_evaluateACLPath("servicebot:deop",sptr,target,chptr,NULL) && (what == MODE_DEL)) { char errmsg2[NICKLEN+32]; snprintf(errmsg2, sizeof(errmsg2), "%s is a Service Bot", target->name); @@ -118,7 +118,7 @@ int servicebot_mode_deop(aClient *sptr, aClient *target, aChannel *chptr, int servicebot_pre_kill(aClient *sptr, aClient *target, char *reason) { - if (IsServiceBot(target) && !(IsNetAdmin(sptr) || IsULine(sptr))) + if (IsServiceBot(target) && !(OperClass_evaluateACLPath("servicebot:kill",sptr,target,NULL,NULL) || IsULine(sptr))) { sendto_one(sptr, err_str(ERR_KILLDENY), me.name, sptr->name, target->name); diff --git a/src/modules/usermodes/showwhois.c b/src/modules/usermodes/showwhois.c index af19de0ce..4305fd1f6 100644 --- a/src/modules/usermodes/showwhois.c +++ b/src/modules/usermodes/showwhois.c @@ -44,7 +44,7 @@ DLLFUNC int MOD_TEST(showwhois)(ModuleInfo *modinfo) DLLFUNC int MOD_INIT(showwhois)(ModuleInfo *modinfo) { - UmodeAdd(modinfo->handle, 'W', UMODE_GLOBAL, umode_allow_opers, &UMODE_SHOWWHOIS); + UmodeAdd(modinfo->handle, 'W', UMODE_GLOBAL, 1, umode_allow_opers, &UMODE_SHOWWHOIS); HookAddEx(modinfo->handle, HOOKTYPE_WHOIS, showwhois_whois); diff --git a/src/modules/webirc.c b/src/modules/webirc.c index 954298ff0..188a9a8c5 100644 --- a/src/modules/webirc.c +++ b/src/modules/webirc.c @@ -130,7 +130,7 @@ void delete_webircblock(ConfigItem_webirc *e) MyFree(e); } -DLLFUNC int webirc_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) +int webirc_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) { ConfigEntry *cep, *cepp; int errors = 0; @@ -244,7 +244,7 @@ DLLFUNC int webirc_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *e return errors ? -1 : 1; } -DLLFUNC int webirc_config_run(ConfigFile *cf, ConfigEntry *ce, int type) +int webirc_config_run(ConfigFile *cf, ConfigEntry *ce, int type) { ConfigEntry *cep; ConfigEntry *cepp; diff --git a/src/operclass.c b/src/operclass.c index 62ead635e..ed321d89a 100644 --- a/src/operclass.c +++ b/src/operclass.c @@ -299,8 +299,11 @@ OperPermission OperClass_evaluateACLPath(char* path, aClient *sptr, aClient *vic ConfigItem_oper *ce_oper; ConfigItem_operclass *ce_operClass; OperClass *oc = NULL; - OperClassACLPath* operPath; - OperClassACL* acl; + OperClassACLPath *operPath; + OperClassACL *acl; + + if (!IsOper(sptr)) + return OPER_DENY; ce_oper = Find_oper(sptr->user->operlogin); if (!ce_oper) @@ -328,7 +331,7 @@ OperPermission OperClass_evaluateACLPath(char* path, aClient *sptr, aClient *vic params->channel = channel; params->extra = extra; - perm = OperClass_evaluateACLPathEx(oc->acls, operPath, params); + perm = OperClass_evaluateACLPathEx(acl, operPath, params); OperClass_freePath(operPath); MyFree(params); return perm; diff --git a/src/parse.c b/src/parse.c index 5ec6cb9f9..678079a46 100644 --- a/src/parse.c +++ b/src/parse.c @@ -167,11 +167,7 @@ inline void parse_addlag(aClient *cptr, int cmdbytes) #ifdef FAKELAG_CONFIGURABLE !(cptr->class && (cptr->class->options & CLASS_OPT_NOFAKELAG)) && #endif -#ifdef NO_FAKE_LAG_FOR_LOCOPS - !IsAnOper(cptr)) -#else - !IsOper(cptr)) -#endif + !OperClass_evaluateACLPath("privacy:fakelag",cptr,NULL,NULL,NULL)) { cptr->since += (1 + cmdbytes/90); } @@ -324,7 +320,7 @@ int parse(aClient *cptr, char *buffer, char *bufend) flags |= M_SHUN; if (IsVirus(from)) flags |= M_VIRUS; - if (IsAnOper(from)) + if (IsOper(from)) flags |= M_OPER; cmptr = find_Command(ch, IsServer(cptr) ? 1 : 0, flags); if (!cmptr) diff --git a/src/res.c b/src/res.c index b1c169d73..544bb9d1c 100644 --- a/src/res.c +++ b/src/res.c @@ -153,11 +153,17 @@ int optmask; } memset(&options, 0, sizeof(options)); - options.timeout = 3; + options.timeout = 1500; /* 1.5 seconds */ options.tries = 2; - options.flags = ARES_FLAG_NOALIASES|ARES_FLAG_IGNTC; + /* Note that the effective DNS timeout is NOT simply 1500*2=3000. + * This is because c-ares does some incremental timeout stuff itself + * that may add up to twice the timeout in the second round, + * so effective max is 1500ms first and then up to 3000s, so 4500ms in total + * (until they change the algorithm again, that is...). + */ + options.flags |= ARES_FLAG_NOALIASES|ARES_FLAG_IGNTC; options.sock_state_cb = unrealdns_sock_state_cb; - optmask = ARES_OPT_TIMEOUT|ARES_OPT_TRIES|ARES_OPT_FLAGS|ARES_OPT_SOCK_STATE_CB; + optmask = ARES_OPT_TIMEOUTMS|ARES_OPT_TRIES|ARES_OPT_FLAGS|ARES_OPT_SOCK_STATE_CB; #ifndef _WIN32 /* on *NIX don't use the hosts file, since it causes countless useless reads. * on Windows we use it for now, this could be changed in the future. @@ -194,7 +200,7 @@ int optmask; } ares_set_socket_callback(resolver_channel, unrealdns_sock_create_cb, NULL); - unrealdns_timeout_hdl = EventAddEx(NULL, "unrealdns_timeout", 1, 0, unrealdns_timeout, NULL); + unrealdns_timeout_hdl = EventAddEx(NULL, "unrealdns_timeout", 0, 0, unrealdns_timeout, NULL); } void reinit_resolver(aClient *sptr) @@ -748,7 +754,7 @@ DNSCache *c; DNSReq *r; char *param; - if (!IsAnOper(sptr)) + if (!OperClass_evaluateACLPath("server:dns",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name); return 0; diff --git a/src/s_bsd.c b/src/s_bsd.c index acd093d63..8ed53edd4 100644 --- a/src/s_bsd.c +++ b/src/s_bsd.c @@ -680,44 +680,21 @@ void write_pidfile(void) #endif } -/* - * Initialize the various name strings used to store hostnames. This is set - * from either the server's sockhost (if client fd is a tty or localhost) - * or from the ip# converted into a string. 0 = success, -1 = fail. +/* This used to initialize the various name strings used to store hostnames. + * But nowadays this takes place much earlier (in add_connection?). + * It's mainly used for "localhost" and WEBIRC magic only now... */ static int check_init(aClient *cptr, char *sockn, size_t size) { struct SOCKADDR_IN sk; int len = sizeof(struct SOCKADDR_IN); + strlcpy(sockn, cptr->sockhost, HOSTLEN); + RunHookReturnInt3(HOOKTYPE_CHECK_INIT, cptr, sockn, size, ==0); - /* If descriptor is a tty, special checking... */ -#if defined(DEBUGMODE) && !defined(_WIN32) - if (isatty(cptr->fd)) -#else - if (0) -#endif - { - strlcpy(sockn, me.sockhost, HOSTLEN); - bzero((char *)&sk, sizeof(struct SOCKADDR_IN)); - } - else if (getpeername(cptr->fd, (struct SOCKADDR *)&sk, &len) == -1) - { - /* On Linux 2.4 and FreeBSD the socket may just have been disconnected - * so it's not a serious error and can happen quite frequently -- Syzop - */ - if (ERRNO != P_ENOTCONN) - report_error("connect failure: %s %s", cptr); - return -1; - } - (void)strlcpy(sockn, (char *)Inet_si2p(&sk), size); - -#ifdef INET6 - if (IN6_IS_ADDR_LOOPBACK(&sk.SIN_ADDR) || !strcmp(sockn, "127.0.0.1")) -#else - if (inet_netof(sk.SIN_ADDR) == IN_LOOPBACKNET) -#endif + /* Some silly hack to convert 127.0.0.1 and such into 'localhost' */ + if (IsLocal(cptr)) { if (cptr->hostp) { @@ -726,7 +703,6 @@ static int check_init(aClient *cptr, char *sockn, size_t size) } strlcpy(sockn, "localhost", HOSTLEN); } - bcopy((char *)&sk.SIN_ADDR, (char *)&cptr->ip, sizeof(struct IN_ADDR)); cptr->port = (int)ntohs(sk.SIN_PORT); @@ -780,22 +756,6 @@ int check_client(aClient *cptr, char *username) Debug((DEBUG_DNS, "ch_cl: access ok: %s[%s]", cptr->name, sockname)); -#ifdef INET6 - if (IN6_IS_ADDR_LOOPBACK(&cptr->ip) || - (cptr->ip.s6_addr[0] == mysk.sin6_addr.s6_addr[0] && - cptr->ip.s6_addr[1] == mysk.sin6_addr.s6_addr[1]) -/* || - IN6_ARE_ADDR_SAMEPREFIX(&cptr->ip, &mysk.SIN_ADDR)) - about the same, I think NOT */ - ) -#else - if (inet_netof(cptr->ip) == IN_LOOPBACKNET || - inet_netof(cptr->ip) == inet_netof(mysk.SIN_ADDR)) -#endif - { - ircstp->is_loc++; - cptr->flags |= FLAGS_LOCAL; - } return 0; } @@ -1190,6 +1150,25 @@ add_con_refuse: */ get_sockhost(acptr, Inet_si2p(&addr)); bcopy((char *)&addr.SIN_ADDR, (char *)&acptr->ip, sizeof(struct IN_ADDR)); + + /* Tag loopback connections as FLAGS_LOCAL */ +#ifdef INET6 + if (IN6_IS_ADDR_LOOPBACK(&acptr->ip) || + (acptr->ip.s6_addr[0] == mysk.sin6_addr.s6_addr[0] && + acptr->ip.s6_addr[1] == mysk.sin6_addr.s6_addr[1]) + /* || + IN6_ARE_ADDR_SAMEPREFIX(&acptr->ip, &mysk.SIN_ADDR)) + about the same, I think NOT */ + ) +#else + if (inet_netof(acptr->ip) == IN_LOOPBACKNET || + inet_netof(acptr->ip) == inet_netof(mysk.SIN_ADDR)) +#endif + { + ircstp->is_loc++; + acptr->flags |= FLAGS_LOCAL; + } + j = 1; list_for_each_entry(acptr2, &unknown_list, lclient_node) @@ -1367,6 +1346,9 @@ static int parse_client_queued(aClient *cptr) time_t now = TStime(); char buf[BUFSIZE]; + if (DoingDNS(cptr)) + return 0; /* we delay processing of data until the host is resolved */ + while (DBufLength(&cptr->recvQ) && ((cptr->status < STAT_UNKNOWN) || (cptr->since - now < 10))) { diff --git a/src/s_conf.c b/src/s_conf.c index 9289fb8d5..45d7abab8 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -60,8 +60,8 @@ struct _confcommand int (*testfunc)(ConfigFile *conf, ConfigEntry *ce); }; -typedef struct _conf_operflag OperFlag; -struct _conf_operflag +typedef struct _conf_namevalue NameValue; +struct _conf_namevalue { long flag; char *name; @@ -160,72 +160,8 @@ static ConfigCommand _ConfigCommands[] = { { "vhost", _conf_vhost, _test_vhost }, }; -static int _OldOperFlags[] = { - OFLAG_LOCAL, 'o', - OFLAG_GLOBAL, 'O', - OFLAG_REHASH, 'r', - OFLAG_DIE, 'D', - OFLAG_RESTART, 'R', - OFLAG_GLOBOP, 'g', - OFLAG_WALLOP, 'w', - OFLAG_LOCOP, 'l', - OFLAG_LROUTE, 'c', - OFLAG_GROUTE, 'L', - OFLAG_LKILL, 'k', - OFLAG_GKILL, 'K', - OFLAG_KLINE, 'b', - OFLAG_UNKLINE, 'B', - OFLAG_LNOTICE, 'n', - OFLAG_GNOTICE, 'G', - OFLAG_ADMIN_, 'A', - OFLAG_SADMIN_, 'a', - OFLAG_NADMIN, 'N', - OFLAG_COADMIN, 'C', - OFLAG_ZLINE, 'z', - OFLAG_HIDE, 'H', - OFLAG_TKL, 't', - OFLAG_GZL, 'Z', - OFLAG_OVERRIDE, 'v', - OFLAG_DCCDENY, 'd', - OFLAG_ADDLINE, 'X', - OFLAG_TSCTL, 'T', - 0, 0 -}; - /* This MUST be alphabetized */ -static OperFlag _OperFlags[] = { - { OFLAG_ADMIN_, "admin"}, - { OFLAG_ADDLINE, "can_addline"}, - { OFLAG_DCCDENY, "can_dccdeny"}, - { OFLAG_DIE, "can_die" }, - { OFLAG_TKL, "can_gkline"}, - { OFLAG_GKILL, "can_globalkill" }, - { OFLAG_GNOTICE, "can_globalnotice" }, - { OFLAG_GROUTE, "can_globalroute" }, - { OFLAG_GLOBOP, "can_globops" }, - { OFLAG_GZL, "can_gzline"}, - { OFLAG_KLINE, "can_kline" }, - { OFLAG_LKILL, "can_localkill" }, - { OFLAG_LNOTICE, "can_localnotice" }, - { OFLAG_LROUTE, "can_localroute" }, - { OFLAG_OVERRIDE, "can_override" }, - { OFLAG_REHASH, "can_rehash" }, - { OFLAG_RESTART, "can_restart" }, - { OFLAG_TSCTL, "can_tsctl" }, - { OFLAG_UNKLINE, "can_unkline" }, - { OFLAG_WALLOP, "can_wallops" }, - { OFLAG_ZLINE, "can_zline"}, - { OFLAG_COADMIN_, "coadmin"}, - { OFLAG_HIDE, "get_host"}, - { OFLAG_GLOBAL, "global" }, - { OFLAG_LOCAL, "local" }, - { OFLAG_LOCOP, "locop"}, - { OFLAG_NADMIN, "netadmin"}, - { OFLAG_SADMIN_, "services-admin"}, -}; - -/* This MUST be alphabetized */ -static OperFlag _ListenerFlags[] = { +static NameValue _ListenerFlags[] = { { LISTENER_CLIENTSONLY, "clientsonly"}, { LISTENER_DEFER_ACCEPT, "defer-accept"}, { LISTENER_SERVERSONLY, "serversonly"}, @@ -234,14 +170,14 @@ static OperFlag _ListenerFlags[] = { }; /* This MUST be alphabetized */ -static OperFlag _LinkFlags[] = { +static NameValue _LinkFlags[] = { { CONNECT_AUTO, "autoconnect" }, { CONNECT_QUARANTINE, "quarantine"}, { CONNECT_SSL, "ssl" }, }; /* This MUST be alphabetized */ -static OperFlag _LogFlags[] = { +static NameValue _LogFlags[] = { { LOG_CHGCMDS, "chg-commands" }, { LOG_CLIENT, "connects" }, { LOG_ERROR, "errors" }, @@ -256,7 +192,7 @@ static OperFlag _LogFlags[] = { }; /* This MUST be alphabetized */ -static OperFlag ExceptTklFlags[] = { +static NameValue ExceptTklFlags[] = { { 0, "all" }, { TKL_GLOBAL|TKL_KILL, "gline" }, { TKL_GLOBAL|TKL_NICK, "gqline" }, @@ -266,7 +202,7 @@ static OperFlag ExceptTklFlags[] = { }; /* This MUST be alphabetized */ -static OperFlag _SSLFlags[] = { +static NameValue _SSLFlags[] = { { SSLFLAG_FAILIFNOCERT, "fail-if-no-clientcert" }, { SSLFLAG_DONOTACCEPTSELFSIGNED, "no-self-signed" }, { SSLFLAG_NOSTARTTLS, "no-starttls" }, @@ -1491,12 +1427,6 @@ void free_iConf(aConfiguration *i) ircfree(i->network.x_ircnet005); ircfree(i->network.x_defserv); ircfree(i->network.x_services_name); - ircfree(i->network.x_oper_host); - ircfree(i->network.x_admin_host); - ircfree(i->network.x_locop_host); - ircfree(i->network.x_sadmin_host); - ircfree(i->network.x_netadmin_host); - ircfree(i->network.x_coadmin_host); ircfree(i->network.x_hidden_host); ircfree(i->network.x_prefix_quit); ircfree(i->network.x_helpchan); @@ -1510,6 +1440,8 @@ int config_test(); void config_setdefaultsettings(aConfiguration *i) { + char tmp[512]; + i->unknown_flood_amount = 4; i->unknown_flood_bantime = 600; i->oper_snomask = strdup(SNO_DEFOPER); @@ -1549,8 +1481,10 @@ void config_setdefaultsettings(aConfiguration *i) i->nicklen = NICKLEN; i->link_bindip = strdup("*"); i->oper_only_stats = strdup("*"); - i->x_server_cert_pem = strdup("ssl/server.cert.pem"); - i->x_server_key_pem = strdup("ssl/server.key.pem"); + snprintf(tmp, sizeof(tmp), "%s/ssl/server.cert.pem", CONFDIR); + i->x_server_cert_pem = strdup(tmp); + snprintf(tmp, sizeof(tmp), "%s/ssl/server.key.pem", CONFDIR); + i->x_server_key_pem = strdup(tmp); } /* 1: needed for set::options::allow-part-if-shunned, @@ -1826,7 +1760,8 @@ int load_conf(char *filename, const char *original_path) ConfigFile *cfptr, *cfptr2, **cfptr3; ConfigEntry *ce; ConfigItem_include *inc, *my_inc; - int ret; + int ret; + int fatal_ret; int counter; if (config_verbose > 0) @@ -1900,23 +1835,34 @@ int load_conf(char *filename, const char *original_path) for (cfptr3 = &conf, cfptr2 = conf; cfptr2; cfptr2 = cfptr2->cf_next) cfptr3 = &cfptr2->cf_next; *cfptr3 = cfptr; + + /* Load modules */ if (config_verbose > 1) config_status("Loading modules in %s", filename); + + fatal_ret = 0; for (ce = cfptr->cf_entries; ce; ce = ce->ce_next) if (!strcmp(ce->ce_varname, "loadmodule")) { ret = _conf_loadmodule(cfptr, ce); - if (need_34_upgrade) - upgrade_conf_to_34(); - if (ret < 0) - return ret; + if (ret < fatal_ret) + fatal_ret = ret; /* lowest wins */ } + ret = fatal_ret; + if (need_34_upgrade) + upgrade_conf_to_34(); + if (ret < 0) + return ret; + + /* Load includes */ if (config_verbose > 1) config_status("Searching through %s for include files..", filename); for (ce = cfptr->cf_entries; ce; ce = ce->ce_next) if (!strcmp(ce->ce_varname, "include")) { ret = _conf_include(cfptr, ce); + if (need_34_upgrade) + upgrade_conf_to_34(); if (ret < 0) return ret; } @@ -1926,6 +1872,17 @@ int load_conf(char *filename, const char *original_path) else { config_error("Could not load config file %s", filename); +#ifdef _WIN32 + if (!strcmp(filename, "conf/unrealircd.conf")) + { + if (file_exists("unrealircd.conf")) + { + config_error("Note that 'unrealircd.conf' now belongs in the 'conf' subdirectory! (So move it to there)"); + } else { + config_error("New to UnrealIRCd? Be sure to read https://www.unrealircd.org/docs/Installing_%28Windows%29"); + } + } +#endif return -1; } } @@ -2288,16 +2245,6 @@ int config_post_test() Error("set::default-server is missing"); if (!settings.has_network_name) Error("set::network-name is missing"); - if (!settings.has_hosts_global) - Error("set::hosts::global is missing"); - if (!settings.has_hosts_admin) - Error("set::hosts::admin is missing"); - if (!settings.has_hosts_servicesadmin) - Error("set::hosts::servicesadmin is missing"); - if (!settings.has_hosts_netadmin) - Error("set::hosts::netadmin is missing"); - if (!settings.has_hosts_coadmin) - Error("set::hosts::coadmin is missing"); if (!settings.has_help_channel) Error("set::help-channel is missing"); if (!settings.has_hiddenhost_prefix) @@ -2402,7 +2349,7 @@ int config_run() } -OperFlag *config_binary_flags_search(OperFlag *table, char *cmd, int size) { +NameValue *config_binary_flags_search(NameValue *table, char *cmd, int size) { int start = 0; int stop = size-1; int mid; @@ -2974,6 +2921,19 @@ int _conf_include(ConfigFile *conf, ConfigEntry *ce) ce->ce_varlinenum); return -1; } + + if (!strcmp(ce->ce_vardata, "help.conf")) + need_34_upgrade = 1; + + /* Hmmm... not really proper huh... */ + if ((ce->ce_vardata[0] != '/') && (ce->ce_vardata[0] != '\\') && strcmp(ce->ce_vardata, CPATH)) + { + char *str = MyMallocEx(strlen(ce->ce_vardata) + strlen(CONFDIR) + 4); + sprintf(str, "%s/%s", CONFDIR, ce->ce_vardata); + MyFree(ce->ce_vardata); + ce->ce_vardata = str; + } + #ifdef USE_LIBCURL if (url_is_valid(ce->ce_vardata)) return remote_include(ce); @@ -3559,7 +3519,6 @@ int _conf_oper(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cep; ConfigEntry *cepp; ConfigItem_oper *oper = NULL; - OperFlag *ofp = NULL; oper = MyMallocEx(sizeof(ConfigItem_oper)); oper->name = strdup(ce->ce_vardata); @@ -3581,32 +3540,6 @@ int _conf_oper(ConfigFile *conf, ConfigEntry *ce) oper->class = default_class; } } - else if (!strcmp(cep->ce_varname, "flags")) - { - if (!cep->ce_entries) - { - char *m = "*"; - int *i, flag; - - for (m = (*cep->ce_vardata) ? cep->ce_vardata : m; *m; m++) - { - for (i = _OldOperFlags; (flag = *i); i += 2) - if (*m == (char)(*(i + 1))) - { - oper->oflags |= flag; - break; - } - } - } - else - { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) - { - if ((ofp = config_binary_flags_search(_OperFlags, cepp->ce_varname, ARRAY_SIZEOF(_OperFlags)))) - oper->oflags |= ofp->flag; - } - } - } else if (!strcmp(cep->ce_varname, "swhois")) { ircstrdup(oper->swhois, cep->ce_vardata); @@ -3631,6 +3564,10 @@ int _conf_oper(ConfigFile *conf, ConfigEntry *ce) { unreal_add_masks(&oper->mask, cep); } + else if (!strcmp(cep->ce_varname, "vhost")) + { + ircstrdup(oper->vhost, cep->ce_vardata); + } } AddListItem(oper, conf_oper); return 1; @@ -3638,12 +3575,13 @@ int _conf_oper(ConfigFile *conf, ConfigEntry *ce) int _test_oper(ConfigFile *conf, ConfigEntry *ce) { - char has_class = 0, has_password = 0, has_flags = 0, has_swhois = 0, has_snomask = 0; - char has_modes = 0, has_require_modes = 0, has_mask = 0, has_maxlogins = 0, has_operclass = 0; + char has_class = 0, has_password = 0, has_swhois = 0, has_snomask = 0; + char has_modes = 0, has_require_modes = 0, has_mask = 0, has_maxlogins = 0; + char has_operclass = 0, has_vhost = 0; int oper_flags = 0; ConfigEntry *cep; ConfigEntry *cepp; - OperFlag *ofp; + NameValue *ofp; int errors = 0; if (!ce->ce_vardata) @@ -3684,16 +3622,16 @@ int _test_oper(ConfigFile *conf, ConfigEntry *ce) continue; } if (!strcmp(cep->ce_varname, "operclass")) - { - if (has_operclass) - { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "oper::operclass"); - continue; - } - has_operclass = 1; - continue; - } + { + if (has_operclass) + { + config_warn_duplicate(cep->ce_fileptr->cf_filename, + cep->ce_varlinenum, "oper::operclass"); + continue; + } + has_operclass = 1; + continue; + } /* Regular variables */ if (!cep->ce_entries) { @@ -3724,6 +3662,17 @@ int _test_oper(ConfigFile *conf, ConfigEntry *ce) } has_swhois = 1; } + /* oper::vhost */ + else if (!strcmp(cep->ce_varname, "vhost")) + { + if (has_vhost) + { + config_warn_duplicate(cep->ce_fileptr->cf_filename, + cep->ce_varlinenum, "oper::vhost"); + continue; + } + has_vhost = 1; + } /* oper::snomask */ else if (!strcmp(cep->ce_varname, "snomask")) { @@ -3797,13 +3746,10 @@ int _test_oper(ConfigFile *conf, ConfigEntry *ce) /* oper::flags */ else if (!strcmp(cep->ce_varname, "flags")) { - if (has_flags) - { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "oper::flags"); - continue; - } - has_flags = 1; + config_error("%s:%i: oper::flags no longer exists. UnrealIRCd 3.4.x uses a new style oper block now.", + cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + errors++; + need_34_upgrade = 1; } else if (!strcmp(cep->ce_varname, "mask")) { @@ -3824,31 +3770,10 @@ int _test_oper(ConfigFile *conf, ConfigEntry *ce) /* oper::flags {} */ if (!strcmp(cep->ce_varname, "flags")) { - if (has_flags) - { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "oper::flags"); - continue; - } - has_flags = 1; - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) - { - if (!cepp->ce_varname) - { - config_error_empty(cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, "oper::flags", - cep->ce_varname); - errors++; - continue; - } - if (!(ofp = config_binary_flags_search(_OperFlags, cepp->ce_varname, ARRAY_SIZEOF(_OperFlags)))) { - config_error_unknownflag(cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, "oper", - cepp->ce_varname); - errors++; - } else - oper_flags |= ofp->flag; - } + config_error("%s:%i: oper::flags no longer exists. UnrealIRCd 3.4.x uses a new style oper block now.", + cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + errors++; + need_34_upgrade = 1; continue; } /* oper::from {} */ @@ -3881,29 +3806,20 @@ int _test_oper(ConfigFile *conf, ConfigEntry *ce) "oper::mask"); errors++; } - if (!has_flags) - { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, - "oper::flags"); - errors++; - } else { - /* Check oper flags -- warning needed only (autoconvert) */ - if (!(oper_flags & (OFLAG_GROUTE|OFLAG_GKILL|OFLAG_GNOTICE)) && - (oper_flags & (OFLAG_GZL|OFLAG_TKL|OFLAG_OVERRIDE))) - { - config_warn("%s:%i: oper::oflags: can_gzline/can_gkline/can_override (global privileges) " - "are incompatible with local oper -- user will be globop", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); - } - } if (!has_class) { config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, "oper::class"); errors++; } + if (!has_operclass) + { + config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + "oper::operclass"); + need_34_upgrade = 1; + errors++; + } - // TODO: upgrading hints return errors; } @@ -4503,7 +4419,7 @@ int _conf_listen(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cep; ConfigEntry *cepp; ConfigItem_listen *listen = NULL; - OperFlag *ofp; + NameValue *ofp; char copy[256]; char *ip; char *port; @@ -4575,7 +4491,7 @@ int _test_listen(ConfigFile *conf, ConfigEntry *ce) int start, end; int errors = 0; char has_options = 0; - OperFlag *ofp; + NameValue *ofp; if (!ce->ce_vardata) { @@ -5178,7 +5094,7 @@ void create_tkl_except_ii(char *mask, char *type) { ConfigItem_except *ca; struct irc_netmask tmp; - OperFlag *opf; + NameValue *opf; ca = MyMallocEx(sizeof(ConfigItem_except)); ca->mask = strdup(mask); @@ -6064,7 +5980,7 @@ int _conf_log(ConfigFile *conf, ConfigEntry *ce) { ConfigEntry *cep, *cepp; ConfigItem_log *ca; - OperFlag *ofp = NULL; + NameValue *ofp = NULL; ca = MyMallocEx(sizeof(ConfigItem_log)); ca->logfd = -1; @@ -6206,7 +6122,7 @@ int _conf_link(ConfigFile *conf, ConfigEntry *ce) { ConfigEntry *cep, *cepp, *ceppp; ConfigItem_link *link = NULL; - OperFlag *ofp; + NameValue *ofp; link = (ConfigItem_link *) MyMallocEx(sizeof(ConfigItem_link)); link->servername = strdup(ce->ce_vardata); @@ -6326,7 +6242,7 @@ void auto_convert_ipv4_to_ipv6(ConfigEntry *cep) int _test_link(ConfigFile *conf, ConfigEntry *ce) { ConfigEntry *cep, *cepp, *ceppp; - OperFlag *ofp; + NameValue *ofp; int errors = 0; int has_incoming = 0, has_incoming_mask = 0, has_outgoing = 0; @@ -6715,7 +6631,7 @@ int _test_ban(ConfigFile *conf, ConfigEntry *ce) int _conf_set(ConfigFile *conf, ConfigEntry *ce) { ConfigEntry *cep, *cepp, *ceppp; - OperFlag *ofl = NULL; + NameValue *ofl = NULL; Hook *h; for (cep = ce->ce_entries; cep; cep = cep->ce_next) @@ -6994,32 +6910,6 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce) } } } - else if (!strcmp(cep->ce_varname, "hosts")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) - { - if (!strcmp(cepp->ce_varname, "local")) { - ircstrdup(tempiConf.network.x_locop_host, cepp->ce_vardata); - } - else if (!strcmp(cepp->ce_varname, "global")) { - ircstrdup(tempiConf.network.x_oper_host, cepp->ce_vardata); - } - else if (!strcmp(cepp->ce_varname, "coadmin")) { - ircstrdup(tempiConf.network.x_coadmin_host, cepp->ce_vardata); - } - else if (!strcmp(cepp->ce_varname, "admin")) { - ircstrdup(tempiConf.network.x_admin_host, cepp->ce_vardata); - } - else if (!strcmp(cepp->ce_varname, "servicesadmin")) { - ircstrdup(tempiConf.network.x_sadmin_host, cepp->ce_vardata); - } - else if (!strcmp(cepp->ce_varname, "netadmin")) { - ircstrdup(tempiConf.network.x_netadmin_host, cepp->ce_vardata); - } - else if (!strcmp(cepp->ce_varname, "host-on-oper-up")) { - tempiConf.network.x_inah = config_checkval(cepp->ce_vardata,CFG_YESNO); - } - } - } else if (!strcmp(cep->ce_varname, "cloak-keys")) { for (h = Hooks[HOOKTYPE_CONFIGRUN]; h; h = h->next) @@ -7768,101 +7658,10 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) } } else if (!strcmp(cep->ce_varname, "hosts")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) - { - char *c, *host; - if (!cepp->ce_vardata) - { - config_error_empty(cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, "set::hosts", - cepp->ce_varname); - errors++; - continue; - } - if (!strcmp(cepp->ce_varname, "local")) { - CheckDuplicate(cepp, hosts_local, "hosts::local"); - } - else if (!strcmp(cepp->ce_varname, "global")) { - CheckDuplicate(cepp, hosts_global, "hosts::global"); - } - else if (!strcmp(cepp->ce_varname, "coadmin")) { - CheckDuplicate(cepp, hosts_coadmin, "hosts::coadmin"); - } - else if (!strcmp(cepp->ce_varname, "admin")) { - CheckDuplicate(cepp, hosts_admin, "hosts::admin"); - } - else if (!strcmp(cepp->ce_varname, "servicesadmin")) { - CheckDuplicate(cepp, hosts_servicesadmin, "hosts::servicesadmin"); - } - else if (!strcmp(cepp->ce_varname, "netadmin")) { - CheckDuplicate(cepp, hosts_netadmin, "hosts::netadmin"); - } - else if (!strcmp(cepp->ce_varname, "host-on-oper-up")) { - CheckDuplicate(cepp, hosts_host_on_oper_up, "hosts::host-on-oper-up"); - } - else - { - config_error_unknown(cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, "set::hosts", cepp->ce_varname); - errors++; - continue; - - } - if ((c = strchr(cepp->ce_vardata, '@'))) - { - char *tmp; - if (!(*(c+1)) || (c-cepp->ce_vardata) > USERLEN || - c == cepp->ce_vardata) - { - config_error("%s:%i: illegal value for set::hosts::%s", - cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, - cepp->ce_varname); - errors++; - continue; - } - for (tmp = cepp->ce_vardata; tmp != c; tmp++) - { - if (*tmp == '~' && tmp == cepp->ce_vardata) - continue; - if (!isallowed(*tmp)) - break; - } - if (tmp != c) - { - config_error("%s:%i: illegal value for set::hosts::%s", - cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, - cepp->ce_varname); - errors++; - continue; - } - host = c+1; - } - else - host = cepp->ce_vardata; - if (strlen(host) > HOSTLEN) - { - config_error("%s:%i: illegal value for set::hosts::%s", - cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, - cepp->ce_varname); - errors++; - continue; - } - for (; *host; host++) - { - if (!isallowed(*host) && *host != ':') - { - config_error("%s:%i: illegal value for set::hosts::%s", - cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, - cepp->ce_varname); - errors++; - continue; - } - } - } + config_error("%s:%i: set::hosts has been removed in UnrealIRCd 3.4.x. You can use oper::vhost now.", + cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + errors++; + need_34_upgrade = 1; } else if (!strcmp(cep->ce_varname, "cloak-keys")) { @@ -8214,11 +8013,21 @@ int _conf_loadmodule(ConfigFile *conf, ConfigEntry *ce) { config_error("%s:%i: You are trying to load the 'commands' module, this is no longer supported. " "Fix this by editing your configuration file: remove the loadmodule line for commands and add the following line instead: " - "include \"modules.full.conf\";", + "include \"modules.default.conf\";", ce->ce_fileptr->cf_filename, ce->ce_varlinenum); need_34_upgrade = 1; return -1; } + if (strstr(ce->ce_vardata, "modules/cloak") && !strcmp(conf->cf_filename, "modules.conf")) + { + config_error("You seem to have an include for 'modules.conf'."); + config_error("If you have this because you are upgrading from 3.4-alpha3 to a"); + config_error("later 3.4.x version then please change the include \"modules.conf\";"); + config_error("into an include \"modules.default.conf\"; (probably in your"); + config_error("conf/unrealircd.conf). Yeah, we changed the file name."); + // TODO ^: silly win32 wrapping prevents this from being displayed otherwise. PLZ FIX! ! + /* let it continue to load anyway? */ + } if ((ret = Module_Create(ce->ce_vardata))) { config_status("%s:%i: loadmodule %s: failed to load: %s", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, diff --git a/src/s_extra.c b/src/s_extra.c index 8c0935726..5ecde5f27 100755 --- a/src/s_extra.c +++ b/src/s_extra.c @@ -258,7 +258,7 @@ int channel_canjoin(aClient *sptr, char *name) ConfigItem_deny_channel *p; aTKline *tklban; int ishold; - if (IsOper(sptr)) + if (!OperClass_evaluateACLPath("channel:restricted",sptr,NULL,NULL,name)) return 1; if (IsULine(sptr)) return 1; diff --git a/src/s_serv.c b/src/s_serv.c index ce4c4087b..43e9e8a88 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -192,11 +192,11 @@ CMD_FUNC(m_version) parv[0], version, debugmode, me.name, serveropts, extraflags ? extraflags : "", tainted ? "3" : "", - (IsAnOper(sptr) ? MYOSNAME : "*"), UnrealProtocol); - if (IsAnOper(sptr)) + (OperClass_evaluateACLPath("server:info",sptr,NULL,NULL,NULL) ? MYOSNAME : "*"), UnrealProtocol); + if (OperClass_evaluateACLPath("server:info",sptr,NULL,NULL,NULL)) sendto_one(sptr, ":%s NOTICE %s :%s", me.name, sptr->name, OPENSSL_VERSION_TEXT); #ifdef USE_LIBCURL - if (IsAnOper(sptr)) + if (OperClass_evaluateACLPath("server:info",sptr,NULL,NULL,NULL)) sendto_one(sptr, ":%s NOTICE %s :%s", me.name, sptr->name, curl_version()); #endif if (MyClient(sptr)) @@ -237,14 +237,14 @@ char buf[1024]; int remotecmdfilter(aClient *sptr, int parc, char *parv[]) { /* no remote requests permitted from non-ircops */ - if (MyClient(sptr) && !IsOper(sptr) && !BadPtr(parv[1])) + if (MyClient(sptr) && !OperClass_evaluateACLPath("server:remote",sptr,NULL,NULL,NULL) && !BadPtr(parv[1])) { parv[1] = NULL; parc = 1; } /* same as above, but in case an old server forwards a request to us: we ignore it */ - if (!MyClient(sptr) && !IsOper(sptr)) + if (!MyClient(sptr) && !OperClass_evaluateACLPath("server:remote",sptr,NULL,NULL,NULL)) return 1; /* STOP (return) */ return 0; /* Continue */ @@ -626,12 +626,12 @@ CMD_FUNC(m_rehash) { int x; - if (MyClient(sptr) && !OPCanRehash(sptr)) + if (MyClient(sptr) && !OperClass_evaluateACLPath("server:rehash",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; } - if (!MyClient(sptr) && !IsNetAdmin(sptr) + if (!MyClient(sptr) && !OperClass_evaluateACLPath("server:rehash",sptr,NULL,NULL,NULL) && !IsULine(sptr)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); @@ -698,10 +698,10 @@ CMD_FUNC(m_rehash) * a) it makes sense * b) remote servers don't support remote rehashes by non-netadmins */ - if (!IsNetAdmin(sptr)) + if (!OperClass_evaluateACLPath("server:rehash",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); - sendnotice(sptr, "'/REHASH -global' requires you to be NetAdmin"); + sendnotice(sptr, "'/REHASH -global' requires you to have server::rehash permissions"); return 0; } if (parv[1] && *parv[1] != '-') @@ -726,7 +726,7 @@ CMD_FUNC(m_rehash) if (!BadPtr(parv[1]) && stricmp(parv[1], "-all")) { - if (!IsAdmin(sptr) && !IsCoAdmin(sptr)) + if (!OperClass_evaluateACLPath("server:rehash",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; @@ -825,12 +825,12 @@ char *reason = parv[1]; aClient *acptr; int i; /* Check permissions */ - if (MyClient(sptr) && !OPCanRestart(sptr)) + if (MyClient(sptr) && !OperClass_evaluateACLPath("server:restart",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; } - if (!MyClient(sptr) && !IsNetAdmin(sptr) && !IsULine(sptr)) + if (!MyClient(sptr) && !OperClass_evaluateACLPath("server:restart",sptr,NULL,NULL,NULL) && !IsULine(sptr)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; @@ -1183,7 +1183,7 @@ CMD_FUNC(m_die) { aClient *acptr; int i; - if (!MyClient(sptr) || !OPCanDie(sptr)) + if (!MyClient(sptr) || !OperClass_evaluateACLPath("server:die",sptr,NULL,NULL,NULL)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; diff --git a/src/s_svs.c b/src/s_svs.c index b5476dcf2..3b658e4ad 100644 --- a/src/s_svs.c +++ b/src/s_svs.c @@ -44,63 +44,6 @@ extern ircstats IRCstats; aConfiguration iConf; -#define STAR1 OFLAG_SADMIN|OFLAG_ADMIN|OFLAG_NETADMIN|OFLAG_COADMIN -#define STAR2 OFLAG_ZLINE|OFLAG_HIDE - -MODVAR int oper_access[] = { - ~(STAR1 | STAR2), '*', - OFLAG_LOCAL, 'o', - OFLAG_GLOBAL, 'O', - OFLAG_REHASH, 'r', - OFLAG_DIE, 'D', - OFLAG_RESTART, 'R', - OFLAG_GLOBOP, 'g', - OFLAG_WALLOP, 'w', - OFLAG_LOCOP, 'l', - OFLAG_LROUTE, 'c', - OFLAG_GROUTE, 'L', - OFLAG_LKILL, 'k', - OFLAG_GKILL, 'K', - OFLAG_KLINE, 'b', - OFLAG_UNKLINE, 'B', - OFLAG_LNOTICE, 'n', - OFLAG_GNOTICE, 'G', - OFLAG_ADMIN, 'A', - OFLAG_SADMIN, 'a', - OFLAG_NETADMIN, 'N', - OFLAG_COADMIN, 'C', - OFLAG_ZLINE, 'z', - OFLAG_HIDE, 'H', - OFLAG_TKL, 't', - OFLAG_GZL, 'Z', - OFLAG_OVERRIDE, 'v', - OFLAG_DCCDENY, 'd', - OFLAG_ADDLINE, 'X', - OFLAG_TSCTL, 'T', - 0, 0 -}; - -MODVAR char oflagbuf[128]; - -char *oflagstr(long oflag) -{ - int *i, flag; - char m; - char *p = oflagbuf; - - for (i = &oper_access[6], m = *(i + 1); (flag = *i); - i += 2, m = *(i + 1)) - { - if (oflag & flag) - { - *p = m; - p++; - } - } - *p = '\0'; - return oflagbuf; -} - /* ok, given a mask, our job is to determine * wether or not it's a safe mask to banish... * diff --git a/src/s_user.c b/src/s_user.c index 55dfeda78..004749e8b 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -308,7 +308,7 @@ int check_for_target_limit(aClient *sptr, void *target, const char *name) #endif u_char hash = (tmp * tmp) >> 12; - if (IsAnOper(sptr)) + if (OperClass_evaluateACLPath("immune:limits",sptr,NULL,NULL,NULL)) return 0; if (sptr->targets[0] == hash) return 0; diff --git a/src/send.c b/src/send.c index 54eddfdde..4816f7e99 100644 --- a/src/send.c +++ b/src/send.c @@ -691,8 +691,8 @@ void sendto_match_butone(aClient *one, aClient *from, char *mask, int what, if (MyConnect(from)) { - cansendlocal = (OPCanLNotice(from)) ? 1 : 0; - cansendglobal = (OPCanGNotice(from)) ? 1 : 0; + cansendlocal = (OperClass_evaluateACLPath("notice:local",from,NULL,NULL,NULL)) ? 1 : 0; + cansendglobal = (OperClass_evaluateACLPath("notice:global",from,NULL,NULL,NULL)) ? 1 : 0; } else cansendlocal = cansendglobal = 1; @@ -1068,7 +1068,7 @@ void sendto_opers_butone(aClient *one, aClient *from, char *pattern, ...) ++current_serial; list_for_each_entry(cptr, &client_list, client_node) { - if (!IsAnOper(cptr)) + if (!IsOper(cptr)) continue; if (cptr->from->serial == current_serial) /* sent message along it already ? */ continue; diff --git a/src/umodes.c b/src/umodes.c index 7560610d6..bf630d984 100644 --- a/src/umodes.c +++ b/src/umodes.c @@ -56,15 +56,10 @@ long UMODE_OPER = 0L; /* Operator */ long UMODE_WALLOP = 0L; /* send wallops to them */ long UMODE_FAILOP = 0L; /* Shows some global messages */ long UMODE_REGNICK = 0L; /* Nick set by services as registered */ -long UMODE_SADMIN = 0L; /* Services Admin */ -long UMODE_ADMIN = 0L; /* Admin */ long UMODE_SERVNOTICE = 0L; /* server notices such as kill */ long UMODE_LOCOP = 0L; /* Local operator -- SRB */ long UMODE_HIDE = 0L; /* Hide from Nukes */ -long UMODE_NETADMIN = 0L; /* Network Admin */ -long UMODE_COADMIN = 0L; /* Co Admin */ long UMODE_SECURE = 0L; /* User is a secure connect */ -long UMODE_VICTIM = 0L; /* Intentional Victim */ long UMODE_DEAF = 0L; /* Deaf */ long UMODE_HIDEOPER = 0L; /* Hide oper mode */ long UMODE_SETHOST = 0L; /* Used sethost */ @@ -112,45 +107,33 @@ void umode_init(void) Snomask_highest = 0; /* Set up modes */ - /* 2004-02-11: note: TODO: 'umode_allow_opers' is in most cases - * not completely correct since even opers shouldn't be allowed - * to set most of these flags (eg locop trying to set +N), - * it is currently handled by the m_umode() routine however, - * but it would be better if we get rid of that and switch - * completely to this umode->allowed system :). -- Syzop. - */ - UmodeAdd(NULL, 'i', UMODE_GLOBAL, NULL, &UMODE_INVISIBLE); - UmodeAdd(NULL, 'o', UMODE_GLOBAL, umode_allow_opers, &UMODE_OPER); - UmodeAdd(NULL, 'w', UMODE_GLOBAL, NULL, &UMODE_WALLOP); - UmodeAdd(NULL, 'g', UMODE_GLOBAL, umode_allow_opers, &UMODE_FAILOP); - UmodeAdd(NULL, 'r', UMODE_GLOBAL, NULL, &UMODE_REGNICK); - UmodeAdd(NULL, 'a', UMODE_GLOBAL, umode_allow_opers, &UMODE_SADMIN); - UmodeAdd(NULL, 'A', UMODE_GLOBAL, umode_allow_opers, &UMODE_ADMIN); - UmodeAdd(NULL, 's', UMODE_LOCAL, NULL, &UMODE_SERVNOTICE); - UmodeAdd(NULL, 'O', UMODE_LOCAL, umode_allow_opers, &UMODE_LOCOP); - UmodeAdd(NULL, 'x', UMODE_GLOBAL, NULL, &UMODE_HIDE); - UmodeAdd(NULL, 'N', UMODE_GLOBAL, umode_allow_opers, &UMODE_NETADMIN); - UmodeAdd(NULL, 'C', UMODE_GLOBAL, umode_allow_opers, &UMODE_COADMIN); - UmodeAdd(NULL, 'z', UMODE_GLOBAL, NULL, &UMODE_SECURE); - UmodeAdd(NULL, 'v', UMODE_GLOBAL, umode_allow_opers, &UMODE_VICTIM); - UmodeAdd(NULL, 'd', UMODE_GLOBAL, NULL, &UMODE_DEAF); - UmodeAdd(NULL, 'H', UMODE_GLOBAL, umode_allow_opers, &UMODE_HIDEOPER); - UmodeAdd(NULL, 't', UMODE_GLOBAL, NULL, &UMODE_SETHOST); - UmodeAdd(NULL, 'I', UMODE_GLOBAL, umode_allow_opers, &UMODE_HIDLE); - SnomaskAdd(NULL, 'k', umode_allow_all, &SNO_KILLS); - SnomaskAdd(NULL, 'c', umode_allow_opers, &SNO_CLIENT); - SnomaskAdd(NULL, 'f', umode_allow_opers, &SNO_FLOOD); - SnomaskAdd(NULL, 'F', umode_allow_opers, &SNO_FCLIENT); - SnomaskAdd(NULL, 'j', umode_allow_opers, &SNO_JUNK); - SnomaskAdd(NULL, 'v', umode_allow_opers, &SNO_VHOST); - SnomaskAdd(NULL, 'e', umode_allow_opers, &SNO_EYES); - SnomaskAdd(NULL, 'G', umode_allow_opers, &SNO_TKL); - SnomaskAdd(NULL, 'n', umode_allow_opers, &SNO_NICKCHANGE); - SnomaskAdd(NULL, 'N', umode_allow_opers, &SNO_FNICKCHANGE); - SnomaskAdd(NULL, 'q', umode_allow_opers, &SNO_QLINE); - SnomaskAdd(NULL, 'S', umode_allow_opers, &SNO_SPAMF); - SnomaskAdd(NULL, 's', umode_allow_all, &SNO_SNOTICE); - SnomaskAdd(NULL, 'o', umode_allow_opers, &SNO_OPER); + UmodeAdd(NULL, 'i', UMODE_GLOBAL, 0, umode_allow_all, &UMODE_INVISIBLE); + UmodeAdd(NULL, 'o', UMODE_GLOBAL, 1, umode_allow_opers, &UMODE_OPER); + UmodeAdd(NULL, 'w', UMODE_GLOBAL, 0, umode_allow_all, &UMODE_WALLOP); + UmodeAdd(NULL, 'g', UMODE_GLOBAL, 1, umode_allow_opers, &UMODE_FAILOP); + UmodeAdd(NULL, 'r', UMODE_GLOBAL, 0, umode_allow_none, &UMODE_REGNICK); + UmodeAdd(NULL, 's', UMODE_LOCAL, 0, umode_allow_all, &UMODE_SERVNOTICE); + UmodeAdd(NULL, 'O', UMODE_LOCAL, 1, umode_allow_opers, &UMODE_LOCOP); + UmodeAdd(NULL, 'x', UMODE_GLOBAL, 0, umode_allow_all, &UMODE_HIDE); + UmodeAdd(NULL, 'z', UMODE_GLOBAL, 0, umode_allow_none, &UMODE_SECURE); + UmodeAdd(NULL, 'd', UMODE_GLOBAL, 0, umode_allow_all, &UMODE_DEAF); + UmodeAdd(NULL, 'H', UMODE_GLOBAL, 1, umode_allow_opers, &UMODE_HIDEOPER); + UmodeAdd(NULL, 't', UMODE_GLOBAL, 0, umode_allow_none, &UMODE_SETHOST); + UmodeAdd(NULL, 'I', UMODE_GLOBAL, 1, umode_allow_opers, &UMODE_HIDLE); + SnomaskAdd(NULL, 'k', 0, umode_allow_all, &SNO_KILLS); + SnomaskAdd(NULL, 'c', 1, umode_allow_opers, &SNO_CLIENT); + SnomaskAdd(NULL, 'f', 1, umode_allow_opers, &SNO_FLOOD); + SnomaskAdd(NULL, 'F', 1, umode_allow_opers, &SNO_FCLIENT); + SnomaskAdd(NULL, 'j', 1, umode_allow_opers, &SNO_JUNK); + SnomaskAdd(NULL, 'v', 1, umode_allow_opers, &SNO_VHOST); + SnomaskAdd(NULL, 'e', 1, umode_allow_opers, &SNO_EYES); + SnomaskAdd(NULL, 'G', 1, umode_allow_opers, &SNO_TKL); + SnomaskAdd(NULL, 'n', 1, umode_allow_opers, &SNO_NICKCHANGE); + SnomaskAdd(NULL, 'N', 1, umode_allow_opers, &SNO_FNICKCHANGE); + SnomaskAdd(NULL, 'q', 1, umode_allow_opers, &SNO_QLINE); + SnomaskAdd(NULL, 'S', 1, umode_allow_opers, &SNO_SPAMF); + SnomaskAdd(NULL, 's', 1, umode_allow_opers, &SNO_SNOTICE); + SnomaskAdd(NULL, 'o', 1, umode_allow_opers, &SNO_OPER); } void make_umodestr(void) @@ -171,7 +154,7 @@ void make_umodestr(void) * Add a usermode with character 'ch', if global is set to 1 the usermode is global * (sent to other servers) otherwise it's a local usermode */ -Umode *UmodeAdd(Module *module, char ch, int global, int (*allowed)(aClient *sptr, int what), long *mode) +Umode *UmodeAdd(Module *module, char ch, int global, int unset_on_deoper, int (*allowed)(aClient *sptr, int what), long *mode) { short i = 0; short j = 0; @@ -202,6 +185,7 @@ Umode *UmodeAdd(Module *module, char ch, int global, int (*allowed)(aClient *spt { Usermode_Table[i].flag = ch; Usermode_Table[i].allowed = allowed; + Usermode_Table[i].unset_on_deoper = unset_on_deoper; Debug((DEBUG_DEBUG, "umode_get(%c) returning %04x", ch, Usermode_Table[i].mode)); /* Update usermode table highest */ @@ -272,7 +256,7 @@ void UmodeDel(Umode *umode) return; } -Snomask *SnomaskAdd(Module *module, char ch, int (*allowed)(aClient *sptr, int what), long *mode) +Snomask *SnomaskAdd(Module *module, char ch, int unset_on_deoper, int (*allowed)(aClient *sptr, int what), long *mode) { short i = 0; short j = 0; @@ -303,6 +287,7 @@ Snomask *SnomaskAdd(Module *module, char ch, int (*allowed)(aClient *sptr, int w { Snomask_Table[i].flag = ch; Snomask_Table[i].allowed = allowed; + Snomask_Table[i].unset_on_deoper = unset_on_deoper; /* Update usermode table highest */ for (j = 0; j < UMODETABLESZ; j++) if (Snomask_Table[i].flag) @@ -381,7 +366,7 @@ int umode_allow_none(aClient *sptr, int what) int umode_allow_opers(aClient *sptr, int what) { if (MyClient(sptr)) - return IsAnOper(sptr) ? 1 : 0; + return IsOper(sptr) ? 1 : 0; else return 1; } @@ -452,68 +437,35 @@ void unload_all_unused_snomasks(void) } } -long umode_get(char ch, int options, int (*allowed)(aClient *sptr, int what)) -{ - long flag; - if (UmodeAdd(NULL, ch, options, allowed, &flag)) - return flag; - return 0; -} - -int umode_delete(char ch, long val) -{ - int i; - for (i = 0; i < UMODETABLESZ; i++) - { - if (Usermode_Table[i].flag == ch && Usermode_Table[i].mode == val) - { - UmodeDel(&Usermode_Table[i]); - return 1; - } - } - return -1; -} - /** - * Simply non-perfect function to remove all oper-snomasks, - * it's at least better than manually doing a .. &= ~SNO_BLAH everywhere. - * - * Also unsets all snomasks and UMODE_SERVNOTICE if it would seem the - * user doesn't deserve to have snomask after being deopered. This is - * simpler, but hackier, than actually recording whether or not the - * user already had some snomasks set before OPERing and then reset - * his stuff to that... --binki + * This function removes any oper-only snomasks when the user is no + * longer an IRC Operator. + * In the past this relied on hacks and guesses. Nowadays we simply + * use the information given by SnomaskAdd() and set::restrict-user-modes. */ void remove_oper_snomasks(aClient *sptr) { -int i; - /* - * See #3329 - */ - if (sptr->umodes & UMODE_SERVNOTICE - && RESTRICT_USERMODES - && strchr(RESTRICT_USERMODES, 's') - && !(CONN_MODES & UMODE_SERVNOTICE)) + int i; + + if (RESTRICT_USERMODES && strchr(RESTRICT_USERMODES, 's')) { sptr->umodes &= ~UMODE_SERVNOTICE; sptr->user->snomask = 0; - /* we unset all snomasks, so short-circuit */ - return; + return; /* we unset all snomasks, so short-circuit */ } for (i = 0; i <= Snomask_highest; i++) { if (!Snomask_Table[i].flag) continue; - if (Snomask_Table[i].allowed == umode_allow_opers) + if (Snomask_Table[i].unset_on_deoper) sptr->user->snomask &= ~Snomask_Table[i].mode; } } /* - * Strip all 'oper only modes' from the user. - * This function is NOT PERFECT, see comments from the - * remove_oper_snomasks above. + * This function removes any oper-only user modes from the user. + * You may also want to call remove_oper_snomasks(), see above. */ void remove_oper_modes(aClient *sptr) { @@ -523,7 +475,7 @@ int i; { if (!Usermode_Table[i].flag) continue; - if (Usermode_Table[i].allowed == umode_allow_opers) + if (Usermode_Table[i].unset_on_deoper) sptr->umodes &= ~Usermode_Table[i].mode; } } diff --git a/src/updconf.c b/src/updconf.c index d16802684..537808f49 100644 --- a/src/updconf.c +++ b/src/updconf.c @@ -12,6 +12,60 @@ extern void config_free(ConfigFile *cfptr); char configfiletmp[512]; +struct _upgrade +{ + char *locop_host; + char *oper_host; + char *coadmin_host; + char *admin_host; + char *sadmin_host; + char *netadmin_host; + int host_on_oper_up; +}; + +struct _upgrade upgrade; + +typedef struct flagmapping FlagMapping; +struct flagmapping +{ + char shortflag; + char *longflag; +}; + +static FlagMapping FlagMappingTable[] = { + { 'o', "local" }, + { 'O', "global" }, + { 'r', "can_rehash" }, + { 'D', "can_die" }, + { 'R', "can_restart" }, + { 'w', "can_wallops" }, + { 'g', "can_globops" }, + { 'c', "can_localroute" }, + { 'L', "can_globalroute" }, + { 'K', "can_globalkill" }, + { 'b', "can_kline" }, + { 'B', "can_unkline" }, + { 'n', "can_localnotice" }, + { 'G', "can_globalnotice" }, + { 'A', "admin" }, + { 'a', "services-admin" }, + { 'N', "netadmin" }, + { 'C', "coadmin" }, + { 'z', "can_zline" }, + { 'W', "get_umodew" }, + { 'H', "get_host" }, + { 't', "can_gkline" }, + { 'Z', "can_gzline" }, + { 'v', "can_override" }, + { 'q', "can_setq" }, + { 'd', "can_dccdeny" }, + { 'T', "can_tsctl" }, + { 0, NULL }, +}; + +int needs_modules_default_conf = 1; +int needs_operclass_default_conf = 1; + static void die() { #ifdef _WIN32 @@ -445,7 +499,6 @@ int upgrade_from_subblock(ConfigEntry *ce) { ConfigEntry *cep, *cepp; char *list[MAXFROMENTRIES]; - char sid[16]; int listcnt = 0; memset(list, 0, sizeof(list)); @@ -480,6 +533,8 @@ int upgrade_from_subblock(ConfigEntry *ce) char *m = !strncmp(list[i], "*@", 2) ? list[i]+2 : list[i]; /* skip or don't skip the user@ part */ snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "\t%s;\n", m); } + + strlcat(buf, "\t};\n", sizeof(buf)); } replace_section(ce, buf); @@ -495,19 +550,26 @@ int upgrade_loadmodule(ConfigEntry *ce) if (!file) return 0; - + if (our_strcasestr(file, "commands.dll") || our_strcasestr(file, "/commands.so")) { - snprintf(buf, sizeof(buf), "include \"modules.full.conf\";\n"); + snprintf(buf, sizeof(buf), "include \"modules.default.conf\";\n"); + needs_modules_default_conf = 0; + if (needs_operclass_default_conf) + { + /* This is a nice place :) */ + snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "include \"operclass.default.conf\";\n"); + needs_operclass_default_conf = 0; + } replace_section(ce, buf); - config_status("- loadmodule for '%s' replaced with an include \"modules.full.conf\"", file); + config_status("- loadmodule for '%s' replaced with an include \"modules.default.conf\"", file); return 1; } if (our_strcasestr(file, "cloak.dll") || our_strcasestr(file, "/cloak.so")) { - replace_section(ce, "/* NOTE: cloaking module is included in modules.full.conf */"); - config_status("- loadmodule for '%s' removed as this is now in modules.full.conf", file); + replace_section(ce, "/* NOTE: cloaking module is included in modules.default.conf */"); + config_status("- loadmodule for '%s' removed as this is now in modules.default.conf", file); return 1; } @@ -701,7 +763,7 @@ int upgrade_allow_block(ConfigEntry *ce) char *class = NULL; char *redirect_server = NULL; int redirect_port = 0; - char *options[MAXSPFTARGETS]; + char *options[MAXALLOWOPTIONS]; int optionscnt = 0; char options_str[512], comment[512]; @@ -931,6 +993,339 @@ int upgrade_cgiirc_block(ConfigEntry *ce) return 1; } +int contains_flag(char **flags, int flagscnt, char *needle) +{ + int i; + + for (i = 0; i < flagscnt; i++) + if (!strcmp(flags[i], needle)) + return 1; + + return 0; +} + +#define MAXOPERFLAGS 64 +int upgrade_oper_block(ConfigEntry *ce) +{ + ConfigEntry *cep, *cepp; + char *name = NULL; + char *password = NULL; + char *password_type = NULL; + char *require_modes = NULL; + char *class = NULL; + char *flags[MAXOPERFLAGS]; + int flagscnt = 0; + char *swhois = NULL; + char *snomask = NULL; + char *modes = NULL; + int maxlogins = -1; + char *fromlist[MAXFROMENTRIES]; + int fromlistcnt = 0; + char maskbuf[1024]; + char *operclass = NULL; /* set by us, not read from conf */ + char *vhost = NULL; /* set by us, not read from conf */ + int i; + char silly[64]; + + memset(flags, 0, sizeof(flags)); + *maskbuf = '\0'; + + name = ce->ce_vardata; + + if (!name) + return 0; /* oper block without a name = invalid */ + + for (cep = ce->ce_entries; cep; cep = cep->ce_next) + { + if (!strcmp(cep->ce_varname, "operclass")) + return 0; /* already 3.4.x conf */ + else if (!strcmp(cep->ce_varname, "flags")) + { + if (cep->ce_vardata) /* short options (flag letters) */ + { + char *p; + for (p = cep->ce_vardata; *p; p++) + { + if (flagscnt == MAXALLOWOPTIONS) + break; + for (i = 0; FlagMappingTable[i].shortflag; i++) + { + if (FlagMappingTable[i].shortflag == *p) + { + flags[flagscnt] = FlagMappingTable[i].longflag; + flagscnt++; + break; + } + } + } + } + else if (cep->ce_entries) /* long options (flags written out) */ + { + for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + { + if (flagscnt == MAXALLOWOPTIONS) + break; + flags[flagscnt++] = cepp->ce_varname; + } + } + } + else if (!strcmp(cep->ce_varname, "from")) + { + for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + { + if (!strcmp(cepp->ce_varname, "userhost") && cepp->ce_vardata) + { + if (fromlistcnt == MAXFROMENTRIES) + break; // no room, sorry. + fromlist[fromlistcnt++] = cepp->ce_vardata; + } + } + } + else if (!strcmp(cep->ce_varname, "mask")) + { + /* processing mask here means we can also upgrade 3.4-alphaX oper blocks.. */ + if (cep->ce_vardata) + { + if (fromlistcnt == MAXFROMENTRIES) + break; // no room, sorry. + fromlist[fromlistcnt++] = cep->ce_vardata; + } else + { + for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + { + if (fromlistcnt == MAXFROMENTRIES) + break; // no room, sorry. + fromlist[fromlistcnt++] = cepp->ce_varname; + } + } + } + else if (!cep->ce_vardata) + continue; /* invalid */ + else if (!strcmp(cep->ce_varname, "password")) + { + password = cep->ce_vardata; + if (cep->ce_entries) + password_type = cep->ce_entries->ce_varname; + } + else if (!strcmp(cep->ce_varname, "require-modes")) + { + require_modes = cep->ce_vardata; + } + else if (!strcmp(cep->ce_varname, "class")) + { + class = cep->ce_vardata; + } + else if (!strcmp(cep->ce_varname, "swhois")) + { + swhois = cep->ce_vardata; + } + else if (!strcmp(cep->ce_varname, "snomasks")) + { + snomask = cep->ce_vardata; + } + else if (!strcmp(cep->ce_varname, "modes")) + { + modes = cep->ce_vardata; + } + else if (!strcmp(cep->ce_varname, "maxlogins")) + { + maxlogins = atoi(cep->ce_vardata); + } + } + + if ((fromlistcnt == 0) || !password || !class) + return 0; /* missing 3.2.x items in allow block (invalid or upgraded already) */ + + /* build oper::mask list in 'maskbuf' (includes variable name) */ + if (fromlistcnt == 1) + { + char *m = !strncmp(fromlist[0], "*@", 2) ? fromlist[0]+2 : fromlist[0]; /* skip or don't skip the user@ part */ + snprintf(maskbuf, sizeof(maskbuf), "mask %s;\n", m); + } else + { + /* Multiple (list of masks) */ + int i; + snprintf(maskbuf, sizeof(maskbuf), "mask {\n"); + + for (i=0; i < fromlistcnt; i++) + { + char *m = !strncmp(fromlist[i], "*@", 2) ? fromlist[i]+2 : fromlist[i]; /* skip or don't skip the user@ part */ + snprintf(maskbuf+strlen(maskbuf), sizeof(maskbuf)-strlen(maskbuf), "\t%s;\n", m); + } + strlcat(maskbuf, "\t};\n", sizeof(maskbuf)); + } + + /* Figure out which default operclass looks most suitable (="find highest rank") */ + if (contains_flag(flags, flagscnt, "netadmin")) + operclass = "netadmin"; + else if (contains_flag(flags, flagscnt, "services-admin")) + operclass = "services-admin"; + else if (contains_flag(flags, flagscnt, "coadmin")) + operclass = "coadmin"; + else if (contains_flag(flags, flagscnt, "admin")) + operclass = "admin"; + else if (contains_flag(flags, flagscnt, "global")) + operclass = "globop"; + else if (contains_flag(flags, flagscnt, "local")) + operclass = "locop"; + else + { + /* Hmm :) */ + config_status("WARNING: I have trouble converting oper block '%s' to the new system. " + "I made it use the locop operclass. Feel free to change", name); + operclass = "locop"; + } + + if (contains_flag(flags, flagscnt, "get_host") || upgrade.host_on_oper_up) + { + if (!strcmp(operclass, "netadmin")) + vhost = upgrade.netadmin_host; + else if (!strcmp(operclass, "services-admin")) + vhost = upgrade.sadmin_host; + else if (!strcmp(operclass, "coadmin")) + vhost = upgrade.coadmin_host; + else if (!strcmp(operclass, "admin")) + vhost = upgrade.admin_host; + else if (!strcmp(operclass, "globop")) + vhost = upgrade.oper_host; + else if (!strcmp(operclass, "locop")) + vhost = upgrade.locop_host; + } + + /* If no swhois is set, then set a title. Just because people are used to it. */ + if (!swhois) + { + if (!strcmp(operclass, "netadmin")) + swhois = "is a Network Administrator"; + else if (!strcmp(operclass, "services-admin")) + swhois = "is a Services Administrator"; + else if (!strcmp(operclass, "coadmin")) + swhois = "is a Co Administrator"; + else if (!strcmp(operclass, "admin")) + swhois = "is a Server Administrator"; + } + + /* The 'coadmin' operclass is actually 'admin'. There's no difference in privileges. */ + if (!strcmp(operclass, "coadmin")) + operclass = "admin"; + + /* convert globop and above w/override to operclassname-with-override */ + if (contains_flag(flags, flagscnt, "can_override") && strcmp(operclass, "locop")) + { + snprintf(silly, sizeof(silly), "%s-with-override", operclass); + operclass = silly; + } + + /* Ok, we got everything we need. Now we will write out the actual new oper block! */ + + /* oper block header & oper::mask */ + snprintf(buf, sizeof(buf), "oper %s {\n" + "\t%s", + name, + maskbuf); + + /* oper::password */ + if (password_type) + snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "\tpassword \"%s\" { %s; };\n", password, password_type); + else + snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "\tpassword \"%s\";\n", password); + + /* oper::require-modes */ + if (require_modes) + snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "\trequire-modes \"%s\";\n", require_modes); + + /* oper::maxlogins */ + if (maxlogins != -1) + snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "\tmaxlogins %d;\n", maxlogins); + + /* oper::class */ + snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "\tclass %s;\n", class); + + /* oper::operclass */ + snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "\toperclass %s;\n", operclass); + + /* oper::modes */ + if (modes) + snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "\tmodes \"%s\";\n", modes); + + /* oper::snomask */ + if (snomask) + snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "\tsnomask \"%s\";\n", snomask); + + /* oper::vhost */ + if (vhost) + snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "\tvhost \"%s\";\n", vhost); + + /* oper::swhois */ + if (swhois) + snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "\tswhois \"%s\";\n", swhois); + + strlcat(buf, "};\n", sizeof(buf)); + + replace_section(ce, buf); + config_status("- oper block (%s) converted to new syntax", name); + return 1; +} + +void update_read_settings(char *cfgfile) +{ + ConfigFile *cf = NULL; + ConfigEntry *ce = NULL, *cep, *cepp; + + cf = config_load(cfgfile); + if (!cf) + return; + + if (strstr(cfgfile, "modules.default.conf")) + needs_modules_default_conf = 0; + else if (strstr(cfgfile, "operclass.default.conf")) + needs_operclass_default_conf = 0; + + + /* This needs to be read early, as the rest may depend on it */ + for (ce = cf->cf_entries; ce; ce = ce->ce_next) + { + if (!strcmp(ce->ce_varname, "set")) + { + for (cep = ce->ce_entries; cep; cep = cep->ce_next) + { + if (!strcmp(cep->ce_varname, "hosts")) + { + for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + { + if (!cepp->ce_vardata) + continue; + if (!strcmp(cepp->ce_varname, "local")) { + ircstrdup(upgrade.locop_host, cepp->ce_vardata); + } + else if (!strcmp(cepp->ce_varname, "global")) { + ircstrdup(upgrade.oper_host, cepp->ce_vardata); + } + else if (!strcmp(cepp->ce_varname, "coadmin")) { + ircstrdup(upgrade.coadmin_host, cepp->ce_vardata); + } + else if (!strcmp(cepp->ce_varname, "admin")) { + ircstrdup(upgrade.admin_host, cepp->ce_vardata); + } + else if (!strcmp(cepp->ce_varname, "servicesadmin")) { + ircstrdup(upgrade.sadmin_host, cepp->ce_vardata); + } + else if (!strcmp(cepp->ce_varname, "netadmin")) { + ircstrdup(upgrade.netadmin_host, cepp->ce_vardata); + } + else if (!strcmp(cepp->ce_varname, "host-on-oper-up")) { + upgrade.host_on_oper_up = config_checkval(cepp->ce_vardata,CFG_YESNO); + } + } + } + } + } + } + + config_free(cf); +} + + int update_conf_file(void) { ConfigFile *cf = NULL; @@ -956,7 +1351,7 @@ again: config_error("could not load configuration file '%s'", configfile); return 0; } - + for (ce = cf->cf_entries; ce; ce = ce->ce_next) { /*printf("%s%s%s\n", @@ -986,14 +1381,8 @@ again: } if (!strcmp(ce->ce_varname, "oper")) { - for (cep = ce->ce_entries; cep; cep = cep->ce_next) - { - if (!strcmp(cep->ce_varname, "from")) - { - if (upgrade_from_subblock(cep)) - goto again; - } - } + if (upgrade_oper_block(ce)) + goto again; } if (!strcmp(ce->ce_varname, "vhost")) { @@ -1044,6 +1433,12 @@ again: insert_section(cep->ce_fileposstart, buf); goto again; + } else + if (!strcmp(cep->ce_varname, "hosts")) + { + config_status("- removed set::hosts. we now use oper::vhost for this."); + remove_section(cep->ce_fileposstart, cep->ce_fileposend+2); /* hmm +2.. why.. */ + goto again; } } } @@ -1091,8 +1486,17 @@ void build_include_list_ex(char *fname, ConfigFile **cf_list) for (ce = cf->cf_entries; ce; ce = ce->ce_next) if (!strcmp(ce->ce_varname, "include")) + { + if ((ce->ce_vardata[0] != '/') && (ce->ce_vardata[0] != '\\') && strcmp(ce->ce_vardata, CPATH)) + { + char *str = MyMallocEx(strlen(ce->ce_vardata) + strlen(CONFDIR) + 4); + sprintf(str, "%s/%s", CONFDIR, ce->ce_vardata); + MyFree(ce->ce_vardata); + ce->ce_vardata = str; + } if (!already_included(ce->ce_vardata, *cf_list)) build_include_list_ex(ce->ce_vardata, cf_list); + } } ConfigFile *build_include_list(char *fname) @@ -1105,6 +1509,7 @@ ConfigFile *build_include_list(char *fname) void update_conf(void) { + ConfigFile *files; ConfigFile *cf; ConfigEntry *ce, *cep, *cepp; char *mainconf = configfile; @@ -1113,10 +1518,18 @@ void update_conf(void) config_status("Attempting to upgrade '%s' (and all it's included files) from UnrealIRCd 3.2.x to UnrealIRCd 3.4.x...", configfile); strlcpy(me.name, "", sizeof(me.name)); + memset(&upgrade, 0, sizeof(upgrade)); - cf = build_include_list(mainconf); + files = build_include_list(mainconf); - for (; cf; cf = cf->cf_next) + /* We need to read some original settings first, before we touch anything... */ + for (cf = files; cf; cf = cf->cf_next) + { + update_read_settings(cf->cf_filename); + } + + /* Now go upgrade... */ + for (cf = files; cf; cf = cf->cf_next) { if (!file_exists(cf->cf_filename)) continue; /* skip silently. errors were already shown earlier by build_include_list anyway. */ @@ -1172,11 +1585,28 @@ void update_conf(void) } } configfile = mainconf; /* restore */ + + if (needs_operclass_default_conf) + { + /* There's a slight chance we never added this include, and you get mysterious + * oper permissions errors if you try to use such an operclass and it's missing. + */ + FILE *fd = fopen(mainconf, "a"); + if (fd) + { + fprintf(fd, "\ninclude \"operclass.default.conf\";\n"); + fclose(fd); + config_status("Oh wait, %s needs an include for operclass.default.conf. Added.", mainconf); + upgraded_files++; + } + } if (upgraded_files > 0) { config_status(""); config_status("%d configuration file(s) upgraded. You can now boot UnrealIRCd with your freshly converted conf's!", upgraded_files); + config_status("You should probably take a look at the converted configuration files now or at a later time."); + config_status("See also https://www.unrealircd.org/docs/Upgrading_from_3.2.x and the sections in there (eg: Oper block)"); config_status(""); } else { config_status(""); diff --git a/src/version.c.SH b/src/version.c.SH index 736f13ece..69dcd033d 100644 --- a/src/version.c.SH +++ b/src/version.c.SH @@ -4,7 +4,7 @@ echo "Extracting src/version.c..." #id=`grep '$Id: Changes,v' ../Changes` #id=`echo $id |sed 's/.* Changes\,v \(.*\) .* Exp .*/\1/'` -id="3.4-alpha3" +id="3.4-alpha4" echo "$id" if test -r version.c diff --git a/src/win32/editor.c b/src/win32/editor.c index 562503cd3..d55424a95 100644 --- a/src/win32/editor.c +++ b/src/win32/editor.c @@ -657,7 +657,7 @@ LRESULT CALLBACK FromFileDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPar lpopen.lpstrFile = path; lpopen.nMaxFile = MAX_PATH; lpopen.lpstrFileTitle = NULL; - lpopen.lpstrInitialDir = CFGPATH; + lpopen.lpstrInitialDir = CONFDIR; lpopen.lpstrTitle = NULL; lpopen.Flags = (OFN_ENABLESIZING|OFN_NONETWORKBUTTON| OFN_OVERWRITEPROMPT); diff --git a/src/win32/encpem.bat b/src/win32/encpem.bat index 1d668eadf..19f93b217 100755 --- a/src/win32/encpem.bat +++ b/src/win32/encpem.bat @@ -1,3 +1,3 @@ @title Encrypting server private key -openssl rsa -in server.key.pem -out server.key.c.pem -des3 -copy server.key.c.pem server.key.pem \ No newline at end of file +openssl rsa -in conf/ssl/server.key.pem -out conf/ssl/server.key.c.pem -des3 +copy conf/ssl/server.key.c.pem conf/ssl/server.key.pem diff --git a/src/win32/makecert.bat b/src/win32/makecert.bat index 1a449992f..f086959ab 100755 --- a/src/win32/makecert.bat +++ b/src/win32/makecert.bat @@ -1,4 +1,4 @@ @title Certificate Generation -openssl req -new -config ssl.cnf -out server.req.pem -keyout server.key.pem -nodes -openssl req -x509 -config ssl.cnf -days 365 -in server.req.pem -key server.key.pem -out server.cert.pem +openssl req -new -config ssl.cnf -out conf/ssl/server.req.pem -keyout conf/ssl/server.key.pem -nodes +openssl req -x509 -config ssl.cnf -days 365 -in conf/ssl/server.req.pem -key conf/ssl/server.key.pem -out conf/ssl/server.cert.pem diff --git a/src/win32/service.c b/src/win32/service.c index 8adafd32a..bfb739573 100644 --- a/src/win32/service.c +++ b/src/win32/service.c @@ -33,7 +33,7 @@ SERVICE_STATUS_HANDLE IRCDStatusHandle; /* Signal to rehash */ #define IRCD_SERVICE_CONTROL_REHASH 128 -BOOL IsService = FALSE; +MODVAR BOOL IsService = FALSE; extern OSVERSIONINFO VerInfo; #define WIN32_VERSION BASE_VERSION PATCH1 PATCH2 PATCH3 PATCH4 PATCH5 diff --git a/src/win32/unrealinst.iss b/src/win32/unrealinst.iss index a2f79e969..3c09832e0 100644 --- a/src/win32/unrealinst.iss +++ b/src/win32/unrealinst.iss @@ -1,13 +1,12 @@ ; UnrealIRCd Win32 Installation Script ; Requires Inno Setup 4.1.6 or later - ; Uncomment the line below to package with libcurl support #define USE_CURL [Setup] -AppName=UnrealIRCd -AppVerName=UnrealIRCd3.4-alpha3 +AppName=UnrealIRCd 3.4 +AppVerName=UnrealIRCd3.4-alpha4 AppPublisher=UnrealIRCd Team AppPublisherURL=http://www.unrealircd.com AppSupportURL=http://www.unrealircd.com @@ -16,11 +15,12 @@ AppMutex=UnrealMutex,Global\UnrealMutex DefaultDirName={pf}\Unreal3.4 DefaultGroupName=UnrealIRCd AllowNoIcons=yes -LicenseFile=.\gplplusssl.rtf +LicenseFile=src\win32\gplplusssl.rtf Compression=lzma SolidCompression=true MinVersion=5.0 -OutputDir=../../ +OutputDir=. +SourceDir=../../ ; !!! Make sure to update SSL validation (WizardForm.TasksList.Checked[9]) if tasks are added/removed !!! [Tasks] @@ -35,48 +35,55 @@ Name: "enccert"; Description: "&Encrypt certificate"; GroupDescription: "SSL opt Name: "fixperm"; Description: "Make Unreal folder writable by current user"; [Files] -Source: "..\..\wircd.exe"; DestDir: "{app}"; Flags: ignoreversion -Source: "..\..\WIRCD.pdb"; DestDir: "{app}"; Flags: ignoreversion -Source: "..\..\.CHANGES.NEW"; DestDir: "{app}"; DestName: "CHANGES.NEW.txt";Flags: ignoreversion -Source: "..\..\.RELEASE.NOTES"; DestDir: "{app}"; DestName: "RELEASE.NOTES.txt"; Flags: ignoreversion -Source: "..\..\.SICI"; DestDir: "{app}"; DestName: "SICI.txt"; Flags: ignoreversion -Source: "..\..\badwords.channel.conf"; DestDir: "{app}"; Flags: ignoreversion -Source: "..\..\badwords.message.conf"; DestDir: "{app}"; Flags: ignoreversion -Source: "..\..\badwords.quit.conf"; DestDir: "{app}"; Flags: ignoreversion -Source: "..\..\spamfilter.conf"; DestDir: "{app}"; Flags: ignoreversion -Source: "..\..\modules.*.conf"; DestDir: "{app}"; Flags: ignoreversion -Source: "..\..\dccallow.conf"; DestDir: "{app}"; Flags: ignoreversion -Source: "..\..\Donation"; DestDir: "{app}"; DestName: "Donation.txt"; Flags: ignoreversion -Source: "..\..\help.conf"; DestDir: "{app}"; Flags: ignoreversion -Source: "..\..\LICENSE"; DestDir: "{app}"; DestName: "LICENSE.txt"; Flags: ignoreversion -Source: "..\..\Unreal.nfo"; DestDir: "{app}"; Flags: ignoreversion -Source: "..\..\doc\*.*"; DestDir: "{app}\doc"; Flags: ignoreversion -Source: "..\..\doc\technical\*.*"; DestDir: "{app}\doc\technical"; Flags: ignoreversion -Source: "..\..\aliases\*"; DestDir: "{app}\aliases"; Flags: ignoreversion -Source: "..\..\unreal.exe"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 0,4.0 -Source: "..\modules\*.dll"; DestDir: "{app}\modules"; Flags: ignoreversion -Source: "..\modules\chanmodes\*.dll"; DestDir: "{app}\modules\chanmodes"; Flags: ignoreversion -Source: "..\modules\usermodes\*.dll"; DestDir: "{app}\modules\usermodes"; Flags: ignoreversion -Source: "..\modules\extbans\*.dll"; DestDir: "{app}\modules\extbans"; Flags: ignoreversion +Source: "wircd.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "WIRCD.pdb"; DestDir: "{app}"; Flags: ignoreversion +Source: ".CHANGES.NEW"; DestDir: "{app}"; DestName: "CHANGES.NEW.txt";Flags: ignoreversion +Source: "doc\RELEASE-NOTES"; DestDir: "{app}"; DestName: "RELEASE.NOTES.txt"; Flags: ignoreversion + +Source: "doc\conf\*.conf"; DestDir: "{app}\conf"; Flags: ignoreversion +Source: "doc\conf\aliases\*.conf"; DestDir: "{app}\conf\aliases"; Flags: ignoreversion +Source: "doc\conf\help\*.conf"; DestDir: "{app}\conf\help"; Flags: ignoreversion +Source: "doc\conf\examples\*.conf"; DestDir: "{app}\conf\examples"; Flags: ignoreversion + +Source: "doc\Donation"; DestDir: "{app}"; DestName: "Donation.txt"; Flags: ignoreversion +Source: "LICENSE"; DestDir: "{app}"; DestName: "LICENSE.txt"; Flags: ignoreversion + +Source: "doc\*.*"; DestDir: "{app}\doc"; Flags: ignoreversion +Source: "doc\technical\*.*"; DestDir: "{app}\doc\technical"; Flags: ignoreversion +Source: "doc\conf\aliases\*"; DestDir: "{app}\conf\aliases"; Flags: ignoreversion + +Source: "unreal.exe"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 0,4.0 + +Source: "src\win32\makecert.bat"; DestDir: "{app}"; Flags: ignoreversion +Source: "src\win32\encpem.bat"; DestDir: "{app}"; Flags: ignoreversion +Source: "src\ssl.cnf"; DestDir: "{app}"; Flags: ignoreversion + +Source: "src\modules\*.dll"; DestDir: "{app}\modules"; Flags: ignoreversion +Source: "src\modules\chanmodes\*.dll"; DestDir: "{app}\modules\chanmodes"; Flags: ignoreversion +Source: "src\modules\usermodes\*.dll"; DestDir: "{app}\modules\usermodes"; Flags: ignoreversion +Source: "src\modules\snomasks\*.dll"; DestDir: "{app}\modules\snomasks"; Flags: ignoreversion +Source: "src\modules\extbans\*.dll"; DestDir: "{app}\modules\extbans"; Flags: ignoreversion + Source: "c:\dev\tre\win32\release\tre.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "c:\dev\pcre2\build\release\pcre2-8.dll"; DestDir: "{app}"; Flags: ignoreversion -Source: "C:\dev\c-ares\msvc90\cares\dll-release\cares.dll"; DestDir: "{app}"; Flags: ignoreversion +Source: "c:\dev\c-ares\msvc90\cares\dll-release\cares.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "c:\openssl\bin\openssl.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "c:\openssl\bin\ssleay32.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "c:\openssl\bin\libeay32.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "c:\dev\setacl.exe"; DestDir: "{app}\tmp"; Flags: ignoreversion -Source: ".\makecert.bat"; DestDir: "{app}"; Flags: ignoreversion -Source: ".\encpem.bat"; DestDir: "{app}"; Flags: ignoreversion -Source: "..\ssl.cnf"; DestDir: "{app}"; Flags: ignoreversion + #ifdef USE_CURL ; curl with ssl support -Source: "C:\dev\curl-ssl\builds\libcurl-vc-x86-release-dll-sspi-spnego\bin\libcurl.dll"; DestDir: "{app}"; Flags: ignoreversion -Source: "..\..\curl-ca-bundle.crt"; DestDir: "{app}"; Flags: ignoreversion +Source: "c:\dev\curl-ssl\builds\libcurl-vc-x86-release-dll-sspi-spnego\bin\libcurl.dll"; DestDir: "{app}"; Flags: ignoreversion #endif -;Source: "..\..\..\dbghelp.dll"; DestDir: "{app}"; Flags: ignoreversion [Dirs] Name: "{app}\tmp" +Name: "{app}\cache" +Name: "{app}\logs" +Name: "{app}\conf" +Name: "{app}\conf\ssl" +Name: "{app}\data" [UninstallDelete] Type: files; Name: "{app}\DbgHelp.Dll" @@ -101,7 +108,8 @@ begin ) then begin MsgBox('UnrealIRCd requires the Microsoft Visual C++ Redistributable for Visual Studio 2012 to be installed.' #13 + - 'After you click OK you will be taken to a download page. There, choose Download -> choose the vcredist_x86 version (last of 3 choices). Then download and install it.', mbInformation, MB_OK); + 'After you click OK you will be taken to a download page. There, click Download and choose the vcredist_x86 version. Then download and install it.' #13 + + 'If you are already absolutely sure that you have this package installed then you can skip this step.', mbInformation, MB_OK); ShellExec('open', 'http://www.microsoft.com/en-us/download/details.aspx?id=30679', '', '', SW_SHOWNORMAL,ewNoWait,ErrorCode); MsgBox('Click OK once you have installed the Microsoft Visual C++ Redistributable for Visual Studio 2012 (vcredist_x86) to continue the UnrealIRCd installer', mbInformation, MB_OK); @@ -170,7 +178,7 @@ procedure CurPageChanged(CurPage: Integer); begin if (CurPage = wpSelectTasks)then begin - if FileExists(ExpandConstant('{app}\server.cert.pem')) then + if FileExists(ExpandConstant('{app}\conf\ssl\server.cert.pem')) then begin WizardForm.TasksList.Checked[9]:=false; end @@ -186,13 +194,14 @@ Name: "{group}\UnrealIRCd"; Filename: "{app}\wircd.exe"; WorkingDir: "{app}" Name: "{group}\Uninstall UnrealIRCd"; Filename: "{uninstallexe}"; WorkingDir: "{app}" Name: "{group}\Make Certificate"; Filename: "{app}\makecert.bat"; WorkingDir: "{app}" Name: "{group}\Encrypt Certificate"; Filename: "{app}\encpem.bat"; WorkingDir: "{app}" -Name: "{group}\Documentation"; Filename: "{app}\doc\unreal32docs.html"; WorkingDir: "{app}" +Name: "{group}\Documentation"; Filename: "https://www.unrealircd.org/docs/UnrealIRCd_3.4.x_documentation"; WorkingDir: "{app}" Name: "{userdesktop}\UnrealIRCd"; Filename: "{app}\wircd.exe"; WorkingDir: "{app}"; Tasks: desktopicon Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\UnrealIRCd"; Filename: "{app}\wircd.exe"; WorkingDir: "{app}"; Tasks: quicklaunchicon [Run] -Filename: "notepad"; Description: "View example.conf"; Parameters: "{app}\doc\example.conf"; Flags: postinstall skipifsilent shellexec runmaximized -Filename: "{app}\doc\unreal32docs.html"; Description: "View UnrealIRCd documentation"; Parameters: ""; Flags: postinstall skipifsilent shellexec runmaximized +;Filename: "notepad"; Description: "View example.conf"; Parameters: "{app}\conf\examples\example.conf"; Flags: postinstall skipifsilent shellexec runmaximized +Filename: "https://www.unrealircd.org/docs/"; Description: "View documentation"; Parameters: ""; Flags: postinstall skipifsilent shellexec runmaximized +Filename: "https://www.unrealircd.org/docs/Installing_%28Windows%29"; Description: "View installation instructions"; Parameters: ""; Flags: postinstall skipifsilent shellexec runmaximized Filename: "notepad"; Description: "View Release Notes"; Parameters: "{app}\RELEASE.NOTES.txt"; Flags: postinstall skipifsilent shellexec runmaximized Filename: "{app}\unreal.exe"; Parameters: "install"; Flags: runminimized nowait; Tasks: installservice Filename: "{app}\unreal.exe"; Parameters: "config startup manual"; Flags: runminimized nowait; Tasks: installservice/startdemand diff --git a/unrealircd.in b/unrealircd.in index e188f4739..bce9130fa 100644 --- a/unrealircd.in +++ b/unrealircd.in @@ -14,6 +14,18 @@ if [ "$1" = "start" ] ; then if [ -r $PID_FILE ] ; then mv -f $PID_FILE $PID_BACKUP fi + # Check if ~/Unreal3.4.x/unrealircd.conf exists but the file + # ~/unrealircd/conf/unrealircd.conf does not. + # If so, then assume a user-build and give the user a nice hint... + if [ ! -f @CONFDIR@/unrealircd.conf -a -f @BUILDDIR@/unrealircd.conf ]; then + echo "" + echo "There is no unrealircd.conf in @CONFDIR@" + echo "However I did find an unrealircd.conf in @BUILDDIR@" + echo "With UnrealIRCd 3.4.x you should no longer run the IRCd from @BUILDDIR@." + echo "You should 'cd @SCRIPTDIR@' and work from there." + echo "See https://www.unrealircd.org/docs/UnrealIRCd_files_and_directories" + exit 1 + fi @BINDIR@/unrealircd sleep 1 if [ ! -r $PID_FILE ] ; then