Initial commit

This commit is contained in:
Dionysus 2020-03-29 05:16:53 -04:00
commit f8a6fedfcf
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
374 changed files with 139378 additions and 0 deletions

75
.gitignore vendored Normal file
View File

@ -0,0 +1,75 @@
# Ignore configure step
aclocal.m4
autom4te.cache
config.log
conftest.*
config.settings
extras/pcre2*
extras/c-ares*
config.status
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
src/modules/third/Makefile
/Makefile
/src/Makefile
/unrealircd
include/setup.h
# Ignore tags file
tags
# Ignore editor files
*\#*
*~
# Ignore SSL Stuff
server.cert.pem
server.key.pem
server.req.pem
tls.rnd
# 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/
# Doxygen generated files
doc/doxygen/

793
Config Executable file
View File

@ -0,0 +1,793 @@
#!/bin/sh
#
# Config script for UnrealIRCd
# (C) 2001-2019 The UnrealIRCd Team
#
# This configure script is free software; the UnrealIRCd Team gives
# unlimited permission to copy, distribute and modify as long as the
# copyright headers stay intact
#
#
# Rewritten completely to be an interface to autoconf by codemastr
# This was inspired by the config by Michael Graff (explorer@flame.org)
# but was written from scratch
# In order to be faster than the old Config, this assumes that all information
# in the cache file is valid and therefore doesn't check it, so if you messed with
# default values thats your problem :P
# some bits edited by baafie on March 17 2004, every change marked.
RUN_CONFIGURE () {
ARG=" "
if [ -z "$BINDIR" -o -z "$DATADIR" -o -z "$CONFDIR" -o -z "$MODULESDIR" -o -z "$LOGDIR" -o -z "$CACHEDIR" -o -z "$DOCDIR" -o -z "$TMPDIR" -o -z "$PRIVATELIBDIR" ]; then
echo "Sorry './Config -quick' cannot be used because your 'config.settings'"
echo "file either does not exist or is from an old UnrealIRCd version"
echo "(older than UnrealIRCd 5.0.0)."
echo ""
echo "Please run './Config' without -quick and answer all questions."
echo ""
exit
fi
mkdir -p $TMPDIR
mkdir -p $PRIVATELIBDIR
# Do this even if we're not in advanced mode
if [ "$SHOWLISTMODES" = "1" ] ; then
ARG="$ARG--with-showlistmodes "
fi
if [ "$ADVANCED" = "1" ] ; then
if [ "$NOOPEROVERRIDE" = "1" ] ; then
ARG="$ARG--with-no-operoverride "
fi
if [ "$OPEROVERRIDEVERIFY" = "1" ] ; then
ARG="$ARG--with-operoverride-verify "
fi
fi
if test x"$SSLDIR" = "x" ; then
ARG="$ARG--enable-ssl "
else
ARG="$ARG--enable-ssl=$SSLDIR "
fi
if [ "$REMOTEINC" = "1" ] ; then
ARG="$ARG--enable-libcurl=$CURLDIR "
fi
if [ "$PREFIXAQ" != "1" ]; then
ARG="$ARG--disable-prefixaq "
fi
if [ "$MAXCONNECTIONS_REQUEST" != "auto" ]; then
ARG="$ARG--with-maxconnections=$MAXCONNECTIONS_REQUEST "
fi
ARG="$ARG--with-bindir=$BINDIR "
ARG="$ARG--with-datadir=$DATADIR "
ARG="$ARG--with-pidfile=$DATADIR/unrealircd.pid "
ARG="$ARG--with-confdir=$CONFDIR "
ARG="$ARG--with-modulesdir=$MODULESDIR "
ARG="$ARG--with-logdir=$LOGDIR "
ARG="$ARG--with-cachedir=$CACHEDIR "
ARG="$ARG--with-docdir=$DOCDIR "
ARG="$ARG--with-tmpdir=$TMPDIR "
ARG="$ARG--with-privatelibdir=$PRIVATELIBDIR "
ARG="$ARG--with-scriptdir=$BASEPATH "
ARG="$ARG--with-nick-history=$NICKNAMEHISTORYLENGTH "
ARG="$ARG--with-permissions=$DEFPERM "
ARG="$ARG--enable-dynamic-linking "
ARG="$ARG $EXTRAPARA "
CONF="./configure $ARG"
# remove possibly old instances of curl in ~/unrealircd/lib/
rm -f $PRIVATELIBDIR/*curl* 1>/dev/null 2>&1
# Ensure we install curl even if someone does ./Config -quick...
if [ "x$CURLDIR" = "x$UNREALCWD/extras/curl" ]; then
INSTALLCURL=1
fi
if [ "x$INSTALLCURL" = "x1" ]; then
extras/curlinstall "$PRIVATELIBDIR" || exit 1
fi
echo $CONF
$CONF || exit 1
cd "$UNREALCWD"
if [ "$QUICK" != "1" ] ; then
if [ ! -f $CONFDIR/tls/server.cert.pem -a ! -f $CONFDIR/ssl/server.cert.pem ]; then
export OPENSSLPATH
TEST=""
while [ -z "$TEST" ] ; do
if [ "$GENCERTIFICATE" = "1" ] ; then
TEST="Yes"
else
TEST="No"
fi
echo ""
echo "Do you want to generate an SSL certificate for the IRCd?"
echo "Only answer No if you already have one."
echo $n "[$TEST] -> $c"
read cc
if [ -z "$cc" ] ; then
cc=$TEST
fi
case "$cc" in
[Yy]*)
GENCERTIFICATE="1"
;;
[Nn]*)
GENCERTIFICATE=""
;;
*)
echo ""
echo "You must enter either Yes or No"
TEST=""
;;
esac
done
if [ "$GENCERTIFICATE" = 1 ]; then
make pem
echo "Certificate created successfully."
sleep 1
else
echo "Ok, not generating SSL certificate. Make sure that the certificate and key"
echo "are installed in conf/tls/server.crt.pem and conf/tls/server.key.pem prior to starting the IRCd."
fi
else
echo "SSL certificate already exists in configuration directory, no need to regenerate."
fi
fi
# Silently force a 'make clean' as otherwise part (or whole) of the
# compiled source could be using different settings than the user
# just requested when re-running ./Config.
make clean 1>/dev/null 2>&1
}
RUN_ADVANCED () {
TEST=""
while [ -z "$TEST" ] ; do
if [ "$SHOWLISTMODES" = "1" ] ; then
TEST="Yes"
else
TEST="No"
fi
echo ""
echo "Do you want to show the modes a channel has set in the /list output?"
echo $n "[$TEST] -> $c"
read cc
if [ -z "$cc" ] ; then
cc=$TEST
fi
case "$cc" in
[Yy]*)
SHOWLISTMODES="1"
;;
[Nn]*)
SHOWLISTMODES=""
;;
*)
echo ""
echo "You must enter either Yes or No"
TEST=""
;;
esac
done
TEST=""
while [ -z "$TEST" ] ; do
if [ "$NOOPEROVERRIDE" = "1" ] ; then
TEST="Yes"
else
TEST="No"
fi
echo ""
echo "Do you want to disable oper override?"
echo $n "[$TEST] -> $c"
read cc
if [ -z "$cc" ] ; then
cc=$TEST
fi
case "$cc" in
[Yy]*)
NOOPEROVERRIDE="1"
;;
[Nn]*)
NOOPEROVERRIDE=""
;;
*)
echo ""
echo "You must enter either Yes or No"
TEST=""
;;
esac
done
TEST=""
while [ -z "$TEST" ] ; do
if [ "$OPEROVERRIDEVERIFY" = "1" ] ; then
TEST="Yes"
else
TEST="No"
fi
echo ""
echo "Do you want to require opers to /invite themselves into a +s or +p channel?"
echo $n "[$TEST] -> $c"
read cc
if [ -z "$cc" ] ; then
cc=$TEST
fi
case "$cc" in
[Yy]*)
OPEROVERRIDEVERIFY="1"
;;
[Nn]*)
OPEROVERRIDEVERIFY=""
;;
*)
echo ""
echo "You must enter either Yes or No"
TEST=""
;;
esac
done
}
c=""
n=""
UNREALCWD="`pwd`"
BASEPATH="$HOME/unrealircd"
DEFPERM="0600"
SSLDIR=""
NICKNAMEHISTORYLENGTH="100"
MAXCONNECTIONS_REQUEST="auto"
REMOTEINC="1"
CURLDIR=""
PREFIXAQ="0"
SHOWLISTMODES="0"
NOOPEROVERRIDE=""
OPEROVERRIDEVERIFY=""
GENCERTIFICATE="1"
EXTRAPARA=""
if [ "`eval echo -n 'a'`" = "-n a" ] ; then
c="\c"
else
n="-n"
fi
#parse arguments
NOCACHE=""
IMPORTEDSETTINGS=""
NOINTRO=""
QUICK=""
CLEAN=""
ADVANCED=""
while [ $# -ge 1 ] ; do
if [ $1 = "--help" ] ; then
echo "Config utility for UnrealIRCd"
echo "-----------------------------"
echo "Syntax: ./Config [options]"
echo "-nocache Ignore settings saved in config.settings"
echo "-nointro Skip intro (release notes, etc)"
echo "-quick Skip questions, go straight to configure"
echo "-advanced Include additional advanced questions"
echo "-clean Clean ./configure cache"
exit 0
elif [ $1 = "-nocache" ] ; then
NOCACHE="1"
elif [ $1 = "-nointro" ] ; then
NOINTRO="1"
elif [ $1 = "-quick" -o $1 = "-q" ] ; then
QUICK="1"
echo "running quick config"
if [ -f "config.settings" ] ; then
. ./config.settings
fi
RUN_CONFIGURE
cd "$UNREALCWD"
exit 0
elif [ $1 = "-clean" -o $1 = "-C" ] ; then
CLEAN="1"
elif [ $1 = "-advanced" ] ; then
PREADVANCED="1"
fi
shift 1
done
if [ "$PREADVANCED" = "1" ] ; then
ADVANCED="1"
elif [ "$ADVANCED" = "1" ]; then
ADVANCED=""
fi
if [ -n "$CLEAN" ] ; then
rm -f config.cache
fi
if [ "`id -u`" = "0" ]; then
echo "ERROR: You cannot build or run UnrealIRCd as root"
echo ""
echo "Please create a separate account for building and running UnrealIRCd."
echo "See https://www.unrealircd.org/docs/Do_not_run_as_root"
exit
fi
clear
if [ -f "doc/Config.header" -a -z "$NOINTRO" ] ; then
more doc/Config.header
echo ""
echo $n "[Press Enter to continue]"
read cc
clear
fi
echo "We will now ask you a number of questions. You can just press ENTER to accept the defaults!"
echo ""
if [ -z "$NOCACHE" ] ; then
# This needs to be updated each release so auto-upgrading works for settings, modules, etc!!:
UNREALRELEASES="unrealircd-5.0.2 unrealircd-5.0.1 unrealircd-5.0.0 unrealircd-5.0.0-rc2 unrealircd-5.0.0-rc1"
if [ -f "config.settings" ]; then
. ./config.settings
else
# Try to load a previous config.settings
for x in $UNREALRELEASES
do
if [ -f ../$x/config.settings ]; then
IMPORTEDSETTINGS="../$x"
break
fi
done
echo "If you have previously installed UnrealIRCd on this shell then you can specify a"
echo "directory here so I can import the build settings and third party modules"
echo "to make your life a little easier."
if [ ! -z "$IMPORTEDSETTINGS" ]; then
echo "Found previous installation in: $IMPORTEDSETTINGS."
echo "You can enter a different path or type 'none' if you don't want to use it."
echo "Just press Enter to accept the default settings."
else
echo "If you install UnrealIRCd for the first time on this shell, then just hit Enter";
fi
TEST="$IMPORTEDSETTINGS"
echo $n "[$TEST] -> $c"
read cc
if [ -z "$cc" ]; then
IMPORTEDSETTINGS="$TEST"
else
IMPORTEDSETTINGS="$cc"
fi
if [ "$IMPORTEDSETTINGS" = "none" ]; then
IMPORTEDSETTINGS=""
fi
if [ "$IMPORTEDSETTINGS" != "" ]; then
if [ -d $IMPORTEDSETTINGS/conf ]; then
echo "ERROR: Directory $IMPORTEDSETTINGS is an INSTALLATION directory (eg /home/irc/unrealircd)."
echo "This question was about a SOURCE directory (eg /home/irc/unrealircd-5.0.0)."
exit
fi
if [ ! -f $IMPORTEDSETTINGS/config.settings ]; then
echo "Directory $IMPORTEDSETTINGS does not exist or does not contain a config.settings file"
exit
fi
COPYMODULES="1"
if grep -q TOPICNICKISNUH $IMPORTEDSETTINGS/config.settings; then
echo "Directory $IMPORTEDSETTINGS seems to be UnrealIRCd 4.x (or older)."
echo "I will copy the settings but not any 3rd party modules, as they are incompatible with 5.x."
COPYMODULES="0"
fi
# Actually load the settings
. $IMPORTEDSETTINGS/config.settings
if [ "$COPYMODULES" = "1" ]; then
# Copy over 3rd party modules (also deals with 0 file cases, hence the silly looking code)
for f in $IMPORTEDSETTINGS/src/modules/third/*.c
do
[ -e "$f" ] && cp $f src/modules/third/
done
fi
fi
fi
# If we just imported settings and the curl dir is set to
# something like /home/xxx/unrealircd-5.x.y/extras/curl/
# (what we call 'local-curl') then remove this setting as
# it would refer to the old UnrealIRCd installation.
if [ ! -z "$IMPORTEDSETTINGS" ]; then
if echo "$CURLDIR"|grep -qi unrealircd; then
CURLDIR=""
fi
fi
fi
TEST="$BASEPATH"
echo ""
echo "In what directory do you want to install UnrealIRCd?"
echo "(Note: UnrealIRCd 5 will need to be installed somewhere."
echo " If this directory does not exist it will be created.)"
echo $n "[$TEST] -> $c"
read cc
if [ -z "$cc" ] ; then
BASEPATH=$TEST
else
BASEPATH=`eval echo $cc` # modified
fi
if [ "$BASEPATH" = "$UNREALCWD" ]; then
echo ""
echo "ERROR: The installation directory cannot be the same as the directory"
echo " containing the source code ($UNREALCWD)."
echo " HINT: Usually the directory containing the source is $HOME/unrealircd-5.x.y"
echo " and the installation directory you would need to enter is $HOME/unrealircd"
exit 1
fi
# TODO: For -advanced we could prompt the user.
BINDIR="$BASEPATH/bin"
DATADIR="$BASEPATH/data"
CONFDIR="$BASEPATH/conf"
MODULESDIR="$BASEPATH/modules"
LOGDIR="$BASEPATH/logs"
CACHEDIR="$BASEPATH/cache"
DOCDIR="$BASEPATH/doc"
TMPDIR="$BASEPATH/tmp"
PRIVATELIBDIR="$BASEPATH/lib"
TEST=""
while [ -z "$TEST" ] ; do
TEST="$DEFPERM"
echo ""
echo "What should the default permissions for your configuration files be? (Set this to 0 to disable)"
echo "It is strongly recommended that you use 0600 to prevent unwanted reading of the file"
echo $n "[$TEST] -> $c"
read cc
if [ -z "$cc" ] ; then
DEFPERM=$TEST
break
fi
case "$cc" in
[0-9]*)
DEFPERM="$cc"
;;
*)
echo ""
echo "You must enter a number"
TEST=""
;;
esac
done
echo ""
echo "If you want, you can manually enter the path to OpenSSL/LibreSSL here."
echo "In most cases you can leave this blank and it will be detected automatically."
if [ -z "$SSLDIR" ]; then
uname|grep -q Darwin
if [ "$?" = 0 ]; then
echo "Looks like you're on a Mac - El Capitan and higher require"
echo "a 3rd party OpenSSL installation. We recommend using homebrew"
echo "to install OpenSSL, but you may install it any other way as well."
echo "We are selecting the default homebrew OpenSSL path - but you can"
echo "change it to another path if you have installed OpenSSL another way"
SSLDIR="/usr/local/opt/openssl/"
fi
fi
TEST="$SSLDIR"
echo $n "[$TEST] -> $c"
read cc
if [ -z "$cc" ] ; then
SSLDIR="$TEST"
else
SSLDIR=`eval echo $cc` # modified
fi
TEST=""
while [ -z "$TEST" ] ; do
if [ "$REMOTEINC" = "1" ] ; then
TEST="Yes"
else
TEST="No"
fi
echo ""
echo "Do you want to enable remote includes?"
echo "This allows stuff like this in your configuration file:"
echo "include \"http://www.somesite.org/files/opers.conf\";"
echo $n "[$TEST] -> $c"
read cc
if [ -z "$cc" ] ; then
cc=$TEST
fi
case "$cc" in
[Yy]*)
REMOTEINC="1"
;;
[Nn]*)
REMOTEINC=""
CURLDIR=""
;;
*)
echo ""
echo "You must enter either Yes or No"
TEST=""
;;
esac
done
if [ "$REMOTEINC" = "1" ] ; then
if [ ! -d "$CURLDIR" ]; then
# Reset any previous CURLDIR if it doesn't exist (anymore)
CURLDIR=""
fi
INSTALLCURL="0"
SUGGESTCURLDIR=""
if [ -d "/usr/local/include/curl" ]; then
SUGGESTCURLDIR="/usr/local"
fi
if [ -d "/usr/include/curl" ]; then
SUGGESTCURLDIR="/usr"
fi
# This one also works for /usr/include/x86_64-linux-gnu and friends:
if [ -f "/usr/bin/curl-config" ]; then
SUGGESTCURLDIR="/usr"
fi
GOTASYNC=0
if [ "x$SUGGESTCURLDIR" != "x" ]; then
# Check if it's of any use: a curl without async dns (cares) hangs the entire ircd..
# normally this is done in ./configure but now we're forced to do it also here..
if "$SUGGESTCURLDIR"/bin/curl-config --features | grep -q -e AsynchDNS; then
GOTASYNC="1"
fi
if [ "$GOTASYNC" != "1" ]; then
SUGGESTCURLDIRBAD="$CURLDIR"
SUGGESTCURLDIR=""
fi
fi
if [ "x$CURLDIR" = "x$HOME/curl" ]; then
if [ "x$SUGGESTCURLDIR" != "x" ]; then
# I guess some people will complain about this, but if system wide cURL is available
# and many people have old defaults then this is much preferred:
echo ""
echo "WARNING: Your previous (potentially old) setting is to use cURL from $HOME/curl."
echo "However, your operating system also provides a working cURL."
echo "I am therefore changing the setting to: $SUGGESTCURLDIR"
CURLDIR="$SUGGESTCURLDIR"
else
echo ""
echo "WARNING: We no longer use $HOME/curl nowadays."
echo "Use the automatic download and install feature below."
CURLDIR=""
fi
fi
if [ "x$CURLDIR" = "x" ]; then
CURLDIR="$SUGGESTCURLDIR"
# NOTE: CURLDIR may still be empty after this
# System curl has no asyncdns, so install our own.
if [ "$GOTASYNC" != "1" ]; then
CURLDIR=""
fi
# Need to output it here, as the HOME check from above may cause this to be no longer relevant.
if [ "x$CURLDIR" = "x" -a "x$SUGGESTCURLDIRBAD" != "x" ]; then
echo "Curl library was found in $SUGGESTCURLDIRBAD, but it does not support Asynchronous DNS (not compiled with c-ares)"
echo "so it's of no use to us as it would stall the IRCd on REHASH."
fi
fi
# Final check
if [ "x$CURLDIR" != "x" ]; then
"$CURLDIR/bin/curl-config" --features 2>/dev/null | grep -q -e AsynchDNS
if [ "$?" != 0 ]; then
echo "Curl from $CURLDIR seems unusable ($CURLDIR/bin/curl-config does not exist)"
CURLDIR=""
fi
fi
if [ "x$CURLDIR" = "x" ]; then
# Still empty?
TEST=""
while [ -z "$TEST" ] ; do
TEST="Yes"
echo ""
echo "Do you want me to automatically download and install curl for you?"
echo $n "[$TEST] -> $c"
read cc
if [ -z "$cc" ] ; then
cc=$TEST
fi
case "$cc" in
[Yy]*)
INSTALLCURL="1"
CURLDIR="$UNREALCWD/extras/curl"
;;
[Nn]*)
INSTALLCURL="0"
;;
*)
echo ""
echo "You must enter either Yes or No"
TEST=""
;;
esac
done
fi
if [ "$INSTALLCURL" != "1" ]; then
TEST=""
while [ -z "$TEST" ] ; do
TEST="$CURLDIR"
echo ""
echo "Specify the directory you installed libcurl to"
echo $n "[$TEST] -> $c"
read cc
if [ -z "$cc" ] ; then
cc=$TEST
else
TEST=$cc
CURLDIR=`eval echo $cc` # modified
fi
done
fi
fi
TEST=""
while [ -z "$TEST" ] ; do
if [ "$PREFIXAQ" = "1" ] ; then
TEST="Yes"
else
TEST="No"
fi
echo ""
echo "Do you want to enable prefixes for chanadmin and chanowner?"
echo "This will give +a the & prefix and ~ for +q (just like +o is @)"
echo "Supported by the major clients (mIRC, xchat, epic, eggdrop, Klient,"
echo "PJIRC, irssi, CGI:IRC, etc.)"
echo "This feature should be enabled/disabled network-wide."
echo $n "[$TEST] -> $c"
read cc
if [ -z "$cc" ] ; then
cc=$TEST
fi
case "$cc" in
[Yy]*)
PREFIXAQ="1"
;;
[Nn]*)
PREFIXAQ=""
;;
*)
echo ""
echo "You must enter either Yes or No"
TEST=""
;;
esac
done
TEST=""
while [ -z "$TEST" ] ; do
TEST="$NICKNAMEHISTORYLENGTH"
echo ""
echo "How far back do you want to keep the nickname history?"
echo $n "[$TEST] -> $c"
read cc
if [ -z "$cc" ] ; then
NICKNAMEHISTORYLENGTH=$TEST
break
fi
case "$cc" in
[1-9]*)
NICKNAMEHISTORYLENGTH="$cc"
;;
*)
echo ""
echo "You must enter a number"
TEST=""
;;
esac
done
echo ""
TEST=""
while [ -z "$TEST" ] ; do
TEST="$MAXCONNECTIONS_REQUEST"
echo ""
echo "What is the maximum number of sockets (and file descriptors) that"
echo "UnrealIRCd may use?"
echo "It is recommended to leave this at the default setting 'auto',"
echo "which at present results in a limit of up to 8192, depending on"
echo "the system. When you boot UnrealIRCd later you will always see"
echo "the effective limit."
echo $n "[$TEST] -> $c"
read cc
if [ -z "$cc" ] ; then
MAXCONNECTIONS_REQUEST=$TEST
break
fi
case "$cc" in
auto)
MAXCONNECTIONS_REQUEST="$cc"
;;
[1-9][0-9][0-9]*)
MAXCONNECTIONS_REQUEST="$cc"
;;
*)
echo ""
echo "You must to enter a number greater than or equal to 100."
echo "Or enter 'auto' to leave it at automatic, which is recommended."
TEST=""
;;
esac
done
if [ -n "$ADVANCED" ] ; then
RUN_ADVANCED
fi
TEST="$EXTRAPARA"
echo ""
echo "Would you like to pass any custom parameters to configure?"
echo "Most people don't need this and can just press ENTER."
echo "Otherwise, see \`./configure --help' and write them here:"
echo $n "[$TEST] -> $c"
read EXTRAPARA
if [ -z "$EXTRAPARA" ]; then
EXTRAPARA="$TEST"
fi
rm -f config.settings
cat > config.settings << __EOF__
#
BASEPATH="$BASEPATH"
BINDIR="$BINDIR"
DATADIR="$DATADIR"
CONFDIR="$CONFDIR"
MODULESDIR="$MODULESDIR"
LOGDIR="$LOGDIR"
CACHEDIR="$CACHEDIR"
DOCDIR="$DOCDIR"
TMPDIR="$TMPDIR"
PRIVATELIBDIR="$PRIVATELIBDIR"
PREFIXAQ="$PREFIXAQ"
MAXCONNECTIONS_REQUEST="$MAXCONNECTIONS_REQUEST"
NICKNAMEHISTORYLENGTH="$NICKNAMEHISTORYLENGTH"
DEFPERM="$DEFPERM"
SSLDIR="$SSLDIR"
REMOTEINC="$REMOTEINC"
CURLDIR="$CURLDIR"
SHOWLISTMODES="$SHOWLISTMODES"
NOOPEROVERRIDE="$NOOPEROVERRIDE"
OPEROVERRIDEVERIFY="$OPEROVERRIDEVERIFY"
GENCERTIFICATE="$GENCERTIFICATE"
EXTRAPARA="$EXTRAPARA"
ADVANCED="$ADVANCED"
__EOF__
RUN_CONFIGURE
cd "$UNREALCWD"
cat << __EOF__
_______________________________________________________________________
| |
| UnrealIRCd Compile-Time Config |
|_______________________________________________________________________|
|_______________________________________________________________________|
| |
| Now all you have to do is type 'make' and let it compile. When that's |
| done, you will receive other instructions on what to do next. |
| |
|_______________________________________________________________________|
|_______________________________________________________________________|
| - The UnrealIRCd Team - |
| |
| * Bram Matthys (Syzop) syzop@unrealircd.org |
| * Gottem gottem@unrealircd.org |
| * i i@unrealircd.org |
|_______________________________________________________________________|
__EOF__

340
LICENSE Normal file
View File

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 2 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

255
Makefile.in Normal file
View File

@ -0,0 +1,255 @@
#/************************************************************************
#* IRC - Internet Relay Chat, Makefile
#* Copyright (C) 1990, Jarkko Oikarinen
#*
#* 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.
#*
#* $Id$
#*/
CC=@CC@
INCLUDEDIR=@UNRLINCDIR@
NETWORKSDIR=
FROMDOS=/home/cmunk/bin/4dos
# [CHANGEME]
# Default flags:
# Change XCFLAGS if you don't like what Config puts there. Same with
# IRCDLIBS.
#
# If you are configuring by hand, try "-O -g" for XCFLAGS, and leave
# IRCDLIBS blank. If that fails, try recomendations below.
#
#XCFLAGS=-O -g -export-dynamic
IRCDLIBS=@IRCDLIBS@ @PCRE2_LIBS@ @ARGON2_LIBS@ @CARES_LIBS@ @PTHREAD_LIBS@
CRYPTOLIB=@CRYPTOLIB@
OPENSSLINCLUDES=
XCFLAGS=@PTHREAD_CFLAGS@ @PCRE2_CFLAGS@ @ARGON2_CFLAGS@ @CARES_CFLAGS@ @CFLAGS@ @HARDEN_CFLAGS@ @CPPFLAGS@
#
# use the following on MIPS:
#CFLAGS= -systype bsd43 -DSYSTYPE_BSD43 -I$(INCLUDEDIR)
# For Irix 4.x (SGI), use the following:
#CFLAGS= -g -cckr -I$(INCLUDEDIR)
#
# on NEXT use:
#CFLAGS=-bsd -I$(INCLUDEDIR)
#on NeXT other than 2.0:
#IRCDLIBS=-lsys_s
#
# AIX 370 flags
#CFLAGS=-D_BSD -Hxa -I$(INCLUDEDIR)
#IRCDLIBS=-lbsd
#
# Dynix/ptx V2.0.x
#CFLAGS= -I$(INCLUDEDIR) -O -Xo
#IRCDLIBS= -lsocket -linet -lnsl -lseq
#
# Dynix/ptx V1.x.x
#IRCDLIBS= -lsocket -linet -lnsl -lseq
#
#use the following on SUN OS without nameserver libraries inside libc
#IRCDLIBS=-lresolv
#
# Solaris 2
#IRCDLIBS=-lsocket -lnsl -lresolv -L/usr/ucblib -R/usr/ucblib -lgen
#
# ESIX
#CFLAGS=-O -I$(INCLUDEDIR) -I/usr/ucbinclude
#IRCDLIBS=-L/usr/ucblib -L/usr/lib -lsocket -lucb -lns -lnsl
#
# LDFLAGS - flags to send the loader (ld). SunOS users may want to add
# -Bstatic here.
#
#LDFLAGS=-Bstatic
#
#Dell SVR4
#CC=gcc
#CFLAGS= -I$(INCLUDEDIR) -O2
#IRCDLIBS=-lsocket -lnsl -lucb
# [CHANGEME]
# IRCDMODE is the mode you want the binary to be.
# The 4 at the front is important (allows for setuidness)
#
# WARNING: if you are making ircd SUID or SGID, check config.h to make sure
# you are not defining CMDLINE_CONFIG
IRCDMODE = 711
URL=@URL@
# Where is your openssl binary
OPENSSLPATH=@OPENSSLPATH@
CFLAGS=-I$(INCLUDEDIR) $(XCFLAGS)
XLDFLAGS=@LDFLAGS_PRIVATELIBS@ @HARDEN_LDFLAGS@ @LDFLAGS@
LDFLAGS=$(XLDFLAGS)
SHELL=/bin/sh
SUBDIRS=src
BINDIR=@BINDIR@
INSTALL=@INSTALL@
RM=@RM@
CP=@CP@
TOUCH=@TOUCH@
RES=
all: build
MAKEARGS = 'CFLAGS=${CFLAGS}' 'CC=${CC}' 'IRCDLIBS=${IRCDLIBS}' \
'LDFLAGS=${LDFLAGS}' 'IRCDMODE=${IRCDMODE}' \
'RES=${RES}' 'BINDIR=${BINDIR}' 'INSTALL=${INSTALL}' \
'INCLUDEDIR=${INCLUDEDIR}' \
'RM=${RM}' 'CP=${CP}' 'TOUCH=${TOUCH}' \
'SHELL=${SHELL}' \
'CRYPTOLIB=${CRYPTOLIB}' \
'CRYPTOINCLUDES=${CRYPTOINCLUDES}' \
'URL=${URL}'
custommodule:
@if test -z "${MODULEFILE}"; then echo "Please set MODULEFILE when calling \`\`make custommodule''. For example, \`\`make custommodule MODULEFILE=callerid''." >&2; exit 1; fi
+cd src; ${MAKE} ${MAKEARGS} MODULEFILE=${MODULEFILE} 'EXLIBS=${EXLIBS}' custommodule
server: Makefile
build: Makefile
-@if [ ! -f include/setup.h ] ; then \
echo "Hmm...doesn't look like you've run Config..."; \
echo "Doing so now."; \
sh Config; \
fi
@+for i in $(SUBDIRS); do \
echo "Building $$i";\
( cd $$i; ${MAKE} ${MAKEARGS} build; ) \
done
@echo ''
@echo '* UnrealIRCd compiled successfully'
@echo '* YOU ARE NOT DONE YET! Run "make install" to install UnrealIRCd !'
@echo ''
clean:
$(RM) -f *~ \#* core *.orig include/*.orig
@+for i in $(SUBDIRS); do \
echo "Cleaning $$i";\
( cd $$i; ${MAKE} ${MAKEARGS} clean; ) \
done
-@if [ -f include/setup.h ] ; then \
echo "To really restart installation, remove include/setup.h" ; \
fi
cleandir: clean
rm -rf include/setup.h Makefile Settings
distclean: cleandir
rm -rf extras/*.bak extras/*.tar extras/c-ares
rm -rf extras/c-ares-* extras/tre-*
rm -rf config.log config.settings *.pem ircd.* unrealircd
rm -rf Makefile config.status
depend:
@+for i in $(SUBDIRS); do \
echo "Making dependencies in $$i";\
( cd $$i; ${MAKE} ${MAKEARGS} depend; ) \
done
install: all
$(INSTALL) -m 0700 -d @BINDIR@
$(INSTALL) -m 0700 src/ircd @BINDIR@/unrealircd
$(INSTALL) -m 0700 -d @DOCDIR@
$(INSTALL) -m 0600 doc/Authors doc/coding-guidelines doc/tao.of.irc @DOCDIR@
$(INSTALL) -m 0700 -d @CONFDIR@
$(INSTALL) -m 0600 doc/conf/*.conf @CONFDIR@
$(INSTALL) -m 0600 doc/conf/*.motd @CONFDIR@
$(INSTALL) -m 0600 doc/conf/modules.sources.list @CONFDIR@
$(INSTALL) -m 0700 unrealircd @SCRIPTDIR@
$(INSTALL) -m 0700 -d @MODULESDIR@
@rm -f @MODULESDIR@/*.so 1>/dev/null 2>&1
$(INSTALL) -m 0700 src/modules/*.so @MODULESDIR@
$(INSTALL) -m 0700 -d @MODULESDIR@/usermodes
@rm -f @MODULESDIR@/usermodes/*.so 1>/dev/null 2>&1
$(INSTALL) -m 0700 src/modules/usermodes/*.so @MODULESDIR@/usermodes
$(INSTALL) -m 0700 -d @MODULESDIR@/chanmodes
@rm -f @MODULESDIR@/chanmodes/*.so 1>/dev/null 2>&1
$(INSTALL) -m 0700 src/modules/chanmodes/*.so @MODULESDIR@/chanmodes
$(INSTALL) -m 0700 -d @MODULESDIR@/snomasks
@rm -f @MODULESDIR@/snomasks/*.so 1>/dev/null 2>&1
$(INSTALL) -m 0700 src/modules/snomasks/*.so @MODULESDIR@/snomasks
$(INSTALL) -m 0700 -d @MODULESDIR@/extbans
@rm -f @MODULESDIR@/extbans/*.so 1>/dev/null 2>&1
$(INSTALL) -m 0700 src/modules/extbans/*.so @MODULESDIR@/extbans
@#If the conf/ssl directory exists then rename it here to conf/tls
@#and add a symlink for backwards compatibility (so that f.e. certbot
@#doesn't randomly fail after an upgrade to U5).
-@if [ -d "@CONFDIR@/ssl" ] ; then \
mv "@CONFDIR@/ssl" "@CONFDIR@/tls" ; \
ln -s "@CONFDIR@/tls" "@CONFDIR@/ssl" ; \
fi
$(INSTALL) -m 0700 -d @CONFDIR@/tls
$(INSTALL) -m 0600 doc/conf/tls/curl-ca-bundle.crt @CONFDIR@/tls
@# delete modules/cap directory, to avoid confusing with U4 to U5 upgrades:
rm -rf @MODULESDIR@/cap
$(INSTALL) -m 0700 -d @MODULESDIR@/third
@rm -f @MODULESDIR@/third/*.so 1>/dev/null 2>&1
@#This step can fail with zero files, so we ignore exit status:
-$(INSTALL) -m 0700 src/modules/third/*.so @MODULESDIR@/third
$(INSTALL) -m 0700 -d @TMPDIR@
$(INSTALL) -m 0700 -d @CACHEDIR@
$(INSTALL) -m 0700 -d @PERMDATADIR@
$(INSTALL) -m 0700 -d @LOGDIR@
-@if [ ! -f "@CONFDIR@/tls/server.cert.pem" ] ; then \
$(INSTALL) -m 0600 server.req.pem @CONFDIR@/tls ; \
$(INSTALL) -m 0600 server.key.pem @CONFDIR@/tls ; \
$(INSTALL) -m 0600 server.cert.pem @CONFDIR@/tls ; \
fi
@echo ''
@echo '* UnrealIRCd is now installed.'
-@if [ "@SCRIPTDIR@/bin" = "@BINDIR@" ] ; then \
echo '* Leave this directory and run "cd @SCRIPTDIR@" now' ; \
fi
@echo '* Directory layout:'
-@if [ "@SCRIPTDIR@/bin" = "@BINDIR@" ] ; then \
echo ' * Base directory: @SCRIPTDIR@' ; \
fi
@echo ' * Configuration files: @CONFDIR@'
@echo ' * Log files: @LOGDIR@'
@echo ' * Modules: @MODULESDIR@'
@echo '* To start/stop UnrealIRCd run: @SCRIPTDIR@/unrealircd"'
@echo ''
@echo '* Consult the documentation online at:'
@echo ' * https://www.unrealircd.org/docs/'
@echo ' * https://www.unrealircd.org/docs/FAQ'
@echo '* You may also wish to install a cron job to ensure UnrealIRCd is always running:'
@echo ' * https://www.unrealircd.org/docs/Cron_job'
@echo ''
-@if [ "@SCRIPTDIR@/bin" = "@BINDIR@" ] ; then \
echo 'Again, be sure to change to the @SCRIPTDIR@ directory!' ; \
fi
pem: extras/tls.cnf
@echo "Generating server key..."
$(OPENSSLPATH) ecparam -out server.key.pem -name secp384r1 -genkey
@echo "Generating certificate request..."
$(OPENSSLPATH) req -new \
-config extras/tls.cnf -sha256 -out server.req.pem \
-key server.key.pem -nodes
@echo "Generating self-signed certificate..."
$(OPENSSLPATH) req -x509 -days 3650 -sha256 -in server.req.pem \
-key server.key.pem -out server.cert.pem
@echo "Setting permissions on server.*.pem files..."
chmod o-rwx server.req.pem server.key.pem server.cert.pem
chmod g-rwx server.req.pem server.key.pem server.cert.pem
Makefile: config.status Makefile.in
./config.status

1084
Makefile.windows Normal file

File diff suppressed because it is too large Load Diff

58
README.md Normal file
View File

@ -0,0 +1,58 @@
[![Twitter Follow](https://img.shields.io/twitter/follow/Unreal_IRCd.svg?style=social&label=Follow)](https://twitter.com/Unreal_IRCd)
## About UnrealIRCd
UnrealIRCd is an Open Source IRC Server, serving thousands of networks since 1999.
It runs on Linux, OS X and Windows and is currently the most widely deployed IRCd
with a market share of 42%. UnrealIRCd is a highly advanced IRCd with a strong
focus on modularity, an advanced and highly configurable configuration file.
Key features include SSL/TLS, cloaking, its advanced anti-flood and anti-spam systems,
swear filtering and module support. We are also particularly proud on our extensive
online documentation.
## How to get started
Please consult our excellent online documentation at https://www.unrealircd.org/docs/
when setting up the IRCd!
### Step 1: Installation
#### Windows
Simply download the UnrealIRCd Windows version from www.unrealircd.org
Alternatively you can compile UnrealIRCd for Windows yourself. However this is not straightforward and thus not recommended.
#### *BSD/Linux/macOS
Do the following steps under a separate account for running UnrealIRCd,
[do NOT compile or run as root](https://www.unrealircd.org/docs/Do_not_run_as_root).
### Step 1: Compile the IRCd
* Run `./Config`
* Run `make`
* Run `make install`
* Now change to the directory where you installed UnrealIRCd, e.g. `cd /home/xxxx/unrealircd`
### Step 2: Configuration
Configuration files are stored in the conf/ folder by default (eg: /home/xxxx/unrealircd/conf)
#### Create a configuration file
If you are new, then you need to create your own configuration file:
Copy conf/examples/example.conf to conf/ and call it unrealircd.conf.
Then open it in an editor and carefully modify it using the documentation and FAQ as a guide (see below).
### Step 3: Booting
#### Linux/*BSD/macOS
Run `./unrealircd start` in the directory where you installed UnrealIRCd.
#### Windows
Start -> All Programs -> UnrealIRCd -> UnrealIRCd
## Documentation & FAQ
You can find the **documentation** online at: https://www.unrealircd.org/docs/
We also have a good **FAQ**: https://www.unrealircd.org/docs/FAQ
## Website, support, and other links ##
* https://www.unrealircd.org - Our main website
* https://forums.unrealircd.org - Support
* https://bugs.unrealircd.org - Bug tracker
* ircs://irc.unrealircd.org:6697/unreal-support - IRC support

3
autoconf/Makefile Normal file
View File

@ -0,0 +1,3 @@
all:
@autoconf
cp configure ..

1438
autoconf/config.guess vendored Normal file

File diff suppressed because it is too large Load Diff

1810
autoconf/config.sub vendored Normal file

File diff suppressed because it is too large Load Diff

0
autoconf/install-sh Normal file
View File

View File

@ -0,0 +1,72 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
#
# DESCRIPTION
#
# Check whether the given FLAG works with the current language's compiler
# or gives an error. (Warnings, however, are ignored)
#
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
# If EXTRA-FLAGS is defined, it is added to the current language's default
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
# force the compiler to issue an error when a bad flag is given.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 2
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
[m4_default([$2], :)],
[m4_default([$3], :)])
AS_VAR_POPDEF([CACHEVAR])dnl
])dnl AX_CHECK_COMPILE_FLAGS

View File

@ -0,0 +1,71 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
#
# DESCRIPTION
#
# Check whether the given FLAG works with the linker or gives an error.
# (Warnings, however, are ignored)
#
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
# If EXTRA-FLAGS is defined, it is added to the linker's default flags
# when the check is done. The check is thus made with the flags: "LDFLAGS
# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
# issue an error when a bad flag is given.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 2
AC_DEFUN([AX_CHECK_LINK_FLAG],
[AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [
ax_check_save_flags=$LDFLAGS
LDFLAGS="$LDFLAGS $4 $1"
AC_LINK_IFELSE([AC_LANG_PROGRAM()],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
LDFLAGS=$ax_check_save_flags])
AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
[m4_default([$2], :)],
[m4_default([$3], :)])
AS_VAR_POPDEF([CACHEVAR])dnl
])dnl AX_CHECK_LINK_FLAGS

332
autoconf/m4/ax_pthread.m4 Normal file
View File

@ -0,0 +1,332 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
#
# DESCRIPTION
#
# This macro figures out how to build C programs using POSIX threads. It
# sets the PTHREAD_LIBS output variable to the threads library and linker
# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
# flags that are needed. (The user can also force certain compiler
# flags/libs to be tested by setting these environment variables.)
#
# Also sets PTHREAD_CC to any special C compiler that is needed for
# multi-threaded programs (defaults to the value of CC otherwise). (This
# is necessary on AIX to use the special cc_r compiler alias.)
#
# NOTE: You are assumed to not only compile your program with these flags,
# but also link it with them as well. e.g. you should link with
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
#
# If you are only building threads programs, you may wish to use these
# variables in your default LIBS, CFLAGS, and CC:
#
# LIBS="$PTHREAD_LIBS $LIBS"
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# CC="$PTHREAD_CC"
#
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
#
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
# PTHREAD_CFLAGS.
#
# ACTION-IF-FOUND is a list of shell commands to run if a threads library
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
# is not found. If ACTION-IF-FOUND is not specified, the default action
# will define HAVE_PTHREAD.
#
# Please let the authors know if this macro fails on any platform, or if
# you have any other suggestions or comments. This macro was based on work
# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
# Alejandro Forero Cuervo to the autoconf macro repository. We are also
# grateful for the helpful feedback of numerous users.
#
# Updated for Autoconf 2.68 by Daniel Richard G.
#
# LICENSE
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
#
# 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 21
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_PUSH([C])
ax_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on True64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes])
AC_MSG_RESULT([$ax_pthread_ok])
if test x"$ax_pthread_ok" = xno; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all, and "pthread-config"
# which is a program returning the flags for the Pth emulation library.
ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
# -pthreads: Solaris/gcc
# -mthreads: Mingw32/gcc, Lynx/gcc
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads too;
# also defines -D_REENTRANT)
# ... -mt is also the pthreads flag for HP/aCC
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
case ${host_os} in
solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
;;
darwin*)
ax_pthread_flags="-pthread $ax_pthread_flags"
;;
esac
# Clang doesn't consider unrecognized options an error unless we specify
# -Werror. We throw in some extra Clang-specific options to ensure that
# this doesn't happen for GCC, which also accepts -Werror.
AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags])
save_CFLAGS="$CFLAGS"
ax_pthread_extra_flags="-Werror"
CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])],
[AC_MSG_RESULT([yes])],
[ax_pthread_extra_flags=
AC_MSG_RESULT([no])])
CFLAGS="$save_CFLAGS"
if test x"$ax_pthread_ok" = xno; then
for flag in $ax_pthread_flags; do
case $flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $flag])
PTHREAD_CFLAGS="$flag"
;;
pthread-config)
AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
if test x"$ax_pthread_config" = xno; then continue; fi
PTHREAD_CFLAGS="`pthread-config --cflags`"
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$flag])
PTHREAD_LIBS="-l$flag"
;;
esac
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
static void routine(void *a) { a = 0; }
static void *start_routine(void *a) { return a; }],
[pthread_t th; pthread_attr_t attr;
pthread_create(&th, 0, start_routine, 0);
pthread_join(th, 0);
pthread_attr_init(&attr);
pthread_cleanup_push(routine, 0);
pthread_cleanup_pop(0) /* ; */])],
[ax_pthread_ok=yes],
[])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT([$ax_pthread_ok])
if test "x$ax_pthread_ok" = xyes; then
break;
fi
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Various other checks:
if test "x$ax_pthread_ok" = xyes; then
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
AC_MSG_CHECKING([for joinable pthread attribute])
attr_name=unknown
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
[int attr = $attr; return attr /* ; */])],
[attr_name=$attr; break],
[])
done
AC_MSG_RESULT([$attr_name])
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name],
[Define to necessary symbol if this constant
uses a non-standard name on your system.])
fi
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case ${host_os} in
aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
osf* | hpux*) flag="-D_REENTRANT";;
solaris*)
if test "$GCC" = "yes"; then
flag="-D_REENTRANT"
else
# TODO: What about Clang on Solaris?
flag="-mt -D_REENTRANT"
fi
;;
esac
AC_MSG_RESULT([$flag])
if test "x$flag" != xno; then
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
fi
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
[ax_cv_PTHREAD_PRIO_INHERIT], [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
[[int i = PTHREAD_PRIO_INHERIT;]])],
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
[ax_cv_PTHREAD_PRIO_INHERIT=no])
])
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
[AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
# More AIX lossage: compile with *_r variant
if test "x$GCC" != xyes; then
case $host_os in
aix*)
AS_CASE(["x/$CC"],
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
[#handle absolute path differently from PATH based program lookup
AS_CASE(["x$CC"],
[x/*],
[AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
[AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
;;
esac
fi
fi
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
AC_SUBST([PTHREAD_LIBS])
AC_SUBST([PTHREAD_CFLAGS])
AC_SUBST([PTHREAD_CC])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$ax_pthread_ok" = xyes; then
ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
:
else
ax_pthread_ok=no
$2
fi
AC_LANG_POP
])dnl AX_PTHREAD

254
autoconf/m4/unreal.m4 Normal file
View File

@ -0,0 +1,254 @@
#serial 1
dnl Macro: unreal_CHECK_TYPE_SIZES
dnl originally called unet_CHECK_TYPE_SIZES
dnl
dnl Check the size of several types and define a valid int16_t and int32_t.
dnl
AC_DEFUN([unreal_CHECK_TYPE_SIZES],
[dnl Check type sizes
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
if test "$ac_cv_sizeof_int" = 2 ; then
AC_CHECK_TYPE(int16_t, int)
AC_CHECK_TYPE(u_int16_t, unsigned int)
elif test "$ac_cv_sizeof_short" = 2 ; then
AC_CHECK_TYPE(int16_t, short)
AC_CHECK_TYPE(u_int16_t, unsigned short)
else
AC_MSG_ERROR([Cannot find a type with size of 16 bits])
fi
if test "$ac_cv_sizeof_int" = 4 ; then
AC_CHECK_TYPE(int32_t, int)
AC_CHECK_TYPE(u_int32_t, unsigned int)
elif test "$ac_cv_sizeof_short" = 4 ; then
AC_CHECK_TYPE(int32_t, short)
AC_CHECK_TYPE(u_int32_t, unsigned short)
elif test "$ac_cv_sizeof_long" = 4 ; then
AC_CHECK_TYPE(int32_t, long)
AC_CHECK_TYPE(u_int32_t, unsigned long)
else
AC_MSG_ERROR([Cannot find a type with size of 32 bits])
fi
AC_CHECK_SIZEOF(rlim_t)
if test "$ac_cv_sizeof_rlim_t" = 8 ; then
AC_DEFINE([LONG_LONG_RLIM_T], [], [Define if rlim_t is long long])
fi
])
AC_DEFUN([CHECK_LIBCURL],
[
AC_ARG_ENABLE(libcurl,
[AC_HELP_STRING([--enable-libcurl=DIR],[enable libcurl (remote include) support])],
[enable_curl=$enableval],
[enable_curl=no])
AS_IF([test "x$enable_curl" != "xno"],
[
dnl sane, default directory for Operating System-managed libcURL
dnl (when --enable-libcurl is passed without any arguments). On
dnl systems with stuff in /usr/local, /usr/local/bin should already
dnl be in PATH. On sane systems, this will invoke the curl-config
dnl installed by the package manager.
CURLCONFIG="curl-config"
AS_IF([test "x$enable_curl" != "xyes"],
[CURLCONFIG="$enable_curl/bin/curl-config"])
AC_MSG_CHECKING([$CURLCONFIG])
AS_IF([$CURLCONFIG --version 2>/dev/null >/dev/null],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_FAILURE([Could not find curl-config, try editing --enable-libcurl])])
CURLCFLAG="`$CURLCONFIG --cflags`"
CURLLIBS="`$CURLCONFIG --libs`"
dnl This test must be this way because of #3981
AS_IF([$CURLCONFIG --libs | grep -q -e ares],
[CURLUSESCARES="1"],
[CURLUSESCARES="0"])
dnl sanity warnings
AS_IF([test -z "${CURLLIBS}"],
[AC_MSG_WARN([CURLLIBS is empty, that probably means that I could not find $enable_curl/bin/curl-config])])
dnl Ok this is ugly, basically we need to strip the version of c-ares that curl uses
dnl because we want to use our own version (which is hopefully fully binary
dnl compatible with the curl one as well).
dnl Therefore we need to strip the cares libs in a weird way...
dnl If anyone can come up with something better and still portable (no awk!?)
dnl then let us know. -- Syzop
dnl
dnl It is dangerous to mix and match cURL with potentially ABI-incompatible versions of
dnl c-ares, just use --with-system-cares.
dnl Thus, make sure to use --with-system-cares when using system-cURL. If the user
dnl wants bundled c-ares + system libcURL, then we should filter out c-ares
dnl flags. _Only_ in that case should we mess with the flags. -- ohnobinki
AS_IF([test "x$has_system_cares" = "xno" && test "x$BUILDDIR/extras/curl" != "x$enable_curl" && test "$CURLUSESCARES" != "0" ],
[
AC_MSG_ERROR([[
You have decided to build unrealIRCd with libcURL (remote includes) support.
However, you have system-installed c-ares support has either been disabled
(--without-system-cares) or is unavailable.
Because UnrealIRCd will use a bundled copy of c-ares which may be incompatible
with the system-installed libcURL, this is a bad idea which may result in error
messages looking like:
\`\`[error] unrealircd.conf:9: include: error downloading '(http://example.net/ex.conf)': Could not resolve host: example.net (Successful completion)''
Or UnrealIRCd might even crash.
Please build UnrealIRCd with --with-system-cares when enabling --enable-libcurl
]])
])
dnl Make sure that linking against cURL works rather than letting the user
dnl find out after compiling most of his program. ~ohnobinki
IRCDLIBS="$IRCDLIBS $CURLLIBS"
CFLAGS="$CFLAGS $CURLCFLAG"
AC_DEFINE([USE_LIBCURL], [], [Define if you have libcurl installed to get remote includes and MOTD support])
AC_MSG_CHECKING([curl_easy_init() in $CURLLIBS])
LIBS_SAVEDA="$LIBS"
CFLAGS_SAVEDA="$CFLAGS"
LIBS="$IRCDLIBS $IRCDLIBS_CURL_CARES"
CFLAGS="$CFLAGS $CFLAGS_CURL_CARES"
AC_LINK_IFELSE(
[
AC_LANG_PROGRAM(
[[#include <curl/curl.h>]],
[[CURL *curl = curl_easy_init();]])
],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_FAILURE([You asked for libcURL (remote includes) support, but it can't be found at $enable_curl])
])
LIBS="$LIBS_SAVEDA"
CFLAGS="$CFLAGS_SAVEDA"
URL="url.o"
AC_SUBST(URL)
]) dnl AS_IF(enable_curl)
])
dnl the following 2 macros are based on CHECK_SSL by Mark Ethan Trostler <trostler@juniper.net>
AC_DEFUN([CHECK_SSL],
[
AC_ARG_ENABLE(ssl,
[AC_HELP_STRING([--enable-ssl=],[enable ssl will check /usr/local/opt/openssl /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/sfw /usr/local /usr])],
[],
[enable_ssl=no])
AS_IF([test $enable_ssl != "no"],
[
AC_MSG_CHECKING([for OpenSSL])
for dir in $enable_ssl /usr/local/opt/openssl /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/sfw /usr/local /usr; do
ssldir="$dir"
if test -f "$dir/include/openssl/ssl.h"; then
AC_MSG_RESULT([found in $ssldir/include/openssl])
found_ssl="yes";
if test ! "$ssldir" = "/usr" ; then
CFLAGS="$CFLAGS -I$ssldir/include";
fi
break
fi
if test -f "$dir/include/ssl.h"; then
AC_MSG_RESULT([found in $ssldir/include])
found_ssl="yes";
if test ! "$ssldir" = "/usr" ; then
CFLAGS="$CFLAGS -I$ssldir/include";
fi
break
fi
done
if test x_$found_ssl != x_yes; then
AC_MSG_RESULT(not found)
echo ""
echo "Apparently you do not have both the openssl binary and openssl development libraries installed."
echo "The following packages are required:"
echo "1) The library package is often called 'openssl-dev', 'openssl-devel' or 'libssl-dev'"
echo "2) The binary package is usually called 'openssl'."
echo "NOTE: you or your system administrator needs to install the library AND the binary package."
echo "After doing so, simply re-run ./Config"
exit 1
else
CRYPTOLIB="-lssl -lcrypto";
if test ! "$ssldir" = "/usr" ; then
LDFLAGS="$LDFLAGS -L$ssldir/lib";
dnl check if binary path exists
if test -f "$ssldir/bin/openssl"; then
OPENSSLPATH="$ssldir/bin/openssl";
fi
fi
dnl linking require -ldl?
AC_MSG_CHECKING([OpenSSL linking with -ldl])
SAVE_LIBS="$LIBS"
LIBS="$LIBS $CRYPTOLIB -ldl"
AC_TRY_LINK([#include <openssl/err.h>], [ERR_clear_error();],
[
AC_MSG_RESULT(yes)
CRYPTOLIB="$CRYPTOLIB -ldl"
],
[
AC_MSG_RESULT(no)
dnl linking require both -ldl and -lpthread?
AC_MSG_CHECKING([OpenSSL linking with -ldl and -lpthread])
LIBS="$SAVE_LIBS $CRYPTOLIB -ldl -lpthread"
AC_TRY_LINK([#include <openssl/err.h>], [ERR_clear_error();],
[
AC_MSG_RESULT(yes)
CRYPTOLIB="$CRYPTOLIB -ldl -lpthread"
],
[
AC_MSG_RESULT(no)
])
])
LIBS="$SAVE_LIBS"
fi
])
])
AC_DEFUN([CHECK_SSL_CTX_SET1_CURVES_LIST],
[
AC_MSG_CHECKING([for SSL_CTX_set1_curves_list in SSL library])
AC_LANG_PUSH(C)
SAVE_LIBS="$LIBS"
LIBS="$LIBS $CRYPTOLIB"
AC_TRY_LINK([#include <openssl/ssl.h>],
[SSL_CTX *ctx = NULL; SSL_CTX_set1_curves_list(ctx, "test");],
has_function=1,
has_function=0)
LIBS="$SAVE_LIBS"
AC_LANG_POP(C)
if test $has_function = 1; then
AC_MSG_RESULT([yes])
AC_DEFINE([HAS_SSL_CTX_SET1_CURVES_LIST], [], [Define if ssl library has SSL_CTX_set1_curves_list])
else
AC_MSG_RESULT([no])
fi
])
AC_DEFUN([CHECK_SSL_CTX_SET_MIN_PROTO_VERSION],
[
AC_MSG_CHECKING([for SSL_CTX_set_min_proto_version in SSL library])
AC_LANG_PUSH(C)
SAVE_LIBS="$LIBS"
LIBS="$LIBS $CRYPTOLIB"
AC_TRY_LINK([#include <openssl/ssl.h>],
[SSL_CTX *ctx = NULL; SSL_CTX_set_min_proto_version(ctx, TLS1_VERSION);],
has_function=1,
has_function=0)
LIBS="$SAVE_LIBS"
AC_LANG_POP(C)
if test $has_function = 1; then
AC_MSG_RESULT([yes])
AC_DEFINE([HAS_SSL_CTX_SET_MIN_PROTO_VERSION], [], [Define if ssl library has SSL_CTX_set_min_proto_version])
else
AC_MSG_RESULT([no])
fi
])

11
autogen.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
echo "Regenerating 'configure' and headers..."
echo "NOTE: Normally only UnrealIRCd developers run this command!!"
cd "$(dirname "${0}")"
ACLOCAL_AMFLAGS=(-I autoconf/m4)
aclocal "${ACLOCAL_AMFLAGS[@]}"
autoconf
autoheader

9027
configure vendored Executable file

File diff suppressed because it is too large Load Diff

721
configure.ac Normal file
View File

@ -0,0 +1,721 @@
dnl Process this file with autoconf to produce a configure script.
dnl When updating the version, remember to update the following files
dnl appropriately:
dnl include/windows/setup.h
dnl src/windows/unrealinst.iss
dnl doc/Config.header
dnl src/version.c.SH
AC_INIT([unrealircd], [5.0.3.1], [https://bugs.unrealircd.org/], [], [https://unrealircd.org/])
AC_CONFIG_SRCDIR([src/ircd.c])
AC_CONFIG_HEADER([include/setup.h])
AC_CONFIG_AUX_DIR([autoconf])
AC_CONFIG_MACRO_DIR([autoconf/m4])
if test "x$enable_dynamic_linking" = "x"; then
echo "Please use ./Config instead of ./configure"
exit 1
fi
dnl Save CFLAGS, use this when building the libraries like c-ares
orig_cflags="$CFLAGS"
dnl Save build directory early on (used in our m4 macros too)
BUILDDIR_NOW="`pwd`"
dnl Calculate the versions. Perhaps the use of expr is a little too extravagant
# Generation version number (e.g.: X in X.Y.Z)
UNREAL_VERSION_GENERATION=["5"]
AC_DEFINE_UNQUOTED([UNREAL_VERSION_GENERATION], [$UNREAL_VERSION_GENERATION], [Generation version number (e.g.: X for X.Y.Z)])
# Major version number (e.g.: Y in X.Y.Z)
UNREAL_VERSION_MAJOR=["0"]
AC_DEFINE_UNQUOTED([UNREAL_VERSION_MAJOR], [$UNREAL_VERSION_MAJOR], [Major version number (e.g.: Y for X.Y.Z)])
# Minor version number (e.g.: Z in X.Y.Z)
UNREAL_VERSION_MINOR=["3"]
AC_DEFINE_UNQUOTED([UNREAL_VERSION_MINOR], [$UNREAL_VERSION_MINOR], [Minor version number (e.g.: Z for X.Y.Z)])
# The version suffix such as a beta marker or release candidate
# marker. (e.g.: -rcX for unrealircd-3.2.9-rcX). This macro is a
# string instead of an integer because it contains arbitrary data.
UNREAL_VERSION_SUFFIX=[".1"]
AC_DEFINE_UNQUOTED([UNREAL_VERSION_SUFFIX], ["$UNREAL_VERSION_SUFFIX"], [Version suffix such as a beta marker or release candidate marker. (e.g.: -rcX for unrealircd-3.2.9-rcX)])
AC_PATH_PROG(RM,rm)
AC_PATH_PROG(CP,cp)
AC_PATH_PROG(TOUCH,touch)
AC_PATH_PROG(OPENSSLPATH,openssl)
AS_IF([test x"$OPENSSLPATH" = "x"],
[
echo ""
echo "Apparently you do not have both the openssl binary and openssl development libraries installed."
echo "The following packages are required:"
echo "1) The library package is often called 'openssl-dev', 'openssl-devel' or 'libssl-dev'"
echo "2) The binary package is usually called 'openssl'."
echo "NOTE: you or your system administrator needs to install the library AND the binary package."
echo "After doing so, simply re-run ./Config"
exit 1
])
AC_PATH_PROG(INSTALL,install)
AC_CHECK_PROG(MAKER, gmake, gmake, make)
AC_PATH_PROG(GMAKE,gmake)
AS_IF([$MAKER --version | grep -q "GNU Make"],
[GNUMAKE="0"],
[AC_MSG_ERROR([It seems your system does not have gmake installed. Please install gmake.])])
AC_PATH_PROG(GUNZIP, gunzip)
AC_PATH_PROG(PKGCONFIG, pkg-config)
dnl Check for compiler
AC_PROG_CC_C99
AS_IF([test "$ac_cv_prog_cc_c99" = "no"],
[AC_MSG_ERROR([No C99 compiler was found. Please install gcc or clang and other build tools. Eg, on Debian/Ubuntu you probably want to run the following as root: apt-get install build-essential ])])
dnl Checks for libraries.
AC_CHECK_LIB(descrypt, crypt,
[AC_DEFINE([HAVE_CRYPT], [], [Define if you have crypt])
IRCDLIBS="$IRCDLIBS-ldescrypt "],
[AC_CHECK_LIB(crypt, crypt,
[AC_DEFINE([HAVE_CRYPT], [], [Define if you have crypt])
IRCDLIBS="$IRCDLIBS-lcrypt "])])
dnl HARDENING START
dnl This is taken from https://github.com/kmcallister/autoharden
dnl With some very small modifications (to remove C++ checking for instance)
# We want to check for compiler flag support, but there is no way to make
# clang's "argument unused" warning fatal. So we invoke the compiler through a
# wrapper script that greps for this message.
saved_CC="$CC"
saved_CXX="$CXX"
saved_LD="$LD"
flag_wrap="$srcdir/extras/wrap-compiler-for-flag-check"
CC="$flag_wrap $CC"
CXX="$flag_wrap $CXX"
LD="$flag_wrap $LD"
# We use the same hardening flags for C and C++. We must check that each flag
# is supported by both compilers.
AC_DEFUN([check_cc_flag],
[AC_LANG_PUSH(C)
AX_CHECK_COMPILE_FLAG([$1], [$2], [$3], [-Werror $4])
AC_LANG_POP(C)])
AC_DEFUN([check_link_flag],
[AX_CHECK_LINK_FLAG([$1], [$2], [$3], [-Werror $4])])
AC_ARG_ENABLE([hardening],
[AS_HELP_STRING([--enable-hardening],
[Enable compiler and linker options to frustrate memory corruption exploits @<:@yes@:>@])],
[hardening="$enableval"],
[hardening="yes"])
HARDEN_CFLAGS=""
HARDEN_LDFLAGS=""
AS_IF([test x"$hardening" != x"no"], [
check_cc_flag([-fno-strict-overflow], [HARDEN_CFLAGS="$HARDEN_CFLAGS -fno-strict-overflow"])
# This one will likely succeed, even on platforms where it does nothing.
check_cc_flag([-D_FORTIFY_SOURCE=2], [HARDEN_CFLAGS="$HARDEN_CFLAGS -D_FORTIFY_SOURCE=2"])
check_cc_flag([-fstack-protector-all],
[check_link_flag([-fstack-protector-all],
[HARDEN_CFLAGS="$HARDEN_CFLAGS -fstack-protector-all"
check_cc_flag([-Wstack-protector], [HARDEN_CFLAGS="$HARDEN_CFLAGS -Wstack-protector"],
[], [-fstack-protector-all])
check_cc_flag([--param ssp-buffer-size=1], [HARDEN_CFLAGS="$HARDEN_CFLAGS --param ssp-buffer-size=1"],
[], [-fstack-protector-all])])])
# At the link step, we might want -pie (GCC) or -Wl,-pie (Clang on OS X)
#
# The linker checks also compile code, so we need to include -fPIE as well.
check_cc_flag([-fPIE],
[check_link_flag([-fPIE -pie],
[HARDEN_BINCFLAGS="-fPIE"
HARDEN_BINLDFLAGS="-pie"],
[check_link_flag([-fPIE -Wl,-pie],
[HARDEN_BINCFLAGS="-fPIE"
HARDEN_BINLDFLAGS="-Wl,-pie"])])])
check_link_flag([-Wl,-z,relro],
[HARDEN_LDFLAGS="$HARDEN_LDFLAGS -Wl,-z,relro"
check_link_flag([-Wl,-z,now], [HARDEN_LDFLAGS="$HARDEN_LDFLAGS -Wl,-z,now"])])])
AC_SUBST([HARDEN_CFLAGS])
AC_SUBST([HARDEN_LDFLAGS])
AC_SUBST([HARDEN_BINCFLAGS])
AC_SUBST([HARDEN_BINLDFLAGS])
# End of flag tests.
CC="$saved_CC"
CXX="$saved_CXX"
LD="$saved_LD"
dnl HARDENING END
dnl UnrealIRCd might not be strict-aliasing safe at this time
check_cc_flag([-fno-strict-aliasing], [CFLAGS="$CFLAGS -fno-strict-aliasing"])
dnl UnrealIRCd should be able to compile with -fno-common
dnl This also makes ASan (if it is in use) able to instrument these variables.
check_cc_flag([-fno-common], [CFLAGS="$CFLAGS -fno-common"])
dnl Previously -funsigned-char was in a config check. It would always
dnl be enabled with gcc and clang. We now unconditionally enable it,
dnl skipping the check. This will cause an error if someone uses a
dnl non-gcc/non-clang compiler that does not support -funsigned-char
dnl which is good. After all, we really depend on it.
dnl UnrealIRCd should never be compiled without char being unsigned.
CFLAGS="$CFLAGS -funsigned-char"
dnl Compiler -W checks...
dnl We should be able to turn this on unconditionally:
CFLAGS="$CFLAGS -Wall"
dnl More warnings (if the compiler supports it):
check_cc_flag([-Wextra], [CFLAGS="$CFLAGS -Wextra"])
check_cc_flag([-Waggregate-return], [CFLAGS="$CFLAGS -Waggregate-return"])
dnl The following few are more experimental, if they have false positives we'll have
dnl to disable them:
dnl Can't use this, too bad: check_cc_flag([-Wlogical-op], [CFLAGS="$CFLAGS -Wlogical-op"])
check_cc_flag([-Wduplicated-cond], [CFLAGS="$CFLAGS -Wduplicated-cond"])
check_cc_flag([-Wduplicated-branches], [CFLAGS="$CFLAGS -Wduplicated-branches"])
dnl And now to filter out certain warnings:
dnl [!] NOTE REGARDING THE check_cc_flag used by these:
dnl We check for the -Woption even though we are going to use -Wno-option.
dnl This is due to the following (odd) gcc behavior:
dnl "When an unrecognized warning option is requested (e.g.,
dnl -Wunknown-warning), GCC emits a diagnostic stating that the option is not
dnl recognized. However, if the -Wno- form is used, the behavior is slightly
dnl different: no diagnostic is produced for -Wno-unknown-warning unless
dnl other diagnostics are being produced. This allows the use of new -Wno-
dnl options with old compilers, but if something goes wrong, the compiler
dnl warns that an unrecognized option is present."
dnl Since we don't want to use any unrecognized -Wno-option, we test for
dnl -Woption instead.
dnl Pointer signedness warnings are really a pain and 99.9% of the time
dnl they are of absolutely no use whatsoever. IMO the person who decided
dnl to enable this without -Wall should be shot on sight.
check_cc_flag([-Wpointer-sign], [CFLAGS="$CFLAGS -Wno-pointer-sign"])
dnl This is purely for charsys.c... I like it so we can easily read
dnl this for non-utf8. We can remove it once we ditch non-utf8 some day
dnl of course, or decide to ignore me and encode them.
check_cc_flag([-Winvalid-source-encoding], [CFLAGS="$CFLAGS -Wno-invalid-source-encoding"])
check_cc_flag([-Wformat-zero-length], [CFLAGS="$CFLAGS -Wno-format-zero-length"])
check_cc_flag([-Wformat-truncation], [CFLAGS="$CFLAGS -Wno-format-truncation"])
dnl While it can be useful to occasionally to compile with warnings about
dnl unused variables and parameters, we often 'think ahead' when coding things
dnl so they may be useless now but not later. Similarly, for variables, we
dnl don't always care about a variable that may still be present in a build
dnl without DEBUGMODE. Unused variables are optimized out anyway.
check_cc_flag([-Wunused], [CFLAGS="$CFLAGS -Wno-unused"])
check_cc_flag([-Wunused-parameter], [CFLAGS="$CFLAGS -Wno-unused-parameter"])
check_cc_flag([-Wunused-but-set-parameter], [CFLAGS="$CFLAGS -Wno-unused-but-set-parameter"])
dnl We use this and this warning is meaningless since 'char' is always unsigned
dnl in UnrealIRCd compiles (-funsigned-char).
check_cc_flag([-Wchar-subscripts], [CFLAGS="$CFLAGS -Wno-char-subscripts"])
check_cc_flag([-Wsign-compare], [CFLAGS="$CFLAGS -Wno-sign-compare"])
dnl Don't warn about empty body, we use this, eg via Debug(()) or in if's.
check_cc_flag([-Wempty-body], [CFLAGS="$CFLAGS -Wno-empty-body"])
dnl This one fails with ircstrdup(var, staticstring)
dnl Shame we have to turn it off completely...
check_cc_flag([-Waddress], [CFLAGS="$CFLAGS -Wno-address"])
dnl This one breaks our TO_INTFUNC() that is used in m_tkl for tkl_typetochar
check_cc_flag([-Wcast-function-type], [CFLAGS="$CFLAGS -Wno-cast-function-type"])
dnl End of -W... compiler checks.
dnl module checking based on Hyb7's module checking code
AC_DEFUN([AC_ENABLE_DYN],
[
AC_CHECK_FUNC(dlopen,, [AC_CHECK_LIB(dl, dlopen,IRCDLIBS="$IRCDLIBS -ldl",
[
AC_MSG_WARN(Dynamic linking is not enabled because dlopen was not found)
AC_DEFINE(STATIC_LINKING)
])])
hold_cflags=$CFLAGS
DYNAMIC_LDFLAGS=""
CFLAGS="$CFLAGS -Wl,-export-dynamic"
AC_CACHE_CHECK(if we need the -export-dynamic flag, ac_cv_export_dynamic, [
AC_TRY_LINK(, [int i];, ac_cv_export_dynamic=yes, ac_cv_export_dynamic=no)])
CFLAGS=$hold_cflags
if test "$ac_cv_export_dynamic" = "yes"; then
DYNAMIC_LDFLAGS="-Wl,-export-dynamic"
fi
AC_CACHE_CHECK(for compiler option to produce PIC,ac_cv_pic,[
if test "$ac_cv_prog_gcc" = "yes"; then
ac_cv_pic="-fPIC -DPIC -shared"
case `uname -s` in
Darwin*[)]
ac_cv_pic="-std=gnu89 -bundle -flat_namespace -undefined suppress"
;;
HP-UX*[)]
ac_cv_pic="-fPIC"
;;
esac
else
case `uname -s` in
SunOS*[)]
ac_cv_pic="-KPIC -DPIC -G"
;;
esac
fi
])
AC_CACHE_CHECK(if your system prepends an underscore on symbols,ac_cv_underscore,[
cat >uscore.c << __EOF__
int main() {
return 0;
}
__EOF__
$CC -o uscore $CFLAGS uscore.c 1>&5
if test -z "`strings -a uscore |grep '^_main$'`"; then
ac_cv_underscore=no
else
ac_cv_underscore=yes
fi
rm -f uscore uscore.c
])
dnl libtool has built-in tests that determine proper underscorage
if test "$ac_cv_underscore" = "yes"; then
AC_DEFINE([UNDERSCORE], [], [Define if your system prepends an underscore to symbols])
fi
MODULEFLAGS="$ac_cv_pic $DYNAMIC_LDFLAGS"
dnl DYNAMIC_LINKING is not meant to be defined in include/setup.h, it's
dnl defined in the Makefiles using -D. Having it defined globally will
dnl only cause braindamage and symbol collisions :-D.
dnl AC_DEFINE([DYNAMIC_LINKING], [], [Link dynamically as opposed to statically. (Dynamic linking is the only supported method of linking atm)])
])
AC_CACHE_CHECK([if your system has IPv6 support], [ac_cv_ip6], [
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/socket.h>
int main() {
int s = socket(AF_INET6, SOCK_STREAM, 0);
exit(0); /* We only check if the code compiles, that's enough. We can deal with missing runtime IPv6 */
}
],
[ac_cv_ip6=yes],
[ac_cv_ip6=no])
])
if test "$ac_cv_ip6" = "no"; then
AC_MSG_ERROR([Your system does not support IPv6])
fi
AC_CHECK_HEADER(sys/syslog.h,
AC_DEFINE([SYSSYSLOGH], [], [Define if you have the <sys/syslog.h> header file.]))
AC_CHECK_HEADER(sys/rusage.h,
AC_DEFINE([RUSAGEH], [], [Define if you have the <sys/rusage.h> header file.]))
AC_CHECK_HEADER(glob.h,
AC_DEFINE([GLOBH], [], [Define if you have the <glob.h> header file.]))
AC_CHECK_HEADERS([stdint.h inttypes.h])
dnl Checks for library functions.
AC_CHECK_FUNCS(strlcpy,
AC_DEFINE([HAVE_STRLCPY], [], [Define if you have strlcpy. Otherwise, an internal implementation will be used!]))
AC_CHECK_FUNCS(strlcat,
AC_DEFINE([HAVE_STRLCAT], [], [Define if you have strlcat]))
AC_CHECK_FUNCS(strlncat,
AC_DEFINE([HAVE_STRLNCAT], [], [Define if you have strlncat]))
AC_CHECK_FUNCS([getrusage],
[AC_DEFINE([GETRUSAGE_2], [], [Define if you have getrusage])],
[AC_CHECK_FUNCS([times],
[AC_DEFINE([TIMES_2], [], [Define if you have times])])])
AC_CHECK_FUNCS([setproctitle],
[AC_DEFINE([HAVE_SETPROCTITLE], [], [Define if you have setproctitle])],
[AC_CHECK_LIB([util],
[setproctitle],
[AC_DEFINE([HAVE_SETPROCTITLE], [], [Define if you have setproctitle])
IRCDLIBS="$IRCDLIBS-lutil"],
[
AC_EGREP_HEADER([#define.*PS_STRINGS.*],[sys/exec.h],
[AC_DEFINE([HAVE_PSSTRINGS],[], [Define if you have PS_STRINGS])],
[AC_CHECK_FUNCS([pstat],
[AC_DEFINE([HAVE_PSTAT], [], [Define if you have pstat])])])
])
]
)
AC_CHECK_FUNCS(explicit_bzero,AC_DEFINE([HAVE_EXPLICIT_BZERO], [], [Define if you have explicit_bzero]))
AC_CHECK_FUNCS(syslog,AC_DEFINE([HAVE_SYSLOG], [], [Define if you have syslog]))
AC_SUBST(CRYPTOLIB)
AC_SUBST(MODULEFLAGS)
AC_SUBST(DYNAMIC_LDFLAGS)
AC_ARG_WITH(nick-history, [AS_HELP_STRING([--with-nick-history=length],[Specify the length of the nickname history])],
[AC_DEFINE_UNQUOTED([NICKNAMEHISTORYLENGTH], [$withval], [Set to the nickname history length you want])],
[AC_DEFINE([NICKNAMEHISTORYLENGTH], [2000], [Set to the nickname history length you want])])
AC_ARG_WITH(permissions, [AS_HELP_STRING([--with-permissions=permissions], [Specify the default permissions for
configuration files])],
dnl We have an apparently out-of-place 0 here because of a MacOSX bug and because
dnl we assume that a user thinks that `chmod 0600 blah' is the same as `chmod 600 blah'
dnl (#3189)
[AC_DEFINE_UNQUOTED([DEFAULT_PERMISSIONS], [0$withval], [The default permissions for configuration files. Set to 0 to prevent unrealircd from calling chmod() on the files.])],
[AC_DEFINE([DEFAULT_PERMISSIONS], [0600], [The default permissions for configuration files. Set to 0 to prevent unrealircd from calling chmod() on the files.])])
AC_ARG_WITH(bindir, [AS_HELP_STRING([--with-bindir=path],[Specify the directory for the unrealircd binary])],
[AC_DEFINE_UNQUOTED([BINDIR], ["$withval"], [Define the directory where the unrealircd binary is located])
BINDIR="$withval"],
[AC_DEFINE_UNQUOTED([BINDIR], ["$HOME/unrealircd/bin"], [Define the directory where the unrealircd binary is located])
BINDIR="$HOME/unrealircd/bin"])
AC_ARG_WITH(scriptdir, [AS_HELP_STRING([--with-scriptdir=path],[Specify the directory for the unrealircd start-stop script])],
[AC_DEFINE_UNQUOTED([SCRIPTDIR], ["$withval"], [Define the directory where the unrealircd start stop scripts is located])
SCRIPTDIR="$withval"],
[AC_DEFINE_UNQUOTED([SCRIPTDIR], ["$HOME/unrealircd"], [Define the directory where the unrealircd start stop scripts is located])
SCRIPTDIR="$HOME/unrealircd"])
AC_ARG_WITH(confdir, [AS_HELP_STRING([--with-confdir=path],[Specify the directory where configuration files are stored])],
[AC_DEFINE_UNQUOTED([CONFDIR], ["$withval"], [Define the location of the configuration files])
CONFDIR="$withval"],
[AC_DEFINE_UNQUOTED([CONFDIR], ["$HOME/unrealircd/conf"], [Define the location of the configuration files])
CONFDIR="$HOME/unrealircd/conf"])
dnl We have to pass the builddir as well, for the module manager
AC_ARG_WITH(builddir, [AS_HELP_STRING([--with-builddir=path],[Specify the build directory])],
[AC_DEFINE_UNQUOTED([BUILDDIR], ["$withval"], [Define the build directory])
BUILDDIR="$withval"],
[AC_DEFINE_UNQUOTED([BUILDDIR], ["$BUILDDIR_NOW"], [Specify the build directory])
BUILDDIR="$BUILDDIR_NOW"])
AC_ARG_WITH(modulesdir, [AS_HELP_STRING([--with-modulesdir=path],[Specify the directory for loadable modules])],
[AC_DEFINE_UNQUOTED([MODULESDIR], ["$withval"], [Define the location of the modules])
MODULESDIR="$withval"],
[AC_DEFINE_UNQUOTED([MODULESDIR], ["$HOME/unrealircd/modules"], [Define the location of the modules])
MODULESDIR="$HOME/unrealircd/modules"])
AC_ARG_WITH(logdir, [AS_HELP_STRING([--with-logdir=path],[Specify the directory where log files are stored])],
[AC_DEFINE_UNQUOTED([LOGDIR], ["$withval"], [Define the location of the log files])
LOGDIR="$withval"],
[AC_DEFINE_UNQUOTED([LOGDIR], ["$HOME/unrealircd/logs"], [Define the location of the log files])
LOGDIR="$HOME/unrealircd/logs"])
AC_ARG_WITH(cachedir, [AS_HELP_STRING([--with-cachedir=path],[Specify the directory where cached files are stored])],
[AC_DEFINE_UNQUOTED([CACHEDIR], ["$withval"], [Define the location of the cached remote include files])
CACHEDIR="$withval"],
[AC_DEFINE_UNQUOTED([CACHEDIR], ["$HOME/unrealircd/cache"], [Define the location of the cached remote include files])
CACHEDIR="$HOME/unrealircd/cache"])
AC_ARG_WITH(tmpdir, [AS_HELP_STRING([--with-tmpdir=path],[Specify the directory where private temporary files are stored. Should not be readable or writable by others, so not /tmp!!])],
[AC_DEFINE_UNQUOTED([TMPDIR], ["$withval"], [Define the location of private temporary files])
TMPDIR="$withval"],
[AC_DEFINE_UNQUOTED([TMPDIR], ["$HOME/unrealircd/tmp"], [Define the location of private temporary files])
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([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])
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])
DOCDIR="$withval"],
[AC_DEFINE_UNQUOTED([DOCDIR], ["$HOME/unrealircd/doc"], [Define the location of the documentation])
DOCDIR="$HOME/unrealircd/doc"])
AC_ARG_WITH(pidfile, [AS_HELP_STRING([--with-pidfile=path],[Specify the path of the pid file])],
[AC_DEFINE_UNQUOTED([PIDFILE], ["$withval"], [Define the path of the pid file])
PIDFILE="$withval"],
[AC_DEFINE_UNQUOTED([PIDFILE], ["$HOME/unrealircd/data/unrealircd.pid"], [Define the path of the pid file])
PIDFILE="$HOME/unrealircd/data/unrealircd.pid"])
dnl Ensure that this “feature” can be disabled as it makes it harder to package unrealircd.
dnl Users have always been able to specify “./configure LDFLAGS=-Wl,-rpath,/path/to/blah”—binki
AC_ARG_WITH(privatelibdir, [AS_HELP_STRING([--with-privatelibdir=path],[Specify the directory where private libraries are stored. Disable when building a package for a distro])],
[],
[with_privatelibdir="yes"])
AS_IF([test "x$with_privatelibdir" = "xno"],
[PRIVATELIBDIR=],
[test "x$with_privatelibdir" = "xyes"],
[PRIVATELIBDIR="$HOME/unrealircd/lib"],
[PRIVATELIBDIR="$with_privatelibdir"])
AS_IF([test "x$PRIVATELIBDIR" = "x"],
[LDFLAGS_PRIVATELIBS=""],
[AC_DEFINE_UNQUOTED([PRIVATELIBDIR], ["$PRIVATELIBDIR"], [Define the location of private libraries])
LDFLAGS_PRIVATELIBS="-Wl,-rpath,$PRIVATELIBDIR"
LDFLAGS="$LDFLAGS $LDFLAGS_PRIVATELIBS"
export LDFLAGS])
AC_SUBST(BUILDDIR)
AC_SUBST(BINDIR)
AC_SUBST(SCRIPTDIR)
AC_SUBST(CONFDIR)
AC_SUBST(MODULESDIR)
AC_SUBST(LOGDIR)
AC_SUBST(CACHEDIR)
AC_SUBST(TMPDIR)
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)
AC_SUBST(LDFLAGS_PRIVATELIBS)
AC_ARG_WITH(maxconnections, [AS_HELP_STRING([--with-maxconnections=size], [Specify the max file descriptors to use])],
[ac_fd=$withval],
[ac_fd=0])
AC_DEFINE_UNQUOTED([MAXCONNECTIONS_REQUEST], [$ac_fd], [Set to the maximum number of connections you want])
AC_ARG_ENABLE([prefixaq],
[AS_HELP_STRING([--disable-prefixaq],[Disable chanadmin (+a) and chanowner (+q) prefixes])],
[],
[enable_prefixaq=yes])
AS_IF([test $enable_prefixaq = "yes"],
[AC_DEFINE([PREFIX_AQ], [], [Define if you want +a/+q prefixes])])
AC_ARG_WITH(showlistmodes,
[AS_HELP_STRING([--with-showlistmodes], [Specify whether modes are shown in /list])],
[AS_IF([test $withval = "yes"],
[AC_DEFINE([LIST_SHOW_MODES], [], [Define if you want modes shown in /list])])])
AC_ARG_WITH(no-operoverride, [AS_HELP_STRING([--with-no-operoverride], [Disable OperOverride])],
[AS_IF([test $withval = "yes"],
[AC_DEFINE([NO_OPEROVERRIDE], [], [Define if you want OperOverride disabled])])])
AC_ARG_WITH(operoverride-verify, [AS_HELP_STRING([--with-operoverride-verify], [Require opers to invite themselves to +s/+p channels])],
[AS_IF([test $withval = "yes"],
[AC_DEFINE([OPEROVERRIDE_VERIFY], [], [Define if you want opers to have to use /invite to join +s/+p channels])])])
AC_ARG_WITH(system-pcre2, [AS_HELP_STRING([--without-system-pcre2], [Use the system pcre2 package instead of bundled, discovered using pkg-config])], [], [with_system_pcre2=yes])
AC_ARG_WITH(system-argon2, [AS_HELP_STRING([--without-system-argon2], [Use bundled version instead of system argon2 library. Normally autodetected via pkg-config])], [], [with_system_argon2=yes])
AC_ARG_WITH(system-cares, [AS_HELP_STRING([--without-system-cares], [Use bundled version instead of system c-ares. Normally autodetected via pkg-config.])], [], [with_system_cares=yes])
CHECK_SSL
CHECK_SSL_CTX_SET1_CURVES_LIST
CHECK_SSL_CTX_SET_MIN_PROTO_VERSION
AC_ARG_ENABLE(dynamic-linking, [AS_HELP_STRING([--disable-dynamic-linking], [Make the IRCd statically link with shared objects rather than dynamically (noone knows if disabling dynamic linking actually does anything or not)])],
[enable_dynamic_linking=$enableval], [enable_dynamic_linking="yes"])
AS_IF([test $enable_dynamic_linking = "yes"],
[AC_ENABLE_DYN],
[AC_DEFINE([STATIC_LINKING], [], [Link... statically(?) (defining this macro will probably cause the build tofail)])])
AC_ARG_ENABLE([werror],
[AS_HELP_STRING([--enable-werror],
[Turn compilation warnings into errors (-Werror)])],
[ac_cv_werror="$enableval"],
[ac_cv_werror="no"])
AC_ARG_ENABLE([asan],
[AS_HELP_STRING([--enable-asan],
[Enable address sanitizer and other debugging options, not recommended for production servers!])],
[ac_cv_asan="$enableval"],
[ac_cv_asan="no"])
AC_CHECK_FUNCS([poll],
AC_DEFINE([HAVE_POLL], [], [Define if you have poll]))
AC_CHECK_FUNCS([epoll_create epoll_ctl epoll_wait],
AC_DEFINE([HAVE_EPOLL], [], [Define if you have epoll]))
AC_CHECK_FUNCS([kqueue kevent],
AC_DEFINE([HAVE_KQUEUE], [], [Define if you have kqueue]))
dnl c-ares needs PATH_SEPARATOR set or it will
dnl fail on certain solaris boxes. We might as
dnl well set it here.
export PATH_SEPARATOR
dnl Use system pcre2 when available, unless --without-system-pcre2.
has_system_pcre2="no"
AS_IF([test "x$with_system_pcre2" = "xyes"],[
PKG_CHECK_MODULES([PCRE2], libpcre2-8 >= 10.00,[has_system_pcre2=yes
AS_IF([test "x$PRIVATELIBDIR" != "x"], [rm -f "$PRIVATELIBDIR/"libpcre2*])],[has_system_pcre2=no])])
AS_IF([test "$has_system_pcre2" = "no"], [
dnl REMEMBER TO CHANGE WITH A NEW PCRE2 RELEASE!
pcre2_version="10.33"
AC_MSG_RESULT(extracting PCRE2 regex library)
cur_dir=`pwd`
cd extras
dnl remove old pcre2 directory to force a recompile...
dnl and remove its installation prefix just to clean things up.
rm -rf pcre2-$pcre2_version pcre2
if test "x$ac_cv_path_GUNZIP" = "x" ; then
tar xfz pcre2.tar.gz
else
cp pcre2.tar.gz pcre2.tar.gz.bak
gunzip -f pcre2.tar.gz
cp pcre2.tar.gz.bak pcre2.tar.gz
tar xf pcre2.tar
fi
AC_MSG_RESULT(configuring PCRE2 regex library)
cd pcre2-$pcre2_version
./configure --enable-jit --enable-shared --disable-unicode --prefix=$cur_dir/extras/pcre2 --libdir=$PRIVATELIBDIR || exit 1
AC_MSG_RESULT(compiling PCRE2 regex library)
$ac_cv_prog_MAKER || exit 1
AC_MSG_RESULT(installing PCRE2 regex library)
$ac_cv_prog_MAKER install || exit 1
PCRE2_CFLAGS="-I$cur_dir/extras/pcre2/include"
AC_SUBST(PCRE2_CFLAGS)
PCRE2_LIBS=
dnl See c-ares's compilation section for more info on this hack.
dnl ensure that we're linking against the bundled version of pcre2
dnl (we only reach this code if linking against the bundled version is desired).
AS_IF([test -n "$ac_cv_path_PKGCONFIG"],
[PCRE2_LIBS="`$ac_cv_path_PKGCONFIG --libs libpcre2-8.pc`"])
dnl For when pkg-config isn't available -- or for when pkg-config
dnl doesn't see the libpcre2-8.pc file somehow... (#3982)
AS_IF([test -z "$PCRE2_LIBS"],
[PCRE2_LIBS="$PRIVATELIBDIR/libpcre2-8.so"])
AC_SUBST(PCRE2_LIBS)
cd $cur_dir
])
dnl Use system argon2 when available, unless --without-system-argon2
has_system_argon2="no"
AS_IF([test "x$with_system_argon2" = "xyes"],[
PKG_CHECK_MODULES([ARGON2], [libargon2 >= 0~20161029],[has_system_argon2=yes
AS_IF([test "x$PRIVATELIBDIR" != "x"], [rm -f "$PRIVATELIBDIR/"libargon2*])],[has_system_argon2=no])])
AS_IF([test "$has_system_argon2" = "no"],[
dnl REMEMBER TO CHANGE WITH A NEW ARGON2 RELEASE!
argon2_version="20181209"
AC_MSG_RESULT(extracting Argon2 library)
cur_dir=`pwd`
cd extras
dnl remove old argon2 directory to force a recompile...
dnl and remove its installation prefix just to clean things up.
rm -rf argon2-$argon2_version argon2
if test "x$ac_cv_path_GUNZIP" = "x" ; then
tar xfz argon2-$argon2_version.tar.gz
else
cp argon2-$argon2_version.tar.gz argon2-$argon2_version.tar.gz.bak
gunzip -f argon2-$argon2_version.tar.gz
cp argon2-$argon2_version.tar.gz.bak argon2-$argon2_version.tar.gz
tar xf argon2-$argon2_version.tar
fi
AC_MSG_RESULT(compiling Argon2 library)
cd argon2-$argon2_version
$ac_cv_prog_MAKER || exit 1
AC_MSG_RESULT(installing Argon2 library)
$ac_cv_prog_MAKER install PREFIX=$cur_dir/extras/argon2 || exit 1
# We need to manually copy the libs to PRIVATELIBDIR because
# there is no way to tell make install in libargon2 to do so.
cp -av $cur_dir/extras/argon2/lib/* $PRIVATELIBDIR/
ARGON2_CFLAGS="-I$cur_dir/extras/argon2/include"
AC_SUBST(ARGON2_CFLAGS)
ARGON2_LIBS="-L$PRIVATELIBDIR -largon2"
AC_SUBST(ARGON2_LIBS)
cd $cur_dir
])
dnl Use system c-ares when available, unless --without-system-cares.
has_system_cares="no"
AS_IF([test "x$with_system_cares" = "xyes"],[
PKG_CHECK_MODULES([CARES], libcares >= 1.6.0,[has_system_cares=yes
AS_IF([test "x$PRIVATELIBDIR" != "x"], [rm -f "$PRIVATELIBDIR/"libcares*])],[has_system_cares=no])])
AS_IF([test "$has_system_cares" = "no"], [
dnl REMEMBER TO CHANGE WITH A NEW C-ARES RELEASE!
dnl NOTE: when changing this here, ALSO change it in extras/curlinstall
dnl and in the comment in this file around line 400!
cares_version="1.15.0"
AC_MSG_RESULT(extracting c-ares resolver library)
cur_dir=`pwd`
cd extras
dnl remove old c-ares directory to force a recompile...
rm -rf c-ares-$cares_version c-ares
if test "x$ac_cv_path_GUNZIP" = "x" ; then
tar xfz c-ares.tar.gz
else
cp c-ares.tar.gz c-ares.tar.gz.bak
gunzip -f c-ares.tar.gz
cp c-ares.tar.gz.bak c-ares.tar.gz
tar xf c-ares.tar
fi
AC_MSG_RESULT(configuring c-ares library)
cd c-ares-$cares_version
save_cflags="$CFLAGS"
CFLAGS="$orig_cflags"
export CFLAGS
./configure --prefix=$cur_dir/extras/c-ares --libdir=$PRIVATELIBDIR --enable-shared || exit 1
CFLAGS="$save_cflags"
AC_MSG_RESULT(compiling c-ares resolver library)
$ac_cv_prog_MAKER || exit 1
AC_MSG_RESULT(installing c-ares resolver library)
$ac_cv_prog_MAKER install || exit 1
CARES_CFLAGS="-I$cur_dir/extras/c-ares/include"
AC_SUBST(CARES_CFLAGS)
CARES_LIBS="-L$PRIVATELIBDIR"
dnl Set default library parameters for when pkg-config is not available
dnl Ugly cd'ing out of extras/c-ares-xxx ;)
dnl Note: must be a full path, not relative path.
cd ../..
CARESLIBSALT="$PRIVATELIBDIR/libcares.so"
cd -
case `uname -s` in
*FreeBSD*)
CARESLIBSALT="$CARESLIBSALT"
;;
*Linux*)
CARESLIBSALT="$CARESLIBSALT -lrt"
;;
*SunOS*)
CARESLIBSALT="$CARESLIBSALT -lrt"
;;
esac
dnl Use pkg-config for c-ares libraries, and if not available use defaults
dnl from above (also if pkg-config returns an empty result).
if test "x$ac_cv_path_PKGCONFIG" = "x" ; then
CARES_LIBS="$CARES_LIBS $CARESLIBSALT"
else
CARES_LIBSPRE="$CARES_LIBS"
dnl the sed expression forces an absolute path to the .so file to be generated
dnl because this is what libtool would do. If this wasn't done and /usr/lib*/libcares.so
dnl exists, then unrealircd would still try to link against the system c-ares.
dnl The [] quotation is needed because the sed expression has [] in it.
[CARES_LIBS="$CARES_LIBS `$ac_cv_path_PKGCONFIG --libs libcares.pc | sed -e 's,-L\([^ ]\+lib\) -lcares,\1/libcares.so,'`"]
if test "$CARES_LIBS" = "$CARES_LIBSPRE " ; then
CARES_LIBS="$CARES_LIBS $CARESLIBSALT"
fi
fi
AC_SUBST(CARES_LIBS)
cd $cur_dir
])
AX_PTHREAD()
CHECK_LIBCURL
UNRLINCDIR="`pwd`/include"
dnl Moved to the very end to ensure it doesn't affect any libs or tests.
if test "$ac_cv_werror" = "yes" ; then
CFLAGS="$CFLAGS -Werror"
fi
dnl Address sanitizer build
if test "$ac_cv_asan" = "yes" ; then
CFLAGS="$CFLAGS -O1 -fno-inline -fsanitize=address -fno-omit-frame-pointer -DNOCLOSEFD"
IRCDLIBS="-fsanitize=address $IRCDLIBS"
fi
AC_SUBST(IRCDLIBS)
AC_SUBST(UNRLINCDIR)
AC_CONFIG_FILES([Makefile
src/Makefile
src/modules/Makefile
src/modules/chanmodes/Makefile
src/modules/usermodes/Makefile
src/modules/snomasks/Makefile
src/modules/extbans/Makefile
src/modules/third/Makefile
unrealircd])
AC_OUTPUT
chmod 0700 unrealircd

148
doc/Authors Normal file
View File

@ -0,0 +1,148 @@
/************************************************************************
* IRC - Internet Relay Chat, doc/AUTHORS
* Copyright (C) 1990
*
* AUTHORS FILE:
* This file attempts to remember all contributors to the IRC
* developement. Names can be only added this file, no name
* should never be removed. This file must be included into all
* distributions of IRC and derived works.
*
* 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.
*/
IRC was conceived of and written by Jarkko Oikarinen <jto@tolsun.oulu.fi>.
IRC was originally written in University of Oulu, Computing Center.
Jan 1991 - IRC 2.6 jto@tolsun.oulu.fi
- Multiple Channels and protocol changes
Contributions were made by a cast of dozens, including the following:
Markku Jarvinen <mta@tut.fi>: Emacs-like editing facility for the client
Kimmo Suominen <kim@kannel.lut.fi>: HP-UX port
Jeff Trim <jtrim@orion.cair.du.edu>: enhancements and advice
Vijay Subramaniam <vijay@lll-winken.llnl.gov>: advice and ruthless publicity
Karl Kleinpaste <karl@cis.ohio-state.edu>: user's manual
Greg Lindahl <gl8f@virginia.edu>: AUTOMATON code, the Wumpus GM automaton,
myriad bug fixes
Bill Wisner <wisner@hayes.fai.alaska.edu>: numerous bug fixes and code
enhancements
Tom Davis <conslt16@zeus.unl.edu> and Tim Russell <russell@zeus.unl.edu>:
VMS modifications
Markku Savela <msa@tel4.tel.vtt.fi>: advice, support, and being the
incentive to do some of our *own* coding. :)
Tom Hopkins <hoppie@buengf.bu.edu>: bug fixes, quarantine lines,
consolidation of various patches.
Christopher Davis <ckd@cs.bu.edu>: EFnet/Anet gateway coding,
many automata ;), documentation fixing.
Helen Rose <hrose@cs.bu.edu>: documentation updating, and fixing.
Tom Hinds <rocker@bucsf.bu.edu>: emacs client updating.
Tim Miller <cerebus@bu-pub.bu.edu>: various server and client-breaking
features.
Darren Reed <avalon@coombs.anu.edu.au>: various bug fixes and enhancements.
Introduced nickname and channelname hash tables into the server.
The version 2.2 release was coordinated by Mike Bolotski
<mikeb@salmon.ee.ubc.ca>.
The version 2.4 release was coordinated by Markku Savela and
Chelsea Ashley Dyerman
The version 2.5.2 release was coordinated by Christopher Davis, Helen Rose,
and Tom Hopkins.
The versions 2.6.2, 2.7 and 2.8 releases were coordinated by Darren Reed.
Contributions for the 2.8 release from the following people:
Matthew Green <phone@coombs.anu.edu.au>
Chuck Kane <ckane@ece.uiuc.edu>
Matt Lyle <matt@oc.com>
Vesa Ruokonen <ruokonen@lut.fi>
Markku Savela <Markku.Savela@vtt.fi> / April 1990
Fixed various bugs in 2.2PL1 release server (2.2msa.4) and changed
sockets to use non-blocking mode (2.2msa.9). [I have absolutely
nothing to do with clients :-]
Chelsea Ashley Dyerman <chelsea@earth.cchem.berkeley.edu> / April 1990
Rewrote the Makefiles, restructuring of source tree. Added libIrcd.a to
the Makefile macros, numerous reformatting of server text messages, and
added mkversion.sh to keep track of compilation statistics. Numerous
bug fixes and enhancements, and co-coordinator of the 2.4 release.
Jarle Lyngaas (nmijl@alf.uib.no) added Note functions to ircd.
Armin Gruner <gruner@informatik.tu-muenchen.de> / May, June 1990:
* Patched KILL-line feature for ircd.conf, works now.
Enhancement: Time intervals can be specified in passwd-field.
Result: KILL-Line is only active during these intervals
* Patched PRIVMSG handling, now OPER can specify masks for sending
private messages, advantage: msg to all at a specified server or host.
* Little tests on irc 2.5 alpha, fixed some little typos in client code.
Change: common/debug.c has been moved to ircd/s_debug.c, and a
irc/c_debug.c has been created, for the benefit that wrong server msg
are displayed if client does not recognize them. (strange, if a server
sends an 'unknown command', isn't it?)
Tom Hopkins <hoppie@buengf.bu.edu> / September, October 1990:
* Patched msa's K lines for servers (Q lines).
* Consolidated several patches, including Stealth's logging patch.
* Fixed several minor bugs.
* Has done lots of other stuff that I can't seem to remember, but he
always works on code, so he has to have done alot more than three
lines worth. :)
UnrealIRCd Coders
Carsten Munk <stskeeps@unrealircd.com> / May 1999 - December 2008
Dominick Meglio <codemastr@unrealircd.com> / June 1999 - August 2005
David Flynn / March 2000 - June 2000
McSkaf / June 2001 - September 2001
Finny Merrill <griever@unrealircd.com> / November 2001 - December 2002
Bram Matthys <syzop@unrealircd.com> / January 2002 - date
This list is incomplete, type /INFO on IRC to find the updated list.
Thanks go to those persons not mentioned here who have added their advice,
opinions, and code to IRC.
Various modifications, bugreports, cleanups and testing by:
Hugo Calendar <hugo@ucscb.ucsc.edu>
Bo Adler <adler@csvax.cs.caltech.edu>
Michael Sandrof <ms5n+@andrew.cmu.edu>
Jon Solomon <jsol@cs.bu.edu>
Jan Peterson <jlp@hamblin.math.byu.edu>
Nathan Glasser <nathan@brokaw.lcs.mit.edu>
Helen Rose <hrose@eff.org>
Mike Pelletier <stealth@caen.engin.umich.edu>
Basalat Ali Raja <gwydion@tavi.rice.edu>
Eric P. Scott <eps@toaster.sfsu.edu>
Dan Goodwin <fornax@wpi.wpi.edu>
Noah Friedman <friedman@ai.mit.edu>
[ $Id$ ]

32
doc/Config.header Normal file
View File

@ -0,0 +1,32 @@
_ _ _ ___________ _____ _
| | | | | |_ _| ___ \/ __ \ | |
| | | |_ __ _ __ ___ __ _| | | | | |_/ /| / \/ __| |
| | | | '_ \| '__/ _ \/ _ | | | | | / | | / _ |
| |_| | | | | | | __/ (_| | |_| |_| |\ \ | \__/\ (_| |
\___/|_| |_|_| \___|\__,_|_|\___/\_| \_| \____/\__,_|
Configuration Program
for UnrealIRCd 5.0.3.1
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.
A short installation guide is available online at:
https://www.unrealircd.org/docs/Installing_from_source
Full documentation is available at:
https://www.unrealircd.org/docs/UnrealIRCd_5_documentation
--------------------------------------------------------------------------------------
The full release notes are available in doc/RELEASE-NOTES.md
For easier viewing, check out the latest online release notes at:
https://github.com/unrealircd/unrealircd/blob/unreal50/doc/RELEASE-NOTES.md
UnrealIRCd 5 is compatible with the following services:
* anope with the "unreal4" protocol module - version 2.0.7 or higher required!
* atheme with the "unreal4" protocol module - tested with version 7.2.9
--------------------------------------------------------------------------------------

14
doc/Donation Normal file
View File

@ -0,0 +1,14 @@
Although UnrealIRCd is a free program, we do put a great deal of time,
effort, and money into keeping UnrealIRCd alive. If you like UnrealIRCd and
want to support us then please consider making a donation.
PayPal Donation Link: https://unrealircd.org/index/donations
If you don't want to use PayPal, or you want to donate something other than
money, then please contact Syzop (syzop@unrealircd.com).
All those who donate at least a certain minimum amount will have their name
and/or company listed in /CREDITS and will be listed on the website.
Thank you for your support,
The UnrealIRCd Team

563
doc/RELEASE-NOTES.md Normal file
View File

@ -0,0 +1,563 @@
UnrealIRCd 5.0.3.1 Release Notes
=================================
UnrealIRCd 5.0.3.1
-------------------
This fixes a crash issue after REHASH in 5.0.3.
UnrealIRCd 5.0.3
-----------------
Fixes:
* Fix serious flood issue in labeled-response implementation.
* An IRCOp SQUIT'ing a far remote server may cause a broken link topology
* In channels that are +D (delayed join), PARTs were not shown correctly to
channel operators.
Enhancements:
* A new HISTORY command for history playback (```HISTORY #channel number-of-lines```)
which allows you to fetch more lines than the on-join history playback.
Of course, taking into account the set limits in the +H channel mode.
This command is one of the [two interfaces](https://www.unrealircd.org/docs/Channel_history#Ways_to_retrieve_history)
to [Channel history](https://www.unrealircd.org/docs/Channel_history).
* Two new [message tags](https://www.unrealircd.org/docs/Message_tags),
```unrealircd.org/userip``` and ```unrealircd.org/userhost```
which communicate the user@ip and real user@host to IRCOps.
Changes:
* Drop the draft/ prefix now that the IRCv3
[labeled-response](https://ircv3.net/specs/extensions/labeled-response.html)
specification is out of draft.
* The operclass permission ```immune:target-limit``` is now called
```immune:max-concurrent-conversations```, since it bypasses
[set::anti-flood::max-concurrent-conversations](https://www.unrealircd.org/docs/Set_block#set::anti-flood::max-concurrent-conversations).
For 99% of the users this change is not important, but it may be
if you use highly customized [operclass blocks](https://www.unrealircd.org/docs/Operclass_block)
Are you upgrading from UnrealIRCd 4.x to UnrealIRCd 5? If so,
then check out the *UnrealIRCd 5* release notes [further down](#unrealircd-5). At the
very least, check out [Upgrading from 4.x](https://www.unrealircd.org/docs/Upgrading_from_4.x).
UnrealIRCd 5.0.2
-----------------
Fixes:
* Halfop users are not synced correctly, resulting in missing users across links.
* [Channel history](https://www.unrealircd.org/docs/Channel_history) used
incorrect time internally, resulting in messages expiring too soon.
The syntax is now really ```/MODE #chan +H lines:time-in-minutes```.
To make clear that the time is in minutes, an 'm' will be added
automatically by the server (eg ```+H 15:1440m```).
* Documentation: to exempt someone from gline via /ELINE you have to use type 'G', not 'g'.
Similarly, to exempt from spamfilter, use type 'F' and not 'f'.
* Exempting IPs from throttling via [except throttle](https://www.unrealircd.org/docs/Except_throttle_block) was not working.
* Unable to customize [set::tls::outdated-protocols](https://www.unrealircd.org/docs/Set_block#set::ssl::outdated-protocols)
and [set::tls::outdated-ciphers](https://www.unrealircd.org/docs/Set_block#set::ssl::outdated-ciphers).
* Specifying multiple channels did not work in [set::auto-join](https://www.unrealircd.org/docs/Set_block#set::auto-join),
[set::oper-auto-join](https://www.unrealircd.org/docs/Set_block#set::oper-auto-join) and
[tld::channel](https://www.unrealircd.org/docs/Tld_block).
Enhancements:
* [Extended server bans](https://www.unrealircd.org/docs/Extended_server_bans) in *LINE and /ELINE allow
you to ban or exempt users on criteria other than host/IP. These use a
similar syntax to extended bans. Currently supported are ~a, ~S and ~r. Examples:
* ```/ELINE ~a:TrustedAccount kG 0 This user can bypass kline/gline when using SASL```
* ```/ELINE ~S:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef kGF 0 Trusted user with this certificate fingerprint```
* ```/GLINE ~r:*some*stupid*real*name*```
* These can also be used in the configuration file, eg: ```except ban { mask ~S:11223344etc; type all; };```
* New options that may not be used much, but can be useful on specific networks:
* The IRCd may add automatic bans, for example due to a blacklist hit,
a spamfilter hit, or because of antirandom or antimixedutf8. The new
option [set::automatic-ban-target](https://www.unrealircd.org/docs/Set_block#set::automatic-ban-target) specifies on *what* the ban should
be placed. The default is *ip*. Other options are: userip, host, userhost, account, certfp.
* Similarly, an oper may type ```/GLINE nickname```. The new option
[set::manual-ban-target](https://www.unrealircd.org/docs/Set_block#set::manual-ban-target) specifies on what the ban should be placed.
By default this is *host* (fallback to *ip*).
* New options to exempt webirc users: [set::connthrottle::webirc-bypass](https://www.unrealircd.org/docs/Connthrottle),
[set::restrict-commands::name-of-command::exempt-webirc](https://www.unrealircd.org/docs/Set_block#set::restrict-commands).
UnrealIRCd 5.0.1
-----------------
Fixes:
* IRCd may hang in rare circumstances
* Windows: fix repeated "ERROR renaming 'data/reputation.db.tmp'" warnings
* Antirandom and blacklist did not deal properly with 'warn' actions
* [Authprompt](https://www.unrealircd.org/docs/Authentication#How_it_looks_like)
did not always work properly
* Line numbers were incorrect in config file warnings/errors when using @if or @define
Enhancements:
* New /ELINE exception type 'm' to bypass allow::maxperip.
Or in the configuration file: ```except ban { mask 203.0.113.0/24; type maxperip; };```
* IRCOps can override MLOCK restrictions when services are down,
if they have the channel:override:mlock operclass permission,
such as opers which use the operclass 'netadmin-with-override'.
Other:
* Gottem and k4be have [uploaded their 3rd party modules](https://modules.unrealircd.org/)
to unrealircd-contrib so *NIX users can now easily install them using the new
[Module manager](https://www.unrealircd.org/docs/Module_manager)
UnrealIRCd 5
-------------
After more than 6 months of hard work, UnrealIRCd 5 is now our new "stable" branch.
In particular I would like to thank Gottem and 'i' for their source code
contributions and PeGaSuS and westor for testing releases.
When we transitioned from 3.2.x to 4.0.0 there were 175,000 lines of source code
added/removed during 3 years of development. This time it was 120,000 lines in
only 6 months, a major effort!
**If you are upgrading from 4.x to 5.x, then it would be wise to read
[Upgrading from 4.x](https://www.unrealircd.org/docs/Upgrading_from_4.x).
In any case, be sure to upgrade your services package first! (if you use any)**
UnrealIRCd 5 is compatible with the following services:
* [anope](https://www.anope.org/) (version 2.0.7 or higher) -
with the "unreal4" protocol module
* [atheme](https://atheme.github.io/atheme.html) (version 7.2.9 or higher) -
with the "unreal4" protocol module
Summary
--------
The most visible change to end-users is channel history. A lot of IRCv3 features were added.
Various modules from Gottem have been integrated and enhanced.
We now have a 3rd party module manager so you can install modules with 1 simple command.
Channel settings of ```+P``` channels and *LINES are saved in a database and
restored on startup (via 'channeldb' and 'tkldb' respectively).
Channel mode ```+L``` has a slight change of meaning, the existing floodprot
mode (```+f```) has a new type to prevent repeated messages and a new drop action.
A few extended bans have been added as well (```~f``` and ```~p```).
IRCOps now have the ability to add ban exceptions via the ```/ELINE``` command.
Advanced admins can use more dynamic configuration options where you can
define variables and use them later in the configuration file.
Finally, there have been speed improvements, we use better defaults and
have added more countermeasures and options against spambots.
Under the hood *a significant amount* of the source code was changed and cleaned up.
Read below for the full list of enhancements, changes and removals (and information for developers too).
Enhancements
-------------
* Support for IRCv3 server generated [message tags](https://ircv3.net/specs/extensions/message-tags), which allows us to communicate
additional information in protocol messages such as in JOIN and PRIVMSG.
Currently implemented and permitted message tags are:
* [account](https://ircv3.net/specs/extensions/account-tag-3.2): communicate the services account that a user uses
* [msgid](https://ircv3.net/specs/extensions/message-ids): assign an unique message id to each message
* [time](https://ircv3.net/specs/extensions/server-time-3.2): assign a time label to each message
The last two are mainly for history playback.
* Support for IRCv3 [echo-message](https://ircv3.net/specs/extensions/echo-message-3.2), which helps clients, among other things,
to see if the message you sent was altered in any way, eg: censored,
stripped from color, etc.
* Support for IRCv3 [draft/labeled-response-0.2](https://ircv3.net/specs/extensions/labeled-response), which helps clients to
correlate commands and responses.
* Support for IRCv3 [BATCH](https://ircv3.net/specs/extensions/batch-3.2), needed for some other features.
* Recording and playback of [channel history](https://www.unrealircd.org/docs/Channel_history) when channel mode +H is set.
The syntax is: ```MODE #chan +H max-lines-to-record:max-time-to-record-in-minutes```.
For example: ```MODE #chan +H 50:1440``` means the last 50 messages will be stored and no
message will be stored longer than 1440 minutes (1 day).
The channel history is then played back when joining such a channel,
but with two things to keep in mind:
1) The client must support the 'server-time' CAP ('time' message tag),
otherwise history is not shown. Any modern IRC client supports this.
2) Only a maximum of 15 lines are played back on-join by default
The reason for the maximum 15 lines on-join playback is that this can
be quite annoying if you rejoin repeatedly and as to not flood the users
screen too much (unwanted). In the future we will support a mechanism
for clients to "fetch" history - rather than sending it on-join - so
they can fetch more than the 15 lines, up to the number of lines and
time configured in the +H channel mode.
You can configure the exact number of lines that are played back and
all the limits that apply to +H via [set::history::channel](https://www.unrealircd.org/docs/Set_block#set::history).
* For saving and retrieving history we currently have the following options:
* *history_backend_mem*: channel history is stored in memory.
This is very fast but also means history is lost on restart.
* *history_backend_null*: don't store channel history at all.
This can be useful to load on servers with no users on it, such as a
hub server, where storing history is unnecessary.
As you can see there is currently no 'disk' backend. However, in the
future more options may be added. Also note that 3rd party modules
can add history backends as well.
* Support for ban exceptions via the new ```/ELINE``` command. This allows you
to add exceptions for regular bans (KLINE/GLINE/ZLINE/etc), but also
for connection throttling and blacklist checking.
For more information, just type ```/ELINE ``` in your IRC client as an IRCOp.
* [Websocket](https://www.unrealircd.org/docs/WebSocket_support) support now includes type 'text'
in addition to 'binary', which should work with [KiwiIRC](https://kiwiirc.com/)'s nextclient.
Also, websockets are no longer active on all ports by default. You have to explicitly
enable the websocket option in the listen block and also specify type *text* or *binary*,
eg: ```listen { ip *; port 6667; options { websocket { type text; } } }```
Also note that websockets require nick names and channels to consist of UTF8
characters only, due to
[WebSocket being incompatible with non-UTF8](https://www.unrealircd.org/docs/WebSocket_support#Problems_with_websockets_and_non-UTF8)
* There's now a [Module manager](https://www.unrealircd.org/docs/Module_manager)
which allows you to install and upgrade 3rd party modules in an easy way:
* ```./unrealircd module list``` - to list all available 3rd party modules
* ```./unrealircd module install third/something``` - to install the specified module.
* You can now test for configuration errors without actually starting the
IRC server. This is ideal if you are upgrading UnrealIRCd to a newer
version: simply run ```./unrealircd configtest``` to make sure it passes
the configuration test, and then you can safely restart the server for
the upgrade (in this example case).
* Channel mode +L now kicks in for any rejected join, so not just for +l but
also for +b, +i, +O, +z, +R and +k. If, for example, the channel is
+L #insecure and also +z then, when an insecure user ties to join, they
will be redirected to #insecure.
* New extended ban ~f to forward users to the specified channel if the ban
matches. Example: ```MODE #chan +b ~f:#badisp:*!*@*.isp.org```
* Channel mode +f now has a 'd' action: drop message. This will send an
error message to the user and not show the message in the channel but
otherwise do nothing (no kick or ban).
For example: ```MODE #chan +f [5t#d]:15``` will limit sending a maximum of
5 messages per 15 seconds per-user and drop any messages sent above that limit.
* Channel mode +f now has 'r' floodtype to prevent repeated lines. This will
compare the current message to the last message and the one before that
the user sent to the channel. If it's a repeat then the user can be
kicked (the default action), the message can be dropped ('d') or the
user can be banned ('b'). Example: ```MODE #chan +f [1r#d]:15```
If you want to permit 1 repeated line but not 2 then use: ```+f [2r#d]:15```
* New module **tkldb** (loaded by default): all *LINES and spamfilters are now
saved across reboots. No need for services for that anymore.
* New module **channeldb** (loaded by default): saves and restores all channel
settings including topic, modes, bans etc. of +P (persistent) channels.
* New module [restrict-commands](https://www.unrealircd.org/docs/Set_block#set::restrict-commands), which allows you to restrict any IRC
command based on criteria such as "how long is this user connected",
"is this user registered (has a services account)" etc.
The example.conf now ships with configuration to disable LIST the
first 60 seconds and disable INVITE the first 120 seconds.
If you are having spambot problems then tweaking this configuration
may be helpful to you.
* New option [set::require-module](https://www.unrealircd.org/docs/Set_block#set::require-module), which allows you to require certain
modules on other UnrealIRCd 5 servers, otherwise the link is rejected.
* New option [set::min-nick-length](https://www.unrealircd.org/docs/Set_block#set::min-nick-length) to set a minimum nick length.
* New module rmtkl (loaded by default): this allows you to remove TKL's
such as GLINEs easily via the /RMTKL command.
* The [reputation and connthrottle](https://www.unrealircd.org/docs/Connthrottle) modules are now loaded by default.
Just as a reminder, what these do is classifying your users in "known
users (known IP's)" and "unknown IP's" for IP's that have not been
seen before (or only for a short amount of time). Then, when there
is a connection flood, unknown/new IP addresses are throttled at
20 connections per minute, while known users are always allowed in.
* Add support for [defines and conditional configuration](https://www.unrealircd.org/docs/Defines_and_conditional_config) via @define and @if.
This is mostly for power users, in particular users who share the same
configuration file across several servers.
* New extban ~p to hide the part/quit message in PART and QUIT.
For example: ```MODE #chan +b ~p:*!*@*.nl```
* You will now see a warning when a server is not responding even
before they time out. How long to wait for a PONG reply upon PING
can be changed via [set::ping-warning](https://www.unrealircd.org/docs/Set_block#set::ping-warning) and defaults to 15 seconds.
If you see the warning frequently then your connection is flakey.
* Add new setting [set::broadcast-channel-messages](https://www.unrealircd.org/docs/Set_block#set::broadcast-channel-messages) which defines when
channel messages are sent across server links. The default setting
is *auto* which is the correct setting for pretty much everyone.
* Add new option [set::part-instead-of-quit-on-comment-change](https://www.unrealircd.org/docs/Set_block#set::part-instead-of-quit-on-comment-change):
when a QUIT message is changed due to channel restrictions, such as
stripping color or censoring a word, we normally change the QUIT
message. This has an effect on ALL channels, not just the one that
imposed the restrictions. While we feel that is the best tradeoff,
there is now also this new option (off by default) that will change
the QUIT into a PART in such a case, so the other channels that
do not have the restrictions (eg: are -S and -G) can still see the
original QUIT message.
* New module [webredir](https://www.unrealircd.org/docs/Set_block#set::webredir::url). Quite some people run their IRCd on port 443 or 80
so their users can avoid firewall restrictions in place. In such a case,
with this module, you can now send a HTTP redirect in case some user
enters your IRC server name in their browser. Eg https://irc.example.org/
can be made to redirect to https://www.example.org/
* We now protect against misbehaving SASL servers and will time out
SASL sessions after
[set::sasl-timeout](https://www.unrealircd.org/docs/Set_block#set::sasl-timeout),
which is 15 seconds by default.
Changed
--------
* Channel mode +L can now be set by chanops (+o and higher) instead of only
by +q (channel owner)
* Channel names must now be valid UTF8 by default.
We actually have 3 possible settings of [set::allowed-channelchars](https://www.unrealircd.org/docs/Set_block#set::allowed-channelchars):
* **utf8**: Channel must be valid UTF8, this is the new default
* **ascii**: A very strict setting, for example in use at freenode,
the channel name may not contain high ascii or UTF8
* **any**: A very loose setting, which allows almost all characters
in the channel name. This was the OLD default, up to and
including UnrealIRCd 4. It is no longer recommended.
For most networks this new default setting of utf8 will be fine, since
by far most IRC clients use UTF8 for many years already.
If you have a network that has a significant portion of chatters
that are on old non-UTF8 clients that use a specific character set
then you may want to use ```set { allowed-nickchars any; }```
Some Russian and Ukrainian networks are known to need this.
* The "except tkl" block is now called [except ban](https://www.unrealircd.org/docs/Except_ban_block#UnrealIRCd_5). If no type
is specified in an except ban { } block then we exempt the entry
from kline, gline, zline, gzline and shun.
* We no longer use a blacklist for stats (set::oper-only-stats).
We use a whitelist now instead: [set::allow-user-starts](https://www.unrealircd.org/docs/Set_block#set::allow-user-stats).
Most users can just remove their old set::oper-only-stats line,
since the new default set::allow-user-starts setting is fine.
* Windows: we now require a 64-bit version, Windows 7 or later.
The new program path is: C:\Program Files\UnrealIRCd 5
and the binaries have been moved to a new subdirectory: bin\
* Modules lost their m_ prefix, so for example m_map is now just map.
Also the modules in cap/ are now directly in modules.
* More modules that were previously PERM (permanent) can now be unloaded
and reloaded on the fly. This allows more "hotfixing" without restart
in case of a bug and also more control for admins at runtime.
Only <5 modules out of 173 are permanent now.
* User mode +T now blocks channel CTCPs as well.
* User mode +q (unkickable) could previously be set by any IRCOp.
This has been changed to require the self:unkickablemode operclass
permission. This is included in the *-with-override operclasses
(eg: netadmin-with-operoverride).
* [set::modes-on-join](https://www.unrealircd.org/docs/Set_block#set::modes-on-join) is now ```+nt``` by default.
* The [authprompt](https://www.unrealircd.org/docs/Authentication#How_it_looks_like) module is now loaded by default. This means that if
you do a soft kline on someone (eg: ```KLINE %*@*.badisp```) then the user
has a chance to [authenticate](https://www.unrealircd.org/docs/Authentication#How_it_looks_like) to services, even without SASL, and
bypass the ban if (s)he is authenticated.
* The WHOX module is now used by default. Previously it was optional.
WHOX enhances the "WHO" output, providing additional information to
IRC clients such as the services account that someone is using.
It is also more universal than standard WHO. Unfortunately this also
means the WHO syntax changed to something less logical.
* At many places the term *SSL* has been changed to *SSL/TLS* or *TLS*.
Configuration items (eg: set::ssl to set::tls) have been renamed
as well and so have directories (eg: conf/ssl to conf/tls).
The old configuration names still work and currently does NOT raise
any warning. Also, when upgrading an existing installation on *NIX,
the conf/tls directory will be symlinked to conf/ssl as to not break
any Let's Encrypt certificate scripts.
* It is now mandatory to have at least one open SSL/TLS port, otherwise
UnrealIRCd will refuse to boot. Previously this was a warning.
* IRCOps now need to use SSL/TLS in order to oper up, as the
[set::plaintext-policy::oper](https://www.unrealircd.org/docs/Set_block#set::plaintext-policy) default setting is now 'deny'.
Similarly, [set::outdated-tls-policy::oper](https://www.unrealircd.org/docs/Set_block#set::outdated-tls-policy) is now also 'deny'.
You can change this, if you want, but it is not recommended.
* [set::outdated-tls-policy::server](https://www.unrealircd.org/docs/Set_block#set::outdated-tls-policy) is now 'deny' as well, since all
servers should use reasonable SSL/TLS protocols and ciphers.
* The default generated certificated has been changed from RSA 4096 bits
to Elliptic Curve Cryptography "384r1". This provides the same amount
of security but at higher speed. This only affects the default self-
signed certificate. You can still use RSA certificates just fine.
* If you do use an RSA certificate, we now require it to be at least
2048 bits otherwise UnrealIRCd will refuse to boot.
* When matching [allow { } blocks](https://www.unrealircd.org/docs/Allow_block), we now always continue with the next
block (if any) if the password did not match or no password was
specified. In other words, allow::options::nopasscont is now the
default and we behave as if there was a ::wrongpasscont too.
* All snomasks are now oper-only. Previously some were not, which
was confusing and could lead to information leaks.
Also removed weird set::snomask-on-connect accordingly.
* The IRCd now uses hash tables that are resilient against hash table
attacks. Also, the hash tables have increased in size to speed things
up when looking up nick names etc.
* Server options in VERSION (eg: Fhin6OoEMR3) are no longer shown to
normal users. They don't mean much nowadays anyway.
* ```./Config``` now asks fewer questions and configure runs faster since
many unnecessary checks have been removed (compatibility with very
old compilers / systems).
* We now default to system libs (eg: ```--with-system-pcre2``` is assumed)
* Spamfilter should catch some more spam evasion techniques.
* All /DCCDENY and deny dcc { } parsing and checking is now moved to
the 'dccdeny' module.
* Windows: If you choose to run UnrealIRCd as a service then it now
runs under the low-privilege NetworkService account rather than
the high-privilege LocalSystem account.
Minor issues fixed
-------------------
* Specifying a custom OpenSSL/LibreSSL path should work now
Removed
--------
* Support for old server protocols has been removed.
This means UnrealIRCd 5.x cannot link to 3.2.x. It also means you need
to use reasonably new services. Generally, if your services can link to
4.x then they should be able to link to 5.x as well. More information
about this change and why it was done
[can be found here](https://www.unrealircd.org/docs/FAQ#old-server-protocol).
* Connecting with a server password will no longer send that password
to NickServ. Use [SASL](https://www.unrealircd.org/docs/SASL) instead!
* Extended ban ~R (registered nick): this was the old method to match
registered users. Everyone should use ~a (services account) instead.
* The old TRE **posix** regex method has been removed because the TRE
library is no longer maintained for over a decade and contains many
bugs. (It was already deprecated in UnrealIRCd 4.2.3).
Use type **regex** instead, which uses the modern PCRE2 regex engine.
* Timesync support has been removed. Use your OS time synchronization
instead. (Note that Timesync was already disabled by default in 2018)
* Changing time offsets via ```TSCTL OFFSET``` and ```TSCTL SVSTIME``` are no longer
supported. Use your OS time synchronization (NTP!). Adjustments via
TSCTL are simply not accurate enough.
* The *nopost* module was removed since it no longer serves any useful
purpose. UnrealIRCd already protects against these kind of attacks
via ping cookies ([set::ping-cookie](https://www.unrealircd.org/docs/Set_block#set::ping-cookie), enabled by default).
Deprecated
-----------
* The set::official-channels block is now deprecated. This provided a
mechanism to pre-configure channels that would have 0 members and
would appear in /LIST with those settings, but once you joined all
those settings would be gone. Rather confusing.
Since UnrealIRCd 4.x we have permanent channels (+P) and since 5.x
we store these permanent channels in a database so all settings are
saved every few minutes and across restarts.
Since permanent channels (+P) are much better, the official-channels
support will be removed in a later version. There's no reason to
use official-channels anymore.
Developers
-----------
* The module header is now as follows:
ModuleHeader MOD_HEADER
= {
"nameofmodule",
"5.0",
"Some description",
"Name of Author",
"unrealircd-5",
};
There's a new author field, the version must start with a digit,
and also the name of the module must match the loadmodule name.
So for example third/funmod must also be named third/funmod.
* The ```MOD_TEST```, ```MOD_INIT```, ```MOD_LOAD``` and ```MOD_UNLOAD``` functions no longer
take a name argument. So: ```MOD_INIT(mymod)``` is now ```MOD_INIT()```
* We now use our own BuildBot infrastructure, so Travis-CI and AppVeyor
have been removed.
* We now use a new test framework.
* ```Auth_Check()``` now returns ```1``` for allow and ```0``` on deny (!!)
* New function ```new_message()``` which should be called when a new message
is sent, or at least for all channel events. It adds (or inherits)
message tags like 'account', 'msgid', 'time', etc.
* Many send functions now take an extra MessageTag *mtags parameter,
including but not limited to: sendto_one() and sendto_server().
* Command functions (CMD_FUNC) have an extra ```MessageTag *mtags```,
on the other hand the ```cptr``` parameter has been removed.
* Command functions no longer return ```int``` but are ```void```,
the same is true for ```exit_client()```. ```FLUSH_BUFFER``` has been removed too.
All this is a consequence of removing this (limited) signaling
of client exits. From now on, if you call ```exit_client()``` it will free
a lot of the client data and exit the user (close socket, send [s]quit),
but it will **not free 'sptr' itself**, so you can simply check if some
upstream function killed the client by checking ```IsDead(sptr)```.
This is highly recommended after running ```do_cmd()``` or calling other
functions that could kill a client. In which case you should return
rather than continue doing anything with ```sptr```.
Ultimately, in the main loop, the client will be freed (normally in less than 1 second).
* New single unified ```sendto_channel()``` and ```sendto_local_common_channels()```
functions that are used by all the channel commands.
* Numerics should now be sent using ```sendnumeric()```. There's also
a format string version ```sendnumericfmt()``` in case you need it,
in which case you need to pass the numeric format string yourself.
In such a case, don't forget the colon character, like ":%s", where needed.
* The parameters in several hooks have changed. Many now have an
extra ```MessageTag *mtags``` parameter. Sometimes there are other changes
as well, for example ```HOOKTYPE_CHANMSG``` now has 4 extra parameters.
* You can call do_cmd() with NULL mtags. Usually this is the correct way.
* If you used ```HOOKTYPE_PRE_USERMSG``` to block a message then you
should now use ```HOOKTYPE_CAN_SEND_TO_USER```. Similarly, the hook
```HOOKTYPE_CAN_SEND``` which deals with channels is now called
```HOOKTYPE_CAN_SEND_TO_CHANNEL```. Some other remarks:
* You CANNOT use HOOKTYPE_PRE_USERMSG anymore.
* The hooks require you to set an error message if you return HOOK_DENY.
* You should not send an error message yourself from these hooks.
In other words: do not use sendnumeric(). This is done by the
hook caller, based on the error message you return.
* Thanks to this, all rejecting of user messages now use generic
numeric 531 and all rejecting of channel messages use numeric 404.
See also under *Client protocol* later in this document.
* If you use CommandOverrideAddEx() to specify a priority value (rare)
then be aware that in 5.0.1 we now use the 4.0.x behavior again to
match the same style of priorities in hooks: overrides with the
lowest priority are run first.
* If you ever send a timestamp in a printf-like function, such as
in ```sendto_server()```, then be sure to use ```%lld``` and cast the timestamp
to *long long* so that it is compatible with both *NIX and Windows.
Example: ```sendnotice(sptr, "Timestamp is %lld", (long long)ts);```
* ```EventAdd()``` changed the order of parameters and expects every_msec now
which specifies the time in milliseconds rather than seconds. This
allows for additional precision, or at least multiple calls per second.
The minimum allowed every_msec value is 100 at this time.
The prototype is now: ```EventAdd(Module *module, char *name,
vFP event, void *data, long every_msec, int count);```
* New ```HOOKTYPE_IS_HANDSHAKE_FINISHED```. If a module returns ```0``` there, then
the ```register_user()``` function will not be called and the user will
not come online (yet). This is used by CAP and some other stuff.
Can be useful if your module needs to "hold" a user in the registration
phase.
* The function ```is_module_loaded()``` now takes a relative path like
"usermodes/noctcp" because with just "ctcp" one could not see the
difference between usermodes/noctcp and chanmodes/noctcp.
* ```CHFL_CHANPROT``` is now ```CHFL_CHANADMIN```, ```is_chanprot()``` is now ```is_chanadmin()```
* All hash tables now use [SipHash](https://en.wikipedia.org/wiki/SipHash), which is a hash function that is
resilient against hash table attacks. If you, as a module dev, too
use any hash tables anywhere (note: this is quite rare), then you
are recommended to use our functions, see the functions siphash()
and siphash_nocase() in src/hash.c.
* The random generator has been updated to use [ChaCha](https://en.wikipedia.org/wiki/Salsa20#ChaCha20_adoption) (more modern).
* You can now save pointers and integers etc. across rehashes by using
```LoadPersistentPointer()``` and ```SavePersistentPointer()```. For an example,
see ```src/modules/chanmodes/floodprot.c``` how this can be used.
Note that there can be no struct or type changes between rehashes.
* New ModData types: ```MODDATA_LOCALVAR``` and ```MODDA_GLOBALVAR```. These are
settings or things that are locally or globally identified by the
variable name only and not attached to any user/channel.
* Various files have been renamed. As previously mentioned, the m_
prefix was dropped in ```src/modules/m_*.c```. Similarly the s_ prefix
was dropped in ```src/s_*.c``` since it no longer had meaning. Also some
files have been deleted and integrated elsewhere or renamed to
have a name that better reflects their true meaning.
Related to this change is that all command functions are now called
```cmd_name``` rather than ```m_name```.
* ```HOOKTYPE_CHECK_INIT``` and ```HOOKTYPE_PRE_LOCAL_CONNECT```
have their return value changed. You should now return ```HOOK_*```, such
as ```HOOK_DENY``` or ```HOOK_CONTINUE```.
Server protocol
----------------
* UnrealIRCd 5 now assumes you support the following PROTOCTL options:
```NOQUIT EAUTH SID NICKv2 SJOIN SJ3 NICKIP TKLEXT2```.
If you fail to use ```SID``` or ```EAUTH``` then you will receive an
error. For the other options, support is *assumed*, no warning or
error is shown when you lack support. These are options that most,
if not all, services support since UnrealIRCd 4.x so it shouldn't be
a problem. More information [here](https://www.unrealircd.org/docs/FAQ#old-server-protocol)
* ```PROTOCTL MTAGS``` indicates that the server is capable of handling
message tags and that the server can cope with 4K lines. (Note that
the ordinary non-message-tag part is still limited to 512 bytes).
* Pseudo ID support in SASL was removed. We now use real UID's.
This breaks services who rely on the old pseudo ID format.
Client protocol
----------------
* Support for message tags and other IRCv3 features. See the IRCv3
specifications for more details.
* When a message is blocked, for whatever reason, we now use a generic
numeric response: ```:server 531 yourname targetname :reason``` for the block
This replaces all the various NOTICEs, ```ERR_NOCTCP```, ```ERR_NONONREG```, etc.
with just one single numeric.
The only other numerics that you may still encounter when PM'ing are
```ERR_NOSUCHNICK```, ```ERR_TOOMANYTARGETS``` and ```ERR_TARGETTOOFAST```, which are
generic errors to any command involving targets. And ```ERR_SERVICESDOWN```.
Note that channel messages already had a generic numeric for signaling
blocked messages for a very long time, ```ERR_CANNOTSENDTOCHAN```.
* The 271 response to the SILENCE command is now:
```:server 271 yournick listentry!*@*```
Previously the nick name appeared twice, which was a mistake.
* The 470 numeric, which is sent on /JOIN #channel redirect to #redirect
now uses the following format:
```:server 470 yournick #channel #redirect :[Link] Cannot join channel...etc..```
* Clients are recommended to implement and enable the
[server-time](https://ircv3.net/specs/extensions/server-time-3.2)
extension by default. When enabled, channel history is played back
on-join (if any) when the channel has channel mode +H.
Otherwise your users will not see channel history.

123
doc/coding-guidelines Normal file
View File

@ -0,0 +1,123 @@
Rules about patches & modifications to UnrealIRCd
1. When making a change, always add a small description in the commit log.
Don't forget to mention the bug# and credit the reporter (if any).
2. If new files are made, they must contain proper copyright headers.
3. Each bug or feature should have a bug# so people can have a discussion
about it. This has a few implications (read!!):
* People must report bugs/feature requests to bugs.unrealircd.org and
not on IRC, e-mail, etc.
* That means other people can see the bug# and comment on it. This means
discussion is easy to read back for each issue and not spread between
several IRC logs.
Furthermore, by using the bugtracker instead of directly committing,
people could point out that there might be a better way to do things
than you originally thought, or it might be that other devs don't like
it at all.
* If a head coder has 'acknowledged' or 'confirmed' the issue or stated
in a comment that it's OK to implement, then any dev may take the issue.
The dev should change the status to 'assigned' and work on it, then
commit and change it to 'resolved', set 'fixed in version' to the
correct release, and add a comment pasting the relevant commit log.
Of course other guidelines, in particular rule #7, still applies.
4. If you don't have direct write access to the repository then you can
submit changes as as PR on github. It is very much preferred to also
have a bugs.unrealircd.org entry for it as well (see previous item).
5. For the stable branch, in general, only commit changes that have an
associated bugid# and/or were discussed.
For branches currently in development (alpha/beta) there's more freedom
and if you think the change will be small and is fine without a
discussion then feel free to commit.
6. Regarding reidenting, restructuring or other major code cleanups: please
discuss before doing so. The other devs might not agree with you on the
particular cleanup you have in mind which would result in another
clean-up-the-cleanup commit.
You may, however reindent and clean up individual sections when you are
working on fixing a particular bug# or implementing a new feature. In fact
you're encouraged to do so if the code is confusing without it. However,
obey the style of Unreal's code (mostly outlined in this document)
and do not introduce yet another (new) style. Also, be careful with doing
any cleanup: if you're unsure in any way about the use of something,
or something that looks redundant on first sight, then look more
carefully... it might indeed be useless and/or redundant, but it might
also be a subtle thing that can create great bugs when 'cleaned up'.
7. During the Release Candidate stage (from RC1 until the final release)
only the head coder may commit directly, all others should ask and
present their patch before committing. Yes, even if you are changing
only 1 line of code or text.
9. UnrealIRCd should compile on all supported operating systems and
platforms, using GCC 3 or higher on *NIX, and Visual Studio 2008 or
higher on Windows. This means you cannot blindly use all C99 extensions.
10. Coders must test their code before committing.
11. /*
* These kind of comments
*/
NOT
// These kind of comments
12. if (something == 1)
{
moo; /* comment */
/* This does what what what */
cow(go(moo));
}
NOT
if (something == 1) {
}
13. Do not touch version.c.SH or version.h, unless you are a head coder.
If you need a credit in, contact us
14. Protocol changes must be discussed before making patches for it.
15. We do NOT rip people off. If we use other people's code, it MUST be
properly credited.
16. We use tabsize 8 and we use tabs AND NOT SPACES.
Some code is old and horrible and has a mix of tabs and spaces used for
spacing, that's something we do not want to have ;)
17. Be careful about overflows. Do not do any unchecked string copies.
Instead of strcpy, strcat and sprintf/ircsprintf, use the following
functions: strlcpy, strlcat, snprintf/ircnsprintf.
If you are copying/writing character-by-character or word-by-word in a
loop, eg using *p++ = x; then be very sure about your size counting.
Often it's better to avoid such code altogether, by simply using
strlcat for everything.
18. Speed. When optimizing or writing code, keep in mind that readability and
stability comes FIRST, and after that comes speed. So we'd rather prefer some
readable code (even if difficult) over some odd highly optimized routine which
nobody understands, is difficult to extend, and might have several bugs.
As mentioned earlier: use ircsnprintf, not snprintf (this is because
ircsnprintf is optimized for simple strings like the ones we use).
ircsnprintf calls snprintf when it finds a (non-simple) format specifier it
can't handle. Simple format specifiers do not have prefixes other than
h and l.
19. Initialize your structs and use the proper memory calls.
In UnrealIRCd we use safe_alloc, safe_free, safe_strdup and safe_strldup.
Do NOT use malloc, calloc or strdup.
20. Comment your code! This should speak for itself...
Put comments wherever you think they are needed, to aid any further coders
with reading your code.. and, in fact, it will aid yourself as well if you
would look back at your code 2 years later.
If there's some obscure pitfall, DO mention it! Don't just "hope" a next
author will see it like you did.
21. Use enums whenever possible, rather than #define constants. Besides making
things more clean, it also aids debugging.

2
doc/compiling_win32.txt Normal file
View File

@ -0,0 +1,2 @@
For information on how to compile UnrealIRCd (modules) on Windows, see:
https://www.unrealircd.org/docs/Compiling_UnrealIRCd_on_Windows

99
doc/conf/badwords.conf Normal file
View File

@ -0,0 +1,99 @@
badword channel { word "bitch"; replace "wombat"; }
badword channel { word "bro"; replace "bo"; }
badword channel { word "(brother)"; replace "bredda"; }
badword channel { word "car"; replace "taxi"; }
badword channel { word "discord"; replace "dicsord"; }
badword channel { word "efnet"; replace "efrael"; }
badword channel { word "hate"; replace "04 hate "; }
badword channel { word "hello"; replace "smello"; }
badword channel { word "house"; replace "flat"; }
badword channel { word "gaming"; replace "gaymen"; }
badword channel { word "im"; replace "m"; }
badword channel { word "i'm"; replace "m"; }
badword channel { word "i am"; replace "m"; }
badword channel { word "my"; replace "me"; }
badword channel { word "(nigger)"; replace "angel"; }
badword channel { word "np"; replace "mp"; }
badword channel { word "on"; replace "pon"; }
badword channel { word "same"; replace "salami"; }
badword channel { word "(skyp)"; replace "skik"; }
badword channel { word "(ss)"; replace "ϟϟ"; }
badword channel { word "(troll)"; replace "papillion"; }
badword channel { word "uber"; replace "HELLS ANGELS"; }
badword channel { word "(year)"; replace "yonk"; }
badword channel { word "sup"; replace "wah gwaan"; }
badword channel { word "wussup"; replace "wah gwaan"; }
badword channel { word "wats up"; replace "wah gwaan"; }
badword channel { word "watsup"; replace "wah gwaan"; }
badword channel { word "whatsup"; replace "wah gwaan"; }
badword channel { word "whats up"; replace "wah gwaan"; }
badword channel { word "what's up"; replace "wah gwaan"; }
badword channel { word "wuddup"; replace "wah gwaan"; }
badword channel { word "gal"; replace "bint"; }
badword channel { word "(girl)"; replace "bint"; }
badword channel { word "lady"; replace "bint"; }
badword channel { word "ladies"; replace "bints"; }
badword channel { word "(woman)"; replace "bint"; }
badword channel { word "women"; replace "bints"; }
badword channel { word "ganja"; replace "bobby brown"; }
badword channel { word "marijuana"; replace "bobby brown"; }
badword channel { word "pot"; replace "bobby brown"; }
badword channel { word "weed"; replace "bobby brown"; }
badword channel { word "kek"; replace "%%"; }
badword channel { word "lmao"; replace "%%"; }
badword channel { word "lmfao"; replace "%%"; }
badword channel { word "(lol)"; replace "%%"; }
badword channel { word "lorf"; replace "%%"; }
badword channel { word "rofl"; replace "%%"; }
badword channel { word "rr"; replace "%%"; }
#badword channel { word "came"; replace "came (nohomo)"; }
#badword channel { word "come"; replace "come (nohomo)"; }
#badword channel { word "comes"; replace "comes (nohomo)"; }
#badword channel { word "coming"; replace "coming (nohomo)"; }
#badword channel { word "hard"; replace "hard (nohomo)"; }
#badword channel { word "nut"; replace "nut (nohomo)"; }
#badword channel { word "nuts"; replace "nuts (nohomo)"; }
#badword channel { word "up"; replace "up (nohomo)"; }
#badword channel { word "vertical"; replace "vertical (nohmo)"; }
#badword channel { word "(a)"; replace ""; }
#badword channel { word "(b)"; replace ""; }
#badword channel { word "(c)"; replace ""; }
#badword channel { word "(d)"; replace ""; }
#badword channel { word "(e)"; replace ""; }
#badword channel { word "(f)"; replace ""; }
#badword channel { word "(g)"; replace ""; }
#badword channel { word "(h)"; replace ""; }
#badword channel { word "(i)"; replace ""; }
#badword channel { word "(j)"; replace ""; }
#badword channel { word "(k)"; replace ""; }
#badword channel { word "(l)"; replace ""; }
#badword channel { word "(m)"; replace ""; }
#badword channel { word "(n)"; replace ""; }
#badword channel { word "(o)"; replace ""; }
#badword channel { word "(p)"; replace ""; }
#badword channel { word "(q)"; replace ""; }
#badword channel { word "(r)"; replace ""; }
#badword channel { word "(s)"; replace ""; }
#badword channel { word "(t)"; replace ""; }
#badword channel { word "(u)"; replace ""; }
#badword channel { word "(v)"; replace ""; }
#badword channel { word "(w)"; replace ""; }
#badword channel { word "(x)"; replace ""; }
#badword channel { word "(y)"; replace ""; }
#badword channel { word "(z)"; replace ""; }
#badword channel { word "(0)"; replace ""; }
#badword channel { word "(1)"; replace ""; }
#badword channel { word "(2)"; replace ""; }
#badword channel { word "(3)"; replace ""; }
#badword channel { word "(4)"; replace ""; }
#badword channel { word "(5)"; replace ""; }
#badword channel { word "(6)"; replace ""; }
#badword channel { word "(7)"; replace ""; }
#badword channel { word "(8)"; replace ""; }
#badword channel { word "(9)"; replace ""; }

35
doc/conf/except.conf Normal file
View File

@ -0,0 +1,35 @@
# Localhost
except ban { mask *@127.0.0.1; }
# IRCCloud
except ban { mask *@192.184.9.108; } # highgate.irccloud.com
except ban { mask *@192.184.9.110; } # ealing.irccloud.com
except ban { mask *@192.184.9.112; } # charlton.irccloud.com
except ban { mask *@192.184.10.118; } # brockwell.irccloud.com
except ban { mask *@192.184.10.9; } # tooting.irccloud.com
except ban { mask *@192.184.8.73; } # hathersage.irccloud.com
except ban { mask *@192.184.8.103; } # stonehaven.irccloud.com
except ban { mask *@2001:67c:2f08::/48; } # IPv6
# IRC Source
except ban { mask *@49.56.142.157; } # yin.ircs.me
except ban { mask *@149.56.142.163; } # yang.ircs.me
except ban { mask *@2607:5300:201:3100::13dd; } # yin.ircs.me
except ban { mask *@2607:5300:201:3100::299d; } # yang.ircs.me
# KiwiIRC
except ban { mask *@107.161.19.53; }
except ban { mask *@107.161.19.109; }
except ban { mask *@109.169.31.4; }
except ban { mask *@109.169.31.13; } # KiwiIRC Verify Bot (out.kiwiirc.com)
# Mibbit
except ban { mask *@207.192.75.252; } # ircip1.mibbit.com
except ban { mask *@64.62.228.82; } # ircip2.mibbit.com
except ban { mask *@78.129.202.38; } # ircip3.mibbit.com
except ban { mask *@109.169.29.95; } # ircip4.mibbit.com
except ban { mask *@97.107.138.109; } # bot.search.mibbit.com
except ban { mask *@2600:3c03::f03c:91ff:fe96:c1fa; } # bot.search.mibbit.com
# Netsplit
except ban { mask *@85.25.137.63; } # eagle.netsplit.de

47
doc/conf/ircd.motd Normal file
View File

@ -0,0 +1,47 @@
0,0 0╗ 0,0 0╗ 0,0 0╗ 0,0 0╗ 0,0 0╗ 0,0 0╗
0,0 0╔══0,0 0╗ 0,0 0║ 0,0 0║ 0,0 0╔══0,0 0╗ 0,0 0╔════╝ 0,0 0╔══0,0 0╗
0,0 0║ ╚═╝ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║
0╚0,0 0╗ 0,0 0║ 0,0 0║ 0,0 0╔╝ 0,0 0╗ 0,0 0╔╝
0╚═══0,0 0╗ 0,0 0║ 0,0 0║ 0,0 0╔═══╝ 0,0 0╔════╝ 0,0 0╔══0,0 0╗
0,0 0╗ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║
0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║
0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║
0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║
0╚0,0 0╔╝ ╚0,0 0╔╝ 0,0 0║ 0,0 0╗ 0,0 0║ 0,0 0║
0 ╚════╝ ╚════╝ ╚═╝ ╚══════╝ ╚═╝ ╚═╝
0,12 
0,12 0,4 0,12 
0,12 0,4 0,8 0,4 0,8 0,4 0,8 0,4 0,12 
0,12 0,4 0,8 0,4 0,8 0,4 0,8 0,4 0,12 
0,12 0,4 0,8 0,4 0,8 0,4 0,12 
0,12 0,4 0,8 0,4 0,8 0,4 0,12 
0,12 0,4 0,12 
0,12 0,4 0,8 0,4 0,12 
0,12 0,4 0,8 0,4 0,8 0,4 0,12 
0,12 0,4 0,12 
0,12 0,4 0,8 0,4 0,12 
0,12 0,4 0,8 0,4 0,12 
0,12 0,4 0,12 
0,12 0,4 0,12 
0,12 
0,12 
0,0 0╗ 0,0 0╗ 0,0 0╗ 0,0 0╗ 0,0 0╗
0,0 0╔═0,0 0╗ 0,0 0║ 0,0 0╔════╝ 0,0 0╔═╝ 0,0 0╔══0,0 0╗
0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ ╚═╝
0,0 0║ 0,0 0║ 0,0 0║ 0,0 0╗ 0,0 0║ ╚0,0 0╗
0,0 0║ 0,0 0║ 0,0 0║ 0,0 0╔════╝ 0,0 0║ ╚═══0,0 0╗
0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0 0║ 0,0  0,0 0║
0,0 0║ ╚0,0 0║ 0,0 0╗ 0,0 0║ ╚0,0 0╔╝
0╚═╝ ╚════╝ ╚══════╝ ╚═╝ ╚════╝
4──────────────────┤ 0RULES 4├───────────────────
14• 7Do not disrupt or compromise our security.
14• 7No malicious abuse of network services.
14• 7No distribution of child pornography.
4──────────────────────────────────────────────

11
doc/conf/links.conf Normal file
View File

@ -0,0 +1,11 @@
link bulbasaur.supernets.org {
incoming { mask REDACTED; }
outgoing {
bind-ip *;
hostname REDACTED;
port REDACTED;
options { tls; }
}
password "REDACTED" { spkifp; }
class servers;
}

190
doc/conf/modules.conf Normal file
View File

@ -0,0 +1,190 @@
// User Commands (Minimal)
#loadmodule "admin";
loadmodule "away";
loadmodule "invite";
loadmodule "ison";
loadmodule "join";
loadmodule "kick";
loadmodule "links";
loadmodule "list";
loadmodule "lusers";
loadmodule "map";
loadmodule "message";
loadmodule "mode";
loadmodule "motd";
loadmodule "names";
loadmodule "nick";
loadmodule "part";
loadmodule "pass";
loadmodule "pingpong";
loadmodule "protoctl";
loadmodule "quit";
#loadmodule "rules";
loadmodule "topic";
loadmodule "user";
loadmodule "userhost";
loadmodule "watch";
loadmodule "whox";
loadmodule "whois";
#loadmodule "whowas";
// User Commands (Extended)
#loadmodule "botmotd";
loadmodule "cap";
loadmodule "cycle";
#loadmodule "dccallow";
#loadmodule "help";
loadmodule "history";
loadmodule "knock";
loadmodule "lag";
loadmodule "sasl";
loadmodule "setname";
loadmodule "silence";
loadmodule "starttls";
loadmodule "time";
loadmodule "userip";
loadmodule "vhost";
// Operator Commands
#loadmodule "addmotd";
#loadmodule "addomotd";
loadmodule "chghost";
loadmodule "chgident";
loadmodule "chgname";
loadmodule "close";
loadmodule "connect";
#loadmodule "dccdeny";
#loadmodule "globops";
#loadmodule "jumpserver";
loadmodule "kill";
#loadmodule "locops";
loadmodule "mkpasswd";
loadmodule "oper";
#loadmodule "opermotd";
loadmodule "sajoin";
loadmodule "samode";
loadmodule "sapart";
#loadmodule "sdesc";
loadmodule "sethost";
loadmodule "setident";
loadmodule "squit";
loadmodule "stats";
loadmodule "tkl";
loadmodule "trace";
loadmodule "tsctl";
loadmodule "unsqline";
#loadmodule "wallops";
// Server-2-Server Commands
loadmodule "eos";
loadmodule "md";
loadmodule "netinfo";
#loadmodule "require-module";
loadmodule "server";
loadmodule "sinfo";
loadmodule "sjoin";
loadmodule "sqline";
loadmodule "swhois";
loadmodule "umode2";
// Services Commands
loadmodule "sendsno";
loadmodule "sendumode";
loadmodule "svsjoin";
loadmodule "svskill";
loadmodule "svslusers";
loadmodule "svsmode";
loadmodule "svsmotd";
loadmodule "svsnick";
loadmodule "svsnline";
loadmodule "svsnolag";
loadmodule "svsnoop";
loadmodule "svspart";
loadmodule "svssilence";
loadmodule "svssno";
loadmodule "svswatch";
// Channel Modes
loadmodule "chanmodes/censor"; /* +G */
loadmodule "chanmodes/delayjoin"; /* +D */
loadmodule "chanmodes/floodprot"; /* +f */
loadmodule "chanmodes/history"; /* +H */
loadmodule "chanmodes/issecure"; /* +Z */
loadmodule "chanmodes/link"; /* +L */
loadmodule "chanmodes/nocolor"; /* +c */
loadmodule "chanmodes/noctcp"; /* +C */
loadmodule "chanmodes/noinvite"; /* +V */
loadmodule "chanmodes/nokick"; /* +Q */
loadmodule "chanmodes/noknock"; /* +K */
loadmodule "chanmodes/nonickchange"; /* +N */
loadmodule "chanmodes/nonotice"; /* +T */
loadmodule "chanmodes/operonly"; /* +O */
loadmodule "chanmodes/permanent"; /* +P */
loadmodule "chanmodes/regonly"; /* +R */
loadmodule "chanmodes/regonlyspeak"; /* +M */
loadmodule "chanmodes/secureonly"; /* +z */
loadmodule "chanmodes/stripcolor"; /* +S */
// User Modes
loadmodule "usermodes/bot"; /* +B */
#loadmodule "usermodes/censor"; /* +G */
loadmodule "usermodes/noctcp"; /* +T */
loadmodule "usermodes/nokick"; /* +q */
loadmodule "usermodes/privacy"; /* +p */
loadmodule "usermodes/privdeaf"; /* +D */
loadmodule "usermodes/regonlymsg"; /* +R */
loadmodule "usermodes/secureonlymsg"; /* +Z */
loadmodule "usermodes/servicebot"; /* +S */
#loadmodule "usermodes/showwhois"; /* +W */
// Snomasks
#loadmodule "snomasks/dccreject"; /* +D */
// Extended Bans
loadmodule "extbans/account"; /* +b ~a */
loadmodule "extbans/certfp"; /* +b ~S */
#loadmodule "extbans/inchannel"; /* +b ~c */
#loadmodule "extbans/join"; /* +b ~j */
loadmodule "extbans/msgbypass"; /* +e ~m */
#loadmodule "extbans/nickchange"; /* +b ~n */
#loadmodule "extbans/operclass"; /* +b ~O */
#loadmodule "extbans/partmsg"; /* +b ~p */
loadmodule "extbans/quiet"; /* +b ~q */
loadmodule "extbans/realname"; /* +b ~r */
loadmodule "extbans/textban"; /* +b ~T */
loadmodule "extbans/timedban"; /* +b ~t */
// IRCv3 Extensions
loadmodule "account-tag";
loadmodule "batch";
loadmodule "echo-message";
loadmodule "labeled-response";
loadmodule "link-security";
loadmodule "message-ids";
loadmodule "message-tags";
loadmodule "plaintext-policy";
loadmodule "server-time";
loadmodule "sts";
// Other
loadmodule "antimixedutf8";
#loadmodule "authprompt";
loadmodule "blacklist";
loadmodule "certfp";
loadmodule "channeldb";
loadmodule "charsys";
loadmodule "connthrottle";
loadmodule "hideserver";
loadmodule "history_backend_mem";
#loadmodule "history_backend_null";
loadmodule "ident_lookup";
loadmodule "jointhrottle";
loadmodule "tkldb";
loadmodule "tls_antidos";
loadmodule "userhost-tag";
loadmodule "userip-tag";
loadmodule "reputation";
loadmodule "restrict-commands";
loadmodule "rmtkl";
loadmodule "webirc";

View File

@ -0,0 +1 @@
https://modules.unrealircd.org/modules.list

162
doc/conf/opers.conf Normal file
View File

@ -0,0 +1,162 @@
oper acidvegas {
mask localhost;
password "REDACTED" { sslclientcertfp; }
class clients;
operclass netadmin;
require-modes z;
maxlogins 1;
vhost super.nets;
swhois "1,1 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,7 1,5 1,1 0 1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 14 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 0THE BIGGEST 1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 0DICK ON IRC 1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,7 1,5 1,1 ";
swhois "1,1 1,5 1,1 ";
}
#oper mate {
# class clients;
# mask localhost;
# password "REDACTED" { sslclientcertfp; }
# operclass linker;
# require-modes z;
# maxlogins 1;
# vhost super.nets.link;
#}
oper 5000 {
class clients;
mask localhost;
password "REDACTED";
operclass fuckyou;
require-modes z;
maxlogins 1;
vhost 5000;
}
oper cancer {
class clients;
mask localhost;
password "REDACTED";
operclass linker;
require-modes z;
maxlogins 1;
vhost NCER;
}
operclass netadmin {
permissions {
chat { notice { global; } }
client { set; }
immune { join-flood; max-conncurrent-conversionations; maxchannelsperuser; nick-flood; server-ban { spamfilter; } }
kill;
channel { operonly; override; see; }
route;
sacmd;
self { set; }
server { rehash; }
server-ban { gline; spamfilter; zline; }
}
}
operclass linker {
permissions {
immune { join-flood; nick-flood; server-ban { spamfilter; } }
channel { operonly { join; topic; } }
channel {
override {
invite { self; }
message { ban; moderated; }
mode { extban; }
}
}
channel {
see {
list { secret; }
names { invisible; secret; }
whois;
}
}
}
}
operclass cancer {
permissions {
immune { join-flood; max-concurrent-conversations; server-ban { spamfilter; } }
kill { global; }
channel {
override {
flood;
message { ban; moderated; }
mode { extban; }
}
}
}
}
operclass fuckyou {
permissions {
immune { join-flood; server-ban { spamfilter; } }
channel {
override {
flood;
message { ban; moderated; }
mode { extban; }
}
}
sacmd { sajoin; }
}
}

0
doc/conf/remote.motd Normal file
View File

7
doc/conf/spamfilter.conf Normal file
View File

@ -0,0 +1,7 @@
#spamfilter {
# match-type simple;
# match "*spam*message*here*";
# target { private; private-notice; channel; channel-notice; }
# action kill;
# reason "8,4 E N T E R T H E V O I D ";
#}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
include "links.conf";
include "modules.conf";
admin { "" }
me { name "irc.supernets.org"; info "SuperNETs IRC Network"; sid 001; }
class opers { pingfreq 120; maxclients 2; sendq 1M; options { nofakelag; } }
class servers { pingfreq 120; maxclients 10; sendq 1M; connfreq 30; }
allow { ip 127.0.0.1; class opers; maxperip 2; }
listen { ip 127.0.0.1; port REDACTED; options { clientsonly; tls; } } # Admin
listen { ip *; port REDACTED; options { serversonly; tls; } } # Links
listen { ip 127.0.0.1; port REDACTED; options { serversonly; } } # Anope
link services.supernets.org {
incoming { mask 127.0.0.1; port REDACTED; }
password "REDACTED";
class servers;
}
log "ircd.log" { flags { errors; } maxsize 1K; }
except ban { mask *@127.0.0.1; }
ulines { services.supernets.org; }
set {
gline-address "banned@supernets.org";
kline-address "banned@supernets.org";
modes-on-connect "+ipTx";
modes-on-oper "+HIq";
snomask-on-oper "+bcFfkGsSo"
modes-on-join "+ns";
level-on-join "op";
static-quit "EMO-QUIT";
static-part "EMO-PART";
nick-length 20;
network-name "SuperNETs";
default-server "irc.supernets.org";
services-server "services.supernets.org";
sasl-server "services.supernets.org";
help-channel "#help";
channel-command-prefix "`!@$.";
cloak-method ip;
cloak-keys {
"REDACTED";
"REDACTED";
"REDACTED";
}
hiddenhost-prefix "SUPER";
default-bantime 1d;
manual-ban-target ip;
}

View File

@ -0,0 +1,7 @@
include "https://USERNAME:PASSWORD@HOSTNAME:PORT/badwords.conf";
include "https://USERNAME:PASSWORD@HOSTNAME:PORT/except.conf";
include "https://USERNAME:PASSWORD@HOSTNAME:PORT/ircd.conf";
include "https://USERNAME:PASSWORD@HOSTNAME:PORT/modules.conf";
include "https://USERNAME:PASSWORD@HOSTNAME:PORT/opers.conf";
include "https://USERNAME:PASSWORD@HOSTNAME:PORT/spamfilter.conf";
me { name "example.supernets.org"; info "SuperNETS IRC Network"; sid XXX; }

View File

@ -0,0 +1,185 @@
admin { ""; }
alias botserv { type services; }
alias bs { target botserv; type services; }
alias chanserv { type services; }
alias cs { target chanserv; type services; }
alias hostserv { type services; }
alias hs { target hostserv; type services; }
alias nickserv { type services; }
alias ns { target nickserv; type services; }
alias operserv { type services; }
alias os { target operserv; type services; }
class clients { pingfreq 120; maxclients 100; sendq 1M; options { nofakelag; } }
class servers { pingfreq 120; maxclients 10; sendq 1M; connfreq 30; }
allow { ip *; class clients; maxperip 2; }
listen { ip *; port 6667; options { clientsonly; } }
listen { ip *; port 6697; options { clientsonly; tls; } }
listen { ip *; port REDACTED; options { serversonly; tls; } }
link irc.supernets.org {
incoming { mask REDACTED; }
outgoing {
bind-ip *;
hostname REDACTED;
port REDACTED;
options { tls; autoconnect; }
}
password "REDACTED" { spkifp; }
class servers;
}
log "errors.log" { flags { errors; } maxsize 10K; }
tld { mask *@*; motd remote.motd; rules remote.motd; options { remote; } }
ulines { services.supernets.org; }
blacklist dronebl {
dns {
name dnsbl.dronebl.org;
type record;
reply { 3; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; }
}
action gzline;
ban-time 1d;
reason "8,4 E N T E R T H E V O I D ";
}
blacklist efnetrbl {
dns {
name rbl.efnetrbl.org;
type record;
reply { 1; 4; 5; }
}
action gzline;
ban-time 1d;
reason "8,4 E N T E R T H E V O I D ";
}
blacklist torbl {
dns {
name torexit.dan.me.uk;
type record;
reply { 100; }
}
action gzline;
ban-time 1d;
reason "8,4 E N T E R T H E V O I D ";
}
webirc { mask 107.161.19.53; password "REDACTED"; } # KiwiIRC
webirc { mask 107.161.19.109; password "REDACTED"; }
webirc { mask 107.161.31.4; password "REDACTED"; }
webirc { mask 207.192.75.252; password "REDACTED"; } # Mibbit
webirc { mask 64.62.228.82; password "REDACTED"; }
webirc { mask 78.129.202.38; password "REDACTED"; }
webirc { mask 109.169.29.95 ; password "REDACTED"; }
set {
kline-address "banned@supernets.org";
gline-address "banned@supernets.org";
modes-on-connect "+ipTx";
modes-on-oper "+HIq";
snomask-on-oper "+bcFfkGsSo";
modes-on-join "+ns";
level-on-join "op";
restrict-channelmodes "Pps";
restrict-commands {
invite { connect-delay 300; exempt-identified yes; }
list { connect-delay 60; exempt-identified yes; }
private-message { connect-delay 300; exempt-identified yes; }
private-notice { connect-delay 300; exempt-identified yes; }
}
auto-join "#superbowl";
oper-auto-join "#help";
static-quit "EMO-QUIT";
static-part "EMO-PART";
who-limit 100;
nick-length 20;
maxchannelsperuser 10;
channel-command-prefix "`!@$.";
options { hide-ulines; flat-map; identd-check; }
network-name "SuperNETs";
default-server "irc.supernets.org";
services-server "services.supernets.org";
sasl-server "services.supernets.org";
help-channel "#help";
cloak-method ip;
cloak-keys {
"REDACTED";
"REDACTED";
"REDACTED";
}
hiddenhost-prefix "SUPER";
plaintext-policy {
user warn;
oper deny;
server deny;
user-message "4WARNING: You are not using a secure connection with SSL/TLS";
oper-message "Network operators must connect using SSL/TLS";
}
outdated-tls-policy {
user warn;
oper deny;
server deny;
user-message "4WARNING: You are using an outdated SSL/TLS protocol or cipher";
oper-message "Network operators must connect using an up-to-date SSL/TLS protocol or cipher";
}
anti-flood {
away-flood 3:300;
connect-flood 3:300;
invite-flood 3:300;
join-flood 3:300;
knock-flood 3:300;
max-concurrent-conversations { users 5; new-user-every 60s; }
nick-flood 3:300;
unknown-flood-amount 2048;
unknown-flood-bantime 1h;
}
default-bantime 1d;
spamfilter {
ban-time 1d;
ban-reason "8,4 E N T E R T H E V O I D ";
except "#anythinggoes";
}
max-targets-per-command { kick 1; part 1; privmsg 1; }
hide-ban-reason yes;
reject-message {
gline "8,4 E N T E R T H E V O I D ";
kline "8,4 E N T E R T H E V O I D ";
password-mismatch "8,4 E N T E R T H E V O I D ";
server-full "8,4 E N T E R T H E V O I D ";
too-many-connections "8,4 E N T E R T H E V O I D ";
unauthorized "8,4 E N T E R T H E V O I D ";
}
antimixedutf8 {
score 10;
ban-action block;
ban-reason "8,4 E N T E R T H E V O I D ";
ban-time 1h;
}
connthrottle {
known-users { minimum-reputation-score 24; sasl-bypass yes; }
new-users { local-throttle 20:60; global-throttle 30:60; }
disabled-when { reputation-gathering 1w; start-delay 3m; }
}
history {
channel {
playback-on-join { lines 100; time 1d; }
max-storage-per-channel { lines 100; time 1d; }
}
}
manual-ban-target ip;
}
hideserver {
disable-map yes;
disable-links yes;
map-deny-message "Denied";
links-deny-message "Denied";
}

271
doc/tao.of.irc Normal file
View File

@ -0,0 +1,271 @@
The Tao of Internet Relay Chat
Copyright (C) Ove Ruben R Olsen 1994
Version of 940110
Contributing masters: Master ScottM
-----
Something is formed by the electrons, born in the silent cable. Shaping
and growing and ungrowing. It is there yet not there. It is the source of
Internet Relay Chat. I do not know the name, thus I will call it the Tao
of Internet Relay Chat.
If the Tao is great, then the IRC is running ceaselessly. If the IRC is
great then the server is running without ever stoping. If the server is
great then the client will always be the server. The luser is then pleased
and there is Chat in the world.
The Tao of IRC squits far away and connects on returning.
-----
The genetic potential of birth, a lot to know, yet unknown.
In the begining there was nothing.
Out of nothing the Tao gave birth to tolsun.oulu.fi. tolsun gave birth to
OuluBox.
OuluBox gave birth to rmsg.
rmsg was not Tao, so MUT gave birth to IRC.
No one knows when IRC came into existance, the mighty master WiZ have it
to be at the end of the eight month in the year of the Dragon.
-----
Each channel has its purpose, however humble. Each channel is the Yin and
Yang of IRC. Each channels has it's place within the IRC.
In the beginning there was only channel 0, thus channel 0 is the soil of
IRC.
Channel 1 to channel 10 then was open as the sea. Channel 11 to 999 was the
trees and forests of IRC. Channels above 999 should not be mentioned, and
channels below 0 were unborn and contained many secrets.
This was not the right Tao, so IRC gave birth to +channels.
+channels had the yin and yang. Mode does not.
This was not the right Tao still, so IRC gave birth to #channels.
#channels have the yin and yang.
Only channel 0 is the right path to Tao, but avoid speaking on channel 0.
-----
There was a great dispute among the Broom-Walkers of the Relay. Some of them
wanted neither yin nor yang. Out of this Eris came into existance. Some of the
Broom-Walkers then created Eris Free-net.
This was the right Tao.
Kind Gentle and Boring Net was another wrong path to the Tao of Internet Relay
Chat.
Some time later there was a quantity of some lusers who wanted to be
Broom-Walkers also. The Eris Free Broom-Walkers did not agree with them,
thus a new IRC was born. This IRC is called the Undernet.
But this is not the right Tao, either.
-----
There will always be disputes among the Broom-Walkers of Internet Relay Chat.
This is the very nature of the IRC.
-----
Lusers that do not understand the Tao is always using the yang of Mode on
their channels. Lusers that do understand the Tao are always using Ignore
on their channels.
How could this not be so ?
-----
The wise sage luser is told about the Chat and uses it. The luser is told
about the IRC and is looking for it. The flock are told about the Tao and
make a fool of the IRC.
If there was no laughter, there would be no Tao.
-----
The master says:
"Without the Tao of Internet Relay Chat, life becomes meaningless."
The Relay of the old time was mysterious and sacred. We can neither imagine
its thoughts nor path; we are left but to describe.
-----
The sage luser must be aware like a frog crossing the highway.
-----
The great master Wumpus once dreamed that he was an automaton. When he awoke
he exclaimed:
"I don't know whether I am Wumpus dreaming that I am a client,
or a client dreaming that I am Wumpus!"
So was the first Automata born.
The master Nap then said:
"Any automata should not speak unless spoken to.
Any automata shall only whisper when spoken to."
Thus replied the master Gnarfer:
"The lusers shall keep in mind that a automata can be either good or
bad. Create good automata, and the IRC will hail you and you will
gain fame and fortune. Create bad automata and people will start to
hate you, and finaly you will be /KILLed to ethernal damnation"
Many lusers have fallen into the clutches of ethernal damnation. They where
not following the Tao.
-----
There once was a luser who went to #BotSex. Each day he saw the automatons.
The luser decided that he also would have such a automata.
He asked another luser for his automata. The other luser gave his automata
away.
The luser was not within the Tao, so he just started the automata. The automata
had only Yang inside so all the lusers files where deleted.
Some moons laither the same luser then had become a sage luser, and did create
his automata from the very grounds with materials found inside the IRC.
The luser was now within the Tao and his automata lived happily ever after.
-----
There once was a master who wrote automatons without the help of master Phone.
A novice luser, seeking to imitate him, began with the help of master Phone.
When the novice luser asked the master to evaluate his automata the master
replied: "What is a working automata for the master is not for the luser.
You must must BE the IRC before automating."
-----
Master BigCheese gave birth to master Troy; his duty clear. Master Troy gave
birth to master Phone, for the Tao of Irc must be eternal and must flow as the
ceaseless river of Time itself.
-----
Master Phone once said about the ircII client:
"public_msg is for a message from someone NOT on the channel
public_other is for a message on a channel that doesn't belong to
a window. public is for a message on a channel that belongs to a
window!"
Out of this raised the mighty chaos.
-----
The sage luser came to the master who wrote automata without the help of
master Phone. The sage luser asked the master who wrote automata: "Which is
easiest to make. A automata with the help of master Phone or an automata
made with the help of a language ?"
The master who wrote automata then replied:
"With the help of a language."
The sage luser was disapointed and exclaimed: "But, with master Phone you
do not need to know anything about the soil of IRC. Is not that the easiet
way ?"
"Not really" said the master who wrote automata, "when using master Phone
you are closed inside a box. For sure, it is a great box for the lusers,
but the master will need more power, thus a language is the only path to go.
With the language the master will never have to limit himself. When using
such a language the master will seek the best between the need and the
availibility."
"I see", said the sage luser.
This is the essence of Tao of IRC automatas.
-----
A client should be light and be used for communication. The spirit of a good
client is that it should be very convinient for the luser to use, but hard
for the luser who want to create automata.
There should never ever be too many functions or too few functions.
There should always be a ignore.
Without ignore the client is not within the Tao of Chating.
The client should always respond the luser with messages that will not
astnonish him too much. The server likewise. If the server does not, then it
is the clients job to explain what the server says.
A client which fails this, will be useless and cause confusion for the lusers.
The only way to correct this is to use another client or to write a new one.
-----
A luser asked the masters on #IrcHelp: "My client does not work".
The masters replied: "Upgrade your client".
The luser then wondered why the master knew. The master then told him about
the Protocol.
"Your client does not work beaucse it does not understand the server. Why
should it always work ? Only a fool would expect such. But, clients are made
by humans, and humans are not perfect. Only Tao is.
The IRC is solid. The IRC is floating, and will always be dynamic. Live with
that or /quit."
-----
The luser came to the masters of #IrcHelp, asking about the Tao of IRC within
the client.
The masters then said that the Tao of IRC always lies inside the client
regardless of how the client connects to the server.
"Is the Tao in irc ?" asked the luser.
"It so is" replied the masters of #IrcHelp.
"Is the Tao in the ircII, Kiwi, rxirc, vms, rockers and msa ?" asked the
luser.
"In all of them and in the TPC, irchat, zenirc, zircon X11-irc and even the
dos irc has the Tao" said the master quietly.
"Is the Tao in a telnet connection directly to the server ?"
The master then was quiet for a long time and said. "Please leave, such
questions are not within the Tao of IRC".
-----
The master says: "Without the Protocol of TCP the messages will not travel.
Without the client, the server is useless."
-----
There once was a luser who used the ircII client. "ircII can do anything I
ever need for using IRC" said the emacs client user, "I have /ON's, I have
assignments, I have aliasing. Why don't you use this instead of the huge
emacs client, which also has a messy screen?"
The emacs client user then replied by saying that "it is better to have a
scripting language that is the client instead of have a client that has
a scripting language." Upon hearing this, the ircII client luser fell silent.
-----
The master Wumpus said: "Time for you to leave. I did, now I'm happy."
The master Gnarfer replied: "Use, but never overuse IRC, then you will also
be happy within IRC"
-----
A luser came unto the masters of #EU-Opers and asked, "How can I be, yet not
be, a user@host within the IRC?"
The masters of #EU-Opers replied: "To be Tao is to be ones true self. To hide
ones self is not Tao, and is not IRC, you have much to learn before you shall
be at rest within the Flow of Irc. Please leave"

180
doc/technical/005.txt Normal file
View File

@ -0,0 +1,180 @@
Numeric 005 Documentation
(c) 2002-2005 codemastr (Dominick Meglio) [codemastr@unrealircd.com]
(c) 2005-2009 syzop (Bram Matthys) [syzop@vulnscan.org]
Numeric 005 allows the server to inform the client of any protocol specific features in the
IRCd. The numeric is sent at connection time immediately after numeric 004. Additionally
the numeric is sent when a /version request is made by a local user, for remote users
numeric 105 is used but contains the same information.
Due to the limit imposed by RFC1459 on both the buffer size (512) and the amount of
parameters that can be sent in a single command (15) a total of 13 parameters may be
specified in each 005. Because of this, a client must be able to accept multiple 005s
consecutively. The format for the 005 message is as follows:
":" <servername> "005" SPACE <nickname> SPACE <token[=value]> SPACE ... ":are supported
by this server"
Currently UnrealIRCd supports several tokens that are included in numeric 005. A list of
all tokens, their respective value and a brief description are listed below.
Unreal attempts to follow the proposed ISupport standard as much as possible. Unreal only
ignores the standard in one regard, the TARGMAX token. This token is believed to be
impractical and technically impossible to correctly implement due to existing limitations
in the standard. Therefore, this token is not currently supported.
Unreal does additionally provide a few tokens which are not specified in the standard, these
include: HCN, AWAYLEN, WATCH, SILENCE, EXTBAN, ELIST, CMDS, NAMESX, UHNAMES, and WATCHOPTS.
Unreal also maintains a few legacy tokens such as MAXCHANNELS and WALLCHOPS to ensure
compatibility until the ISupport standard is more widely accepted by clients.
Token Value Default Value Description
------------------------------------------------------------------------------------------------
MAP none none Informs the client that the /map
command is present. [Obsolete]
KNOCK none none Informs the client that the /knock
command is present. [Obsolete]
SAFELIST none none The LIST command is sent in
multiple iterations so that the
client's queue does not get filled
causing the user to be killed.
HCN none none The server supports the HCN
(Hybrid Connect Notice) protocol.
MAXCHANNELS number 10 The maximum number of channels a
user may join. [Deprecated]
MAXBANS number 60 The maximum number of bans that
may be placed for a channel.
[Obsolete]
NICKLEN number 30 Maximum length of a user's
nickname.
TOPICLEN number 307 Maximum length of a channel's
topic.
KICKLEN number 307 Maximum length of a kick reason.
MAXTARGETS number 20 Maximum targets for the PRIVMSG
command.
AWAYLEN number 307 Maximum length of an away message.
WALLCHOPS none none Indicates that you may use
NOTICE/PRIVMSG to send to +ohv by
using PRIVMSG/NOTICE [@|%|+]#channel.
[Deprecated]
WATCH number 128 Indicates the presence of the
WATCH command and specifies the
maximum number of watch entries.
SILENCE number 15 Indicates the maximum number of
entries on the silence list.
MODES number 13 Indicates the number of channel
modes with parameters that may be
sent at one time.
CHANTYPES chars # Indicates the prefixes available
for channels.
PREFIX (modes)prefixes (qaohv)~&@%+ Indicates the modes on a channel
that corespond to the given
nickname prefixes.
CHANMODES A,B,C,D be,kfL,lj, Specifies how each channel mode is
psmntirRcOAQKVHGCuzNSMT set/unset. The A section specifies
modes that add a nick/mask to a
list. The B section specifies
modes that require a parameter
to be both set and unset. The C
section specifies modes that
only require a parameter to be
set, and the D section
specifies modes that require no
parameters.
NETWORK string no default value Specifies the name of the
network that the server is
connected to.
CASEMAPPING string ascii Specifies what definition the
server uses when determining if
characters are upper/lowercase
of eachother.
EXTBAN prefix,types ~,cqnr Specifies what extbans are
supported by the server. The prefix
defines which character indicates
an extban and the types defines
which extbans the server supports.
ELIST flags MNUCT Specifies the set of extended LIST
options supported. The M flag
indicates mask based searching,
the N flag indicates negative
mask based searching. The U flag
means support for user count
searching. The C flag allows channel
creation time searching, and the T
flag allows topic set time
searching.
CMDS commands MAP,KNOCK,DCCALLOW,USERIP Specifies a series of commands that
can be useful for the client to know
exist as they may provide a more
efficient means for the client to
accomplish a specific task. This
token replaces the MAP and KNOCK
tokens.
STATUSMSG flags ~&@%+ Specifies the mode flags that may
prefix a channel name in a PRIVMSG
or NOTICE to limit who receives the
message to only those with a certain
level of access. This token will
replace the WALLCHOPS token.
EXCEPTS none none Indicates that channel ban exceptions
(+e) are supported by the server.
INVEX none none Indicates that channel invite
exceptions (+I) are supported by
the server.
MAXLIST mode:num,... b:60,e:60,I:60 Specifies the maximum number of
entries that may be added to a
particular mode list (type A modes).
This token replaces MAXBANS.
CHANLIMIT pfx:num,... #:10 Specifies the maximum number of
channels with the specified prefix
that a user may join at one time.
This token will replace MAXCHANNELS.
CHANNELLEN number 32 Provides the maximum length of a
channel name that a user can create.
NAMESX none none Indicates that extended /NAMES info
is available on this server. If the
client sends "PROTOCTL NAMESX" then
the server will, from then on, send
all channel rights in a NAMES reply
instead of only the highest right
(eg: @+Person instead of @Person).
UHNAMES none none Indicates that (other) extended
/NAMES info is available on the
server. If the client sends
"PROTOCTL UHNAMES" then the server
will, from then on, send user@host
information in a NAMES reply
(eg: @nick!ident@hostname).
WATCHOPTS flags A WATCH options supported. 'A' means
Away Notification is available.

11
doc/technical/base64.txt Normal file
View File

@ -0,0 +1,11 @@
base64 Documentation (c) 2002 codemastr (Dominick Meglio) [codemastr@unrealircd.com]
(As of Unreal3.2-beta11)
The base64 system used by Unreal is defined as follows:
0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T
U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x
y z { }
These numbers are translated to and from their decimal equivilents of 0-64 in order to
provide a shorter way of expressing a number.

View File

@ -0,0 +1,2 @@
All server protocol documentation has been moved to the wiki:
https://www.unrealircd.org/docs/Server_protocol

26
doc/translations.txt Normal file
View File

@ -0,0 +1,26 @@
==[ Translations ]===========================================================
In UnrealIRCd 5 we support the following translations:
* on-line documentation at https://www.unrealircd.org/docs/ (wiki!)
* help.conf
* example.conf
For translating the wiki documentation see this article:
https://www.unrealircd.org/docs/Translating_UnrealIRCd_wiki_pages
For the .conf files the following rules apply:
* You must translate the very latest (English) version of the document(s)
* The translation must be correct. Not just the spelling and grammar,
but also 'technically'. You should therefore have some real experience
with UnrealIRCd.
* Someone, usually the person who translated it, needs to be willing
to actively maintain the docs. This is very important! If docs are
out of date (out-of-synch) there will be confusion among users.
We will remove documents that have been out of date too long (months)
If you want to start translating a document, please send an email to
syzop@unrealircd.org and mention the language you are willing to translate
to.. You will then receive an email back saying you can go ahead (or not).
This is mainly to avoid multiple persons working on the same translation.
=============================================================================

52
extras/.indent.pro vendored Normal file
View File

@ -0,0 +1,52 @@
--leave-preprocessor-space
--dont-break-procedure-type
--no-space-after-function-call-names
--brace-indent0
--indent-level8
-ip8
--dont-line-up-parentheses
--continuation-indentation4
--case-indentation2
--no-space-after-casts
--blank-lines-after-procedures
--no-blank-lines-after-declarations
--braces-on-struct-decl-line
--paren-indentation0
--case-brace-indentation0
--line-length80
--declaration-indentation5
-T size_t
-T aClass
-T TS
-T aClient
-T aServer
-T anUser
-T aChannel
-T Mode
-T aConfItem
-T aMessage
-T aMessageTree
-T aGline
-T aListingArgs
-T snomask_t
-T n_short
-T n_long
-T n_time
-T u_char
-T u_short
-T u_long
-T u_int
-T dbuf
-T dbufbuf
-T aHashEntry
-T Link
-T Dlink
-T VOIDSIG
-T aHostent
-T ResRQ
-T aCache
-T CacheTable
-T cainfo
-T reinfo
-T RETSIGTYPE
-T OPT_TYPE

155
extras/VStudioAnalyze.ruleset Executable file
View File

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="UnrealIRCd rules - based off Microsoft Native Minimum Rules" Description="These rules focus on the most critical problems in your native code, including potential security holes and application crashes. It is recommended to include this rule set in any custom rule set you create for your native projects." ToolsVersion="10.0">
<Localization ResourceAssembly="Microsoft.VisualStudio.CodeAnalysis.RuleSets.Strings.dll" ResourceBaseName="Microsoft.VisualStudio.CodeAnalysis.RuleSets.Strings.Localized">
<Name Resource="NativeMinimumRules_Name" />
<Description Resource="NativeMinimumRules_Description" />
</Localization>
<Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native">
<!-- Many false positives <Rule Id="C6001" Action="Warning" /> -->
<!-- Many false positives <Rule Id="C6011" Action="Warning" /> -->
<Rule Id="C6029" Action="Warning" />
<Rule Id="C6053" Action="Warning" />
<Rule Id="C6059" Action="Warning" />
<Rule Id="C6063" Action="Warning" />
<Rule Id="C6064" Action="Warning" />
<Rule Id="C6066" Action="Warning" />
<Rule Id="C6067" Action="Warning" />
<Rule Id="C6101" Action="Warning" />
<Rule Id="C6200" Action="Warning" />
<Rule Id="C6201" Action="Warning" />
<Rule Id="C6270" Action="Warning" />
<Rule Id="C6271" Action="Warning" />
<Rule Id="C6272" Action="Warning" />
<Rule Id="C6273" Action="Warning" />
<Rule Id="C6274" Action="Warning" />
<Rule Id="C6276" Action="Warning" />
<Rule Id="C6277" Action="Warning" />
<Rule Id="C6284" Action="Warning" />
<Rule Id="C6290" Action="Warning" />
<Rule Id="C6291" Action="Warning" />
<Rule Id="C6302" Action="Warning" />
<Rule Id="C6303" Action="Warning" />
<Rule Id="C6305" Action="Warning" />
<Rule Id="C6306" Action="Warning" />
<Rule Id="C6328" Action="Warning" />
<!-- <Rule Id="C6385" Action="Warning" /> more false positives -->
<!-- <Rule Id="C6386" Action="Warning" /> the analysis this one does - or lack thereof - is particularly dumb pffff -->
<!-- <Rule Id="C6387" Action="Warning" /> more null/0 false positives -->
<Rule Id="C6500" Action="Warning" />
<Rule Id="C6501" Action="Warning" />
<Rule Id="C6503" Action="Warning" />
<Rule Id="C6504" Action="Warning" />
<Rule Id="C6505" Action="Warning" />
<Rule Id="C6506" Action="Warning" />
<Rule Id="C6508" Action="Warning" />
<Rule Id="C6509" Action="Warning" />
<Rule Id="C6510" Action="Warning" />
<Rule Id="C6511" Action="Warning" />
<Rule Id="C6513" Action="Warning" />
<Rule Id="C6514" Action="Warning" />
<Rule Id="C6515" Action="Warning" />
<Rule Id="C6516" Action="Warning" />
<Rule Id="C6517" Action="Warning" />
<Rule Id="C6518" Action="Warning" />
<Rule Id="C6522" Action="Warning" />
<Rule Id="C6525" Action="Warning" />
<Rule Id="C6527" Action="Warning" />
<Rule Id="C6530" Action="Warning" />
<Rule Id="C6540" Action="Warning" />
<Rule Id="C6551" Action="Warning" />
<Rule Id="C6552" Action="Warning" />
<Rule Id="C6701" Action="Warning" />
<Rule Id="C6702" Action="Warning" />
<Rule Id="C6703" Action="Warning" />
<Rule Id="C6704" Action="Warning" />
<Rule Id="C6705" Action="Warning" />
<Rule Id="C6706" Action="Warning" />
<!-- CppCoreCheck -->
<!-- Span/View over temporary -->
<Rule Id="C26449" Action="Warning" />
<!-- Arithmetic overflow -->
<Rule Id="C26450" Action="Warning" />
<Rule Id="C26451" Action="Warning" />
<Rule Id="C26452" Action="Warning" />
<Rule Id="C26453" Action="Warning" />
<Rule Id="C26454" Action="Warning" />
<!-- Unitialized Member -->
<Rule Id="C26495" Action="Warning" />
<Rule Id="C28021" Action="Warning" />
<!-- <Rule Id="C28182" Action="Warning" /> false positives for dereferencing null ptr -->
<Rule Id="C28202" Action="Warning" />
<Rule Id="C28203" Action="Warning" />
<Rule Id="C28205" Action="Warning" />
<Rule Id="C28206" Action="Warning" />
<Rule Id="C28207" Action="Warning" />
<Rule Id="C28210" Action="Warning" />
<Rule Id="C28211" Action="Warning" />
<Rule Id="C28212" Action="Warning" />
<Rule Id="C28213" Action="Warning" />
<Rule Id="C28214" Action="Warning" />
<Rule Id="C28215" Action="Warning" />
<Rule Id="C28216" Action="Warning" />
<Rule Id="C28217" Action="Warning" />
<Rule Id="C28218" Action="Warning" />
<Rule Id="C28219" Action="Warning" />
<Rule Id="C28220" Action="Warning" />
<Rule Id="C28221" Action="Warning" />
<Rule Id="C28222" Action="Warning" />
<Rule Id="C28223" Action="Warning" />
<Rule Id="C28224" Action="Warning" />
<Rule Id="C28225" Action="Warning" />
<Rule Id="C28226" Action="Warning" />
<Rule Id="C28227" Action="Warning" />
<Rule Id="C28228" Action="Warning" />
<Rule Id="C28229" Action="Warning" />
<Rule Id="C28230" Action="Warning" />
<Rule Id="C28231" Action="Warning" />
<Rule Id="C28232" Action="Warning" />
<Rule Id="C28233" Action="Warning" />
<Rule Id="C28234" Action="Warning" />
<Rule Id="C28235" Action="Warning" />
<Rule Id="C28236" Action="Warning" />
<Rule Id="C28237" Action="Warning" />
<Rule Id="C28238" Action="Warning" />
<Rule Id="C28239" Action="Warning" />
<Rule Id="C28240" Action="Warning" />
<Rule Id="C28241" Action="Warning" />
<Rule Id="C28243" Action="Warning" />
<Rule Id="C28245" Action="Warning" />
<Rule Id="C28246" Action="Warning" />
<Rule Id="C28250" Action="Warning" />
<!-- <Rule Id="C28251" Action="Warning" /> this may be real but it's damn annoying: inconsistent annotation for function -->
<Rule Id="C28252" Action="Warning" />
<Rule Id="C28253" Action="Warning" />
<Rule Id="C28254" Action="Warning" />
<Rule Id="C28262" Action="Warning" />
<Rule Id="C28263" Action="Warning" />
<Rule Id="C28267" Action="Warning" />
<Rule Id="C28272" Action="Warning" />
<Rule Id="C28273" Action="Warning" />
<Rule Id="C28275" Action="Warning" />
<Rule Id="C28279" Action="Warning" />
<Rule Id="C28280" Action="Warning" />
<Rule Id="C28282" Action="Warning" />
<Rule Id="C28285" Action="Warning" />
<Rule Id="C28286" Action="Warning" />
<Rule Id="C28287" Action="Warning" />
<Rule Id="C28288" Action="Warning" />
<Rule Id="C28289" Action="Warning" />
<Rule Id="C28290" Action="Warning" />
<Rule Id="C28291" Action="Warning" />
<Rule Id="C28300" Action="Warning" />
<Rule Id="C28301" Action="Warning" />
<Rule Id="C28302" Action="Warning" />
<Rule Id="C28303" Action="Warning" />
<Rule Id="C28304" Action="Warning" />
<Rule Id="C28305" Action="Warning" />
<Rule Id="C28308" Action="Warning" />
<Rule Id="C28309" Action="Warning" />
<Rule Id="C28350" Action="Warning" />
<Rule Id="C28351" Action="Warning" />
</Rules>
</RuleSet>

Binary file not shown.

74
extras/build-tests/nix/build Executable file
View File

@ -0,0 +1,74 @@
#!/bin/bash
# Exit on any failure:
set -e
# Verbose:
set -x
if [ "$1" != "" ]; then
BUILDCONFIG="$*"
fi
if [[ "$OSTYPE" == "freebsd"* ]]; then
export MAKE="gmake -j4"
else
export MAKE="make -j4"
fi
export CPPFLAGS="-DFAKELAG_CONFIGURABLE -DNOREMOVETMP"
# !! skipped for now: extras/build-tests/nix/select-config $BUILDCONFIG !!
# !! temporary use this:
cp extras/build-tests/nix/configs/default ./config.settings
# Debian 8 workaround:
if lsb_release -av 2>&1|egrep 'Debian.*jessie'; then
echo "Disabling ASan due to false positives on deb8"
echo 'EXTRAPARA="--enable-werror --disable-asan"' >>config.settings
fi
# Read config.settings, this makes a couple of variables available to us.
. ./config.settings
if [ "$SSLDIR" != "" ]; then
# In case we build local openssl/libressl
export LD_LIBRARY_PATH="$SSLDIR/lib"
fi
./Config -quick || (tail -n 5000 config.log; exit 1)
$MAKE
yes ''|make pem
make
./unrealircd module install third/dumpcmds
make install
set +x
echo ""
echo "***********************************************"
echo "UnrealIRCd build & install successful."
echo "***********************************************"
if [[ "$OSTYPE" == "darwin"* ]]; then
otool -L ~/unrealircd/bin/unrealircd
else
ldd ~/unrealircd/bin/unrealircd
fi
if [ "$BUILDCONFIG" = "local-curl" ]; then
# We broke the system significantly earlier that build tests
# won't work (eg: 'git' is uninstallable). Don't bother
# running the tests. I don't expect a 'local-curl' specific
# bug anyway.
exit 0
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
# 'rake' doesn't work. have to figure that one out..
echo "Not running test on OS X for now"
exit 0
fi
echo ""
echo ""
#echo "Now running UnrealIRCd test framework..."
#set -x
#extras/build-tests/nix/run-tests

View File

@ -0,0 +1,24 @@
#
BASEPATH=$HOME/unrealircd
BINDIR=$HOME/unrealircd/bin
DATADIR=$HOME/unrealircd/data
CONFDIR=$HOME/unrealircd/conf
MODULESDIR=$HOME/unrealircd/modules
LOGDIR=$HOME/unrealircd/logs
CACHEDIR=$HOME/unrealircd/cache
DOCDIR=$HOME/unrealircd/doc
TMPDIR=$HOME/unrealircd/tmp
PRIVATELIBDIR=$HOME/unrealircd/lib
PREFIXAQ="1"
MAXCONNECTIONS="1024"
NICKNAMEHISTORYLENGTH="2000"
DEFPERM="0600"
SSLDIR=""
REMOTEINC=""
CURLDIR=""
SHOWLISTMODES="1"
NOOPEROVERRIDE=""
OPEROVERRIDEVERIFY=""
GENCERTIFICATE="0"
EXTRAPARA="--enable-werror --enable-asan"
ADVANCED=""

View File

@ -0,0 +1,44 @@
#!/bin/bash
#
# This script fires up a two-server IRC network and runs the test framework
#
# Exit on error:
set -e
# Verbose:
set -x
# Kill old instances
killall -9 unrealircd || true
# Remove old junk
rm -rf cipherscan/ unrealircd-tests/
if [ ! -d ~/cipherscan ]; then
# Install 'cipherscan'
git clone -q https://github.com/mozilla/cipherscan
fi
# Install 'unrealircd-tests'
git clone -q https://github.com/unrealircd/unrealircd-tests.git
cd unrealircd-tests
# Run the test framework, testing both services:
if uname -a|grep -q FreeBSD; then
# FreeBSD runs without services since they fail mysteriously:
./run -services none || exit 1
else
# Linux tests both with anope and atheme services:
./run -services anope || exit 1
./run -services atheme || exit 1
fi
# Do cipherscan test at the end
if [[ "$OSTYPE" != "freebsd"* ]]; then
sleep 2
cd ../extras/tests/tls
./tls-tests
cd -
fi
killall -15 unrealircd atheme-services services anope || true

View File

@ -0,0 +1,14 @@
#!/bin/bash
#
# This is a simple wrapper script that will run the tests
# When finished, either due to succes or failure,
# it will kill the ircd
#
# Also, it makes sure the job times out (is killed)
# in case it misbehaves
#
set +ex
timeout --kill-after=5 600 extras/build-tests/nix/run-tests
EX="$?"
killall -9 valgrind valgrind.bin memcheck memcheck-amd64-linux memcheck-x86-linux ircd unrealircd val 1>/dev/null 2>&1
exit $EX

View File

@ -0,0 +1,114 @@
#!/bin/bash
#
# This is a helper script for travis-ci builds and our own FreeBSD test machine.
# It is not meant to be used by end-users
#
function fail()
{
echo "select-config failed: $*"
exit 1
}
function build_ssl {
DIR="$2"
URL="$1/$2.tar.gz"
savewd="$PWD"
cd ~
wget "$URL" || exit 1
tar xzf $DIR.tar.gz
cd "$DIR"
(./configure --prefix=$HOME/ssl 1>/dev/null 2>&1 || ./config --prefix=$HOME/ssl -fPIC 1>/dev/null 2>&1 ) || fail "build_ssl: configure/config failed"
(make -j2 1>/dev/null 2>&1 && make install 1>/dev/null 2>&1) || fail "build_ssl: make failed"
cd "$savewd"
echo "SSLDIR=$HOME/ssl" >>config.settings
}
if [ ! -d extras ]; then
echo "This tool is supposed to be run from the source root, so ~/unrealircd-5.0.x or similar"
exit 1
fi
set -x
# Take default settings as a starter..
cp extras/build-tests/nix/configs/default ./config.settings
# Libtool is required for the other options..
# Also for our FreeBSD machine we have to uninstall some stuff since a clean
# environment is not guaranteed...
if [ "$OSTYPE" = "linux-gnu" ]; then
sudo apt-get -qq update
sudo apt-get install libtool -qq
elif [[ "$OSTYPE" == "freebsd"* ]]; then
sudo pkg install -y libtool
sudo pkg remove -y c-ares
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew update
brew install openssl
else
echo "OS not correctly detected ($OSTYPE). Aborting."
exit 1
fi
echo "*****************************************************************"
echo "SELECTED BUILD OPTIONS: $*"
echo "*****************************************************************"
while [ "$1" ]
do
echo "Processing option $1..."
if [ "$1" = "system-cares" ]; then
if [ "$OSTYPE" = "linux-gnu" ]; then
sudo apt-get install libc-ares-dev -qq
elif [[ "$OSTYPE" == "freebsd"* ]]; then
sudo pkg install -y c-ares
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install c-ares
fi
elif [ "$1" = "system-curl" ]; then
echo 'REMOTEINC=1' >>config.settings
if [ "$OSTYPE" = "linux-gnu" ]; then
sudo apt-get install libcurl4-openssl-dev -qq
echo 'CURLDIR=/usr' >>config.settings
elif [[ "$OSTYPE" == "freebsd"* ]]; then
sudo pkg install -y curl
echo 'CURLDIR=/usr/local' >>config.settings
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install c-ares curl
echo 'CURLDIR=/usr/local/opt/curl' >>config.settings
fi
elif [ "$1" = "local-curl" ]; then
if [ "$OSTYPE" = "linux-gnu" ]; then
sudo apt-get remove libcurl4-openssl-dev libcurl3-gnutls libcurl3 -qq
elif [[ "$OSTYPE" == "freebsd"* ]]; then
sudo pkg remove -y curl #NOTE: unfortunately this also removes 'git' :D
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo "No need to remove curl since it's not installed. Or at least I hope so..."
fi
echo 'REMOTEINC=1' >>config.settings
echo "CURLDIR=`pwd`/extras/curl" >>config.settings
elif [ "$1" = "libressl-27" ]; then
build_ssl https://ftp.openbsd.org/pub/OpenBSD/LibreSSL libressl-2.7.5
elif [ "$1" = "libressl-28" ]; then
build_ssl https://ftp.openbsd.org/pub/OpenBSD/LibreSSL libressl-2.8.3
elif [ "$1" = "libressl-29" ]; then
build_ssl https://ftp.openbsd.org/pub/OpenBSD/LibreSSL libressl-2.9.0
elif [ "$1" = "openssl-102" ]; then
build_ssl https://www.openssl.org/source openssl-1.0.2q
elif [ "$1" = "openssl-110" ]; then
build_ssl https://www.openssl.org/source openssl-1.1.0j
elif [ "$1" = "openssl-111" ]; then
build_ssl https://www.openssl.org/source openssl-1.1.1a
else
echo "Unknown option $1"
exit 1
fi
shift
done
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "NOTE: Not building with -Werror for now on macOS..."
else
echo 'EXTRAPARA="--enable-werror"' >>config.settings
fi

View File

@ -0,0 +1,86 @@
echo on
rem Temporarily hardcoded:
set TARGET=Visual Studio 2019
set SHORTNAME=vs2019
rem Initialize Visual Studio variables
if "%TARGET%" == "Visual Studio 2017" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
if "%TARGET%" == "Visual Studio 2019" call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
rem Installing tools
rem only for appveyor:
rem cinst unrar -y
rem cinst unzip -y
rem cinst innosetup -y
rem Installing UnrealIRCd dependencies
cd \projects
mkdir unrealircd-5-libs
cd unrealircd-5-libs
curl -fsS -o unrealircd-libraries-5-devel.zip https://www.unrealircd.org/files/dev/win/libs/unrealircd-libraries-5-devel.zip
unzip unrealircd-libraries-5-devel.zip
copy dlltool.exe \users\user\worker\unreal5-w10\build /y
rem for appveyor: cd \projects\unrealircd
cd \users\user\worker\unreal5-w10\build
rem Now the actual build
call extras\build-tests\windows\compilecmd\%SHORTNAME%.bat
rem The above command will fail, due to missing symbol file
rem However the symbol file can only be generated after the above command
rem So... we create the symbolfile...
nmake -f makefile.windows SYMBOLFILE
rem And we re-run the exact same command:
call extras\build-tests\windows\compilecmd\%SHORTNAME%.bat
if %ERRORLEVEL% NEQ 0 EXIT /B 1
rem Convert c:\dev to c:\projects\unrealircd-5-libs
rem TODO: should use environment variable in innosetup script?
sed -i "s/c:\\dev\\unrealircd-5-libs/c:\\projects\\unrealircd-5-libs/gi" src\windows\unrealinst.iss
rem Build installer file
"c:\Program Files (x86)\Inno Setup 5\iscc.exe" /Q- src\windows\unrealinst.iss
if %ERRORLEVEL% NEQ 0 EXIT /B 1
rem Show some proof
ren mysetup.exe unrealircd-dev-build.exe
dir unrealircd-dev-build.exe
sha256sum unrealircd-dev-build.exe
rem Kill any old instances, just to be sure
taskkill -im unrealircd.exe -f
sleep 2
rem Just a safety measure so we don't end up testing
rem some old version...
del "C:\Program Files\UnrealIRCd 5\bin\unrealircd.exe"
echo Running installer...
start /WAIT unrealircd-dev-build.exe /VERYSILENT /LOG=setup.log
if %ERRORLEVEL% NEQ 0 goto installerfailed
rem Upload artifact
rem appveyor PushArtifact unrealircd-dev-build.exe
rem if %ERRORLEVEL% NEQ 0 EXIT /B 1
rem Install 'unrealircd-tests'
cd ..
rd /q/s unrealircd-tests
git clone https://github.com/unrealircd/unrealircd-tests.git
if %ERRORLEVEL% NEQ 0 EXIT /B 1
cd unrealircd-tests
dir
"C:\Program Files\Git\bin\bash.exe" ./runwin
if %ERRORLEVEL% NEQ 0 EXIT /B 1
goto end
:installerfailed
type setup.log
echo INSTALLATION FAILED
EXIT /B 1
:end

View File

@ -0,0 +1,18 @@
rem Build command for Visual Studio 2019
nmake -f makefile.windows ^
LIBRESSL_INC_DIR="c:\projects\unrealircd-5-libs\libressl\include" ^
LIBRESSL_LIB_DIR="c:\projects\unrealircd-5-libs\libressl\lib" ^
SSLLIB="crypto-45.lib ssl-47.lib" ^
USE_REMOTEINC=1 ^
LIBCURL_INC_DIR="c:\projects\unrealircd-5-libs\curl\include" ^
LIBCURL_LIB_DIR="c:\projects\unrealircd-5-libs\curl\builds\libcurl-vc-x64-release-dll-ssl-dll-cares-dll-ipv6-obj-lib" ^
CARES_LIB_DIR="c:\projects\unrealircd-5-libs\c-ares\msvc\cares\dll-release" ^
CARES_INC_DIR="c:\projects\unrealircd-5-libs\c-ares" ^
CARESLIB="cares.lib" ^
PCRE2_INC_DIR="c:\projects\unrealircd-5-libs\pcre2\include" ^
PCRE2_LIB_DIR="c:\projects\unrealircd-5-libs\pcre2\lib" ^
PCRE2LIB="pcre2-8.lib" ^
ARGON2_LIB_DIR="c:\projects\unrealircd-5-libs\argon2\vs2015\build" ^
ARGON2_INC_DIR="c:\projects\unrealircd-5-libs\argon2\include" ^
ARGON2LIB="Argon2RefDll.lib" %*

BIN
extras/c-ares.tar.gz Normal file

Binary file not shown.

98
extras/curlinstall Executable file
View File

@ -0,0 +1,98 @@
#!/bin/sh
URL="https://www.unrealircd.org/files/curl-latest.tar.gz"
OUTF="curl-latest.tar.gz"
OUTD="curl-latest"
ARESPATH="`pwd`/extras/c-ares"
UNREALDIR="`pwd`"
CARESVERSION="1.15.0"
LIBDIR="$1"
if [ "x$1" = "x" ]; then
echo "You should (no longer) run this program directly."
echo "It will be invoked by ./Config"
exit 1
fi
if [ ! -f src/parse.c ]; then
if [ -f ../src/parse.c ]; then
cd ..
else
echo "Please run this program from your UnrealIRCd directory"
echo "(usually $HOME/unrealircd-5.0.X or something like that)"
exit 1
fi
fi
wget --version 1>/dev/null 2>&1
if [ "$?" = 0 ]; then
FETCHER="wget"
else
fetch --version 1>/dev/null 2>&1
if [ "$?" = 0 ]; then
FETCHER="fetch"
else
lynx --version 1>/dev/null 2>&1
if [ "$?" = 0 ]; then
FETCHER="lynx"
else
echo "ERROR: unable to find wget/fetch/lynx, please install at least one of these programs"
exit 1
fi
fi
fi
if [ ! -d tmp ]; then
mkdir tmp || exit 1
fi
cd tmp || exit 1
rm -f "$OUTF"
if [ "$FETCHER" = "wget" ]; then
wget -O "$OUTF" "$URL"
elif [ "$FETCHER" = "lynx" ]; then
lynx -dump "$URL" >"$OUTF"
elif [ "$FETCHER" = "fetch" ]; then
cd tmp #todo: find out the cmd line parameter ;)
fetch "$URL"
fi
if [ "$?" != 0 ]; then
echo "ERROR: Something went wrong while trying to download $URL"
exit 1
fi
rm -rf "$OUTD" # remove old directory prior to extracting
tar xzf "$OUTF" || exit 1
if [ "`eval echo -n 'a'`" = "-n a" ] ; then
c="\c"
else
n="-n"
fi
if [ ! -d "$ARESPATH/lib" ]; then
echo "c-ares has not been build yet, let's do that now..."
cd ../extras/
tar xzf c-ares.tar.gz || exit 1
cd c-ares-$CARESVERSION || exit 1
./configure --prefix=$ARESPATH || exit 1
(make && make install) || exit 1
cd ../../tmp/
echo "c-ares built."
echo ""
fi
# We assume curl has been packaged in a way it will extract to "$OUTD"/
cd "$OUTD" || exit 1
echo "Building and installing libcurl"
CPPFLAGS="-I$ARESPATH/include" ./configure --prefix=$UNREALDIR/extras/curl --libdir=$LIBDIR --enable-shared \
--disable-thread --enable-ares=$ARESPATH --disable-ipv6
cp -R $ARESPATH/lib ares
make && make install
#cp $ARESPATH/lib/libcares.a $HOME/curl/lib
# that isn't needed anymore as the lib is already in unreal...

View File

@ -0,0 +1,17 @@
Welcome to the doxygen-generated documentation for the UnrealIRCd 5.x API.
This is intended **for developers only!**
If you are creating a 3rd party module for UnrealIRCd or are interested
in contributing to UnrealIRCd then this is the right place.
Here you should be able to find a lot of information on the data structures
and functions available to you when coding for UnrealIRCd.
## Wiki documentation ##
* Be sure to check the [Module API](https://www.unrealircd.org/docs/Dev:Module_API) article on the wiki, which currently provides a better overview of the module API.
## Doxygen docs ##
* [The most common structs](group__CommonStructs.html) - like Client, User, Server, Channel, etc.
* [All structs](classes.html) - in a simple alphabetical index
* [Functions and structs ordered by purpose](modules.html) - this is work in progress and still needs expansion!
* [Browse by source file](dir_68267d1309a1af8e8297ef4c3efbcdba.html) - see all src/*.c files and their (documented) functions.

2494
extras/doxygen/Doxyfile Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
code {
border: 1px solid #C4CFE5;
background-color: #FBFCFD;
}

View File

@ -0,0 +1,56 @@
<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen $doxygenversion"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<!--BEGIN PROJECT_NAME--><title>$projectname Module API: $title</title><!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="$relpath^jquery.js"></script>
<script type="text/javascript" src="$relpath^dynsections.js"></script>
$treeview
$search
$mathjax
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
$extrastylesheet
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<!--BEGIN TITLEAREA-->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<!--BEGIN PROJECT_LOGO-->
<td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo"/></td>
<!--END PROJECT_LOGO-->
<!--BEGIN PROJECT_NAME-->
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">$projectname
<!--BEGIN PROJECT_NUMBER-->&#160;<span id="projectnumber">Module API $projectnumber</span><!--END PROJECT_NUMBER-->
</div>
<!--BEGIN PROJECT_BRIEF--><div id="projectbrief">$projectbrief</div><!--END PROJECT_BRIEF-->
</td>
<!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME-->
<!--BEGIN PROJECT_BRIEF-->
<td style="padding-left: 0.5em;">
<div id="projectbrief">$projectbrief</div>
</td>
<!--END PROJECT_BRIEF-->
<!--END !PROJECT_NAME-->
<!--BEGIN DISABLE_INDEX-->
<!--BEGIN SEARCHENGINE-->
<td>$searchbox</td>
<!--END SEARCHENGINE-->
<!--END DISABLE_INDEX-->
</tr>
</tbody>
</table>
</div>
<!--END TITLEAREA-->
<!-- end header part -->

View File

@ -0,0 +1,40 @@
#!/bin/sh
#
# This script tries to upgrade spamfilter.conf from an old
# version that uses 'posix' spamfilters to a bit more recent
# version with examples using 'regex' spamfilters.
# This so fewer users end up with a headache when upgrading
# to UnrealIRCd 4.2.3+.
#
if [ -f spamfilter.conf.patch ]; then
F="`pwd`/spamfilter.conf.patch"
elif [ -f extras/patches/spamfilter.conf.patch ]; then
F="`pwd`/extras/patches/spamfilter.conf.patch"
else
echo "WARNING: spamfilter.conf.patch not found"
exit 0
fi
if [ ! -f "$F" ]; then
echo "WARNING: spamfilter.conf.patch not found in round two"
exit 0
fi
if [ "$1" = "" ]; then
echo "ERROR: No target confdir specified."
exit 0
fi
if [ ! -f "$1/spamfilter.conf" ]; then
echo "WARNING: no spamfilter.conf found in $1 -- strange"
exit 0
fi
cd "$1" || exit 1
cat "$F"|patch -p0 --dry-run -N 1>/dev/null 2>&1
if [ "$?" = 0 ]; then
# Patch succeeded, patch now!
echo "Upgrading examples in your spamfilter.conf..."
cat "$F"|patch -p0 -N
fi

View File

@ -0,0 +1,328 @@
--- spamfilter.conf.old 2015-06-27 18:29:01.084559805 +0200
+++ spamfilter.conf 2019-04-04 18:29:38.390647262 +0200
@@ -1,232 +1,154 @@
/*
- * This an example spamfilter file, it contains several
- * real and useful spamfilters. This should give you an
- * idea of how powerful spamfilter can be in real-life
- * situations.
+ * This configuration file contains example spamfilter rules.
+ * They are real rules that were useful a long time ago.
+ * Since 2005 these rules are no longer maintained.
+ * The main purpose nowadays is to serve as an example
+ * to give you an idea of how powerful spamfilters can
+ * be in real-life situations.
*
- * $Id$
+ * Documentation on spamfilter is available at:
+ * https://www.unrealircd.org/docs/Spamfilter
*/
-/* Guidelines on the 'action' field:
- * As a general rule we use 'action block' for any newly added
- * spamfilters at first, later on (after knowing about false
- * positives) we might change some to viruschan/kill/gline/etc..
+/* General note:
+ * If you want to use a \ in a spamfilter, or in fact
+ * anywhere in the configuration file, then you need
+ * to escape this to \\ instead.
*/
-spamfilter {
- match-type posix;
- match "\x01DCC (SEND|RESUME)[ ]+\"(.+ ){20}";
- target { private; channel; };
- action kill;
- reason "mIRC 6.0-6.11 exploit attempt";
-};
-spamfilter {
- match-type posix;
- match "\x01DCC (SEND|RESUME).{225}";
- target { private; channel; };
- action kill;
- reason "Possible mIRC 6.12 exploit attempt";
-};
+/* First some spamfilters with match-type 'simple'.
+ * The only matchers available are * and ?
+ * PRO's: very fast, easy matching: everyone can do this.
+ * CON's: limited ability to fine-tune spamfilters
+ */
spamfilter {
- match-type posix;
- match "Come watch me on my webcam and chat /w me :-\) http://.+:\d+/me\.mpg";
+ match-type simple;
+ match "Come watch me on my webcam and chat /w me :-) http://*:*/me.mpg";
target private;
action gline;
reason "Infected by fyle trojan: see http://www.sophos.com/virusinfo/analyses/trojfylexa.html";
};
+/* This signature uses a \ which has to escaped to \\ in the configuration file */
spamfilter {
- 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";
-};
-
-spamfilter {
- match-type posix;
- match "^http://www\.angelfire\.com/[a-z0-9]+/[a-z0-9]+/[a-z_]+\.jpg <- .*!";
- target private;
+ match-type simple;
+ match "C:\\WINNT\\system32\\*.zip";
+ target dcc;
action block;
- reason "Infected by fagot worm: see http://www.f-secure.com/v-descs/fagot.shtml";
+ reason "Infected by Gaggle worm?";
};
spamfilter {
- match-type posix;
- match "^FREE PORN: http://free:porn@([0-9]{1,3}\.){3}[0-9]{1,3}:8180$";
+ match-type simple;
+ match "Speed up your mIRC DCC Transfer by up to 75%*www.freewebs.com/mircupdate/mircspeedup.exe";
target private;
action gline;
- reason "Infected by aplore worm: see http://www.f-secure.com/v-descs/aplore.shtml";
-};
-
-spamfilter {
- match-type posix;
- match "^!login Wasszup!$";
- target channel;
- action gline;
- reason "Attempting to login to a GTBot";
-};
-
-spamfilter {
- match-type posix;
- match "^!login grrrr yeah baby!$";
- target channel;
- action gline;
- reason "Attempting to login to a GTBot";
-};
-
-spamfilter {
- 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";
-};
-
-spamfilter {
- match-type posix;
- match "^!icqpagebomb ([0-9]{1,15} ){2}.+";
- target channel;
- action gline;
- reason "Attempting to use a GTBot";
+ reason "Infected by mirseed trojan: see http://www.sophos.com/virusinfo/analyses/trojmirseeda.html";
};
spamfilter {
- match-type posix;
- match "^!pfast [0-9]{1,15} ([0-9]{1,3}\.){3}[0-9]{1,3} [0-9]{1,5}$";
- target channel;
+ match-type simple;
+ match "STOP SPAM, USE THIS COMMAND: //write nospam $decode(*) | .load -rs nospam | //mode $me +R";
+ target private;
action gline;
- reason "Attempting to use a GTBot";
+ reason "Infected by nkie worm: see http://www.trojaninfo.com/nkie/nkie.htm";
};
-spamfilter {
- 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";
-};
-spamfilter {
- 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";
-};
+/* Now spamfilters of type 'regex'.
+ * These use powerful regular expressions (Perl/PCRE style)
+ * You may have to learn more about "regex" first before you
+ * can use them. For example the dot ('.') has special meaning.
+ */
+/* This regex shows a pattern which requires 20 paramaters,
+ * such as "x x x x x x x x x x x x x x x x x x x x"
+ */
spamfilter {
- 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; };
- action gline;
- reason "Attempting to use a SpyBot";
+ match-type regex;
+ match "\x01DCC (SEND|RESUME)[ ]+\"(.+ ){20}";
+ target { private; channel; };
+ action kill;
+ reason "mIRC 6.0-6.11 exploit attempt";
};
+/* Similarly, this regex shows a pattern that matches
+ * against at least 225 characters in length.
+ */
spamfilter {
- 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";
+ match-type regex;
+ match "\x01DCC (SEND|RESUME).{225}";
+ target { private; channel; };
+ action kill;
+ reason "Possible mIRC 6.12 exploit attempt";
};
+/* Earlier you saw an example of a $decode exploit which used
+ * match-type 'simple' and - indeed - the filter was quite simple.
+ * The following uses a regex with a similar example.
+ * Regular expressions are very powerful but here you can see
+ * that it actually complicates writing a filter quite a bit.
+ * With regex in this filter we need to escape the ( and all
+ * the dots, question marks, etc. if we want to match these
+ * characters in literal text.
+ */
spamfilter {
- match-type posix;
- match "(^wait a minute plz\. i am updating my site|.*my erotic video).*http://.+/erotic(a)?/myvideo\.exe$";
+ match-type regex;
+ match "^Want To Be An IRCOp\? Try This New Bug Type: //write \$decode\(.+=.?,m\) \| \.load -rs \$decode\(.+=.?,m\)$";
target private;
- action gline;
- reason "Infected by some trojan (erotica?)";
+ action block;
+ reason "Spamming users with an mIRC trojan. Type '/unload -rs newb' to remove the trojan.";
};
spamfilter {
- match-type posix;
- match "^STOP SPAM, USE THIS COMMAND: //write nospam \$decode\(.+\) \| \.load -rs nospam \| //mode \$me \+R$";
+ match-type regex;
+ match "^http://www\.angelfire\.com/[a-z0-9]+/[a-z0-9]+/[a-z_]+\.jpg <- .*!";
target private;
- action gline;
- reason "Infected by nkie worm: see http://www.trojaninfo.com/nkie/nkie.htm";
+ action block;
+ reason "Infected by fagot worm: see http://www.f-secure.com/v-descs/fagot.shtml";
};
+/* This shows a regex which specifically matches an entire line by
+ * the use of ^ and $
+ */
spamfilter {
- match-type posix;
- match "^FOR MATRIX 2 DOWNLOAD, USE THIS COMMAND: //write Matrix2 \$decode\(.+=,m\) \| \.load -rs Matrix2 \| //mode \$me \+R$";
- target private;
+ match-type regex;
+ match "^!login Wasszup!$";
+ target channel;
action gline;
- reason "Infected by nkie worm: see http://www.trojaninfo.com/nkie/nkie.htm";
+ reason "Attempting to login to a GTBot";
};
+/* An example of how to match against an IP address in text (IPv4 only) */
spamfilter {
- match-type posix;
- match "^hey .* to get OPs use this hack in the chan but SHH! //\$decode\(.*,m\) \| \$decode\(.*,m\)$";
- target private;
+ match-type regex;
+ match "^!packet ([0-9]{1,3}\.){3}[0-9]{1,3} [0-9]{1,15}";
+ target channel;
action gline;
- reason "Infected by nkie worm: see http://www.trojaninfo.com/nkie/nkie.htm";
+ reason "Attempting to use a GTBot";
};
+/* A slightly more complex example with a partial OR matcher (|) */
spamfilter {
- match-type posix;
- match ".*(http://jokes\.clubdepeche\.com|http://horny\.69sexy\.net|http://private\.a123sdsdssddddgfg\.com).*";
+ match-type regex;
+ 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 LOI trojan";
-};
-
-/* This is a 'general sig' which might have a tad more false positives, hence just 'block' is used */
-spamfilter {
- match-type posix;
- match "C:\\WINNT\\system32\\[][0-9a-z_-{|}`]+\.zip";
- target dcc;
- action block;
- reason "Infected by Gaggle worm?";
+ reason "Infected by some trojan (erotica?)";
};
+/* In regex a \ is special and needs to be escaped to \\
+ * However in this configuration file, \ is also special and
+ * needs to be escaped to \\ as well.
+ * The result is that we need double escaping:
+ * To match a \ you need to write \\\\ in the configuration file.
+ */
spamfilter {
- match-type posix;
- match "C:\\WINNT\\system32\\(notes|videos|xxx|ManualSeduccion|postal|hechizos|images|sex|avril)\.zip";
+ match-type regex;
+ match "C:\\\\WINNT\\\\system32\\\\(notes|videos|xxx|ManualSeduccion|postal|hechizos|images|sex|avril)\.zip";
target dcc;
action dccblock;
reason "Infected by Gaggle worm";
};
-
-spamfilter {
- 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 {
- 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 {
- match-type posix;
- match "^LOL! //echo -a \$\(\$decode\(.+,m\),[0-9]\)$";
- target channel;
- action block;
- reason "$decode exploit";
-};
-
-/*
-spamfilter {
- regex "//write \$decode\(.+\|.+load -rs";
- target { private; channel; };
- reason "Generic $decode exploit";
- action block;
-};
-*/
-
-spamfilter {
- 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.";
-};

BIN
extras/pcre2.tar.gz Normal file

Binary file not shown.

View File

@ -0,0 +1,27 @@
# AppArmor profile for UnrealIRCd 5
#
# Note that you may still see some DENIED warnings in logs with
# operation="chmod". These are harmless and can be safely ignored.
#
# Tested on Ubuntu 16.04 LTS and Ubuntu 18.04 LTS
#
# IMPORTANT: you will have to modify the path to executable below
# if it's not /home/ircd/unrealircd/bin/unrealircd !
#include <tunables/global>
# Change the pathname of your UnrealIRCd executable here:
/home/ircd/unrealircd/bin/unrealircd {
#include <abstractions/base>
#include <abstractions/nameservice>
@{HOME}/unrealircd/conf/ r,
@{HOME}/unrealircd/conf/** r,
@{HOME}/unrealircd/data/** rw,
@{HOME}/unrealircd/lib/*.so* mr,
@{HOME}/unrealircd/logs/* rw,
@{HOME}/unrealircd/modules/**.so r,
@{HOME}/unrealircd/tmp/ r,
@{HOME}/unrealircd/tmp/* mrw,
@{HOME}/unrealircd/bin/unrealircd mr,
}

View File

@ -0,0 +1,27 @@
Target: 127.0.0.1:5901
prio ciphersuite protocols pfs curves
1 ECDHE-ECDSA-AES256-GCM-SHA384 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1
2 ECDHE-ECDSA-AES128-GCM-SHA256 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1
3 ECDHE-ECDSA-AES256-SHA384 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1
4 ECDHE-ECDSA-AES128-SHA256 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1
5 ECDHE-ECDSA-AES256-SHA TLSv1,TLSv1.1,TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1
6 ECDHE-ECDSA-AES128-SHA TLSv1,TLSv1.1,TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1
Certificate: untrusted, 384 bits, ecdsa-with-SHA256 signature
TLS ticket lifetime hint: None
NPN protocols: None
OCSP stapling: not supported
Cipher ordering: server
Curves ordering: server - fallback: no
Server supports secure renegotiation
Server supported compression methods: NONE
TLS Tolerance: yes
Intolerance to:
SSL 3.254 : absent
TLS 1.0 : absent
TLS 1.1 : absent
TLS 1.2 : absent
TLS 1.3 : absent
TLS 1.4 : absent

View File

@ -0,0 +1,27 @@
Target: 127.0.0.1:5901
prio ciphersuite protocols pfs curves
1 ECDHE-ECDSA-AES256-GCM-SHA384 TLSv1.2 ECDH,P-256,256bits prime256v1
2 ECDHE-ECDSA-AES128-GCM-SHA256 TLSv1.2 ECDH,P-256,256bits prime256v1
3 ECDHE-ECDSA-AES256-SHA384 TLSv1.2 ECDH,P-256,256bits prime256v1
4 ECDHE-ECDSA-AES256-SHA TLSv1,TLSv1.1,TLSv1.2 ECDH,P-256,256bits prime256v1
5 ECDHE-ECDSA-AES128-SHA256 TLSv1.2 ECDH,P-256,256bits prime256v1
6 ECDHE-ECDSA-AES128-SHA TLSv1,TLSv1.1,TLSv1.2 ECDH,P-256,256bits prime256v1
Certificate: untrusted, 384 bits, ecdsa-with-SHA256 signature
TLS ticket lifetime hint: None
NPN protocols: None
OCSP stapling: not supported
Cipher ordering: server
Curves ordering: server - fallback: no
Server supports secure renegotiation
Server supported compression methods: NONE
TLS Tolerance: yes
Intolerance to:
SSL 3.254 : absent
TLS 1.0 : absent
TLS 1.1 : absent
TLS 1.2 : absent
TLS 1.3 : absent
TLS 1.4 : absent

90
extras/tests/tls/tls-tests Executable file
View File

@ -0,0 +1,90 @@
#!/bin/bash
# We assume we are executed from extras/tests/tls
function fail()
{
echo "TLS TEST ERROR: $*"
exit 1
}
CIPHERSCAN="cipherscan"
OPENSSL="openssl"
if [ -x ~/cipherscan ]; then
CIPHERSCAN="$HOME/cipherscan/cipherscan"
OPENSSL="$HOME/cipherscan/openssl"
elif [ -x /home/travis/build/unrealircd/unrealircd/cipherscan/cipherscan ]; then
CIPHERSCAN="/home/travis/build/unrealircd/unrealircd/cipherscan/cipherscan"
OPENSSL="/home/travis/build/unrealircd/unrealircd/cipherscan/openssl"
elif [ -x ../../../cipherscan/ ]; then
CIPHERSCAN="`readlink -f ../../../cipherscan/cipherscan`"
OPENSSL="`readlink -f ../../../cipherscan/openssl`"
fi
$CIPHERSCAN --help >/dev/null || exit 1
# This is the basic cipherscan test.
# It compares the output against a reference .txt file and alarms us if there
# are any changes. These changes may not always be harmful, but at least we
# will get warned on any possible changes.
$CIPHERSCAN --no-colors 127.0.0.1:5901|grep -vF '.....' >cipherscan.test.txt
# Now check if profile matches, if so.. everything is ok.
# We have 1 or more baseline profiles
# And you can optionally add profile-specific, eg openssl-102.txt
# Yeah that was a great idea but maintaining that is a bit of a hassle.
# TODO: reintroduce it though, see below.
##for f in cipherscan_profiles/baseline*txt cipherscan_profiles/$BUILDCONFIG.txt
FAILED=1
for f in cipherscan_profiles/*.txt
do
diff -uab $f cipherscan.test.txt 1>/dev/null 2>&1
if [ "$?" -eq 0 ]; then
FAILED=0
echo "Cipherscan profile $f matched."
break
fi
done
if [ "$FAILED" -eq 1 ]; then
echo "*** Differences found between cipherscan scan and expected output ***"
if [ -f cipherscan_profiles/$BUILDCONFIG.txt ]; then
COMPARE_PROFILE="cipherscan_profiles/$BUILDCONFIG.txt"
else
COMPARE_PROFILE="cipherscan_profiles/baseline.txt"
fi
echo "== EXPECTED OUTPUT ($COMPARE_PROFILE) =="
cat $COMPARE_PROFILE
echo
echo "== ACTUAL TEST OUTPUT =="
cat cipherscan.test.txt
echo
echo "== DIFF =="
diff -uab $COMPARE_PROFILE cipherscan.test.txt
echo
echo "cipherscan test failed."
exit 1
else
echo "*** Cipherscan output was good ***"
cat cipherscan.test.txt
fi
# This checks for a couple of old ciphers that should never work:
for cipher in 3DES RC4
do
echo "Testing cipher $cipher (MUST FAIL!).."
(echo QUIT|$OPENSSL s_client -connect 127.0.0.1:5901 -cipher $cipher) &&
fail "UnrealIRCd allowed us to connect with cipher $cipher, BAD!"
done
# This checks older SSL/TLS versions that should not work:
for protocol in ssl2 ssl3
do
echo "Testing protocol $protocol (MUST FAIL!).."
(echo QUIT|$OPENSSL s_client -connect 127.0.0.1:5901 -$protocol) &&
fail "UnrealIRCd allowed us to connect with protocol $protocol, BAD!"
done
echo
echo "TLS tests ended (no issues)."
exit 0

31
extras/tls.cnf Normal file
View File

@ -0,0 +1,31 @@
# create RSA certs - Server
[ req ]
# Note: RSA bits is ignored, as we use ECC now
default_bits = 2048
distinguished_name = req_dn
x509_extensions = cert_type
[ req_dn ]
countryName = Country Name
countryName_default = US
countryName_min = 2
countryName_max = 2
stateOrProvinceName = State/Province
stateOrProvinceName_default = New York
localityName = Locality Name (eg, city)
0.organizationName = Organization Name (eg, company)
0.organizationName_default = SuperNETs
organizationalUnitName = Organizational Unit Name (eg, section)
organizationalUnitName_default = IRCd
0.commonName = Common Name (Full domain of your server)
1.commonName_value = localhost
[ cert_type ]
nsCertType = server

10
extras/unreal.supp Normal file
View File

@ -0,0 +1,10 @@
{
arc4_rnd1
Memcheck:Value8
fun:getrandom8
}
{
arc4_rnd2
Memcheck:Value8
fun:add_entropy_configfile
}

View File

@ -0,0 +1,22 @@
#!/bin/sh
# There is no way to make clang's "argument unused" warning fatal. So when
# configure checks for supported flags, it runs $CC, $CXX, $LD via this
# wrapper.
#
# Ideally the search string would also include 'clang: ' but this output might
# depend on clang's argv[0].
if out=`"$@" 2>&1`; then
echo "$out"
if echo "$out" | grep 'warning: argument unused' >/dev/null; then
echo "$0: found clang warning"
exit 1
else
exit 0
fi
else
code=$?
echo "$out"
exit $code
fi

40
include/channel.h Normal file
View File

@ -0,0 +1,40 @@
/************************************************************************
* Unreal Internet Relay Chat Daemon, ircd/channel.h
* Copyright (C) 1990 Jarkko Oikarinen
*
* 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.
*
* $Id$
*/
#ifndef __channel_include__
#define __channel_include__
#define CREATE 1 /* whether a channel should be
created or just tested for existance */
#define MODEBUFLEN 200
#define ChannelExists(n) (find_channel(n, NULL))
/* NOTE: Timestamps will be added to MODE-commands, so never make
* RESYNCMODES and MODEPARAMS higher than MAXPARA-3. DALnet servers
* before Dreamforge aren't safe with more than six. -Donwulff
*/
#include "msg.h"
#define MAXMODEPARAMS (MAXPARA-3) /* Maximum modes processed */
#define RESYNCMODES 12 /* Max modes per MODE in resync */
#define MODEPARAMS 6 /* Max modes from user */
#endif

240
include/common.h Normal file
View File

@ -0,0 +1,240 @@
/************************************************************************
* Unreal Internet Relay Chat Daemon, include/common.h
* Copyright (C) 1990 Armin Gruner
*
* 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.
*
* $Id$
*/
#ifndef __common_include__
#define __common_include__
#include <time.h>
#ifdef _WIN32
#include <malloc.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
#include <io.h>
#include <direct.h>
#endif
#include "types.h"
#include "config.h"
#ifndef _WIN32
#include <sys/param.h>
#include <stdbool.h>
#else
typedef int bool;
#define false 0
#define true 1
#endif
#include "sys.h"
#include "ircsprintf.h"
#include "list.h"
#ifdef DEVELOP_CVS
#define ID_Copyright(x) static char id_copyright[] = x
#define ID_Notes(x) static char id_notes[] = x
#else
#define ID_Copyright(x)
#define ID_Notes(x)
#endif
#define BMAGIC 0x4675636B596F754661736369737473
#ifdef _WIN32
#define DEADBEEF_ADDR 0xDEADBEEFDEADBEEF
#else
#define DEADBEEF_ADDR 0xDEADBEEF
#endif
#define BASE_VERSION "UnrealIRCd"
#ifndef _WIN32
#define FDwrite(x,y,z) write(x, y, z)
#else
#define FDwrite(x,y,z) send(x, y, z, 0)
#endif
#ifndef NULL
#define NULL 0
#endif
#ifdef TRUE
#undef TRUE
#endif
#ifdef FALSE
#undef FALSE
#endif
#define FALSE (0)
#define TRUE (!FALSE)
#ifndef UNSURE
#define UNSURE (2)
#endif
#define mycmp(a,b) \
( (toupper(a[0])!=toupper(b[0])) || smycmp((a)+1,(b)+1) )
extern int smycmp(const char *, const char *);
#ifndef GLIBC2_x
extern int myncmp(const char *, const char *, int);
#endif
extern char *strtoken(char **, char *, char *);
extern MODVAR int global_count, max_global_count;
extern char *myctime(time_t);
#ifdef _WIN32
extern int gettimeofday(struct timeval *tp, void *tzp);
#endif
#define PRECISE_CHECK
#ifndef MAX
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
extern MODVAR u_char tolowertab[], touppertab[];
#undef tolower
#define tolower(c) (tolowertab[(u_char)(c)])
#undef toupper
#define toupper(c) (touppertab[(u_char)(c)])
#undef isalpha
#undef isdigit
#undef isxdigit
#undef isalnum
#undef isprint
#undef isascii
#undef isgraph
#undef ispunct
#undef islower
#undef isupper
#undef isspace
#undef iscntrl
extern MODVAR unsigned char char_atribs[];
#define PRINT 1
#define CNTRL 2
#define ALPHA 4
#define PUNCT 8
#define DIGIT 16
#define SPACE 32
#define ALLOW 64
#define ALLOWN 128
#ifndef KLINE_TEMP
#define KLINE_PERM 0
#define KLINE_TEMP 1
#define KLINE_AKILL 2
#define KLINE_EXCEPT 3
#endif
#define isallowed(c) (char_atribs[(u_char)(c)]&ALLOW)
#define iscntrl(c) (char_atribs[(u_char)(c)]&CNTRL)
#define isalpha(c) (char_atribs[(u_char)(c)]&ALPHA)
#define isspace(c) (char_atribs[(u_char)(c)]&SPACE)
#define islower(c) ((char_atribs[(u_char)(c)]&ALPHA) && ((u_char)(c) > 0x5f))
#define isupper(c) ((char_atribs[(u_char)(c)]&ALPHA) && ((u_char)(c) < 0x60))
#define isdigit(c) (char_atribs[(u_char)(c)]&DIGIT)
#define isxdigit(c) (isdigit(c) || ('a' <= (c) && (c) <= 'f') || \
('A' <= (c) && (c) <= 'F'))
#define isalnum(c) (char_atribs[(u_char)(c)]&(DIGIT|ALPHA))
#define isprint(c) (char_atribs[(u_char)(c)]&PRINT)
#define isascii(c) ((u_char)(c) >= 0 && (u_char)(c) <= 0x7f)
#define isgraph(c) ((char_atribs[(u_char)(c)]&PRINT) && ((u_char)(c) != 0x32))
#define ispunct(c) (!(char_atribs[(u_char)(c)]&(CNTRL|ALPHA|DIGIT)))
#define iswseperator(c) (!isalnum(c) && !((u_char)c >= 128))
/*
* Protocol support text. DO NO CHANGE THIS unless you know what
* you are doing.
*/
/* IRCu/Hybrid/Unreal way now :) -Stskeeps */
#define EXPAR1 extchmstr[0]
#define EXPAR2 extchmstr[1]
#define EXPAR3 extchmstr[2]
#define EXPAR4 extchmstr[3]
#ifdef PREFIX_AQ
#define CHPFIX "(qaohv)~&@%+"
#define CHPAR1 "beI"
#else
#define CHPFIX "(ohv)@%+"
#define CHPAR1 "beIqa"
#endif /* PREFIX_AQ */
#define CHPAR2 "k"
#define CHPAR3 "l"
#define CHPAR4 "psmntir"
#ifdef _WIN32
/*
* Used to display a string to the GUI interface.
* Windows' internal strerror() function doesn't work with socket errors.
*/
extern int DisplayString(HWND hWnd, char *InBuf, ...);
#else
typedef int SOCKET;
#define INVALID_SOCKET -1
#endif
#if defined(__FreeBSD__) || defined(__APPLE__)
extern char *malloc_options;
#endif
extern int lu_noninv, lu_inv, lu_serv, lu_oper,
lu_unknown, lu_channel, lu_lu, lu_lulocal, lu_lserv,
lu_clu, lu_mlu, lu_cglobalu, lu_mglobalu;
extern MODVAR time_t now;
#ifndef _WIN32
#if defined(__STDC__)
#define __const const
#define __signed signed
#define __volatile volatile
#ifndef __GNUC__
#define __inline
#endif
#else
#ifndef __GNUC__
#define __const
#define __inline
#define __signed
#define __volatile
#ifndef NO_ANSI_KEYWORDS
#define const /* delete ANSI C keywords */
#define inline
#define signed
#define volatile
#endif
#endif
#endif
#else
#define inline __inline
#endif
#define READBUF_SIZE 8192
#endif /* __common_include__ */

327
include/config.h Normal file
View File

@ -0,0 +1,327 @@
/*
* Unreal Internet Relay Chat Daemon, include/config.h
* Copyright (C) 1990 Jarkko Oikarinen
*
* $Id$
*
* 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.
*/
#ifndef __config_include__
#define __config_include__
#include "setup.h"
/* IMPORTANT:
* Under normal conditions, you should not have to edit this file. Run
* the ./Config script in the root directory instead!
*
* Windows is not a normal condition, edit this file if you use it. :-)
*/
/* Additional flags to give FreeBSD's malloc, only play with this if you
* know what you're doing.
*/
#define MALLOC_FLAGS_EXTRA ""
/* I/O Engine: determine what method to use.
* So, the way this works is we determine using the preprocessor
* what polling backend to use for the eventloop. We prefer epoll,
* followed by kqueue, followed by poll, and then finally select.
* Kind of ugly, but it gets the job done. You can also fiddle with
* this to determine what backend is used.
*/
#ifndef _WIN32
# ifdef HAVE_EPOLL
# define BACKEND_EPOLL
# else
# ifdef HAVE_KQUEUE
# define BACKEND_KQUEUE
# else
# ifdef HAVE_POLL
# define BACKEND_POLL
# else
# define BACKEND_SELECT
# endif
# endif
# endif
#else
# define BACKEND_SELECT
#endif
/* Define the ircd module suffix, should be .so on UNIX, and .dll on Windows. */
#ifndef _WIN32
# define MODULE_SUFFIX ".so"
#else
# define MODULE_SUFFIX ".dll"
#endif
/* Permit remote /rehash */
#define REMOTE_REHASH
/*
** Freelinks garbage collector -Stskeeps
**
** GARBAGE_COLLECT_EVERY - how many seconds between every garbage collect
** HOW_MANY_FREELINKS_ALLOWED - how many freelinks allowed
*/
#ifndef GARBAGE_COLLECT_EVERY
#define GARBAGE_COLLECT_EVERY 600 /* default: 600 (10 mins) */
#endif
#define HOW_MANY_FREELINKS_ALLOWED 200 /* default: 200 */
/*
* read/write are restarted after signals defining this 1, gets
* siginterrupt call compiled, which attempts to remove this
* behaviour (apollo sr10.1/bsd4.3 needs this)
*/
#ifdef APOLLO
#define RESTARTING_SYSTEMCALLS
#endif
/* DEBUGMODE: This should only be used when tracing a problem. It creates
* an insane amount of log output which can be very useful for debugging.
* You should *NEVER* enable this setting on production servers.
*/
/* #undef DEBUGMODE */
/* Similarly, DEBUG_IOENGINE can be used to debug the I/O engine. */
/* #undef DEBUG_IOENGINE */
/*
* Full pathnames and defaults of irc system's support files.
*/
#define CPATH CONFDIR"/unrealircd.conf" /* server configuration file */
#define MPATH CONFDIR"/ircd.motd" /* server MOTD file */
#define SMPATH CONFDIR"/ircd.smotd" /* short MOTD file */
#define RPATH CONFDIR"/ircd.rules" /* server rules file */
#define OPATH CONFDIR"/oper.motd" /* Operators MOTD file */
#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 PERMDATADIR"/ircd.tune" /* tuning .. */
/** FAKELAG_CONFIGURABLE makes it possible to make certain classes exempted
* from 'fake lag' (that is, the artificial delay that is added by the ircd
* to prevent flooding, which causes the messages/commands of the user to
* slow down). Naturally, incorrect use of this feature can cause SEVERE
* issues, in fact it can easily bring your whole IRCd down if one of the
* users with class::options::nofakelag does a good flood at full speed.
* Hence, this is disabled by default, and you need to explicitly enable it
* here IF YOU KNOW WHAT YOU ARE DOING. People complaining their ircd
* ""crashed"" because of this setting will be shot. </DISCLAIMER>
* Common usage for this are: a trusted bot ran by an IRCOp, that you only
* want to give "flood access" and nothing else, and other such things.
*/
#define FAKELAG_CONFIGURABLE
/* The default value for class::sendq */
#define DEFAULT_SENDQ 3000000
/* The default value for class::recvq */
#define DEFAULT_RECVQ 8000
/* You can define the nickname of NickServ here (usually "NickServ").
* This is ONLY used for the ""infamous IDENTIFY feature"", which is:
* whenever a user connects with a server password but there isn't
* a server password set, the password is sent to NickServ in an
* 'IDENTIFY <pass>' message.
*/
#define NickServ "NickServ"
/* STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP */
/* You shouldn't change anything below this line, unless absolutely needed. */
/*
* Maximum number of network connections your server will allow.
* On *NIX this is configured via ./Config so don't set it here.
* The setting below is the Windows (default) setting and isn't actually
* the maximum number of network connections but the highest FD (File
* Descriptor) that we can deal with.
*
* 2004-10-13: 1024 -> 4096
*/
#ifdef _WIN32
#define MAXCONNECTIONS 10240
#else
/* Non-Windows: */
#if (!defined(MAXCONNECTIONS_REQUEST) || (MAXCONNECTIONS_REQUEST < 1)) && \
(defined(HAVE_POLL) || defined(HAVE_EPOLL) || defined(HAVE_KQUEUE))
/* Have poll/epoll/kqueue and either no --with-maxconnections or
* --with-maxconnections=0, either of which indicates 'automatic' mode.
* At the time of writing we will try a limit of 8192.
* It will automatically be lowered at boottime if we can only use
* 4096, 2048 or 1024. No problem.
*/
#define MAXCONNECTIONS 8192
#elif defined(MAXCONNECTIONS_REQUEST) && (MAXCONNECTIONS_REQUEST >= 1)
/* --with-maxconnections=something */
#define MAXCONNECTIONS MAXCONNECTIONS_REQUEST
#else
/* Automatic mode, but we only have select(). Bummer... */
#define MAXCONNECTIONS 1024
#endif
#endif
/* Number of file descriptors reserved for non-incoming-clients.
* One of which may be used by auth, the rest are really reserved.
* They can be used for outgoing server links, listeners, logging, etc.
*/
#if MAXCONNECTIONS > 1024
#define CLIENTS_RESERVE 8
#else
#define CLIENTS_RESERVE 4
#endif
/*
* this defines the length of the nickname history. each time a user changes
* nickname or signs off, their old nickname is added to the top of the list.
* The following sizes are recommended:
* 8MB or less core memory : 500 (at least 1/4 of max users)
* 8MB-16MB core memory : 500-750 (1/4 -> 1/2 of max users)
* 16MB-32MB core memory : 750-1000 (1/2 -> 3/4 of max users)
* 32MB or more core memory : 1000+ (> 3/4 of max users)
* where max users is the expected maximum number of users.
* (100 nicks/users ~ 25k)
* NOTE: this is directly related to the amount of memory ircd will use whilst
* resident and running - it hardly ever gets swapped to disk! You can
* ignore these recommendations- they only are meant to serve as a guide
* NOTE: But the *Minimum* ammount should be 100, in order to make nick
* chasing possible for mode and kick.
*/
#ifndef NICKNAMEHISTORYLENGTH
#define NICKNAMEHISTORYLENGTH 2000
#endif
/*
* 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.
* 500ms in UnrealIRCd 4 (?)
* 250ms in UnrealIRCd 5.
*/
#define SOCKETLOOP_MAX_DELAY 250
/*
* Max time from the nickname change that still causes KILL
* automaticly to switch for the current nick of that user. (seconds)
*/
#define KILLCHASETIMELIMIT 30
/* Detect slow spamfilters? This requires a little more cpu time when processing
* any spamfilter (like on text/connect/..) but will save you from slowing down
* your IRCd to a near-halt (well, in most cases.. there are still cases like when
* it goes into a loop that it will still stall completely... forever..).
* This is kinda experimental, and requires getrusage.
*/
#ifndef _WIN32
#define SPAMFILTER_DETECTSLOW
#endif
/* Maximum number of ModData objects that may be attached to an object */
/* UnrealIRCd 4.0.0 - 4.0.13: 8, 8, 4, 4
* UnrealIRCd 4.0.14+ : 12, 8, 4, 4
* UnrealIRCd 5.0.0 : 12, 8, 8, 4, 4, 500, 500
*/
#define MODDATA_MAX_CLIENT 12
#define MODDATA_MAX_LOCAL_CLIENT 8
#define MODDATA_MAX_CHANNEL 8
#define MODDATA_MAX_MEMBER 4
#define MODDATA_MAX_MEMBERSHIP 4
#define MODDATA_MAX_LOCAL_VARIABLE 500
#define MODDATA_MAX_GLOBAL_VARIABLE 500
/* If EXPERIMENTAL is #define'd then all users will receive a notice about
* this when they connect, along with a pointer to bugs.unrealircd.org where
* they can report any problems. This is mainly to help UnrealIRCd development.
*/
#undef EXPERIMENTAL
/* Default SSL/TLS cipherlist (except for TLS1.3, see further down).
* This can be changed via set::ssl::options::ciphers in the config file.
*/
#define UNREALIRCD_DEFAULT_CIPHERS "TLS13-CHACHA20-POLY1305-SHA256 TLS13-AES-256-GCM-SHA384 TLS13-AES-128-GCM-SHA256 EECDH+CHACHA20 EECDH+AESGCM EECDH+AES AES256-GCM-SHA384 AES128-GCM-SHA256 AES256-SHA256 AES128-SHA256 AES256-SHA AES128-SHA"
/* Default TLS 1.3 ciphersuites.
* This can be changed via set::ssl::options::ciphersuites in the config file.
*/
#define UNREALIRCD_DEFAULT_CIPHERSUITES "TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384:TLS_AES_128_GCM_SHA256:TLS_AES_128_CCM_8_SHA256:TLS_AES_128_CCM_SHA256"
/* Default SSL/TLS curves for ECDH(E)
* This can be changed via set::ssl::options::ecdh-curve in the config file.
* NOTE: This requires openssl 1.0.2 or newer, otherwise these defaults
* are not applied, due to the missing openssl API call.
*/
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
#define UNREALIRCD_DEFAULT_ECDH_CURVES "X25519:secp521r1:secp384r1:prime256v1"
#else
#define UNREALIRCD_DEFAULT_ECDH_CURVES "secp521r1:secp384r1:prime256v1"
#endif
/* ------------------------- END CONFIGURATION SECTION -------------------- */
#define MOTD MPATH
#define RULES RPATH
#define MYNAME BINDIR "/unrealircd"
#define CONFIGFILE CPATH
#define IRCD_PIDFILE PIDFILE
#ifdef DEBUGMODE
#define Debug(x) debug x
#define LOGFILE LPATH
#else
#define Debug(x) ;
#define LOGFILE "/dev/null"
#endif
#if defined(DEFAULT_RECVQ)
# if (DEFAULT_RECVQ < 512)
error DEFAULT_RECVQ needs redefining.
# endif
#else
error DEFAULT_RECVQ undefined
#endif
#if (NICKNAMEHISTORYLENGTH < 100)
# define NICKNAMEHISTORYLENGTH 100
#endif
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && \
((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \
!defined(__cplusplus)
#define GCC_TYPECHECKING
/* copied from cURL: */
#define _UNREAL_WARNING(id, message) \
static void __attribute__((__warning__(message))) \
__attribute__((__unused__)) __attribute__((__noinline__)) \
id(void) { __asm__(""); }
#define _UNREAL_ERROR(id, message) \
static void __attribute__((__error__(message))) \
__attribute__((__unused__)) __attribute__((__noinline__)) \
id(void) { __asm__(""); }
#endif
#ifndef __has_feature
#define __has_feature(x) 0 // Compatibility with non-clang compilers.
#endif
#ifndef __has_extension
#define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
#endif
#endif /* __config_include__ */

27
include/crypt_blowfish.h Normal file
View File

@ -0,0 +1,27 @@
/*
* Written by Solar Designer <solar at openwall.com> in 2000-2011.
* No copyright is claimed, and the software is hereby placed in the public
* domain. In case this attempt to disclaim copyright and place the software
* in the public domain is deemed null and void, then the software is
* Copyright (c) 2000-2011 Solar Designer and it is hereby released to the
* general public under the following terms:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted.
*
* There's ABSOLUTELY NO WARRANTY, express or implied.
*
* See crypt_blowfish.c for more information.
*/
#ifndef _CRYPT_BLOWFISH_H
#define _CRYPT_BLOWFISH_H
extern int _crypt_output_magic(const char *setting, char *output, int size);
extern char *_crypt_blowfish_rn(const char *key, const char *setting,
char *output, int size);
extern char *_crypt_gensalt_blowfish_rn(const char *prefix,
unsigned long count,
const char *input, int size, char *output, int output_size);
#endif

101
include/dbuf.h Normal file
View File

@ -0,0 +1,101 @@
/************************************************************************
* Unreal Internet Relay Chat Daemon, include/dbuf.h
* Copyright (C) 1990 Markku Savela
* Copyright (C) 2013 William Pitcock <nenolod@dereferenced.org>
*
* 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.
*
* $Id$
*/
#ifndef __dbuf_include__
#define __dbuf_include__
#include "list.h"
/* 512 bytes -- 510 character bytes + \r\n, per rfc1459 */
#define DBUF_BLOCK_SIZE (512)
/*
** dbuf is a collection of functions which can be used to
** maintain a dynamic buffering of a byte stream.
** Functions allocate and release memory dynamically as
** required [Actually, there is nothing that prevents
** this package maintaining the buffer on disk, either]
*/
/*
** These structure definitions are only here to be used
** as a whole, *DO NOT EVER REFER TO THESE FIELDS INSIDE
** THE STRUCTURES*! It must be possible to change the internal
** implementation of this package without changing the
** interface.
*/
typedef struct dbuf {
u_int length; /* Current number of bytes stored */
// u_int offset; /* Offset to the first byte */
struct list_head dbuf_list;
} dbuf;
/*
** And this 'dbufbuf' should never be referenced outside the
** implementation of 'dbuf'--would be "hidden" if C had such
** keyword...
** If it was possible, this would compile to be exactly 1 memory
** page in size. 2048 bytes seems to be the most common size, so
** as long as a pointer is 4 bytes, we get 2032 bytes for buffer
** data after we take away a bit for malloc to play with. -avalon
*/
typedef struct dbufbuf {
struct list_head dbuf_node;
size_t size;
char data[DBUF_BLOCK_SIZE];
} dbufbuf;
/*
** dbuf_put
** Append the number of bytes to the buffer, allocating more
** memory as needed. Bytes are copied into internal buffers
** from users buffer.
*/
void dbuf_put(dbuf *, char *, size_t);
/* Dynamic buffer header */
/* Pointer to data to be stored */
/* Number of bytes to store */
void dbuf_delete(dbuf *, size_t);
/* Dynamic buffer header */
/* Number of bytes to delete */
/*
** DBufLength
** Return the current number of bytes stored into the buffer.
** (One should use this instead of referencing the internal
** length field explicitly...)
*/
#define DBufLength(dyn) ((dyn)->length)
/*
** DBufClear
** Scratch the current content of the buffer. Release all
** allocated buffers and make it empty.
*/
#define DBufClear(dyn) dbuf_delete((dyn),DBufLength(dyn))
extern int dbuf_getmsg(dbuf *, char *);
extern void dbuf_queue_init(dbuf *dyn);
extern void dbuf_init(void);
#endif /* __dbuf_include__ */

72
include/dns.h Normal file
View File

@ -0,0 +1,72 @@
/* OMG... OMG! WHAT AN INCLUDE HORROR !!! */
#include <ares.h>
#include <ares_version.h>
typedef enum {
DNSREQ_CLIENT = 1,
DNSREQ_LINKCONF = 2,
DNSREQ_CONNECT = 3
} DNSReqType;
typedef struct DNSReq DNSReq;
/* Depending on the request type, some fields are filled in:
* cptr: DNSREQ_CLIENT, DNSREQ_CONNECT
* link: DNSREQ_LINKCONF, DNSREQ_CONNECT
*/
struct DNSReq {
DNSReq *prev, *next;
char *name; /**< Name being resolved (only for DNSREQ_LINKCONF and DNSREQ_CONNECT) */
char ipv6; /**< Resolving for ipv6 or ipv4? */
DNSReqType type; /**< DNS Request type (DNSREQ_*) */
Client *client; /**< Client the request is for, NULL if client died OR unavailable */
ConfigItem_link *linkblock; /**< Linkblock */
};
typedef struct DNSCache DNSCache;
struct DNSCache {
DNSCache *prev, *next; /**< Previous and next in linked list */
DNSCache *hprev, *hnext; /**< Previous and next in hash list */
char *name; /**< The hostname */
char *ip; /**< The IP address */
time_t expires; /**< When record expires */
};
typedef struct DNSStats DNSStats;
struct DNSStats {
unsigned int cache_hits;
unsigned int cache_misses;
unsigned int cache_adds;
};
/** Time to keep cache records. */
#define DNSCACHE_TTL 600
/** Size of the hash table (prime!).
* Consumes <this>*4 on ia32 and <this>*4 on 64 bit
* 241 seems a good bet.. which ~1k on ia32 and ~2k on ia64.
*/
#define DNS_HASH_SIZE 241
/** Max # of entries we want in our cache.
* This:
* a) prevents us from using too much memory, and
* b) prevents us from keeping useless cache records
*
* A dnscache item is roughly ~80 bytes in size (slightly more on x86),
* so 241*80=~20k, which seems reasonable ;).
*/
#define DNS_MAX_ENTRIES DNS_HASH_SIZE
extern ares_channel resolver_channel;
extern void init_resolver(int);
struct hostent *unrealdns_doclient(Client *cptr);
extern void unreal_gethostbyname(const char *name, int family, ares_host_callback callback, void *arg);

375
include/dynconf.h Normal file
View File

@ -0,0 +1,375 @@
/************************************************************************
* Unreal Internet Relay Chat Daemon, include/dynconf.h
* Copyright (C) 1999 Carsten Munk
*
* 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.
*
* $Id$
*/
#define DYNCONF_H
typedef struct NetworkConfiguration NetworkConfiguration;
struct NetworkConfiguration {
unsigned x_inah:1;
char *x_ircnetwork;
char *x_ircnet005;
char *x_defserv;
char *x_services_name;
char *x_hidden_host;
char *x_prefix_quit;
char *x_helpchan;
char *x_stats_server;
char *x_sasl_server;
};
enum UHAllowed { UHALLOW_ALWAYS, UHALLOW_NOCHANS, UHALLOW_REJOIN, UHALLOW_NEVER };
struct ChMode {
long mode;
long extmodes;
char *extparams[EXTCMODETABLESZ];
};
typedef struct OperStat {
struct OperStat *prev, *next;
char *flag;
} OperStat;
typedef enum BroadcastChannelMessagesOption { BROADCAST_CHANNEL_MESSAGES_AUTO=1, BROADCAST_CHANNEL_MESSAGES_ALWAYS=2, BROADCAST_CHANNEL_MESSAGES_NEVER=3 } BroadcastChannelMessagesOption;
typedef enum AllowedChannelChars { ALLOWED_CHANNELCHARS_ANY=1, ALLOWED_CHANNELCHARS_ASCII=2, ALLOWED_CHANNELCHARS_UTF8=3 } AllowedChannelChars;
typedef enum BanTarget { BAN_TARGET_IP=1, BAN_TARGET_USERIP=2, BAN_TARGET_HOST=3, BAN_TARGET_USERHOST=4, BAN_TARGET_ACCOUNT=5, BAN_TARGET_CERTFP=6 } BanTarget;
/** The set { } block configuration */
typedef struct Configuration Configuration;
struct Configuration {
unsigned som:1;
unsigned hide_ulines:1;
unsigned flat_map:1;
unsigned allow_chatops:1;
unsigned ident_check:1;
unsigned fail_oper_warn:1;
unsigned show_connect_info:1;
unsigned no_connect_tls_info:1;
unsigned dont_resolve:1;
unsigned use_ban_version:1;
unsigned mkpasswd_for_everyone:1;
unsigned hide_ban_reason;
unsigned allow_insane_bans;
unsigned allow_part_if_shunned:1;
unsigned disable_cap:1;
unsigned check_target_nick_bans:1;
unsigned use_egd : 1;
char *dns_bindip;
char *link_bindip;
long throttle_period;
char throttle_count;
char *kline_address;
char *gline_address;
long conn_modes;
long oper_modes;
char *oper_snomask;
char *auto_join_chans;
char *oper_auto_join_chans;
char *allow_user_stats;
OperStat *allow_user_stats_ext;
int ping_warning;
int maxchannelsperuser;
int maxdccallow;
int anti_spam_quit_message_time;
char *egd_path;
char *static_quit;
char *static_part;
TLSOptions *tls_options;
Policy plaintext_policy_user;
char *plaintext_policy_user_message;
Policy plaintext_policy_oper;
char *plaintext_policy_oper_message;
Policy plaintext_policy_server;
Policy outdated_tls_policy_user;
char *outdated_tls_policy_user_message;
Policy outdated_tls_policy_oper;
char *outdated_tls_policy_oper_message;
Policy outdated_tls_policy_server;
enum UHAllowed userhost_allowed;
char *restrict_usermodes;
char *restrict_channelmodes;
char *restrict_extendedbans;
char *channel_command_prefix;
long unknown_flood_bantime;
long unknown_flood_amount;
struct ChMode modes_on_join;
int level_on_join;
unsigned char away_count;
long away_period;
unsigned char nick_count;
long nick_period;
unsigned char invite_count;
long invite_period;
unsigned char knock_count;
long knock_period;
unsigned char max_concurrent_conversations_users;
unsigned char max_concurrent_conversations_new_user_every;
int ident_connect_timeout;
int ident_read_timeout;
long default_bantime;
int who_limit;
int silence_limit;
long ban_version_tkl_time;
long spamfilter_ban_time;
char *spamfilter_ban_reason;
char *spamfilter_virus_help_channel;
char spamfilter_vchan_deny;
SpamExcept *spamexcept;
char *spamexcept_line;
long spamfilter_detectslow_warn;
long spamfilter_detectslow_fatal;
int spamfilter_stop_on_first_match;
int maxbans;
int maxbanlength;
int watch_away_notification;
int uhnames;
NetworkConfiguration network;
unsigned short default_ipv6_clone_mask;
int ping_cookie;
int min_nick_length;
int nick_length;
int topic_length;
int kick_length;
int quit_length;
int away_length;
int hide_list;
int max_unknown_connections_per_ip;
long handshake_timeout;
long sasl_timeout;
long handshake_delay;
BanTarget automatic_ban_target;
BanTarget manual_ban_target;
char *reject_message_too_many_connections;
char *reject_message_server_full;
char *reject_message_unauthorized;
char *reject_message_kline;
char *reject_message_gline;
int topic_setter;
int ban_setter;
int ban_setter_sync;
int part_instead_of_quit_on_comment_change;
BroadcastChannelMessagesOption broadcast_channel_messages;
AllowedChannelChars allowed_channelchars;
};
extern MODVAR Configuration iConf;
extern MODVAR Configuration tempiConf;
extern MODVAR int ipv6_disabled;
#define KLINE_ADDRESS iConf.kline_address
#define GLINE_ADDRESS iConf.gline_address
#define CONN_MODES iConf.conn_modes
#define OPER_MODES iConf.oper_modes
#define OPER_SNOMASK iConf.oper_snomask
#define SHOWOPERMOTD iConf.som
#define HIDE_ULINES iConf.hide_ulines
#define FLAT_MAP iConf.flat_map
#define ALLOW_CHATOPS iConf.allow_chatops
#define PINGWARNING iConf.ping_warning
#define MAXCHANNELSPERUSER iConf.maxchannelsperuser
#define MAXDCCALLOW iConf.maxdccallow
#define DONT_RESOLVE iConf.dont_resolve
#define AUTO_JOIN_CHANS iConf.auto_join_chans
#define OPER_AUTO_JOIN_CHANS iConf.oper_auto_join_chans
#define DNS_BINDIP iConf.dns_bindip
#define LINK_BINDIP iConf.link_bindip
#define IDENT_CHECK iConf.ident_check
#define FAILOPER_WARN iConf.fail_oper_warn
#define SHOWCONNECTINFO iConf.show_connect_info
#define NOCONNECTTLSLINFO iConf.no_connect_tls_info
#define ALLOW_USER_STATS iConf.allow_user_stats
#define ANTI_SPAM_QUIT_MSG_TIME iConf.anti_spam_quit_message_time
#ifdef HAVE_RAND_EGD
#define USE_EGD iConf.use_egd
#else
#define USE_EGD 0
#endif
#define EGD_PATH iConf.egd_path
#define ircnetwork iConf.network.x_ircnetwork
#define ircnet005 iConf.network.x_ircnet005
#define defserv iConf.network.x_defserv
#define SERVICES_NAME iConf.network.x_services_name
#define hidden_host iConf.network.x_hidden_host
#define helpchan iConf.network.x_helpchan
#define STATS_SERVER iConf.network.x_stats_server
#define SASL_SERVER iConf.network.x_sasl_server
#define iNAH iConf.network.x_inah
#define PREFIX_QUIT iConf.network.x_prefix_quit
#define STATIC_QUIT iConf.static_quit
#define STATIC_PART iConf.static_part
#define UHOST_ALLOWED iConf.userhost_allowed
#define RESTRICT_USERMODES iConf.restrict_usermodes
#define RESTRICT_CHANNELMODES iConf.restrict_channelmodes
#define RESTRICT_EXTENDEDBANS iConf.restrict_extendedbans
#define THROTTLING_PERIOD iConf.throttle_period
#define THROTTLING_COUNT iConf.throttle_count
#define USE_BAN_VERSION iConf.use_ban_version
#define UNKNOWN_FLOOD_BANTIME iConf.unknown_flood_bantime
#define UNKNOWN_FLOOD_AMOUNT iConf.unknown_flood_amount
#define MODES_ON_JOIN iConf.modes_on_join.mode
#define LEVEL_ON_JOIN iConf.level_on_join
#define AWAY_PERIOD iConf.away_period
#define AWAY_COUNT iConf.away_count
#define NICK_PERIOD iConf.nick_period
#define NICK_COUNT iConf.nick_count
#define KNOCK_PERIOD iConf.knock_period
#define KNOCK_COUNT iConf.knock_count
#define INVITE_PERIOD iConf.invite_period
#define INVITE_COUNT iConf.invite_count
#define IDENT_CONNECT_TIMEOUT iConf.ident_connect_timeout
#define IDENT_READ_TIMEOUT iConf.ident_read_timeout
#define MKPASSWD_FOR_EVERYONE iConf.mkpasswd_for_everyone
#define HIDE_BAN_REASON iConf.hide_ban_reason
#define ALLOW_INSANE_BANS iConf.allow_insane_bans
#define CHANCMDPFX iConf.channel_command_prefix
#define DEFAULT_BANTIME iConf.default_bantime
#define WHOLIMIT iConf.who_limit
#define ALLOW_PART_IF_SHUNNED iConf.allow_part_if_shunned
#define DISABLE_CAP iConf.disable_cap
#define DISABLE_IPV6 ipv6_disabled
#define BAN_VERSION_TKL_TIME iConf.ban_version_tkl_time
#define SILENCE_LIMIT (iConf.silence_limit ? iConf.silence_limit : 15)
#define SPAMFILTER_BAN_TIME iConf.spamfilter_ban_time
#define SPAMFILTER_BAN_REASON iConf.spamfilter_ban_reason
#define SPAMFILTER_VIRUSCHAN iConf.spamfilter_virus_help_channel
#define SPAMFILTER_VIRUSCHANDENY iConf.spamfilter_vchan_deny
#define SPAMFILTER_EXCEPT iConf.spamexcept_line
#define SPAMFILTER_DETECTSLOW_WARN iConf.spamfilter_detectslow_warn
#define SPAMFILTER_DETECTSLOW_FATAL iConf.spamfilter_detectslow_fatal
#define SPAMFILTER_STOP_ON_FIRST_MATCH iConf.spamfilter_stop_on_first_match
#define CHECK_TARGET_NICK_BANS iConf.check_target_nick_bans
#define MAXBANS iConf.maxbans
#define MAXBANLENGTH iConf.maxbanlength
#define WATCH_AWAY_NOTIFICATION iConf.watch_away_notification
#define UHNAMES_ENABLED iConf.uhnames
/** Used for testing the set { } block configuration.
* It tests if a setting is present and is also used for duplicate checking.
*/
struct SetCheck {
unsigned has_show_opermotd:1;
unsigned has_hide_ulines:1;
unsigned has_flat_map:1;
unsigned has_allow_chatops:1;
unsigned has_ident_check:1;
unsigned has_fail_oper_warn:1;
unsigned has_show_connect_info:1;
unsigned has_dont_resolve:1;
unsigned has_mkpasswd_for_everyone:1;
unsigned has_allow_part_if_shunned:1;
unsigned has_tls_server_cipher_list :1;
unsigned has_tls_protocols :1;
unsigned has_dns_bind_ip:1;
unsigned has_link_bind_ip:1;
unsigned has_throttle_period:1;
unsigned has_throttle_connections:1;
unsigned has_kline_address:1;
unsigned has_gline_address:1;
unsigned has_modes_on_connect:1;
unsigned has_modes_on_oper:1;
unsigned has_snomask_on_connect:1;
unsigned has_snomask_on_oper:1;
unsigned has_auto_join:1;
unsigned has_oper_auto_join:1;
unsigned has_check_target_nick_bans:1;
unsigned has_watch_away_notification:1;
unsigned has_uhnames:1;
unsigned has_allow_user_stats:1;
unsigned has_ping_warning:1;
unsigned has_maxchannelsperuser:1;
unsigned has_maxdccallow:1;
unsigned has_anti_spam_quit_message_time:1;
unsigned has_egd_path:1;
unsigned has_static_quit:1;
unsigned has_static_part:1;
unsigned has_allow_userhost_change:1;
unsigned has_restrict_usermodes:1;
unsigned has_restrict_channelmodes:1;
unsigned has_restrict_extendedbans:1;
unsigned has_channel_command_prefix:1;
unsigned has_anti_flood_unknown_flood_bantime:1;
unsigned has_anti_flood_unknown_flood_amount:1;
unsigned has_modes_on_join:1;
unsigned has_level_on_join:1;
unsigned has_anti_flood_away_count:1;
unsigned has_anti_flood_away_period:1;
unsigned has_anti_flood_nick_flood:1;
unsigned has_anti_flood_connect_flood:1;
unsigned has_anti_flood_invite_flood:1;
unsigned has_anti_flood_knock_flood:1;
unsigned has_ident_connect_timeout:1;
unsigned has_ident_read_timeout:1;
unsigned has_default_bantime:1;
unsigned has_who_limit:1;
unsigned has_maxbans:1;
unsigned has_maxbanlength:1;
unsigned has_silence_limit:1;
unsigned has_ban_version_tkl_time:1;
unsigned has_spamfilter_ban_time:1;
unsigned has_spamfilter_ban_reason:1;
unsigned has_spamfilter_virus_help_channel:1;
unsigned has_spamfilter_virus_help_channel_deny:1;
unsigned has_spamfilter_except:1;
unsigned has_network_name:1;
unsigned has_default_server:1;
unsigned has_services_server:1;
unsigned has_sasl_server:1;
unsigned has_hiddenhost_prefix:1;
unsigned has_prefix_quit:1;
unsigned has_help_channel:1;
unsigned has_stats_server:1;
unsigned has_cloak_keys:1;
unsigned has_options_hide_ulines:1;
unsigned has_options_flat_map:1;
unsigned has_options_show_opermotd:1;
unsigned has_options_identd_check:1;
unsigned has_options_fail_oper_warn:1;
unsigned has_options_dont_resolve:1;
unsigned has_options_show_connect_info:1;
unsigned has_options_no_connect_tls_info:1;
unsigned has_options_mkpasswd_for_everyone:1;
unsigned has_options_allow_insane_bans:1;
unsigned has_options_allow_part_if_shunned:1;
unsigned has_options_disable_cap:1;
unsigned has_options_disable_ipv6:1;
unsigned has_ping_cookie:1;
unsigned has_min_nick_length:1;
unsigned has_nick_length:1;
unsigned has_hide_ban_reason:1;
};

52
include/fdlist.h Normal file
View File

@ -0,0 +1,52 @@
#ifndef FDLIST_H
#define FDLIST_H
/* $Id$ */
#define FD_DESC_SZ (100)
typedef void (*IOCallbackFunc)(int fd, int revents, void *data);
typedef struct fd_entry {
int fd;
char desc[FD_DESC_SZ];
IOCallbackFunc read_callback;
IOCallbackFunc write_callback;
void *data;
time_t deadline;
unsigned char is_open;
unsigned int backend_flags;
} FDEntry;
extern MODVAR FDEntry fd_table[MAXCONNECTIONS + 1];
extern int fd_open(int fd, const char *desc);
extern void fd_close(int fd);
extern int fd_unmap(int fd);
extern void fd_unnotify(int fd);
extern int fd_socket(int family, int type, int protocol, const char *desc);
extern int fd_accept(int sockfd);
extern void fd_desc(int fd, const char *desc);
extern int fd_fileopen(const char *path, unsigned int flags);
#define FD_SELECT_READ 0x1
#define FD_SELECT_WRITE 0x2
/* Socket buffer sizes for clients and servers
* Note that these have been carefully chosen so you shouldn't touch these.
* If you make these much higher then be aware that this means you loose
* send queue / receive queue protection, otherwise known as "Excess flood"
* and "SendQ Exceeded", since these queues are ON TOP of UnrealIRCd's
* own queueing mechanism, it uses the OS TCP Socket queue.
*/
#define USER_SOCKET_RECEIVE_BUFFER 8192
#define USER_SOCKET_SEND_BUFFER 32768
#define SERVER_SOCKET_RECEIVE_BUFFER 131072
#define SERVER_SOCKET_SEND_BUFFER 131072
extern void fd_setselect(int fd, int flags, IOCallbackFunc iocb, void *data);
extern void fd_select(time_t delay); /* backend-specific */
extern void fd_refresh(int fd); /* backend-specific */
extern void fd_fork(); /* backend-specific */
#endif

967
include/h.h Normal file
View File

@ -0,0 +1,967 @@
/************************************************************************
* Unreal Internet Relay Chat Daemon, include/h.h
* Copyright (C) 1992 Darren Reed
*
* 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.
*
* $Id$
*/
/*
* "h.h". - Headers file.
*
* Most of the externs and prototypes thrown in here to 'cleanup' things.
* -avalon
*/
#include "setup.h"
#include "fdlist.h"
extern MODVAR char *extraflags;
extern MODVAR int tainted;
/* for the new s_err.c */
extern char *getreply(int);
#define rpl_str(x) getreply(x)
#define err_str(x) getreply(x)
extern MODVAR Member *freemember;
extern MODVAR Membership *freemembership;
extern MODVAR Client me;
extern MODVAR Channel *channels;
extern MODVAR ModData local_variable_moddata[MODDATA_MAX_LOCAL_VARIABLE];
extern MODVAR ModData global_variable_moddata[MODDATA_MAX_GLOBAL_VARIABLE];
extern MODVAR IRCStatistics ircstats;
extern MODVAR int bootopt;
extern MODVAR time_t timeofday;
extern MODVAR struct timeval timeofday_tv;
extern MODVAR char cmodestring[512];
extern MODVAR char umodestring[UMODETABLESZ+1];
/* newconf */
#define get_sendq(x) ((x)->local->class ? (x)->local->class->sendq : DEFAULT_SENDQ)
/* get_recvq is only called in send.c for local connections */
#define get_recvq(x) ((x)->local->class->recvq ? (x)->local->class->recvq : DEFAULT_RECVQ)
/* Configuration preprocessor */
extern PreprocessorItem parse_preprocessor_item(char *start, char *end, char *filename, int linenumber, ConditionalConfig **cc);
extern void preprocessor_cc_duplicate_list(ConditionalConfig *r, ConditionalConfig **out);
extern void preprocessor_cc_free_level(ConditionalConfig **cc_list, int level);
extern void preprocessor_cc_free_list(ConditionalConfig *cc);
extern void preprocessor_resolve_conditionals_ce(ConfigEntry **ce_list, PreprocessorPhase phase);
extern void preprocessor_resolve_conditionals_all(PreprocessorPhase phase);
extern void free_config_defines(void);
extern void preprocessor_replace_defines(char **item, ConfigEntry *ce);
/*
* Configuration linked lists
*/
extern MODVAR ConfigItem_me *conf_me;
extern MODVAR ConfigItem_files *conf_files;
extern MODVAR ConfigItem_class *conf_class;
extern MODVAR ConfigItem_class *default_class;
extern MODVAR ConfigItem_admin *conf_admin;
extern MODVAR ConfigItem_admin *conf_admin_tail;
extern MODVAR ConfigItem_drpass *conf_drpass;
extern MODVAR ConfigItem_ulines *conf_ulines;
extern MODVAR ConfigItem_tld *conf_tld;
extern MODVAR ConfigItem_oper *conf_oper;
extern MODVAR ConfigItem_listen *conf_listen;
extern MODVAR ConfigItem_allow *conf_allow;
extern MODVAR ConfigItem_except *conf_except;
extern MODVAR ConfigItem_vhost *conf_vhost;
extern MODVAR ConfigItem_link *conf_link;
extern MODVAR ConfigItem_sni *conf_sni;
extern MODVAR ConfigItem_ban *conf_ban;
extern MODVAR ConfigItem_deny_channel *conf_deny_channel;
extern MODVAR ConfigItem_deny_link *conf_deny_link;
extern MODVAR ConfigItem_allow_channel *conf_allow_channel;
extern MODVAR ConfigItem_deny_version *conf_deny_version;
extern MODVAR ConfigItem_log *conf_log;
extern MODVAR ConfigItem_alias *conf_alias;
extern MODVAR ConfigItem_include *conf_include;
extern MODVAR ConfigItem_help *conf_help;
extern MODVAR ConfigItem_offchans *conf_offchans;
extern void completed_connection(int, int, void *);
extern void clear_unknown();
extern EVENT(e_unload_module_delayed);
extern EVENT(throttling_check_expire);
extern void module_loadall(void);
extern long set_usermode(char *umode);
extern char *get_usermode_string_raw(long umodes);
extern ConfigFile *config_parse(char *filename, char *confdata);
extern ConfigFile *config_parse_with_offset(char *filename, char *confdata, unsigned int line_offset);
extern void config_error(FORMAT_STRING(const char *format), ...) __attribute__((format(printf,1,2)));
extern void config_warn(FORMAT_STRING(const char *format), ...) __attribute__((format(printf,1,2)));
extern void config_error_missing(const char *filename, int line, const char *entry);
extern void config_error_unknown(const char *filename, int line, const char *block, const char *entry);
extern void config_error_unknownflag(const char *filename, int line, const char *block, const char *entry);
extern void config_error_unknownopt(const char *filename, int line, const char *block, const char *entry);
extern void config_error_noname(const char *filename, int line, const char *block);
extern void config_error_blank(const char *filename, int line, const char *block);
extern void config_error_empty(const char *filename, int line, const char *block, const char *entry);
extern void config_warn_duplicate(const char *filename, int line, const char *entry);
extern int config_is_blankorempty(ConfigEntry *cep, const char *block);
extern MODVAR int config_verbose;
extern void config_progress(FORMAT_STRING(const char *format), ...) __attribute__((format(printf,1,2)));
extern void config_entry_free(ConfigEntry *ce);
extern void config_entry_free_all(ConfigEntry *ce);
extern ConfigFile *config_load(char *filename, char *displayname);
extern void config_free(ConfigFile *cfptr);
extern void ipport_seperate(char *string, char **ip, char **port);
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, int ipv6);
extern ConfigItem_sni *find_sni(char *name);
extern ConfigItem_ulines *find_uline(char *host);
extern ConfigItem_except *find_except(Client *, short type);
extern ConfigItem_tld *find_tld(Client *cptr);
extern ConfigItem_link *find_link(char *servername, Client *acptr);
extern ConfigItem_ban *find_ban(Client *, char *host, short type);
extern ConfigItem_ban *find_banEx(Client *,char *host, short type, short type2);
extern ConfigItem_vhost *find_vhost(char *name);
extern ConfigItem_deny_channel *find_channel_allowed(Client *cptr, char *name);
extern ConfigItem_alias *find_alias(char *name);
extern ConfigItem_help *find_Help(char *command);
extern OperPermission ValidatePermissionsForPath(char *path, Client *client, Client *victim, Channel *channel, void *extra);
extern void OperClassValidatorDel(OperClassValidator *validator);
extern ConfigItem_ban *find_ban_ip(Client *client);
extern void add_ListItem(ListStruct *, ListStruct **);
extern void append_ListItem(ListStruct *item, ListStruct **list);
extern void add_ListItemPrio(ListStructPrio *, ListStructPrio **, int);
extern void del_ListItem(ListStruct *, ListStruct **);
extern MODVAR LoopStruct loop;
extern int del_banid(Channel *channel, char *banid);
extern int del_exbanid(Channel *channel, char *banid);
#define REPORT_DO_DNS "NOTICE * :*** Looking up your hostname...\r\n"
#define REPORT_FIN_DNS "NOTICE * :*** Found your hostname\r\n"
#define REPORT_FIN_DNSC "NOTICE * :*** Found your hostname (cached)\r\n"
#define REPORT_FAIL_DNS "NOTICE * :*** Couldn't resolve your hostname; using your IP address instead\r\n"
#define REPORT_DO_ID "NOTICE * :*** Checking ident...\r\n"
#define REPORT_FIN_ID "NOTICE * :*** Received identd response\r\n"
#define REPORT_FAIL_ID "NOTICE * :*** No ident response; username prefixed with ~\r\n"
extern MODVAR int R_do_dns, R_fin_dns, R_fin_dnsc, R_fail_dns, R_do_id, R_fin_id, R_fail_id;
extern MODVAR struct list_head client_list;
extern MODVAR struct list_head lclient_list;
extern MODVAR struct list_head server_list;
extern MODVAR struct list_head oper_list;
extern MODVAR struct list_head unknown_list;
extern MODVAR struct list_head global_server_list;
extern MODVAR struct list_head dead_list;
extern RealCommand *find_command(char *cmd, int flags);
extern RealCommand *find_command_simple(char *cmd);
extern Channel *find_channel(char *, Channel *);
extern Membership *find_membership_link(Membership *lp, Channel *ptr);
extern Member *find_member_link(Member *, Client *);
extern int remove_user_from_channel(Client *, Channel *);
extern void add_server_to_table(Client *);
extern void remove_server_from_table(Client *);
extern void iNAH_host(Client *client, char *host);
extern void set_snomask(Client *client, char *snomask);
extern char *get_snomask_string(Client *client);
extern int check_tkls(Client *cptr);
/* for services */
extern void del_invite(Client *, Channel *);
extern void send_user_joins(Client *, Client *);
extern int valid_channelname(const char *);
extern int valid_server_name(char *name);
extern long get_access(Client *, Channel *);
extern int ban_check_mask(Client *, Channel *, char *, int, char **, char **, int);
extern int extban_is_ok_nuh_extban(Client *, Channel *, char *, int, int, int);
extern char *extban_conv_param_nuh_or_extban(char *);
extern char *extban_conv_param_nuh(char *);
extern Ban *is_banned(Client *, Channel *, int, char **, char **);
extern Ban *is_banned_with_nick(Client *, Channel *, int, char *, char **, char **);
extern void ircd_log(int, FORMAT_STRING(const char *), ...) __attribute__((format(printf,2,3)));
extern Client *find_client(char *, Client *);
extern Client *find_name(char *, Client *);
extern Client *find_nickserv(char *, Client *);
extern Client *find_person(char *, Client *);
extern Client *find_server(char *, Client *);
extern Client *find_service(char *, Client *);
#define find_server_quick(x) find_server(x, NULL)
extern char *find_or_add(char *);
extern void inittoken();
extern void reset_help();
extern MODVAR char *debugmode, *configfile, *sbrk0;
extern char *getfield(char *);
extern void set_sockhost(Client *, char *);
#ifdef _WIN32
extern MODFUNC char *sock_strerror(int);
#endif
extern int dgets(int, char *, int);
#ifdef _WIN32
extern MODVAR int debuglevel;
#else
extern int debuglevel, errno, h_errno;
#endif
extern MODVAR int OpenFiles; /* number of files currently open */
extern MODVAR int debuglevel, portnum, debugtty, maxusersperchannel;
extern MODVAR int readcalls, udpfd, resfd;
extern Client *add_connection(ConfigItem_listen *, int);
extern void add_local_domain(char *, int);
extern int check_server_init(Client *);
extern void close_connection(Client *);
extern void close_unbound_listeners();
extern int connect_server(ConfigItem_link *, Client *, struct hostent *);
extern void get_my_name(Client *, char *, int);
extern int get_sockerr(Client *);
extern int inetport(ConfigItem_listen *, char *, int, int);
extern void init_sys();
extern void check_user_limit(void);
extern void init_modef();
extern int verify_hostname(char *name);
extern void report_error(char *, Client *);
extern int setup_ping();
extern void set_channel_mlock(Client *, Channel *, const char *, int);
extern void restart(char *);
extern void server_reboot(char *);
extern void terminate(), write_pidfile();
extern void *safe_alloc(size_t size);
extern void set_socket_buffers(int fd, int rcvbuf, int sndbuf);
extern int send_queued(Client *);
extern void send_queued_cb(int fd, int revents, void *data);
extern void sendto_connectnotice(Client *client, int disconnect, char *comment);
extern void sendto_serv_butone_nickcmd(Client *one, Client *client, char *umodes);
extern void sendto_message_one(Client *to, Client *from, char *sender,
char *cmd, char *nick, char *msg);
#define PREFIX_ALL 0
#define PREFIX_HALFOP 0x1
#define PREFIX_VOICE 0x2
#define PREFIX_OP 0x4
#define PREFIX_ADMIN 0x08
#define PREFIX_OWNER 0x10
extern void sendto_channel(Channel *channel, Client *from, Client *skip,
int prefix, long clicap, int sendflags,
MessageTag *mtags,
FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,8,9)));
extern void sendto_local_common_channels(Client *user, Client *skip,
long clicap, MessageTag *mtags,
FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,5,6)));
extern void sendto_match_servs(Channel *, Client *, FORMAT_STRING(const char *), ...) __attribute__((format(printf,3,4)));
extern void sendto_match_butone(Client *, Client *, char *, int, MessageTag *,
FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,6,7)));
extern void sendto_all_butone(Client *, Client *, FORMAT_STRING(const char *), ...) __attribute__((format(printf,3,4)));
extern void sendto_ops(FORMAT_STRING(const char *), ...) __attribute__((format(printf,1,2)));
extern void sendto_ops_butone(Client *, Client *, FORMAT_STRING(const char *), ...) __attribute__((format(printf,3,4)));
extern void sendto_prefix_one(Client *, Client *, MessageTag *, FORMAT_STRING(const char *), ...) __attribute__((format(printf,4,5)));
extern void sendto_opers(FORMAT_STRING(const char *), ...) __attribute__((format(printf,1,2)));
extern void sendto_umode(int, FORMAT_STRING(const char *), ...) __attribute__((format(printf,2,3)));
extern void sendto_umode_global(int, FORMAT_STRING(const char *), ...) __attribute__((format(printf,2,3)));
extern void sendto_snomask(int snomask, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,2,3)));
extern void sendto_snomask_global(int snomask, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,2,3)));
extern void sendnotice(Client *to, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,2,3)));
extern void sendnumeric(Client *to, int numeric, ...);
extern void sendnumericfmt(Client *to, int numeric, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,3,4)));
extern void sendto_server(Client *one, unsigned long caps, unsigned long nocaps, MessageTag *mtags, FORMAT_STRING(const char *format), ...) __attribute__((format(printf, 5, 6)));
extern void sendto_ops_and_log(FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,1,2)));
extern MODVAR int writecalls, writeb[];
extern int deliver_it(Client *cptr, char *str, int len, int *want_read);
extern int target_limit_exceeded(Client *client, void *target, const char *name);
extern char *canonize(char *buffer);
extern int check_registered(Client *);
extern int check_registered_user(Client *);
extern char *get_client_name(Client *, int);
extern char *get_client_host(Client *);
extern char *myctime(time_t);
extern char *short_date(time_t, char *buf);
extern char *long_date(time_t);
extern void exit_client(Client *client, MessageTag *recv_mtags, char *comment);
extern void initstats(), tstats(Client *, char *);
extern char *check_string(char *);
extern char *make_nick_user_host(char *, char *, char *);
extern char *make_nick_user_host_r(char *namebuf, char *nick, char *name, char *host);
extern char *make_user_host(char *, char *);
extern void parse(Client *cptr, char *buffer, int length);
extern int hunt_server(Client *, MessageTag *, char *, int, int, char **);
extern int cmd_server_estab(Client *);
extern void umode_init(void);
#define UMODE_GLOBAL 1
#define UMODE_LOCAL 0
extern int umode_allow_all(Client *client, int what);
extern int umode_allow_unset(Client *client, int what);
extern int umode_allow_opers(Client *client, int what);
extern int umode_allow_none(Client *client, int what);
extern int umode_delete(char ch, long val);
extern void build_umode_string(Client *client, long old, long sendmask, char *umode_buf);
extern void send_umode_out(Client *client, int show_to_user, long old);
extern void free_client(Client *);
extern void free_link(Link *);
extern void free_ban(Ban *);
extern void free_user(Client *);
extern int find_str_match_link(Link *, char *);
extern void free_str_list(Link *);
extern Link *make_link();
extern Ban *make_ban();
extern ClientUser *make_user(Client *);
extern Server *make_server();
extern Client *make_client(Client *, Client *);
extern Member *find_channel_link(Member *, Channel *);
extern char *pretty_mask(char *);
extern void add_client_to_list(Client *);
extern void remove_client_from_list(Client *);
extern void initlists();
extern struct hostent *get_res(char *);
extern struct hostent *gethost_byaddr(char *, Link *);
extern struct hostent *gethost_byname(char *, Link *);
extern void flush_cache();
extern void init_resolver(int firsttime);
extern time_t timeout_query_list(time_t);
extern time_t expire_cache(time_t);
extern void del_queries(char *);
/* Hash stuff */
#define NICK_HASH_TABLE_SIZE 32768
#define CHAN_HASH_TABLE_SIZE 32768
#define WATCH_HASH_TABLE_SIZE 32768
#define WHOWAS_HASH_TABLE_SIZE 32768
#define THROTTLING_HASH_TABLE_SIZE 8192
#define find_channel hash_find_channel
extern uint64_t siphash(const char *in, const char *k);
extern uint64_t siphash_raw(const char *in, size_t len, const char *k);
extern uint64_t siphash_nocase(const char *in, const char *k);
extern void siphash_generate_key(char *k);
extern void init_hash(void);
uint64_t hash_whowas_name(const char *name);
extern int add_to_client_hash_table(char *, Client *);
extern int del_from_client_hash_table(char *, Client *);
extern int add_to_id_hash_table(char *, Client *);
extern int del_from_id_hash_table(char *, Client *);
extern int add_to_channel_hash_table(char *, Channel *);
extern void del_from_channel_hash_table(char *, Channel *);
extern int add_to_watch_hash_table(char *, Client *, int);
extern int del_from_watch_hash_table(char *, Client *);
extern int hash_check_watch(Client *, int);
extern int hash_del_watch_list(Client *);
extern void count_watch_memory(int *, u_long *);
extern Watch *hash_get_watch(char *);
extern Channel *hash_get_chan_bucket(uint64_t);
extern Client *hash_find_client(const char *, Client *);
extern Client *hash_find_id(const char *, Client *);
extern Client *hash_find_nickatserver(const char *, Client *);
extern Channel *hash_find_channel(char *name, Channel *channel);
extern Client *hash_find_server(const char *, Client *);
extern struct MODVAR ThrottlingBucket *ThrottlingHash[THROTTLING_HASH_TABLE_SIZE];
extern char *find_by_aln(char *);
extern char *convert2aln(int);
extern int convertfromaln(char *);
extern char *find_server_aln(char *);
extern time_t atime(char *xtime);
/* Mode externs
*/
extern MODVAR long UMODE_INVISIBLE; /* 0x0001 makes user invisible */
extern MODVAR long UMODE_OPER; /* 0x0002 Operator */
extern MODVAR long UMODE_WALLOP; /* 0x0004 send wallops to them */
extern MODVAR long UMODE_REGNICK; /* 0x0020 Nick set by services as registered */
extern MODVAR long UMODE_SERVNOTICE;/* 0x0100 server notices such as kill */
extern MODVAR long UMODE_HIDE; /* 0x8000 Hide from Nukes */
extern MODVAR long UMODE_SECURE; /* 0x800000 User is a secure connect */
extern MODVAR long UMODE_DEAF; /* 0x10000000 Deaf */
extern MODVAR long UMODE_HIDEOPER; /* 0x20000000 Hide oper mode */
extern MODVAR long UMODE_SETHOST; /* 0x40000000 used sethost */
extern MODVAR long UMODE_HIDLE; /* hides oper idle times */
extern MODVAR long AllUmodes, SendUmodes;
extern MODVAR long SNO_KILLS;
extern MODVAR long SNO_CLIENT;
extern MODVAR long SNO_FLOOD;
extern MODVAR long SNO_FCLIENT;
extern MODVAR long SNO_JUNK;
extern MODVAR long SNO_VHOST;
extern MODVAR long SNO_EYES;
extern MODVAR long SNO_TKL;
extern MODVAR long SNO_NICKCHANGE;
extern MODVAR long SNO_FNICKCHANGE;
extern MODVAR long SNO_QLINE;
extern MODVAR long SNO_SNOTICE;
extern MODVAR long SNO_SPAMF;
extern MODVAR long SNO_OPER;
#ifndef HAVE_STRLCPY
extern size_t strlcpy(char *dst, const char *src, size_t size);
#endif
#ifndef HAVE_STRLCAT
extern size_t strlcat(char *dst, const char *src, size_t size);
#endif
#ifndef HAVE_STRLNCAT
extern size_t strlncat(char *dst, const char *src, size_t size, size_t n);
#endif
extern char *strldup(const char *src, size_t n);
extern void dopacket(Client *, char *, int);
extern void debug(int, FORMAT_STRING(const char *), ...) __attribute__((format(printf,2,3)));
#if defined(DEBUGMODE)
extern void send_usage(Client *, char *);
extern void count_memory(Client *, char *);
extern int checkprotoflags(Client *, int, char *, int);
#endif
extern char *inetntop(int af, const void *in, char *local_dummy, size_t the_size);
/* Internal command stuff - not for modules */
extern MODVAR RealCommand *CommandHash[256];
extern void init_CommandHash(void);
/* CRULE */
char *crule_parse(char *);
int crule_test(char *);
char *crule_errstring(int);
int crule_eval(char *);
void crule_free(char **);
/*
* Close all local socket connections, invalidate client fd's
* WIN32 cleanup winsock lib
*/
extern void close_connections(void);
extern int b64_encode(unsigned char const *src, size_t srclength, char *target, size_t targsize);
extern int b64_decode(char const *src, unsigned char *target, size_t targsize);
extern AuthenticationType Auth_FindType(char *hash, char *type);
extern AuthConfig *AuthBlockToAuthConfig(ConfigEntry *ce);
extern void Auth_FreeAuthConfig(AuthConfig *as);
extern int Auth_Check(Client *cptr, AuthConfig *as, char *para);
extern char *Auth_Hash(int type, char *para);
extern int Auth_CheckError(ConfigEntry *ce);
extern void make_cloakedhost(Client *client, char *curr, char *buf, size_t buflen);
extern int channel_canjoin(Client *client, char *name);
extern char *collapse(char *pattern);
extern void dcc_sync(Client *client);
extern void report_flines(Client *client);
extern void report_network(Client *client);
extern void report_dynconf(Client *client);
extern void count_memory(Client *cptr, char *nick);
extern void list_scache(Client *client);
extern char *oflagstr(long oflag);
extern int rehash(Client *client, int sig);
extern int match_simple(const char *mask, const char *name);
extern int match_esc(const char *mask, const char *name);
extern int add_listener(ConfigItem_listen *conf);
extern void link_cleanup(ConfigItem_link *link_ptr);
extern void listen_cleanup();
extern int numeric_collides(long numeric);
extern u_long cres_mem(Client *client, char *nick);
extern void flag_add(char ch);
extern void flag_del(char ch);
extern void init_dynconf(void);
extern char *pretty_time_val(long);
extern char *pretty_date(time_t t);
extern int init_conf(char *filename, int rehash);
extern void validate_configuration(void);
extern void run_configuration(void);
extern void rehash_motdrules();
extern void read_motd(const char *filename, MOTDFile *motd); /* s_serv.c */
extern void send_proto(Client *, ConfigItem_link *);
extern void unload_all_modules(void);
extern void set_sock_opts(int fd, Client *cptr, int ipv6);
extern void stripcrlf(char *line);
extern time_t rfc2time(char *s);
extern char *rfctime(time_t t, char *buf);
extern int strnatcmp(char const *a, char const *b);
extern int strnatcasecmp(char const *a, char const *b);
extern void outofmemory(size_t bytes);
/** Memory allocation and deallocation functions and macros that should be used in UnrealIRCd.
* Use these instead of malloc/calloc/free.
* @defgroup MemoryRoutines Memory allocation and deallocation
* @{
*/
extern void *safe_alloc(size_t size);
/** Free previously allocate memory pointer.
* This also sets the pointer to NULL, since that would otherwise be common to forget.
*/
#define safe_free(x) do { if (x) free(x); x = NULL; } while(0)
/** Free previously allocated memory pointer.
* Raw version which does not touch the pointer itself. You most likely don't
* need this, as it's only used in 1 place in UnrealIRCd.
*/
#define safe_free_raw(x) free(x)
/** Free previous memory (if any) and then save a duplicate of the specified string.
* @param dst The current pointer and the pointer where a new copy of the string will be stored.
* @param str The string you want to copy
*/
#define safe_strdup(dst,str) do { if (dst) free(dst); if (!(str)) dst = NULL; else dst = our_strdup(str); } while(0)
/** Return a copy of the string. Do not free any existing memory.
* @param str The string to duplicate
* @returns A pointer to the new copy.
* @note
* Generally you need to use safe_strdup() instead(!). But when clearly initializing
* a variable that does not have a previous value, then raw_strdup() usage is fine, eg:
* int somefunc()
* {
* char *somevar = raw_strdup("IRC");
* And, similarly if you want to return a duplicate (there is no destination variable):
* return raw_strdup(something);
*/
#define raw_strdup(str) strdup(str)
/** Free previous memory (if any) and then save a duplicate of the specified string with a length limit.
* @param dst The current pointer and the pointer where a new copy of the string will be stored.
* @param str The string you want to copy
* @param sz Length limit including the NUL byte, usually sizeof(dst)
*/
#define safe_strldup(dst,str,sz) do { if (dst) free(dst); if (!str) dst = NULL; else dst = our_strldup(str,sz); } while(0)
/** Return a duplicate of the specified string with a length limit. Do not free any existing memory.
* @param str The string you want to copy
* @param sz Length limit including the NUL byte, usually sizeof(dst)
* @returns A pointer to the new copy.
* @note
* Generally you need to use safe_strldup() instead(!). But when clearly initializing
* a variable that does not have a previous value, then raw_strldup() usage is fine, eg:
* int somefunc(char *str)
* {
* char *somevar = raw_strldup(str, 16);
* And, similarly if you want to return a duplicate (there is no destination variable):
* return raw_strldup(something);
*/
#define raw_strldup(str, max) our_strldup(str, max)
/** @} */
extern char *our_strdup(const char *str);
extern char *our_strldup(const char *str, size_t max);
extern MODFUNC char *tls_get_cipher(SSL *ssl);
extern TLSOptions *get_tls_options_for_client(Client *acptr);
extern int outdated_tls_client(Client *acptr);
extern char *outdated_tls_client_build_string(char *pattern, Client *acptr);
extern long config_checkval(char *value, unsigned short flags);
extern void config_status(FORMAT_STRING(const char *format), ...) __attribute__((format(printf,1,2)));
extern void init_random();
extern u_char getrandom8();
extern uint16_t getrandom16();
extern uint32_t getrandom32();
extern void gen_random_alnum(char *buf, int numbytes);
extern MODVAR char extchmstr[4][64];
extern int extcmode_default_requirechop(Client *, Channel *, char, char *, int, int);
extern int extcmode_default_requirehalfop(Client *, Channel *, char, char *, int, int);
extern Cmode_t extcmode_get(Cmode *);
extern void extcmode_init(void);
extern void make_extcmodestr();
extern void extcmode_duplicate_paramlist(void **xi, void **xo);
extern void extcmode_free_paramlist(void **ar);
extern void chmode_str(struct ChMode *, char *, char *, size_t, size_t);
extern char *get_client_status(Client *);
extern char *get_snomask_string_raw(long);
extern void SocketLoop(void *);
#ifdef _WIN32
extern void InitDebug(void);
extern int InitUnrealIRCd(int argc, char **);
extern void win_error();
extern void win_log(FORMAT_STRING(const char *format), ...);
extern int GetOSName(char *pszOS);
extern void CleanUp(void);
extern int CountRTFSize(unsigned char *buffer);
extern void IRCToRTF(unsigned char *buffer, unsigned char *string);
#endif
extern void sendto_chmodemucrap(Client *, Channel *, char *);
extern void verify_opercount(Client *, char *);
extern int valid_host(char *host);
extern int count_oper_sessions(char *);
extern char *unreal_mktemp(const char *dir, const char *suffix);
extern char *unreal_getpathname(char *filepath, char *path);
extern char *unreal_getfilename(char *path);
extern char *unreal_getmodfilename(char *path);
extern char *unreal_mkcache(const char *url);
extern int has_cached_version(const char *url);
extern int unreal_copyfile(const char *src, const char *dest);
extern int unreal_copyfileex(const char *src, const char *dest, int tryhardlink);
extern time_t unreal_getfilemodtime(const char *filename);
extern void unreal_setfilemodtime(const char *filename, time_t mtime);
extern void DeleteTempModules(void);
extern MODVAR Extban *extbaninfo;
extern Extban *findmod_by_bantype(char c);
extern Extban *ExtbanAdd(Module *reserved, ExtbanInfo req);
extern void ExtbanDel(Extban *);
extern void extban_init(void);
extern char *trim_str(char *str, int len);
extern MODVAR char *ban_realhost, *ban_virthost, *ban_ip;
extern BanAction banact_stringtoval(char *s);
extern char *banact_valtostring(BanAction val);
extern BanAction banact_chartoval(char c);
extern char banact_valtochar(BanAction val);
extern int spamfilter_gettargets(char *s, Client *client);
extern char *spamfilter_target_inttostring(int v);
extern Spamfilter *unreal_buildspamfilter(char *s);
extern char *our_strcasestr(char *haystack, char *needle);
extern int spamfilter_getconftargets(char *s);
extern void remove_oper_snomasks(Client *client);
extern void remove_oper_modes(Client *client);
extern char *spamfilter_inttostring_long(int v);
extern Channel *get_channel(Client *cptr, char *chname, int flag);
extern MODVAR char backupbuf[];
extern void add_invite(Client *, Client *, Channel *, MessageTag *);
extern void channel_modes(Client *cptr, char *mbuf, char *pbuf, size_t mbuf_size, size_t pbuf_size, Channel *channel);
extern MODVAR char modebuf[BUFSIZE], parabuf[BUFSIZE];
extern int op_can_override(char *acl, Client *client,Channel *channel,void* extra);
extern Client *find_chasing(Client *client, char *user, int *chasing);
extern MODVAR long opermode;
extern MODVAR long sajoinmode;
extern void add_user_to_channel(Channel *channel, Client *who, int flags);
extern int add_banid(Client *, Channel *, char *);
extern int add_exbanid(Client *cptr, Channel *channel, char *banid);
extern int sub1_from_channel(Channel *);
extern MODVAR CoreChannelModeTable corechannelmodetable[];
extern char *unreal_encodespace(char *s);
extern char *unreal_decodespace(char *s);
extern MODVAR Link *helpign;
extern void reread_motdsandrules();
extern MODVAR int SVSNOOP;
extern int callbacks_check(void);
extern void callbacks_switchover(void);
extern int efunctions_check(void);
extern void efunctions_switchover(void);
extern char *encode_ip(char *);
extern char *decode_ip(char *);
extern void sendto_fconnectnotice(Client *client, int disconnect, char *comment);
extern void sendto_one_nickcmd(Client *server, Client *client, char *umodes);
extern int on_dccallow_list(Client *to, Client *from);
extern int add_dccallow(Client *client, Client *optr);
extern int del_dccallow(Client *client, Client *optr);
extern void delete_linkblock(ConfigItem_link *link_ptr);
extern void delete_classblock(ConfigItem_class *class_ptr);
extern void del_async_connects(void);
extern void isupport_init(void);
extern void clicap_init(void);
extern void efunctions_init(void);
extern void do_cmd(Client *client, MessageTag *mtags, char *cmd, int parc, char *parv[]);
extern MODVAR char *me_hash;
extern MODVAR int dontspread;
extern MODVAR int labeled_response_inhibit;
extern MODVAR int labeled_response_inhibit_end;
extern MODVAR int labeled_response_force;
/* Efuncs */
extern MODVAR void (*do_join)(Client *, int, char **);
extern MODVAR void (*join_channel)(Channel *channel, Client *client, MessageTag *mtags, int flags);
extern MODVAR int (*can_join)(Client *client, Channel *channel, char *key, char *parv[]);
extern MODVAR void (*do_mode)(Channel *channel, Client *client, MessageTag *mtags, int parc, char *parv[], time_t sendts, int samode);
extern MODVAR void (*set_mode)(Channel *channel, Client *cptr, int parc, char *parv[], u_int *pcount,
char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], int bounce);
extern MODVAR void (*cmd_umode)(Client *, MessageTag *, int, char **);
extern MODVAR int (*register_user)(Client *client, char *nick, char *username, char *umode, char *virthost, char *ip);
extern MODVAR int (*tkl_hash)(unsigned int c);
extern MODVAR char (*tkl_typetochar)(int type);
extern MODVAR int (*tkl_chartotype)(char c);
extern MODVAR char *(*tkl_type_string)(TKL *tk);
extern MODVAR TKL *(*tkl_add_serverban)(int type, char *usermask, char *hostmask, char *reason, char *setby,
time_t expire_at, time_t set_at, int soft, int flags);
extern MODVAR TKL *(*tkl_add_banexception)(int type, char *usermask, char *hostmask, char *reason, char *set_by,
time_t expire_at, time_t set_at, int soft, char *bantypes, int flags);
extern MODVAR TKL *(*tkl_add_nameban)(int type, char *name, int hold, char *reason, char *setby,
time_t expire_at, time_t set_at, int flags);
extern MODVAR TKL *(*tkl_add_spamfilter)(int type, unsigned short target, unsigned short action, Match *match, char *setby,
time_t expire_at, time_t set_at,
time_t spamf_tkl_duration, char *spamf_tkl_reason,
int flags);
extern MODVAR TKL *(*find_tkl_serverban)(int type, char *usermask, char *hostmask, int softban);
extern MODVAR TKL *(*find_tkl_banexception)(int type, char *usermask, char *hostmask, int softban);
extern MODVAR TKL *(*find_tkl_nameban)(int type, char *name, int hold);
extern MODVAR TKL *(*find_tkl_spamfilter)(int type, char *match_string, unsigned short action, unsigned short target);
extern MODVAR void (*sendnotice_tkl_del)(char *removed_by, TKL *tkl);
extern MODVAR void (*sendnotice_tkl_add)(TKL *tkl);
extern MODVAR void (*free_tkl)(TKL *tkl);
extern MODVAR TKL *(*tkl_del_line)(TKL *tkl);
extern MODVAR void (*tkl_check_local_remove_shun)(TKL *tmp);
extern MODVAR int (*find_tkline_match)(Client *cptr, int skip_soft);
extern MODVAR int (*find_shun)(Client *cptr);
extern MODVAR int (*find_spamfilter_user)(Client *client, int flags);
extern MODVAR TKL *(*find_qline)(Client *cptr, char *nick, int *ishold);
extern MODVAR TKL *(*find_tkline_match_zap)(Client *cptr);
extern MODVAR void (*tkl_stats)(Client *cptr, int type, char *para);
extern MODVAR void (*tkl_sync)(Client *client);
extern MODVAR void (*cmd_tkl)(Client *client, MessageTag *recv_mtags, int parc, char *parv[]);
extern MODVAR int (*place_host_ban)(Client *client, BanAction action, char *reason, long duration);
extern MODVAR int (*match_spamfilter)(Client *client, char *str_in, int type, char *target, int flags, TKL **rettk);
extern MODVAR int (*join_viruschan)(Client *client, TKL *tk, int type);
extern MODVAR unsigned char *(*StripColors)(unsigned char *text);
extern MODVAR const char *(*StripControlCodes)(unsigned char *text);
extern MODVAR void (*spamfilter_build_user_string)(char *buf, char *nick, Client *acptr);
extern MODVAR void (*send_protoctl_servers)(Client *client, int response);
extern MODVAR int (*verify_link)(Client *client, char *servername, ConfigItem_link **link_out);
extern MODVAR void (*send_server_message)(Client *client);
extern MODVAR void (*broadcast_md_client)(ModDataInfo *mdi, Client *acptr, ModData *md);
extern MODVAR void (*broadcast_md_channel)(ModDataInfo *mdi, Channel *channel, ModData *md);
extern MODVAR void (*broadcast_md_member)(ModDataInfo *mdi, Channel *channel, Member *m, ModData *md);
extern MODVAR void (*broadcast_md_membership)(ModDataInfo *mdi, Client *acptr, Membership *m, ModData *md);
extern MODVAR void (*broadcast_md_client_cmd)(Client *except, Client *sender, Client *acptr, char *varname, char *value);
extern MODVAR void (*broadcast_md_channel_cmd)(Client *except, Client *sender, Channel *channel, char *varname, char *value);
extern MODVAR void (*broadcast_md_member_cmd)(Client *except, Client *sender, Channel *channel, Client *acptr, char *varname, char *value);
extern MODVAR void (*broadcast_md_membership_cmd)(Client *except, Client *sender, Client *acptr, Channel *channel, char *varname, char *value);
extern MODVAR void (*send_moddata_client)(Client *srv, Client *acptr);
extern MODVAR void (*send_moddata_channel)(Client *srv, Channel *channel);
extern MODVAR void (*send_moddata_members)(Client *srv);
extern MODVAR void (*broadcast_moddata_client)(Client *acptr);
extern MODVAR int (*check_banned)(Client *cptr, int exitflags);
extern MODVAR void (*introduce_user)(Client *to, Client *acptr);
extern MODVAR int (*check_deny_version)(Client *cptr, char *software, int protocol, char *flags);
extern MODVAR int (*match_user)(char *rmask, Client *acptr, int options);
extern MODVAR void (*userhost_save_current)(Client *client);
extern MODVAR void (*userhost_changed)(Client *client);
extern MODVAR void (*send_join_to_local_users)(Client *client, Channel *channel, MessageTag *mtags);
extern MODVAR int (*do_nick_name)(char *nick);
extern MODVAR int (*do_remote_nick_name)(char *nick);
extern MODVAR char *(*charsys_get_current_languages)(void);
extern MODVAR void (*broadcast_sinfo)(Client *acptr, Client *to, Client *except);
extern MODVAR void (*parse_message_tags)(Client *cptr, char **str, MessageTag **mtag_list);
extern MODVAR char *(*mtags_to_string)(MessageTag *m, Client *acptr);
extern MODVAR int (*can_send_to_channel)(Client *cptr, Channel *channel, char **msgtext, char **errmsg, int notice);
extern MODVAR void (*broadcast_md_globalvar)(ModDataInfo *mdi, ModData *md);
extern MODVAR void (*broadcast_md_globalvar_cmd)(Client *except, Client *sender, char *varname, char *value);
extern MODVAR int (*tkl_ip_hash)(char *ip);
extern MODVAR int (*tkl_ip_hash_type)(int type);
extern MODVAR int (*find_tkl_exception)(int ban_type, Client *cptr);
extern MODVAR int (*del_silence)(Client *client, const char *mask);
extern MODVAR int (*add_silence)(Client *client, const char *mask, int senderr);
extern MODVAR int (*is_silenced)(Client *client, Client *acptr);
extern MODVAR void *(*labeled_response_save_context)(void);
extern MODVAR void (*labeled_response_set_context)(void *ctx);
extern MODVAR void (*labeled_response_force_end)(void);
extern MODVAR void (*kick_user)(MessageTag *mtags, Channel *channel, Client *client, Client *victim, char *comment);
/* /Efuncs */
extern void parse_message_tags_default_handler(Client *client, char **str, MessageTag **mtag_list);
extern char *mtags_to_string_default_handler(MessageTag *m, Client *client);
extern void *labeled_response_save_context_default_handler(void);
extern void labeled_response_set_context_default_handler(void *ctx);
extern void labeled_response_force_end_default_handler(void);
extern int add_silence_default_handler(Client *client, const char *mask, int senderr);
extern int del_silence_default_handler(Client *client, const char *mask);
extern int is_silenced_default_handler(Client *client, Client *acptr);
extern MODVAR MOTDFile opermotd, svsmotd, motd, botmotd, smotd, rules;
extern MODVAR int max_connection_count;
extern int add_listmode(Ban **list, Client *cptr, Channel *channel, char *banid);
extern int add_listmode_ex(Ban **list, Client *cptr, Channel *channel, char *banid, char *setby, time_t seton);
extern int del_listmode(Ban **list, Channel *channel, char *banid);
extern int Halfop_mode(long mode);
extern char *clean_ban_mask(char *, int, Client *);
extern int find_invex(Channel *channel, Client *client);
extern void DoMD5(char *mdout, const char *src, unsigned long n);
extern char *md5hash(char *dst, const char *src, unsigned long n);
extern MODVAR TKL *tklines[TKLISTLEN];
extern MODVAR TKL *tklines_ip_hash[TKLIPHASHLEN1][TKLIPHASHLEN2];
extern char *cmdname_by_spamftarget(int target);
extern void unrealdns_delreq_bycptr(Client *cptr);
extern void sendtxtnumeric(Client *to, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,2,3)));
extern void unrealdns_gethostbyname_link(char *name, ConfigItem_link *conf, int ipv4_only);
extern void unrealdns_delasyncconnects(void);
extern int is_autojoin_chan(char *chname);
extern void unreal_free_hostent(struct hostent *he);
extern struct hostent *unreal_create_hostent(char *name, char *ip);
extern char *unreal_time_sync_error(void);
extern int unreal_time_synch(int timeout);
extern char *getcloak(Client *client);
extern MODVAR unsigned char param_to_slot_mapping[256];
extern char *cm_getparameter(Channel *channel, char mode);
extern void cm_putparameter(Channel *channel, char mode, char *str);
extern void cm_freeparameter(Channel *channel, char mode);
extern char *cm_getparameter_ex(void **p, char mode);
extern void cm_putparameter_ex(void **p, char mode, char *str);
extern void cm_freeparameter_ex(void **p, char mode, char *str);
extern int file_exists(char *file);
extern void free_motd(MOTDFile *motd); /* s_serv.c */
extern void fix_timers(void);
extern char *chfl_to_sjoin_symbol(int s);
extern char chfl_to_chanmode(int s);
extern void add_pending_net(Client *client, char *str);
extern void free_pending_net(Client *client);
extern Client *find_non_pending_net_duplicates(Client *cptr);
extern PendingNet *find_pending_net_by_sid_butone(char *sid, Client *exempt);
extern Client *find_pending_net_duplicates(Client *cptr, Client **srv, char **sid);
extern MODVAR char serveropts[];
extern MODVAR char *ISupportStrings[];
extern void read_packet(int fd, int revents, void *data);
extern int process_packet(Client *cptr, char *readbuf, int length, int killsafely);
extern void sendto_realops_and_log(FORMAT_STRING(const char *fmt), ...) __attribute__((format(printf,1,2)));
extern int parse_chanmode(ParseMode *pm, char *modebuf_in, char *parabuf_in);
extern void config_report_ssl_error(void);
extern int dead_socket(Client *to, char *notice);
extern Match *unreal_create_match(MatchType type, char *str, char **error);
extern void unreal_delete_match(Match *m);
extern int unreal_match(Match *m, char *str);
extern int unreal_match_method_strtoval(char *str);
extern char *unreal_match_method_valtostr(int val);
extern int mixed_network(void);
extern void unreal_delete_masks(ConfigItem_mask *m);
extern void unreal_add_masks(ConfigItem_mask **head, ConfigEntry *ce);
extern int unreal_mask_match(Client *acptr, ConfigItem_mask *m);
extern char *our_strcasestr(char *haystack, char *needle);
extern void update_conf(void);
extern MODVAR int need_34_upgrade;
#ifdef _WIN32
extern MODVAR BOOL IsService;
#endif
extern int match_ip46(char *a, char *b);
extern void extcmodes_check_for_changes(void);
extern void umodes_check_for_changes(void);
extern int config_parse_flood(char *orig, int *times, int *period);
extern int swhois_add(Client *acptr, char *tag, int priority, char *swhois, Client *from, Client *skip);
extern int swhois_delete(Client *acptr, char *tag, char *swhois, Client *from, Client *skip);
extern void remove_oper_privileges(Client *client, int broadcast_mode_change);
extern int client_starttls(Client *acptr);
extern void start_server_handshake(Client *cptr);
extern void reject_insecure_server(Client *cptr);
extern void report_crash(void);
extern void modulemanager(int argc, char *argv[]);
extern int inet_pton4(const char *src, unsigned char *dst);
extern int inet_pton6(const char *src, unsigned char *dst);
extern int unreal_bind(int fd, char *ip, int port, int ipv6);
extern int unreal_connect(int fd, char *ip, int port, int ipv6);
extern int is_valid_ip(char *str);
extern int ipv6_capable(void);
extern MODVAR Client *remote_rehash_client;
extern MODVAR int debugfd;
extern void convert_to_absolute_path(char **path, char *reldir);
extern int has_user_mode(Client *acptr, char mode);
extern int has_channel_mode(Channel *channel, char mode);
extern Cmode_t get_extmode_bitbychar(char m);
extern long get_mode_bitbychar(char m);
extern long find_user_mode(char mode);
extern void start_listeners(void);
extern void buildvarstring(const char *inbuf, char *outbuf, size_t len, const char *name[], const char *value[]);
extern void reinit_ssl(Client *);
extern CMD_FUNC(cmd_error);
extern CMD_FUNC(cmd_dns);
extern CMD_FUNC(cmd_info);
extern CMD_FUNC(cmd_summon);
extern CMD_FUNC(cmd_users);
extern CMD_FUNC(cmd_version);
extern CMD_FUNC(cmd_dalinfo);
extern CMD_FUNC(cmd_credits);
extern CMD_FUNC(cmd_license);
extern CMD_FUNC(cmd_module);
extern CMD_FUNC(cmd_rehash);
extern CMD_FUNC(cmd_die);
extern CMD_FUNC(cmd_restart);
extern void cmd_alias(Client *client, MessageTag *recv_mtags, int parc, char *parv[], char *cmd); /* special! */
extern void ban_flooder(Client *cptr);
extern char *pcre2_version(void);
extern int get_terminal_width(void);
extern int has_common_channels(Client *c1, Client *c2);
extern int user_can_see_member(Client *user, Client *target, Channel *channel);
extern int invisible_user_in_channel(Client *target, Channel *channel);
extern MODVAR int ssl_client_index;
extern TLSOptions *FindTLSOptionsForUser(Client *acptr);
extern int IsWebsocket(Client *acptr);
extern Policy policy_strtoval(char *s);
extern char *policy_valtostr(Policy policy);
extern char policy_valtochar(Policy policy);
extern int verify_certificate(SSL *ssl, char *hostname, char **errstr);
extern char *certificate_name(SSL *ssl);
extern void start_of_normal_client_handshake(Client *acptr);
extern void clicap_pre_rehash(void);
extern void clicap_post_rehash(void);
extern void send_cap_notify(int add, char *token);
extern void sendbufto_one(Client *to, char *msg, unsigned int quick);
extern MODVAR int current_serial;
extern char *spki_fingerprint(Client *acptr);
extern char *spki_fingerprint_ex(X509 *x509_cert);
extern int is_module_loaded(char *name);
extern void close_std_descriptors(void);
extern void banned_client(Client *acptr, char *bantype, char *reason, int global, int noexit);
extern char *mystpcpy(char *dst, const char *src);
extern size_t add_sjsby(char *buf, char *setby, time_t seton);
extern MaxTarget *findmaxtarget(char *cmd);
extern void setmaxtargets(char *cmd, int limit);
extern void freemaxtargets(void);
extern int max_targets_for_command(char *cmd);
extern void set_targmax_defaults(void);
extern void parse_chanmodes_protoctl(Client *client, char *str);
extern void concat_params(char *buf, int len, int parc, char *parv[]);
extern void charsys_check_for_changes(void);
extern int maxclients;
extern int fast_badword_match(ConfigItem_badword *badword, char *line);
extern int fast_badword_replace(ConfigItem_badword *badword, char *line, char *buf, int max);
extern char *stripbadwords(char *str, ConfigItem_badword *start_bw, int *blocked);
extern int badword_config_process(ConfigItem_badword *ca, char *str);
extern void badword_config_free(ConfigItem_badword *ca);
extern char *badword_config_check_regex(char *s, int fastsupport, int check_broadness);
extern AllowedChannelChars allowed_channelchars_strtoval(char *str);
extern char *allowed_channelchars_valtostr(AllowedChannelChars v);
extern long ClientCapabilityBit(const char *token);
extern int is_handshake_finished(Client *client);
extern void SetCapability(Client *acptr, const char *token);
extern void ClearCapability(Client *acptr, const char *token);
extern void new_message(Client *sender, MessageTag *recv_mtags, MessageTag **mtag_list);
extern void new_message_special(Client *sender, MessageTag *recv_mtags, MessageTag **mtag_list, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,4,5)));
extern void generate_batch_id(char *str);
extern MessageTag *find_mtag(MessageTag *mtags, const char *token);
extern MessageTag *duplicate_mtag(MessageTag *mtag);
extern void free_message_tags(MessageTag *m);
extern time_t server_time_to_unix_time(const char *tbuf);
extern int history_set_limit(char *object, int max_lines, long max_t);
extern int history_add(char *object, MessageTag *mtags, char *line);
extern int history_request(Client *acptr, char *object, HistoryFilter *filter);
extern int history_destroy(char *object);
extern void special_delayed_unloading(void);
extern int write_int64(FILE *fd, uint64_t t);
extern int write_int32(FILE *fd, uint32_t t);
extern int read_int64(FILE *fd, uint64_t *t);
extern int read_int32(FILE *fd, uint32_t *t);
extern int read_data(FILE *fd, void *buf, size_t len);
extern int write_data(FILE *fd, const void *buf, size_t len);
extern int write_str(FILE *fd, char *x);
extern int read_str(FILE *fd, char **x);
extern int char_to_channelflag(char c);
extern void _free_entire_name_list(NameList *n);
extern void _add_name_list(NameList **list, char *name);
extern void _del_name_list(NameList **list, char *name);
extern NameList *find_name_list(NameList *list, char *name);
extern NameList *find_name_list_match(NameList *list, char *name);
extern int minimum_msec_since_last_run(struct timeval *tv_old, long minimum);
extern int unrl_utf8_validate(const char *str, const char **end);
extern char *unrl_utf8_make_valid(const char *str);
extern void utf8_test(void);
extern MODVAR int non_utf8_nick_chars_in_use;
extern void short_motd(Client *client);
extern int should_show_connect_info(Client *client);
extern void send_invalid_channelname(Client *client, char *channelname);
extern int is_extended_ban(const char *str);
extern int valid_sid(char *name);
extern void parse_client_queued(Client *client);
extern char *sha256sum_file(const char *fname);
extern char *filename_strip_suffix(const char *fname, const char *suffix);
extern char *filename_add_suffix(const char *fname, const char *suffix);
extern int filename_has_suffix(const char *fname, const char *suffix);
extern void addmultiline(MultiLine **l, char *line);
extern void freemultiline(MultiLine *l);
extern void sendnotice_multiline(Client *client, MultiLine *m);
extern void unreal_del_quotes(char *i);
extern char *unreal_add_quotes(char *str);
extern int unreal_add_quotes_r(char *i, char *o, size_t len);
extern void user_account_login(MessageTag *recv_mtags, Client *client);
extern void link_generator(void);
extern void update_throttling_timer_settings(void);

23
include/ircsprintf.h Normal file
View File

@ -0,0 +1,23 @@
/*
* sprintf_irc.h
*
* $Id$
*/
#ifndef IRCSPRINTF_H
#define IRCSPRINTF_H
#include <stdarg.h>
#include <stdio.h>
/* ugly hack GRR, for both attribute and FORMAT_STRING */
#if !defined(__GNUC__) && !defined(__common_include__)
#define __attribute__(x) /* nothing */
#endif
#ifndef FORMAT_STRING
# define FORMAT_STRING(p) p
#endif
extern char *ircvsnprintf(char *str, size_t size, const char *format, va_list);
extern char *ircsnprintf(char *str, size_t size, FORMAT_STRING(const char *format), ...) __attribute__((format(printf,3,4)));
#endif

48
include/license.h Normal file
View File

@ -0,0 +1,48 @@
/*
* Unreal Internet Relay Chat Daemon, include/license.h
* Copyright (C) 1999 Carsten Munk
*
* 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.
*
* $Id$
*/
/*
* GNU License converted by Techie <stskeeps@tspre.org>
*
*/
char *gnulicense[] = {
" \2UnrealIRCd License\2",
"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.",
"",
"To see the UnrealIRCd License, please point your browser",
"at http://www.gnu.org/copyleft/gpl.html or look in the",
"file LICENSE in the UnrealIRCd dist",
0
};

592
include/list.h Normal file
View File

@ -0,0 +1,592 @@
/*
* These are list macros/functions derived from the Linux kernel.
* All original copyright (GPLv2) applies here.
* -- nenolod
*/
#ifndef __LIST_H
#define __LIST_H
#include "common.h"
#ifndef _WIN32
#define SINLINE static inline
#else
#define SINLINE static
#endif
#ifdef _WIN32
#define typeof(x) Client
/* ^ FIXME if/when Microsoft supports this.
* All functions use Client at the moment, with the exception of CAP, which has
* to use list_for_each_entry2 because of it
* Yeah this looks ugly and hacky.. thanks nenolod for making all code use this
* non-portable gcc-specific stuff and violating all our code rules. Once again.
*/
#endif
/**
* container_of - cast a member of a structure out to the containing structure
* @ptr: the pointer to the member.
* @type: the type of the container struct this is embedded in.
* @member: the name of the member within the struct.
*
*/
#define container_of(ptr, type, member) \
((type *)( (char *)ptr - offsetof(type, member) ))
struct list_head {
struct list_head *next, *prev;
};
/*
* Simple doubly linked list implementation.
*
* Some of the internal functions ("__xxx") are useful when
* manipulating whole lists rather than single entries, as
* sometimes we already know the next/prev entries and we can
* generate better code by using them directly rather than
* using the generic single-entry routines.
*/
#define LIST_HEAD_INIT(name) { &(name), &(name) }
#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)
SINLINE void INIT_LIST_HEAD(struct list_head *list)
{
list->next = list;
list->prev = list;
}
/*
* Insert a new entry between two known consecutive entries.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
SINLINE void __list_add(struct list_head *new,
struct list_head *prev,
struct list_head *next)
{
next->prev = new;
new->next = next;
new->prev = prev;
prev->next = new;
}
/**
* list_add - add a new entry
* @new: new entry to be added
* @head: list head to add it after
*
* Insert a new entry after the specified head.
* This is good for implementing stacks.
*/
SINLINE void list_add(struct list_head *new, struct list_head *head)
{
__list_add(new, head, head->next);
}
/**
* list_add_tail - add a new entry
* @new: new entry to be added
* @head: list head to add it before
*
* Insert a new entry before the specified head.
* This is useful for implementing queues.
*/
SINLINE void list_add_tail(struct list_head *new, struct list_head *head)
{
__list_add(new, head->prev, head);
}
/*
* Delete a list entry by making the prev/next entries
* point to each other.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
SINLINE void __list_del(struct list_head * prev, struct list_head * next)
{
next->prev = prev;
prev->next = next;
}
/**
* list_del - deletes entry from list.
* @entry: the element to delete from the list.
* Note: list_empty() on entry does not return true after this, the entry is
* in an undefined state.
*/
SINLINE void __list_del_entry(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
}
SINLINE void list_del(struct list_head *entry)
{
__list_del_entry(entry);
INIT_LIST_HEAD(entry);
}
/**
* list_replace - replace old entry by new one
* @old : the element to be replaced
* @new : the new element to insert
*
* If @old was empty, it will be overwritten.
*/
SINLINE void list_replace(struct list_head *old,
struct list_head *new)
{
new->next = old->next;
new->next->prev = new;
new->prev = old->prev;
new->prev->next = new;
}
SINLINE void list_replace_init(struct list_head *old,
struct list_head *new)
{
list_replace(old, new);
INIT_LIST_HEAD(old);
}
/**
* list_del_init - deletes entry from list and reinitialize it.
* @entry: the element to delete from the list.
*/
SINLINE void list_del_init(struct list_head *entry)
{
__list_del_entry(entry);
INIT_LIST_HEAD(entry);
}
/**
* list_move - delete from one list and add as another's head
* @list: the entry to move
* @head: the head that will precede our entry
*/
SINLINE void list_move(struct list_head *list, struct list_head *head)
{
__list_del_entry(list);
list_add(list, head);
}
/**
* list_move_tail - delete from one list and add as another's tail
* @list: the entry to move
* @head: the head that will follow our entry
*/
SINLINE void list_move_tail(struct list_head *list,
struct list_head *head)
{
__list_del_entry(list);
list_add_tail(list, head);
}
/**
* list_is_last - tests whether @list is the last entry in list @head
* @list: the entry to test
* @head: the head of the list
*/
SINLINE int list_is_last(const struct list_head *list,
const struct list_head *head)
{
return list->next == head;
}
/**
* list_empty - tests whether a list is empty
* @head: the list to test.
*/
SINLINE int list_empty(const struct list_head *head)
{
return head->next == head;
}
/**
* list_empty_careful - tests whether a list is empty and not being modified
* @head: the list to test
*
* Description:
* tests whether a list is empty _and_ checks that no other CPU might be
* in the process of modifying either member (next or prev)
*
* NOTE: using list_empty_careful() without synchronization
* can only be safe if the only activity that can happen
* to the list entry is list_del_init(). Eg. it cannot be used
* if another CPU could re-list_add() it.
*/
SINLINE int list_empty_careful(const struct list_head *head)
{
struct list_head *next = head->next;
return (next == head) && (next == head->prev);
}
/**
* list_rotate_left - rotate the list to the left
* @head: the head of the list
*/
SINLINE void list_rotate_left(struct list_head *head)
{
struct list_head *first;
if (!list_empty(head)) {
first = head->next;
list_move_tail(first, head);
}
}
/**
* list_is_singular - tests whether a list has just one entry.
* @head: the list to test.
*/
SINLINE int list_is_singular(const struct list_head *head)
{
return !list_empty(head) && (head->next == head->prev);
}
SINLINE void __list_cut_position(struct list_head *list,
struct list_head *head, struct list_head *entry)
{
struct list_head *new_first = entry->next;
list->next = head->next;
list->next->prev = list;
list->prev = entry;
entry->next = list;
head->next = new_first;
new_first->prev = head;
}
/**
* list_cut_position - cut a list into two
* @list: a new list to add all removed entries
* @head: a list with entries
* @entry: an entry within head, could be the head itself
* and if so we won't cut the list
*
* This helper moves the initial part of @head, up to and
* including @entry, from @head to @list. You should
* pass on @entry an element you know is on @head. @list
* should be an empty list or a list you do not care about
* losing its data.
*
*/
SINLINE void list_cut_position(struct list_head *list,
struct list_head *head, struct list_head *entry)
{
if (list_empty(head))
return;
if (list_is_singular(head) &&
(head->next != entry && head != entry))
return;
if (entry == head)
INIT_LIST_HEAD(list);
else
__list_cut_position(list, head, entry);
}
SINLINE void __list_splice(const struct list_head *list,
struct list_head *prev,
struct list_head *next)
{
struct list_head *first = list->next;
struct list_head *last = list->prev;
first->prev = prev;
prev->next = first;
last->next = next;
next->prev = last;
}
/**
* list_splice - join two lists, this is designed for stacks
* @list: the new list to add.
* @head: the place to add it in the first list.
*/
SINLINE void list_splice(const struct list_head *list,
struct list_head *head)
{
if (!list_empty(list))
__list_splice(list, head, head->next);
}
/**
* list_splice_tail - join two lists, each list being a queue
* @list: the new list to add.
* @head: the place to add it in the first list.
*/
SINLINE void list_splice_tail(struct list_head *list,
struct list_head *head)
{
if (!list_empty(list))
__list_splice(list, head->prev, head);
}
/**
* list_splice_init - join two lists and reinitialise the emptied list.
* @list: the new list to add.
* @head: the place to add it in the first list.
*
* The list at @list is reinitialised
*/
SINLINE void list_splice_init(struct list_head *list,
struct list_head *head)
{
if (!list_empty(list)) {
__list_splice(list, head, head->next);
INIT_LIST_HEAD(list);
}
}
/**
* list_splice_tail_init - join two lists and reinitialise the emptied list
* @list: the new list to add.
* @head: the place to add it in the first list.
*
* Each of the lists is a queue.
* The list at @list is reinitialised
*/
SINLINE void list_splice_tail_init(struct list_head *list,
struct list_head *head)
{
if (!list_empty(list)) {
__list_splice(list, head->prev, head);
INIT_LIST_HEAD(list);
}
}
/**
* list_entry - get the struct for this entry
* @ptr: the &struct list_head pointer.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*/
#define list_entry(ptr, type, member) \
container_of(ptr, type, member)
/**
* list_first_entry - get the first element from a list
* @ptr: the list head to take the element from.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*
* Note, that list is expected to be not empty.
*/
#define list_first_entry(ptr, type, member) \
list_entry((ptr)->next, type, member)
/**
* list_for_each - iterate over a list
* @pos: the &struct list_head to use as a loop cursor.
* @head: the head for your list.
*/
#define list_for_each(pos, head) \
for (pos = (head)->next; pos != (head); pos = pos->next)
/**
* __list_for_each - iterate over a list
* @pos: the &struct list_head to use as a loop cursor.
* @head: the head for your list.
*
* This variant doesn't differ from list_for_each() any more.
* We don't do prefetching in either case.
*/
#define __list_for_each(pos, head) \
for (pos = (head)->next; pos != (head); pos = pos->next)
/**
* list_for_each_prev - iterate over a list backwards
* @pos: the &struct list_head to use as a loop cursor.
* @head: the head for your list.
*/
#define list_for_each_prev(pos, head) \
for (pos = (head)->prev; pos != (head); pos = pos->prev)
/**
* list_for_each_safe - iterate over a list safe against removal of list entry
* @pos: the &struct list_head to use as a loop cursor.
* @n: another &struct list_head to use as temporary storage
* @head: the head for your list.
*/
#define list_for_each_safe(pos, n, head) \
for (pos = (head)->next, n = pos->next; pos != (head); \
pos = n, n = pos->next)
/**
* list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry
* @pos: the &struct list_head to use as a loop cursor.
* @n: another &struct list_head to use as temporary storage
* @head: the head for your list.
*/
#define list_for_each_prev_safe(pos, n, head) \
for (pos = (head)->prev, n = pos->prev; \
pos != (head); \
pos = n, n = pos->prev)
/**
* list_for_each_entry - iterate over list of given type
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
#define list_for_each_entry(pos, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member); \
&pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
/**
* list_for_each_entry - iterate over list of given type
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
#define list_for_each_entry2(pos, tpe, head, member) \
for (pos = list_entry((head)->next, tpe, member); \
&pos->member != (head); \
pos = list_entry(pos->member.next, tpe, member))
/**
* list_for_each_entry_reverse - iterate backwards over list of given type.
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
#define list_for_each_entry_reverse(pos, head, member) \
for (pos = list_entry((head)->prev, typeof(*pos), member); \
&pos->member != (head); \
pos = list_entry(pos->member.prev, typeof(*pos), member))
/**
* list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue()
* @pos: the type * to use as a start point
* @head: the head of the list
* @member: the name of the list_struct within the struct.
*
* Prepares a pos entry for use as a start point in list_for_each_entry_continue().
*/
#define list_prepare_entry(pos, head, member) \
((pos) ? : list_entry(head, typeof(*pos), member))
/**
* list_for_each_entry_continue - continue iteration over list of given type
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Continue to iterate over list of given type, continuing after
* the current position.
*/
#define list_for_each_entry_continue(pos, head, member) \
for (pos = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
/**
* list_for_each_entry_continue_reverse - iterate backwards from the given point
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Start to iterate over list of given type backwards, continuing after
* the current position.
*/
#define list_for_each_entry_continue_reverse(pos, head, member) \
for (pos = list_entry(pos->member.prev, typeof(*pos), member); \
&pos->member != (head); \
pos = list_entry(pos->member.prev, typeof(*pos), member))
/**
* list_for_each_entry_from - iterate over list of given type from the current point
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Iterate over list of given type, continuing from current position.
*/
#define list_for_each_entry_from(pos, head, member) \
for (; &pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
/**
* list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
#define list_for_each_entry_safe(pos, n, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member), \
n = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
/**
* list_for_each_entry_safe_continue - continue list iteration safe against removal
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Iterate over list of given type, continuing after current point,
* safe against removal of list entry.
*/
#define list_for_each_entry_safe_continue(pos, n, head, member) \
for (pos = list_entry(pos->member.next, typeof(*pos), member), \
n = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
/**
* list_for_each_entry_safe_from - iterate over list from current point safe against removal
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Iterate over list of given type from current point, safe against
* removal of list entry.
*/
#define list_for_each_entry_safe_from(pos, n, head, member) \
for (n = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
/**
* list_for_each_entry_safe_reverse - iterate backwards over list safe against removal
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Iterate backwards over list of given type, safe against removal
* of list entry.
*/
#define list_for_each_entry_safe_reverse(pos, n, head, member) \
for (pos = list_entry((head)->prev, typeof(*pos), member), \
n = list_entry(pos->member.prev, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.prev, typeof(*n), member))
/**
* list_safe_reset_next - reset a stale list_for_each_entry_safe loop
* @pos: the loop cursor used in the list_for_each_entry_safe loop
* @n: temporary storage used in list_for_each_entry_safe
* @member: the name of the list_struct within the struct.
*
* list_safe_reset_next is not safe to use in general if the list may be
* modified concurrently (eg. the lock is dropped in the loop body). An
* exception to this is if the cursor element (pos) is pinned in the list,
* and list_safe_reset_next is called after re-taking the lock and before
* completing the current iteration of the loop body.
*/
#define list_safe_reset_next(pos, n, member) \
n = list_entry(pos->member.next, typeof(*pos), member)
#endif

105
include/mempool.h Normal file
View File

@ -0,0 +1,105 @@
/*
* Copyright (c) 2007-2012, The Tor Project, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
*
* * Neither the names of the copyright owners nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* Imported from hybrid svn:
* \file mempool.h
* \brief Pooling allocator
* \version $Id: mempool.h 1662 2012-11-17 20:11:33Z michael $
*/
#ifndef TOR_MEMPOOL_H
#define TOR_MEMPOOL_H
#ifdef _WIN32
#define uint64_t unsigned __int64
#endif
/** A memory pool is a context in which a large number of fixed-sized
* objects can be allocated efficiently. See mempool.c for implementation
* details. */
typedef struct mp_pool_t mp_pool_t;
extern void mp_pool_init(void);
extern void *mp_pool_get(mp_pool_t *);
extern void mp_pool_release(void *);
extern mp_pool_t *mp_pool_new(size_t, size_t);
extern void mp_pool_clean(mp_pool_t *, int, int);
extern void mp_pool_destroy(mp_pool_t *);
extern void mp_pool_assert_ok(mp_pool_t *);
extern void mp_pool_log_status(mp_pool_t *);
extern void mp_pool_garbage_collect(void *);
#define MEMPOOL_STATS
struct mp_pool_t {
/** Next pool. A pool is usually linked into the mp_allocated_pools list. */
mp_pool_t *next;
/** Doubly-linked list of chunks in which no items have been allocated.
* The front of the list is the most recently emptied chunk. */
struct mp_chunk_t *empty_chunks;
/** Doubly-linked list of chunks in which some items have been allocated,
* but which are not yet full. The front of the list is the chunk that has
* most recently been modified. */
struct mp_chunk_t *used_chunks;
/** Doubly-linked list of chunks in which no more items can be allocated.
* The front of the list is the chunk that has most recently become full. */
struct mp_chunk_t *full_chunks;
/** Length of <b>empty_chunks</b>. */
int n_empty_chunks;
/** Lowest value of <b>empty_chunks</b> since last call to
* mp_pool_clean(-1). */
int min_empty_chunks;
/** Size of each chunk (in items). */
int new_chunk_capacity;
/** Size to allocate for each item, including overhead and alignment
* padding. */
size_t item_alloc_size;
#ifdef MEMPOOL_STATS
/** Total number of items allocated ever. */
uint64_t total_items_allocated;
/** Total number of chunks allocated ever. */
uint64_t total_chunks_allocated;
/** Total number of chunks freed ever. */
uint64_t total_chunks_freed;
#endif
};
#endif

1379
include/modules.h Normal file

File diff suppressed because it is too large Load Diff

68
include/modversion.h Normal file
View File

@ -0,0 +1,68 @@
/************************************************************************
* Unreal Internet Relay Chat Daemon, include/modversion.h
* (C) 2004-2005 Bram Matthys 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.
*
* $Id$
*/
#include "version.h"
/* What all this is for? Well, it's simple...
* Example: When someone compiles a module with ssl support, but the
* core was not compiled with ssl support, then the module will read
* things incorrect in the struct because the module sees an extra
* field half-way the struct but in the core that field does not exist,
* hence all data is shifted 4 bytes causing all kinds of odd crashes,
* memory corruption, and weird problems.
* This is an attempt to prevent this a bit, but there are a lot more
* options that cause binary incompatability (eg: changing nicklen),
* we just take the most common ones...
*
* NOTE: On win32 we allow ssl inconsistencies because we
* explicitly use "padding" in the structs: we add a useless
* placeholder so everything is still aligned correctly.
* In the process of doing so, we waste several bytes per-user,
* but this prevents (most) binary incompatability problems
* making it easier for module coders to ship dll's.
*/
#ifndef _WIN32
#define MYTOKEN_SSL "/SSL"
#else
#define MYTOKEN_SSL ""
#endif
#define MYTOKEN_NEWCHF "/NOCHF"
#ifdef __GNUC__
#if defined(__GNUC_PATCHLEVEL__)
#define GCCVER ((__GNUC__ << 16) + (__GNUC_MINOR__ << 8) + __GNUC_PATCHLEVEL__)
#else
#define GCCVER ((__GNUC__ << 16) + (__GNUC_MINOR__ << 8))
#endif
#else
#define GCCVER 0
#endif
#ifdef UNREALCORE
char our_mod_version[] = BASE_VERSION "-" PATCH1 PATCH2 PATCH3 PATCH4 PATCH6 PATCH7 PATCH8 PATCH9 \
MYTOKEN_SSL MYTOKEN_NEWCHF;
unsigned int our_compiler_version = GCCVER;
#else
DLLFUNC char Mod_Version[] = BASE_VERSION "-" PATCH1 PATCH2 PATCH3 PATCH4 PATCH6 PATCH7 PATCH8 PATCH9 \
MYTOKEN_SSL MYTOKEN_NEWCHF;
DLLFUNC unsigned int compiler_version = GCCVER;
#endif

173
include/msg.h Normal file
View File

@ -0,0 +1,173 @@
/************************************************************************
* Unreal Internet Relay Chat Daemon, include/msg.h
* Copyright (C) 1990 Jarkko Oikarinen and
* University of Oulu, Computing Center
*
* 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.
*
* $Id$
*/
#ifndef __msg_include__
#define __msg_include__
#define MSG_PRIVATE "PRIVMSG" /* PRIV */
#define MSG_WHOIS "WHOIS" /* WHOI */
#define MSG_WHOWAS "WHOWAS" /* WHOW */
#define MSG_USER "USER" /* USER */
#define MSG_NICK "NICK" /* NICK */
#define MSG_SERVER "SERVER" /* SERV */
#define MSG_LIST "LIST" /* LIST */
#define MSG_TOPIC "TOPIC" /* TOPI */
#define MSG_INVITE "INVITE" /* INVI */
#define MSG_VERSION "VERSION" /* VERS */
#define MSG_QUIT "QUIT" /* QUIT */
#define MSG_SQUIT "SQUIT" /* SQUI */
#define MSG_KILL "KILL" /* KILL */
#define MSG_INFO "INFO" /* INFO */
#define MSG_LINKS "LINKS" /* LINK */
#define MSG_SUMMON "SUMMON" /* SUMM */
#define MSG_STATS "STATS" /* STAT */
#define MSG_USERS "USERS" /* USER -> USRS */
#define MSG_HELP "HELP" /* HELP */
#define MSG_HELPOP "HELPOP" /* HELP */
#define MSG_ERROR "ERROR" /* ERRO */
#define MSG_AWAY "AWAY" /* AWAY */
#define MSG_CONNECT "CONNECT" /* CONN */
#define MSG_PING "PING" /* PING */
#define MSG_PONG "PONG" /* PONG */
#define MSG_OPER "OPER" /* OPER */
#define MSG_PASS "PASS" /* PASS */
#define MSG_WALLOPS "WALLOPS" /* WALL */
#define MSG_TIME "TIME" /* TIME */
#define MSG_NAMES "NAMES" /* NAME */
#define MSG_ADMIN "ADMIN" /* ADMI */
#define MSG_NOTICE "NOTICE" /* NOTI */
#define MSG_JOIN "JOIN" /* JOIN */
#define MSG_PART "PART" /* PART */
#define MSG_LUSERS "LUSERS" /* LUSE */
#define MSG_MOTD "MOTD" /* MOTD */
#define MSG_MODE "MODE" /* MODE */
#define MSG_KICK "KICK" /* KICK */
#define MSG_SERVICE "SERVICE" /* SERV -> SRVI */
#define MSG_USERHOST "USERHOST" /* USER -> USRH */
#define MSG_ISON "ISON" /* ISON */
#define MSG_REHASH "REHASH" /* REHA */
#define MSG_RESTART "RESTART" /* REST */
#define MSG_CLOSE "CLOSE" /* CLOS */
#define MSG_DIE "DIE" /* DIE */
#define MSG_HASH "HASH" /* HASH */
#define MSG_DNS "DNS" /* DNS -> DNSS */
#define MSG_SILENCE "SILENCE" /* SILE */
#define MSG_AKILL "AKILL" /* AKILL */
#define MSG_KLINE "KLINE" /* KLINE */
#define MSG_UNKLINE "UNKLINE" /* UNKLINE */
#define MSG_RAKILL "RAKILL" /* RAKILL */
#define MSG_GNOTICE "GNOTICE" /* GNOTICE */
#define MSG_GOPER "GOPER" /* GOPER */
#define MSG_GLOBOPS "GLOBOPS" /* GLOBOPS */
#define MSG_LOCOPS "LOCOPS" /* LOCOPS */
#define MSG_PROTOCTL "PROTOCTL" /* PROTOCTL */
#define MSG_WATCH "WATCH" /* WATCH */
#define MSG_TRACE "TRACE" /* TRAC */
#define MSG_SQLINE "SQLINE" /* SQLINE */
#define MSG_UNSQLINE "UNSQLINE" /* UNSQLINE */
#define MSG_SVSNICK "SVSNICK" /* SVSNICK */
#define MSG_SVSNOOP "SVSNOOP" /* SVSNOOP */
#define MSG_IDENTIFY "IDENTIFY" /* IDENTIFY */
#define MSG_SVSKILL "SVSKILL" /* SVSKILL */
#define MSG_NICKSERV "NICKSERV" /* NICKSERV */
#define MSG_NS "NS"
#define MSG_CHANSERV "CHANSERV" /* CHANSERV */
#define MSG_CS "CS"
#define MSG_OPERSERV "OPERSERV" /* OPERSERV */
#define MSG_OS "OS"
#define MSG_MEMOSERV "MEMOSERV" /* MEMOSERV */
#define MSG_MS "MS"
#define MSG_SERVICES "SERVICES" /* SERVICES */
#define MSG_SVSMODE "SVSMODE" /* SVSMODE */
#define MSG_SAMODE "SAMODE" /* SAMODE */
#define MSG_CHATOPS "CHATOPS" /* CHATOPS */
#define MSG_ZLINE "ZLINE" /* ZLINE */
#define MSG_UNZLINE "UNZLINE" /* UNZLINE */
#define MSG_HELPSERV "HELPSERV" /* HELPSERV */
#define MSG_HS "HS"
#define MSG_RULES "RULES" /* RULES */
#define MSG_MAP "MAP" /* MAP */
#define MSG_SVS2MODE "SVS2MODE" /* SVS2MODE */
#define MSG_DALINFO "DALINFO" /* dalinfo */
#define MSG_ADMINCHAT "ADCHAT" /* Admin chat */
#define MSG_MKPASSWD "MKPASSWD" /* MKPASSWD */
#define MSG_ADDLINE "ADDLINE" /* ADDLINE */
#define MSG_GLINE "GLINE" /* The awesome g-line */
#define MSG_SJOIN "SJOIN"
#define MSG_SETHOST "SETHOST" /* sethost */
#define MSG_NACHAT "NACHAT" /* netadmin chat */
#define MSG_SETIDENT "SETIDENT"
#define MSG_SETNAME "SETNAME" /* set GECOS */
#define MSG_LAG "LAG" /* Lag detect */
#define MSG_STATSERV "STATSERV" /* alias */
#define MSG_KNOCK "KNOCK"
#define MSG_CREDITS "CREDITS"
#define MSG_LICENSE "LICENSE"
#define MSG_CHGHOST "CHGHOST"
#define MSG_NETINFO "NETINFO"
#define MSG_SENDUMODE "SENDUMODE"
#define MSG_ADDMOTD "ADDMOTD"
#define MSG_ADDOMOTD "ADDOMOTD"
#define MSG_SVSMOTD "SVSMOTD"
#define MSG_SMO "SMO"
#define MSG_OPERMOTD "OPERMOTD"
#define MSG_TSCTL "TSCTL"
#define MSG_SVSJOIN "SVSJOIN"
#define MSG_SAJOIN "SAJOIN"
#define MSG_SVSPART "SVSPART"
#define MSG_SAPART "SAPART"
#define MSG_CHGIDENT "CHGIDENT"
#define MSG_SWHOIS "SWHOIS"
#define MSG_SVSO "SVSO"
#define MSG_SVSFLINE "SVSFLINE"
#define MSG_TKL "TKL"
#define MSG_VHOST "VHOST"
#define MSG_BOTMOTD "BOTMOTD"
#define MSG_REMGLINE "REMGLINE" /* remove g-line */
#define MSG_UMODE2 "UMODE2"
#define MSG_DCCDENY "DCCDENY"
#define MSG_UNDCCDENY "UNDCCDENY"
#define MSG_CHGNAME "CHGNAME"
#define MSG_SHUN "SHUN"
#define MSG_NEWJOIN "NEWJOIN" /* For CR Java Chat */
#define MSG_POST "POST"
#define MSG_INFOSERV "INFOSERV"
#define MSG_IS "IS"
#define MSG_BOTSERV "BOTSERV"
#define MSG_CYCLE "CYCLE"
#define MSG_MODULE "MODULE"
/* BR and BT are in use */
#define MSG_SENDSNO "SENDSNO"
#define MSG_EOS "EOS"
#define MSG_MLOCK "MLOCK"
#define MAXPARA 15
#endif

396
include/numeric.h Normal file
View File

@ -0,0 +1,396 @@
/************************************************************************
* Unreal Internet Relay Chat Daemon, include/numeric.h
* Copyright (C) 1990 Jarkko Oikarinen
*
* 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.
*
* $Id$
*/
/*
* Added numerics 600-799 as numeric_replies2[], we ran out
*/
/*
* Reserve numerics 000-099 for server-client connections where the client
* is local to the server. If any server is passed a numeric in this range
* from another server then it is remapped to 100-199.
*/
#define RPL_WELCOME 001
#define RPL_YOURHOST 002
#define RPL_CREATED 003
#define RPL_MYINFO 004
#define RPL_ISUPPORT 005
#define RPL_REDIR 10
#define RPL_YOURID 42
#define RPL_REMOTEISUPPORT 105
/*
* Errors are in the range from 400-599 currently and are grouped by what
* commands they come from.
*/
#define ERR_NOSUCHNICK 401
#define ERR_NOSUCHSERVER 402
#define ERR_NOSUCHCHANNEL 403
#define ERR_CANNOTSENDTOCHAN 404
#define ERR_TOOMANYCHANNELS 405
#define ERR_WASNOSUCHNICK 406
#define ERR_TOOMANYTARGETS 407
#define ERR_NOSUCHSERVICE 408
#define ERR_NOORIGIN 409
#define ERR_INVALIDCAPCMD 410
#define ERR_NORECIPIENT 411
#define ERR_NOTEXTTOSEND 412
#define ERR_NOTOPLEVEL 413
#define ERR_WILDTOPLEVEL 414
#define ERR_TOOMANYMATCHES 416
#define ERR_UNKNOWNCOMMAND 421
#define ERR_NOMOTD 422
#define ERR_NOADMININFO 423
#define ERR_FILEERROR 424
#define ERR_NOOPERMOTD 425
#define ERR_TOOMANYAWAY 429
#define ERR_NONICKNAMEGIVEN 431
#define ERR_ERRONEUSNICKNAME 432
#define ERR_NICKNAMEINUSE 433
#define ERR_NORULES 434
#define ERR_SERVICECONFUSED 435
#define ERR_NICKCOLLISION 436
#define ERR_BANNICKCHANGE 437
#define ERR_NCHANGETOOFAST 438
#define ERR_TARGETTOOFAST 439
#define ERR_SERVICESDOWN 440
#define ERR_USERNOTINCHANNEL 441
#define ERR_NOTONCHANNEL 442
#define ERR_USERONCHANNEL 443
#define ERR_NOLOGIN 444
#define ERR_SUMMONDISABLED 445
#define ERR_USERSDISABLED 446
#define ERR_NONICKCHANGE 447
#define ERR_FORBIDDENCHANNEL 448
#define ERR_NOTREGISTERED 451
#define ERR_HOSTILENAME 455
#define ERR_NOHIDING 459
#define ERR_NOTFORHALFOPS 460
#define ERR_NEEDMOREPARAMS 461
#define ERR_ALREADYREGISTRED 462
#define ERR_NOPERMFORHOST 463
#define ERR_PASSWDMISMATCH 464
#define ERR_YOUREBANNEDCREEP 465
#define ERR_YOUWILLBEBANNED 466
#define ERR_KEYSET 467
#define ERR_ONLYSERVERSCANCHANGE 468
#define ERR_LINKSET 469
#define ERR_LINKCHANNEL 470
#define ERR_CHANNELISFULL 471
#define ERR_UNKNOWNMODE 472
#define ERR_INVITEONLYCHAN 473
#define ERR_BANNEDFROMCHAN 474
#define ERR_BADCHANNELKEY 475
#define ERR_BADCHANMASK 476
#define ERR_NEEDREGGEDNICK 477
#define ERR_BANLISTFULL 478
#define ERR_LINKFAIL 479
#define ERR_CANNOTKNOCK 480
#define ERR_NOPRIVILEGES 481
#define ERR_CHANOPRIVSNEEDED 482
#define ERR_CANTKILLSERVER 483
#define ERR_ATTACKDENY 484
#define ERR_KILLDENY 485
#define ERR_NONONREG 486
#define ERR_NOTFORUSERS 487
#define ERR_SECUREONLYCHAN 489
#define ERR_NOSWEAR 490
#define ERR_NOOPERHOST 491
#define ERR_NOCTCP 492
#define ERR_CHANOWNPRIVNEEDED 499
#define ERR_TOOMANYJOINS 500
#define ERR_UMODEUNKNOWNFLAG 501
#define ERR_USERSDONTMATCH 502
#define ERR_SILELISTFULL 511
#define ERR_TOOMANYWATCH 512
#define ERR_NEEDPONG 513
#define ERR_TOOMANYDCC 514
#define ERR_DISABLED 517
#define ERR_NOINVITE 518
#define ERR_ADMONLY 519
#define ERR_OPERONLY 520
#define ERR_LISTSYNTAX 521
#define ERR_CANTSENDTOUSER 531
/*
* Numberic replies from server commands.
* These are currently in the range 200-399.
*/
#define RPL_NONE 300
#define RPL_AWAY 301
#define RPL_USERHOST 302
#define RPL_ISON 303
#define RPL_TEXT 304
#define RPL_UNAWAY 305
#define RPL_NOWAWAY 306
#define RPL_WHOISREGNICK 307
#define RPL_RULESSTART 308
#define RPL_ENDOFRULES 309
#define RPL_WHOISHELPOP 310 /* -Donwulff */
#define RPL_WHOISUSER 311
#define RPL_WHOISSERVER 312
#define RPL_WHOISOPERATOR 313
#define RPL_WHOWASUSER 314
/* rpl_endofwho below (315) */
#define RPL_ENDOFWHOWAS 369
#define RPL_WHOISCHANOP 316 /* redundant and not needed but reserved */
#define RPL_WHOISIDLE 317
#define RPL_ENDOFWHOIS 318
#define RPL_WHOISCHANNELS 319
#define RPL_WHOISSPECIAL 320
#define RPL_LISTSTART 321
#define RPL_LIST 322
#define RPL_LISTEND 323
#define RPL_CHANNELMODEIS 324
#define RPL_CREATIONTIME 329
#define RPL_WHOISLOGGEDIN 330 /* ircu/charybdis-family --nenolod */
#define RPL_NOTOPIC 331
#define RPL_TOPIC 332
#define RPL_TOPICWHOTIME 333
#define RPL_INVITELIST 336
#define RPL_ENDOFINVITELIST 337
#define RPL_LISTSYNTAX 334
#define RPL_WHOISBOT 335
#define RPL_USERIP 340
#define RPL_INVITING 341
#define RPL_SUMMONING 342
#define RPL_VERSION 351
#define RPL_WHOREPLY 352
#define RPL_ENDOFWHO 315
#define RPL_NAMREPLY 353
#define RPL_ENDOFNAMES 366
#define RPL_INVEXLIST 346
#define RPL_ENDOFINVEXLIST 347
#define RPL_EXLIST 348
#define RPL_ENDOFEXLIST 349
#define RPL_KILLDONE 361
#define RPL_CLOSING 362
#define RPL_CLOSEEND 363
#define RPL_LINKS 364
#define RPL_ENDOFLINKS 365
/* rpl_endofnames above (366) */
#define RPL_BANLIST 367
#define RPL_ENDOFBANLIST 368
/* rpl_endofwhowas above (369) */
#define RPL_INFO 371
#define RPL_MOTD 372
#define RPL_INFOSTART 373
#define RPL_ENDOFINFO 374
#define RPL_MOTDSTART 375
#define RPL_ENDOFMOTD 376
#define RPL_WHOISHOST 378
#define RPL_WHOISMODES 379
#define RPL_YOUREOPER 381
#define RPL_REHASHING 382
#define RPL_YOURESERVICE 383
#define RPL_MYPORTIS 384
#define RPL_NOTOPERANYMORE 385
#define RPL_QLIST 386
#define RPL_ENDOFQLIST 387
#define RPL_ALIST 388
#define RPL_ENDOFALIST 389
#define RPL_TIME 391
#define RPL_USERSSTART 392
#define RPL_USERS 393
#define RPL_ENDOFUSERS 394
#define RPL_NOUSERS 395
#define RPL_HOSTHIDDEN 396
#define RPL_TRACELINK 200
#define RPL_TRACECONNECTING 201
#define RPL_TRACEHANDSHAKE 202
#define RPL_TRACEUNKNOWN 203
#define RPL_TRACEOPERATOR 204
#define RPL_TRACEUSER 205
#define RPL_TRACESERVER 206
#define RPL_TRACESERVICE 207
#define RPL_TRACENEWTYPE 208
#define RPL_TRACECLASS 209
#define RPL_STATSHELP 210
#define RPL_STATSLINKINFO 211
#define RPL_STATSCOMMANDS 212
#define RPL_STATSCLINE 213
#define RPL_STATSOLDNLINE 214
#define RPL_STATSILINE 215
#define RPL_STATSKLINE 216
#define RPL_STATSQLINE 217
#define RPL_STATSYLINE 218
#define RPL_ENDOFSTATS 219
#define RPL_STATSBLINE 220
#define RPL_UMODEIS 221
#define RPL_SQLINE_NICK 222
#define RPL_STATSGLINE 223
#define RPL_STATSTLINE 224
#define RPL_STATSELINE 225
#define RPL_STATSNLINE 226
#define RPL_STATSVLINE 227
#define RPL_STATSBANVER 228
#define RPL_STATSSPAMF 229
#define RPL_STATSEXCEPTTKL 230
#define RPL_SERVICEINFO 231
#define RPL_RULES 232
#define RPL_SERVICE 233
#define RPL_SERVLIST 234
#define RPL_SERVLISTEND 235
#define RPL_STATSLLINE 241
#define RPL_STATSUPTIME 242
#define RPL_STATSOLINE 243
#define RPL_STATSHLINE 244
#define RPL_STATSSLINE 245
#define RPL_STATSXLINE 247
#define RPL_STATSULINE 248
#define RPL_STATSDEBUG 249
#define RPL_STATSCONN 250
#define RPL_LUSERCLIENT 251
#define RPL_LUSEROP 252
#define RPL_LUSERUNKNOWN 253
#define RPL_LUSERCHANNELS 254
#define RPL_LUSERME 255
#define RPL_ADMINME 256
#define RPL_ADMINLOC1 257
#define RPL_ADMINLOC2 258
#define RPL_ADMINEMAIL 259
#define RPL_TRACELOG 261
#define RPL_TRYAGAIN 263
#define RPL_LOCALUSERS 265
#define RPL_GLOBALUSERS 266
#define RPL_SILELIST 271
#define RPL_ENDOFSILELIST 272
#define RPL_STATSDLINE 275
#define RPL_WHOISCERTFP 276
#define RPL_HELPHDR 290
#define RPL_HELPOP 291
#define RPL_HELPTLR 292
#define RPL_HELPHLP 293
#define RPL_HELPFWD 294
#define RPL_HELPIGN 295
/*
* New /MAP format.
*/
#define RPL_MAP 006
#define RPL_MAPMORE 610
#define RPL_MAPEND 007
#define ERR_WHOSYNTAX 522
#define ERR_WHOLIMEXCEED 523
#define ERR_OPERSPVERIFY 524
#define RPL_SNOMASK 8
/*
* Numberic replies from server commands.
* These are also in the range 600-799.
*/
#define RPL_REAWAY 597
#define RPL_GONEAWAY 598
#define RPL_NOTAWAY 599
#define RPL_LOGON 600
#define RPL_LOGOFF 601
#define RPL_WATCHOFF 602
#define RPL_WATCHSTAT 603
#define RPL_NOWON 604
#define RPL_NOWOFF 605
#define RPL_WATCHLIST 606
#define RPL_ENDOFWATCHLIST 607
#define RPL_CLEARWATCH 608
#define RPL_NOWISAWAY 609
#define RPL_DCCSTATUS 617
#define RPL_DCCLIST 618
#define RPL_ENDOFDCCLIST 619
#define RPL_DCCINFO 620
#define RPL_DUMPING 640
#define RPL_DUMPRPL 641
#define RPL_EODUMP 642
#define RPL_SPAMCMDFWD 659
#define RPL_STARTTLS 670
#define RPL_WHOISSECURE 671
#define ERR_MLOCKRESTRICTED 742
#define ERR_CANNOTDOCOMMAND 972
#define ERR_CANNOTCHANGECHANMODE 974
#define ERR_STARTTLS 691
#define RPL_LOGGEDIN 900
#define RPL_LOGGEDOUT 901
#define ERR_NICKLOCKED 902
#define RPL_SASLSUCCESS 903
#define ERR_SASLFAIL 904
#define ERR_SASLTOOLONG 905
#define ERR_SASLABORTED 906
#define ERR_SASLALREADY 907
#define RPL_SASLMECHS 908
#define ERR_NUMERICERR 999

View File

@ -0,0 +1,81 @@
#ifndef HEADER_CURL_HOSTCHECK_H
#define HEADER_CURL_HOSTCHECK_H
/* Obtained from cURL
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#define CURL_HOST_NOMATCH 0
#define CURL_HOST_MATCH 1
int Curl_cert_hostcheck(const char *match_pattern, const char *hostname);
#endif /* HEADER_CURL_HOSTCHECK_H */
/* Obtained from: https://github.com/iSECPartners/ssl-conservatory */
/*
Copyright (C) 2012, iSEC Partners.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
* Helper functions to perform basic hostname validation using OpenSSL.
*
* Please read "everything-you-wanted-to-know-about-openssl.pdf" before
* attempting to use this code. This whitepaper describes how the code works,
* how it should be used, and what its limitations are.
*
* Author: Alban Diquet
* License: See LICENSE
*
*/
typedef enum {
MatchFound,
MatchNotFound,
NoSANPresent,
MalformedCertificate,
Error
} HostnameValidationResult;
/**
* Validates the server's identity by looking for the expected hostname in the
* server's certificate. As described in RFC 6125, it first tries to find a match
* in the Subject Alternative Name extension. If the extension is not present in
* the certificate, it checks the Common Name instead.
*
* Returns MatchFound if a match was found.
* Returns MatchNotFound if no matches were found.
* Returns MalformedCertificate if any of the hostnames had a NUL character embedded in it.
* Returns Error if there was an error.
*/
HostnameValidationResult validate_hostname(const char *hostname, const X509 *server_cert);

68
include/proto.h Normal file
View File

@ -0,0 +1,68 @@
/************************************************************************
* Unreal Internet Relay Chat Daemon, include/proto.h
* (C) Dominick Meglio <codemastr@unrealircd.com> 2000
*
* 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.
*/
#ifndef proto_h
#define proto_h
/* lusers.c */
extern void init_irccounts(void);
/* match.c */
extern char *collapse(char *pattern);
/* scache.c */
extern void clear_scache_hash_table(void);
/* send.c */
extern void sendto_one(Client *, MessageTag *mtags, FORMAT_STRING(const char *), ...) __attribute__((format(printf,3,4)));
extern void sendto_realops(FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,1,2)));
/* ircd.c */
extern EVENT(garbage_collect);
extern EVENT(loop_event);
extern EVENT(check_pings);
extern EVENT(handshake_timeout);
extern EVENT(check_deadsockets);
extern EVENT(try_connections);
/* support.c */
extern char *my_itoa(int i);
/* s_serv.c */
extern void load_tunefile(void);
extern EVENT(save_tunefile);
extern void read_motd(const char *filename, MOTDFile *motd);
/* s_user.c */
extern int target_limit_exceeded(Client *client, void *target, const char *name);
extern void make_umodestr(void);
extern char *get_usermode_string(Client *acptr);
/* s_misc.c */
extern char *convert_time(time_t ltime);
/* whowas.c */
extern void initwhowas(void);
/* uid.c */
extern void uid_init(void);
extern const char *uid_get(void);
#endif /* proto_h */

59
include/resource.h Normal file
View File

@ -0,0 +1,59 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by GENERIC.RC
// $Id$
#define IDC_USERID 1051
#define IDC_REALNAME 1052
#define IDC_PNICK 1053
#define IDC_ANICK 1054
#define IDC_SERVERLIST 1057
#define IDC_NEWSERVER 1058
#define IDC_EDITSERVER 1059
#define IDC_IRCDCONF 1059
#define IDC_DELSERVER 1060
#define IDC_SHOW_GLOBOPS 1060
#define IDC_SHOW_WALLOPS 1061
#define IDC_SHOW_HELPOPS 1062
#define IDC_SHOW_SERVNOTICE 1063
#define IDC_INFOTEXT 1063
#define IDM_OPEN 40001
#define IDM_SAVE 40002
#define IDM_SAVEAS 40003
#define IDM_EXIT 40004
#define IDM_ABOUT 40005
#define IDM_WINDOWCHILD 40006
#define IDM_REHASH 40007
#define IDM_OPTIONS 40008
#define IDM_CREDITS 40009
#define IDM_DF 40010
#define IDM_LICENSE 40011
#define IDM_DBGOFF 41099
#define IDM_DBGFATAL 41100
#define IDM_DBGERROR 41101
#define IDM_DBGNOTICE 41103
#define IDM_DBGDNS 41104
#define IDM_DBGINFO 41105
#define IDM_DBGNUM 41106
#define IDM_DBGSEND 41107
#define IDM_DBGDEBUG 41108
#define IDM_DBGMALLOC 41109
#define IDM_DBGLIST 41110
#define IDM_POPUP 50000
#define IDC_STATIC -1
#define IDM_IRCDRULES 65530
#define IDM_IRCDMOTD 65531
#define IDC_VERSION 65532
#define IDM_SETUP 65536
#define IDM_IRCDCONF 65535
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 113
#define _APS_NEXT_COMMAND_VALUE 40011
#define _APS_NEXT_CONTROL_VALUE 1064
#define _APS_NEXT_SYMED_VALUE 104
#endif
#endif

219
include/setup.h.in Normal file
View File

@ -0,0 +1,219 @@
/* include/setup.h.in. Generated from configure.ac by autoheader. */
/* Define the directory where the unrealircd binary is located */
#undef BINDIR
/* Specify the build directory */
#undef BUILDDIR
/* Define the location of the cached remote include files */
#undef CACHEDIR
/* Define the location of the configuration files */
#undef CONFDIR
/* Define the location of permanent data files */
#undef DATADIR
/* The default permissions for configuration files. Set to 0 to prevent
unrealircd from calling chmod() on the files. */
#undef DEFAULT_PERMISSIONS
/* Define the location of the documentation */
#undef DOCDIR
/* Define if you have getrusage */
#undef GETRUSAGE_2
/* Define if you have the <glob.h> header file. */
#undef GLOBH
/* Define if ssl library has SSL_CTX_set1_curves_list */
#undef HAS_SSL_CTX_SET1_CURVES_LIST
/* Define if ssl library has SSL_CTX_set_min_proto_version */
#undef HAS_SSL_CTX_SET_MIN_PROTO_VERSION
/* Define if you have crypt */
#undef HAVE_CRYPT
/* Define if you have epoll */
#undef HAVE_EPOLL
/* Define to 1 if you have the `epoll_create' function. */
#undef HAVE_EPOLL_CREATE
/* Define to 1 if you have the `epoll_ctl' function. */
#undef HAVE_EPOLL_CTL
/* Define to 1 if you have the `epoll_wait' function. */
#undef HAVE_EPOLL_WAIT
/* Define to 1 if you have the `explicit_bzero' function. */
#undef HAVE_EXPLICIT_BZERO
/* Define to 1 if you have the `getrusage' function. */
#undef HAVE_GETRUSAGE
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `kevent' function. */
#undef HAVE_KEVENT
/* Define to 1 if you have the `kqueue' function. */
#undef HAVE_KQUEUE
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `poll' function. */
#undef HAVE_POLL
/* Define if you have PS_STRINGS */
#undef HAVE_PSSTRINGS
/* Define if you have pstat */
#undef HAVE_PSTAT
/* Define if you have POSIX threads libraries and header files. */
#undef HAVE_PTHREAD
/* Have PTHREAD_PRIO_INHERIT. */
#undef HAVE_PTHREAD_PRIO_INHERIT
/* Define if you have setproctitle */
#undef HAVE_SETPROCTITLE
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strlcat' function. */
#undef HAVE_STRLCAT
/* Define to 1 if you have the `strlcpy' function. */
#undef HAVE_STRLCPY
/* Define to 1 if you have the `strlncat' function. */
#undef HAVE_STRLNCAT
/* Define to 1 if you have the `syslog' function. */
#undef HAVE_SYSLOG
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the `times' function. */
#undef HAVE_TIMES
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you want modes shown in /list */
#undef LIST_SHOW_MODES
/* Define the location of the log files */
#undef LOGDIR
/* Set to the maximum number of connections you want */
#undef MAXCONNECTIONS_REQUEST
/* Define the location of the modules */
#undef MODULESDIR
/* Set to the nickname history length you want */
#undef NICKNAMEHISTORYLENGTH
/* Define if you want OperOverride disabled */
#undef NO_OPEROVERRIDE
/* Define if you want opers to have to use /invite to join +s/+p channels */
#undef OPEROVERRIDE_VERIFY
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define the location of permanent data files */
#undef PERMDATADIR
/* Define the path of the pid file */
#undef PIDFILE
/* Define if you want +a/+q prefixes */
#undef PREFIX_AQ
/* Define the location of private libraries */
#undef PRIVATELIBDIR
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
#undef PTHREAD_CREATE_JOINABLE
/* Define if you have the <sys/rusage.h> header file. */
#undef RUSAGEH
/* Define the directory where the unrealircd start stop scripts is located */
#undef SCRIPTDIR
/* Link... statically(?) (defining this macro will probably cause the build
tofail) */
#undef STATIC_LINKING
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you have the <sys/syslog.h> header file. */
#undef SYSSYSLOGH
/* Define if you have times */
#undef TIMES_2
/* Define the location of private temporary files */
#undef TMPDIR
/* Define if your system prepends an underscore to symbols */
#undef UNDERSCORE
/* Generation version number (e.g.: X for X.Y.Z) */
#undef UNREAL_VERSION_GENERATION
/* Major version number (e.g.: Y for X.Y.Z) */
#undef UNREAL_VERSION_MAJOR
/* Minor version number (e.g.: Z for X.Y.Z) */
#undef UNREAL_VERSION_MINOR
/* Version suffix such as a beta marker or release candidate marker. (e.g.:
-rcX for unrealircd-3.2.9-rcX) */
#undef UNREAL_VERSION_SUFFIX
/* Define if you have libcurl installed to get remote includes and MOTD
support */
#undef USE_LIBCURL

2159
include/struct.h Normal file

File diff suppressed because it is too large Load Diff

227
include/sys.h Normal file
View File

@ -0,0 +1,227 @@
/*
* Unreal Internet Relay Chat Daemon, include/sys.h
* Copyright (C) 1990 University of Oulu, Computing Center
*
* 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.
*
* $Id$
*/
#ifndef __sys_include__
#define __sys_include__
/* PATH_MAX */
#include <limits.h>
#ifdef ISC202
#include <net/errno.h>
#else
#include <errno.h>
#endif
#include "setup.h"
#include <stdio.h>
#include <sys/types.h>
#ifndef _WIN32
#include <sys/param.h>
#else
#include <stdarg.h>
#include <process.h>
#endif
#include <stdlib.h>
#ifndef _WIN32
#include <unistd.h>
#include <strings.h>
#include <sys/resource.h>
#endif
/* get intptr_t if the system provides it -- otherwise, ./configure will define it for us */
#ifdef HAVE_STDINT_H
#include <stdint.h>
#else
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif /* HAVE_INTTYPES_H */
#endif /* HAVE_STDINT_H */
#ifdef SSL
#include <openssl/ssl.h>
#endif
#ifndef _WIN32
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#else
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
#ifndef _WIN32
#include <sys/time.h>
#endif
#include <time.h>
#ifndef _WIN32
#include <sys/wait.h>
#ifndef WEXITSTATUS
#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
#endif
#ifndef WIFEXITED
#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
#endif
#endif
/*
* Different name on NetBSD, FreeBSD, and BSDI
*/
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__) || defined(__linux__) || defined(__APPLE__)
#define dn_skipname __dn_skipname
#endif
/*
* Mac OS X Tiger Support (Intel Only)
*/
#if defined(macosx) || defined(__APPLE__)
#define OSXTIGER
#endif
#ifndef _WIN32
extern void dummy();
#endif
#ifdef NO_U_TYPES
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned long u_long;
typedef unsigned int u_int;
#endif
#ifdef _WIN32
#define MYOSNAME OSName
extern char OSName[256];
#define PATH_MAX MAX_PATH
#define getpid _getpid
#else
#define MYOSNAME getosname()
#endif
#define MYDUMMY_SIZE 128
/*
* Socket, File, and Error portability macros
*/
#ifndef _WIN32
#define SET_ERRNO(x) errno = x
#define READ_SOCK(fd, buf, len) read((fd), (buf), (len))
#define WRITE_SOCK(fd, buf, len) write((fd), (buf), (len))
#define CLOSE_SOCK(fd) close(fd)
#define IOCTL(x, y, z) ioctl((x), (y), (z))
#define ERRNO errno
#define STRERROR(x) strerror(x)
/* error constant portability */
#define P_EMFILE EMFILE
#define P_ENOBUFS ENOBUFS
#define P_EWOULDBLOCK EWOULDBLOCK
#define P_EAGAIN EAGAIN
#define P_EINPROGRESS EINPROGRESS
#define P_EWORKING EINPROGRESS
#define P_EINTR EINTR
#define P_ETIMEDOUT ETIMEDOUT
#define P_ENOTSOCK ENOTSOCK
#define P_EIO EIO
#define P_ECONNABORTED ECONNABORTED
#define P_ECONNRESET ECONNRESET
#define P_ENOTCONN ENOTCONN
#define P_EMSGSIZE EMSGSIZE
#else
/* WIN32 */
#define NETDB_INTERNAL -1 /* see errno */
#define NETDB_SUCCESS 0 /* no problem */
/* IO and Error portability macros */
#define READ_SOCK(fd, buf, len) recv((fd), (buf), (len), 0)
#define WRITE_SOCK(fd, buf, len) send((fd), (buf), (len), 0)
#define CLOSE_SOCK(fd) closesocket(fd)
#define IOCTL(x, y, z) ioctlsocket((x), (y), (z))
#define ERRNO WSAGetLastError()
#define STRERROR(x) sock_strerror(x)
#define SET_ERRNO(x) WSASetLastError(x)
/* Error constant portability */
#define P_EMFILE WSAEMFILE
#define P_ENOBUFS WSAENOBUFS
#define P_EWOULDBLOCK WSAEWOULDBLOCK
#define P_EAGAIN WSAEWOULDBLOCK
#define P_EINPROGRESS WSAEINPROGRESS
#define P_EWORKING WSAEWOULDBLOCK
#define P_EINTR WSAEINTR
#define P_ETIMEDOUT WSAETIMEDOUT
#define P_ENOTSOCK WSAENOTSOCK
#define P_EIO EIO
#define P_ECONNABORTED WSAECONNABORTED
#define P_ECONNRESET WSAECONNRESET
#define P_ENOTCONN WSAENOTCONN
#define P_EMSGSIZE WSAEMSGSIZE
#endif
#ifndef __GNUC__
#define __attribute__(x) /* nothing */
#endif
#undef FORMAT_STRING
#if _MSC_VER >= 1400
# include <sal.h>
# if _MSC_VER > 1400
# define FORMAT_STRING(p) _Printf_format_string_ p
# else
# define FORMAT_STRING(p) __format_string p
# endif /* FORMAT_STRING */
#else
# define FORMAT_STRING(p) p
#endif /* _MSC_VER */
/* A normal abort() on windows causes the crucial stack frame to be missing
* from the stack trace, IOTW: you don't see where abort() was called!
* It's silly but this works:
*/
#ifdef _WIN32
#define abort() do { char *crash = NULL; *crash = 'x'; exit(1); } while(0)
#endif
#ifndef SOMAXCONN
# define LISTEN_SIZE (5)
#else
# define LISTEN_SIZE (SOMAXCONN)
#endif
/*
* Try and find the correct name to use with getrlimit() for setting the max.
* number of files allowed to be open by this process.
*/
#ifdef RLIMIT_FDMAX
# define RLIMIT_FD_MAX RLIMIT_FDMAX
#else
# ifdef RLIMIT_NOFILE
# define RLIMIT_FD_MAX RLIMIT_NOFILE
# else
# ifdef RLIMIT_OPEN_MAX
# define RLIMIT_FD_MAX RLIMIT_OPEN_MAX
# else
# undef RLIMIT_FD_MAX
# endif
# endif
#endif
#endif /* __sys_include__ */

43
include/types.h Normal file
View File

@ -0,0 +1,43 @@
/*
* Unreal Internet Relay Chat Daemon, include/types.h
* (C) 2003 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.
*/
#ifndef TYPES_H
#define TYPES_H
typedef void (*vFP)(); /* Void function pointer */
typedef int (*iFP)(); /* Integer function pointer */
typedef char (*cFP)(); /* char * function pointer */
#ifndef MODVAR
#if defined(MODULE_COMPILE) && defined(_WIN32)
#define MODVAR __declspec(dllimport)
#else
#define MODVAR
#endif
#endif
#ifndef MODFUNC
#ifdef _WIN32
#define MODFUNC __declspec(dllexport)
#else
#define MODFUNC
#endif
#endif
#endif

37
include/unrealircd.h Normal file
View File

@ -0,0 +1,37 @@
/** Standard include for all UnrealIRCd modules.
* This should normally provide all of UnrealIRCd's functionality
* (that is publicly exposed anyway).
*/
#include "config.h"
#include <assert.h>
#include "struct.h"
#include "common.h"
#include "sys.h"
#include "numeric.h"
#include "msg.h"
#include "mempool.h"
#include "proto.h"
#include "channel.h"
#include <time.h>
#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
#ifdef GLOBH
#include <glob.h>
#endif
#ifdef _WIN32
#include <io.h>
#include <sys/timeb.h>
#undef GLOBH
#else
#include <sys/resource.h>
#include <utime.h>
#endif
#include <fcntl.h>
#include <signal.h>
#include "h.h"
#include "url.h"
#include "version.h"
#ifdef USE_LIBCURL
#include <curl/curl.h>
#endif

13
include/url.h Normal file
View File

@ -0,0 +1,13 @@
#ifndef URL_H
#define URL_H
#include "types.h"
int MODFUNC url_is_valid(const char *);
extern const char MODFUNC *displayurl(const char *url);
char MODFUNC *url_getfilename(const char *url);
char MODFUNC *download_file(const char *, char **);
void MODFUNC download_file_async(const char *, time_t, vFP, void *callback_data);
void MODFUNC url_do_transfers_async(void);
void MODFUNC url_init(void);
#endif

72
include/version.h Normal file
View File

@ -0,0 +1,72 @@
/*
**
** version.h
** UnrealIRCd
** $Id$
*/
#ifndef __versioninclude
#define __versioninclude 1
/*
* Utility macros to convert version number constants to strings.
* Delayed expansion requires two macros to work. See:
*
* $ info '(cpp) Stringification'
*/
#define _macro_to_str(n) #n
#define macro_to_str(n) _macro_to_str(n)
/*
* Mark of settings
*/
#ifdef DEBUGMODE
#define DEBUGMODESET "+(debug)"
#else
#define DEBUGMODESET ""
#endif
/**/
#ifdef DEBUG
#define DEBUGSET "(Debug)"
#else
#define DEBUGSET ""
#endif
/**/
#define COMPILEINFO DEBUGMODESET DEBUGSET
/* Version info follows
* Please be sure to update ALL fields when changing the version.
* Also don't forget to bump the protocol version every release.
*/
/**
* The following code concerns UNREAL_VERSION_GENERATION,
* UNREAL_VERSION_MAJOR, and UNREAL_VERSION_MINOR.
*
* These UNREAL_VERSION_* macros can be used so (3rd party) modules
* can easily distinguish versions.
*
* They are set during ./configure, so update ./configure.ac's AC_INIT
* line upon a new release.
*/
/** Year + week of the year (ISO week number, with Monday as first day of week)
* Can be useful if the above 3 versionids are insufficient for you (eg: you want to support CVS).
* This is updated automatically on the CVS server every Monday. so don't touch it.
*/
#define UNREAL_VERSION_TIME 202001
#define UnrealProtocol 5002
#define PATCH1 macro_to_str(UNREAL_VERSION_GENERATION)
#define PATCH2 "." macro_to_str(UNREAL_VERSION_MAJOR)
#define PATCH3 "." macro_to_str(UNREAL_VERSION_MINOR)
#define PATCH4 UNREAL_VERSION_SUFFIX
#define PATCH5 ""
#define PATCH6 ""
#define PATCH7 ""
#define PATCH8 COMPILEINFO
#define PATCH9 ""
/* release header */
#define Rh BASE_VERSION
#define VERSIONONLY PATCH1 PATCH2 PATCH3 PATCH4 PATCH5 PATCH6 PATCH7
#endif /* __versioninclude */

71
include/whowas.h Normal file
View File

@ -0,0 +1,71 @@
/************************************************************************
* IRC - Internet Relay Chat, include/whowas.h
* Copyright (C) 1990 Markku Savela
*
* 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.
*/
/*
* from original rcs
* $ Id: whowas.h,v 6.1 1991/07/04 21:04:39 gruner stable gruner $
*
* $ Log: whowas.h,v $
* Revision 6.1 1991/07/04 21:04:39 gruner
* Revision 2.6.1 [released]
*
* Revision 6.0 1991/07/04 18:05:08 gruner
* frozen beta revision 2.6.1
*
* th+hybrid rcs version
* $Id$
*/
#ifndef __whowas_include__
#define __whowas_include__
/*
** add_history
** Add the currently defined name of the client to history.
** usually called before changing to a new name (nick).
** Client must be a fully registered user (specifically,
** the user structure must have been allocated).
*/
void add_history(Client *, int);
/*
** off_history
** This must be called when the client structure is about to
** be released. History mechanism keeps pointers to client
** structures and it must know when they cease to exist. This
** also implicitly calls AddHistory.
*/
void off_history(Client *);
/*
** get_history
** Return the current client that was using the given
** nickname within the timelimit. Returns NULL, if no
** one found...
*/
Client *get_history(char *, time_t);
/* Nick name */
/* Time limit in seconds */
/*
** for debugging...counts related structures stored in whowas array.
*/
void count_whowas_memory(int *, u_long *);
#endif /* __whowas_include__ */

72
include/windows/setup.h Normal file
View File

@ -0,0 +1,72 @@
/************************************************************************
* IRC - Internet Relay Chat, include/win32/setup.h
* Copyright (C) 1999 Carsten Munk
*
* 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.
*
* $Id$
*/
#ifndef __setup_include__
#define __setup_include__
#undef SYSSYSLOGH
#define NOINDEX
#undef TIMES_2
#undef GETRUSAGE_2
#define CONFDIR "conf"
#define MODULESDIR "modules"
#define LOGDIR "logs"
#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
#define LIST_SHOW_MODES
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#define HAVE_EXPLICIT_BZERO
#define explicit_bzero(a,b) SecureZeroMemory(a,b)
/* mode_t: Needed in s_conf.c for the third argument of open(3p).
* Should be an int because of http://msdn.microsoft.com/en-us/library/z0kc8e3z(VS.71).aspx
*/
#define mode_t int
/* We don't use any of the wincrypt stuff and this silences
* a warning emitted by LibreSSL:
*/
#define NOCRYPT
/* We require Windows 7 or later */
#define NTDDI_VERSION 0x06010000
#define _WIN32_WINNT 0x0601
/* Generation version number (e.g.: 3 for Unreal3*) */
#define UNREAL_VERSION_GENERATION 5
/* Major version number (e.g.: 2 for Unreal3.2*) */
#define UNREAL_VERSION_MAJOR 0
/* Minor version number (e.g.: 1 for Unreal3.2.1) */
#define UNREAL_VERSION_MINOR 3
/* Version suffix such as a beta marker or release candidate marker. (e.g.:
-rcX for unrealircd-3.2.9-rcX) */
#define UNREAL_VERSION_SUFFIX ".1"
#endif

246
src/Makefile.in Normal file
View File

@ -0,0 +1,246 @@
#************************************************************************
#* IRC - Internet Relay Chat, src/Makefile
#* Copyright (C) 1990 Jarkko Oikarinen
#*
#* 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.
#*
#* $Id$
#*/
CC = "==== DO NOT RUN MAKE FROM THIS DIRECTORY ===="
OBJS=dns.o auth.o channel.o crule.o dbuf.o \
fdlist.o hash.o ircd.o ircsprintf.o list.o \
match.o modules.o parse.o mempool.o operclass.o \
conf_preprocessor.o conf.o debug.o dispatch.o numeric.o \
misc.o serv.o aliases.o socket.o \
tls.o user.o scache.o send.o support.o \
version.o whowas.o random.o api-usermode.o api-channelmode.o \
api-moddata.o api-extban.o api-isupport.o api-command.o \
api-clicap.o api-messagetag.o api-history-backend.o api-efunctions.o \
api-event.o \
crypt_blowfish.o updconf.o crashreport.o modulemanager.o \
utf8.o \
openssl_hostname_validation.o $(URL)
SRC=$(OBJS:%.o=%.c)
# Flags specific for the ircd binary (and it's object files)...
# .. but NOT for modules.
BINCFLAGS=@HARDEN_BINCFLAGS@
BINLDFLAGS=@DYNAMIC_LDFLAGS@ @HARDEN_BINLDFLAGS@
INCLUDES = ../include/channel.h \
../include/common.h ../include/config.h ../include/dbuf.h \
../include/dynconf.h ../include/fdlist.h ../include/h.h \
../include/ircsprintf.h \
../include/license.h \
../include/modules.h ../include/modversion.h ../include/msg.h \
../include/numeric.h ../include/proto.h \
../include/resource.h ../include/setup.h \
../include/struct.h ../include/sys.h \
../include/types.h ../include/url.h \
../include/version.h ../include/whowas.h \
../include/openssl_hostname_validation.h
all: build
build:
# Force build of 'ircd', before we start building any modules:
$(MAKE) ircd
$(MAKE) mods
custommodule:
+cd modules/third; $(MAKE) MODULEFILE=$(MODULEFILE) 'EXLIBS=$(EXLIBS)' custommodule
ircd: $(OBJS)
$(CC) $(CFLAGS) $(BINCFLAGS) $(CRYPTOLIB) -o ircd $(OBJS) $(LDFLAGS) $(BINLDFLAGS) $(IRCDLIBS) $(CRYPTOLIB)
mods:
@if [ ! -r include ] ; then \
ln -s ../include include; \
fi
@if [ ! -r modules ] ; then \
echo "You havent done cvs update -P -d"; \
fi
+cd modules; $(MAKE) all
version.c: version.c.SH
$(SHELL) version.c.SH
version.o: version.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c version.c
parse.o: parse.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c parse.c
socket.o: socket.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c socket.c
dispatch.o: dispatch.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c dispatch.c
dbuf.o: dbuf.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c dbuf.c
auth.o: auth.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c auth.c
send.o: send.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c send.c
tls.o: tls.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c tls.c
match.o: match.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c match.c
modules.o: modules.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c modules.c
mempool.o: mempool.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c mempool.c
support.o: support.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c support.c
userload.o: userload.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c userload.c
aliases.o: aliases.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c aliases.c
clean:
$(RM) -f *.o *.so *~ core ircd version.c; \
cd modules; make clean
cleandir: clean
depend:
makedepend -I${INCLUDEDIR} ${SRC}
channel.o: channel.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c channel.c
ircd.o: ircd.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c ircd.c
list.o: list.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c list.c
dns.o: dns.c $(INCLUDES) ../include/dns.h
$(CC) $(CFLAGS) $(BINCFLAGS) -c dns.c
fdlist.o: fdlist.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c fdlist.c
conf_preprocessor.o: conf_preprocessor.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c conf_preprocessor.c
conf.o: conf.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c conf.c
debug.o: debug.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c debug.c
numeric.o: numeric.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c numeric.c
misc.o: misc.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c misc.c
scache.o: scache.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c scache.c
ircsprintf.o: ircsprintf.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c ircsprintf.c
user.o: user.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c user.c
serv.o: serv.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c serv.c
whowas.o: whowas.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c whowas.c
hash.o: hash.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c hash.c
crule.o: crule.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c crule.c
random.o: random.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c random.c
operclass.o: operclass.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c operclass.c
api-usermode.o: api-usermode.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c api-usermode.c
api-event.o: api-event.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c api-event.c
api-channelmode.o: api-channelmode.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c api-channelmode.c
api-moddata.o: api-moddata.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c api-moddata.c
api-extban.o: api-extban.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c api-extban.c
api-command.o: api-command.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c api-command.c
api-isupport.o: api-isupport.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c api-isupport.c
api-clicap.o: api-clicap.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c api-clicap.c
api-messagetag.o: api-messagetag.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c api-messagetag.c
api-history-backend.o: api-history-backend.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c api-history-backend.c
api-efunctions.o: api-efunctions.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c api-efunctions.c
crypt_blowfish.o: crypt_blowfish.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c crypt_blowfish.c
updconf.o: updconf.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c updconf.c
crashreport.o: crashreport.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c crashreport.c
modulemanager.o: modulemanager.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c modulemanager.c
utf8.o: utf8.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c utf8.c
openssl_hostname_validation.o: openssl_hostname_validation.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c openssl_hostname_validation.c
url.o: url.c $(INCLUDES)
$(CC) $(CFLAGS) $(BINCFLAGS) -c url.c
# DO NOT DELETE THIS LINE -- make depend depends on it.

287
src/aliases.c Normal file
View File

@ -0,0 +1,287 @@
/*
* Unreal Internet Relay Chat Daemon, src/aliases.c
* (C) 2000-2001 Carsten V. Munk 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"
/* Function to return a group of tokens -- codemastr */
void strrangetok(char *in, char *out, char tok, short first, short last) {
int i = 0, tokcount = 0, j = 0;
first--;
last--;
while(in[i]) {
if (in[i] == tok) {
tokcount++;
if (tokcount == first)
i++;
}
if (tokcount >= first && (tokcount <= last || last == -1)) {
out[j] = in[i];
j++;
}
i++;
}
out[j] = 0;
}
/* cmd_alias is a special type of command, it has an extra argument 'cmd'. */
static int recursive_alias = 0;
void cmd_alias(Client *client, MessageTag *mtags, int parc, char *parv[], char *cmd)
{
ConfigItem_alias *alias;
Client *acptr;
int ret;
if (!(alias = find_alias(cmd)))
{
sendto_one(client, NULL, ":%s %d %s %s :Unknown command",
me.name, ERR_UNKNOWNCOMMAND, client->name, cmd);
return;
}
/* If it isn't an ALIAS_COMMAND, we require a paramter ... We check ALIAS_COMMAND LATER */
if (alias->type != ALIAS_COMMAND && (parc < 2 || *parv[1] == '\0'))
{
sendnumeric(client, ERR_NOTEXTTOSEND);
return;
}
if (alias->type == ALIAS_SERVICES)
{
if (SERVICES_NAME && (acptr = find_person(alias->nick, NULL)))
{
if (alias->spamfilter && match_spamfilter(client, parv[1], SPAMF_USERMSG, alias->nick, 0, NULL))
return;
sendto_one(acptr, NULL, ":%s PRIVMSG %s@%s :%s", client->name,
alias->nick, SERVICES_NAME, parv[1]);
}
else
sendnumeric(client, ERR_SERVICESDOWN, alias->nick);
}
else if (alias->type == ALIAS_STATS)
{
if (STATS_SERVER && (acptr = find_person(alias->nick, NULL)))
{
if (alias->spamfilter && match_spamfilter(client, parv[1], SPAMF_USERMSG, alias->nick, 0, NULL))
return;
sendto_one(acptr, NULL, ":%s PRIVMSG %s@%s :%s", client->name,
alias->nick, STATS_SERVER, parv[1]);
}
else
sendnumeric(client, ERR_SERVICESDOWN, alias->nick);
}
else if (alias->type == ALIAS_NORMAL)
{
if ((acptr = find_person(alias->nick, NULL)))
{
if (alias->spamfilter && match_spamfilter(client, parv[1], SPAMF_USERMSG, alias->nick, 0, NULL))
return;
if (MyUser(acptr))
sendto_one(acptr, NULL, ":%s!%s@%s PRIVMSG %s :%s", client->name,
client->user->username, GetHost(client),
alias->nick, parv[1]);
else
sendto_one(acptr, NULL, ":%s PRIVMSG %s :%s", client->name,
alias->nick, parv[1]);
}
else
sendnumeric(client, ERR_NOSUCHNICK, alias->nick);
}
else if (alias->type == ALIAS_CHANNEL)
{
Channel *channel;
if ((channel = find_channel(alias->nick, NULL)))
{
char *msg = parv[1];
char *errmsg = NULL;
if (can_send_to_channel(client, channel, &msg, &errmsg, 0))
{
if (alias->spamfilter && match_spamfilter(client, parv[1], SPAMF_CHANMSG, channel->chname, 0, NULL))
return;
new_message(client, NULL, &mtags);
sendto_channel(channel, client, client->direction,
PREFIX_ALL, 0, SEND_ALL|SKIP_DEAF, mtags,
":%s PRIVMSG %s :%s",
client->name, channel->chname, parv[1]);
free_message_tags(mtags);
return;
}
}
sendnumeric(client, ERR_CANNOTDOCOMMAND,
cmd, "You may not use this command at this time");
}
else if (alias->type == ALIAS_COMMAND)
{
ConfigItem_alias_format *format;
char *ptr = "";
if (!(parc < 2 || *parv[1] == '\0'))
ptr = parv[1];
for (format = alias->format; format; format = format->next)
{
if (unreal_match(format->expr, ptr))
{
/* Parse the parameters */
int i = 0, j = 0, k = 1;
char output[1024], current[1024];
char nums[4];
memset(current, 0, sizeof(current));
memset(output, 0, sizeof(output));
while(format->parameters[i] && j < 500)
{
k = 0;
if (format->parameters[i] == '%')
{
i++;
if (format->parameters[i] == '%')
output[j++] = '%';
else if (isdigit(format->parameters[i]))
{
for(; isdigit(format->parameters[i]) && k < 2; i++, k++) {
nums[k] = format->parameters[i];
}
nums[k] = 0;
i--;
if (format->parameters[i+1] == '-') {
strrangetok(ptr, current, ' ', atoi(nums),0);
i++;
}
else
strrangetok(ptr, current, ' ', atoi(nums), atoi(nums));
if (!*current)
continue;
if (j + strlen(current)+1 >= 500)
break;
strlcat(output, current, sizeof output);
j += strlen(current);
}
else if (format->parameters[i] == 'n' ||
format->parameters[i] == 'N')
{
strlcat(output, client->name, sizeof output);
j += strlen(client->name);
}
else
{
output[j++] = '%';
output[j++] = format->parameters[i];
}
i++;
continue;
}
output[j++] = format->parameters[i++];
}
output[j] = 0;
/* Now check to make sure we have something to send */
if (strlen(output) == 0)
{
sendnumeric(client, ERR_NEEDMOREPARAMS, cmd);
return;
}
if (format->type == ALIAS_SERVICES)
{
if (SERVICES_NAME && (acptr = find_person(format->nick, NULL)))
{
if (alias->spamfilter && match_spamfilter(client, output, SPAMF_USERMSG, format->nick, 0, NULL))
return;
sendto_one(acptr, NULL, ":%s PRIVMSG %s@%s :%s", client->name,
format->nick, SERVICES_NAME, output);
} else
sendnumeric(client, ERR_SERVICESDOWN, format->nick);
}
else if (format->type == ALIAS_STATS)
{
if (STATS_SERVER && (acptr = find_person(format->nick, NULL)))
{
if (alias->spamfilter && match_spamfilter(client, output, SPAMF_USERMSG, format->nick, 0, NULL))
return;
sendto_one(acptr, NULL, ":%s PRIVMSG %s@%s :%s", client->name,
format->nick, STATS_SERVER, output);
} else
sendnumeric(client, ERR_SERVICESDOWN, format->nick);
}
else if (format->type == ALIAS_NORMAL)
{
if ((acptr = find_person(format->nick, NULL)))
{
if (alias->spamfilter && match_spamfilter(client, output, SPAMF_USERMSG, format->nick, 0, NULL))
return;
if (MyUser(acptr))
sendto_one(acptr, NULL, ":%s!%s@%s PRIVMSG %s :%s", client->name,
client->user->username, IsHidden(client) ? client->user->virthost : client->user->realhost,
format->nick, output);
else
sendto_one(acptr, NULL, ":%s PRIVMSG %s :%s", client->name,
format->nick, output);
}
else
sendnumeric(client, ERR_NOSUCHNICK, format->nick);
}
else if (format->type == ALIAS_CHANNEL)
{
Channel *channel;
if ((channel = find_channel(format->nick, NULL)))
{
char *msg = output;
char *errmsg = NULL;
if (!can_send_to_channel(client, channel, &msg, &errmsg, 0))
{
if (alias->spamfilter && match_spamfilter(client, output, SPAMF_CHANMSG, channel->chname, 0, NULL))
return;
new_message(client, NULL, &mtags);
sendto_channel(channel, client, client->direction,
PREFIX_ALL, 0, SEND_ALL|SKIP_DEAF, mtags,
":%s PRIVMSG %s :%s",
client->name, channel->chname, parv[1]);
free_message_tags(mtags);
return;
}
}
sendnumeric(client, ERR_CANNOTDOCOMMAND, cmd,
"You may not use this command at this time");
}
else if (format->type == ALIAS_REAL)
{
int ret;
char mybuf[500];
snprintf(mybuf, sizeof(mybuf), "%s %s", format->nick, output);
if (recursive_alias)
{
sendnumeric(client, ERR_CANNOTDOCOMMAND, cmd, "You may not use this command at this time -- recursion");
return;
}
recursive_alias = 1;
parse(client, mybuf, strlen(mybuf));
recursive_alias = 0;
return;
}
break;
}
}
}
}

549
src/api-channelmode.c Normal file
View File

@ -0,0 +1,549 @@
/************************************************************************
* IRC - Internet Relay Chat, src/api-channelmode.c
* (C) 2003-2007 Bram Matthys (Syzop) and the UnrealIRCd Team
*
* 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.
*/
/** @file
* @brief The channel mode API used by modules.
*/
#include "unrealircd.h"
/** This is the extended channel mode API
* @defgroup ChannelModeAPI Channel mode API
* @{
*/
/** Table with details on each channel mode handler */
Cmode *Channelmode_Table = NULL;
/** Highest index in Channelmode_Table */
unsigned short Channelmode_highest = 0;
/** @} */
/** Channel parameter to slot# mapping - used by GETPARAMSLOT() macro */
MODVAR unsigned char param_to_slot_mapping[256];
/** Extended channel modes in use - used by ISUPPORT/005 numeric only */
char extchmstr[4][64];
/* Private functions (forward declaration) and variables */
static void make_cmodestr(void);
static char previous_chanmodes[256];
static Cmode *ParamTable[MAXPARAMMODES+1];
static void unload_extcmode_commit(Cmode *cmode);
/** Create the strings that are used for CHANMODES=a,b,c,d in numeric 005 */
void make_extcmodestr()
{
char *p;
int i;
extchmstr[0][0] = extchmstr[1][0] = extchmstr[2][0] = extchmstr[3][0] = '\0';
/* type 1: lists (like b/e) */
/* [NOT IMPLEMENTED IN EXTCMODES] */
/* type 2: 1 par to set/unset (has .unset_with_param) */
p = extchmstr[1];
for (i=0; i <= Channelmode_highest; i++)
if (Channelmode_Table[i].paracount && Channelmode_Table[i].flag &&
Channelmode_Table[i].unset_with_param)
*p++ = Channelmode_Table[i].flag;
*p = '\0';
/* type 3: 1 param to set, 0 params to unset (does not have .unset_with_param) */
p = extchmstr[2];
for (i=0; i <= Channelmode_highest; i++)
if (Channelmode_Table[i].paracount && Channelmode_Table[i].flag &&
!Channelmode_Table[i].unset_with_param)
*p++ = Channelmode_Table[i].flag;
*p = '\0';
/* type 4: paramless modes */
p = extchmstr[3];
for (i=0; i <= Channelmode_highest; i++)
if (!Channelmode_Table[i].paracount && Channelmode_Table[i].flag)
*p++ = Channelmode_Table[i].flag;
*p = '\0';
}
/** Create the string that is used in numeric 004 */
static void make_cmodestr(void)
{
char *p = &cmodestring[0];
CoreChannelModeTable *tab = &corechannelmodetable[0];
int i;
while (tab->mode != 0x0)
{
*p = tab->flag;
p++;
tab++;
}
for (i=0; i <= Channelmode_highest; i++)
if (Channelmode_Table[i].flag)
*p++ = Channelmode_Table[i].flag;
*p = '\0';
}
/** Check for changes - if any are detected, we broadcast the change */
void extcmodes_check_for_changes(void)
{
char chanmodes[256];
ISupport *isup;
make_cmodestr();
make_extcmodestr();
snprintf(chanmodes, sizeof(chanmodes), "%s%s", CHPAR1, EXPAR1);
safe_strdup(me.serv->features.chanmodes[0], chanmodes);
snprintf(chanmodes, sizeof(chanmodes), "%s%s", CHPAR2, EXPAR2);
safe_strdup(me.serv->features.chanmodes[1], chanmodes);
snprintf(chanmodes, sizeof(chanmodes), "%s%s", CHPAR3, EXPAR3);
safe_strdup(me.serv->features.chanmodes[2], chanmodes);
snprintf(chanmodes, sizeof(chanmodes), "%s%s", CHPAR4, EXPAR4);
safe_strdup(me.serv->features.chanmodes[3], chanmodes);
ircsnprintf(chanmodes, sizeof(chanmodes), "%s,%s,%s,%s",
me.serv->features.chanmodes[0],
me.serv->features.chanmodes[1],
me.serv->features.chanmodes[2],
me.serv->features.chanmodes[3]);
isup = ISupportFind("CHANMODES");
if (!isup)
{
strlcpy(previous_chanmodes, chanmodes, sizeof(previous_chanmodes));
return; /* not booted yet. then we are done here. */
}
ISupportSetValue(isup, chanmodes);
if (*previous_chanmodes && strcmp(chanmodes, previous_chanmodes))
{
ircd_log(LOG_ERROR, "Channel modes changed at runtime: %s -> %s",
previous_chanmodes, chanmodes);
sendto_realops("Channel modes changed at runtime: %s -> %s",
previous_chanmodes, chanmodes);
/* Broadcast change to all (locally connected) servers */
sendto_server(NULL, 0, 0, NULL, "PROTOCTL CHANMODES=%s", chanmodes);
}
strlcpy(previous_chanmodes, chanmodes, sizeof(previous_chanmodes));
}
/** Initialize the extended channel modes system */
void extcmode_init(void)
{
Cmode_t val = 1;
int i;
Channelmode_Table = safe_alloc(sizeof(Cmode) * EXTCMODETABLESZ);
for (i = 0; i < EXTCMODETABLESZ; i++)
{
Channelmode_Table[i].mode = val;
val *= 2;
}
Channelmode_highest = 0;
memset(&extchmstr, 0, sizeof(extchmstr));
memset(&param_to_slot_mapping, 0, sizeof(param_to_slot_mapping));
*previous_chanmodes = '\0';
}
/** Update letter->slot mapping and slot->handler mapping */
void extcmode_para_addslot(Cmode *c, int slot)
{
if ((slot < 0) || (slot > MAXPARAMMODES))
abort();
c->slot = slot;
ParamTable[slot] = c;
param_to_slot_mapping[c->flag] = slot;
}
/** Update letter->slot mapping and slot->handler mapping */
void extcmode_para_delslot(Cmode *c, int slot)
{
if ((slot < 0) || (slot > MAXPARAMMODES))
abort();
ParamTable[slot] = NULL;
param_to_slot_mapping[c->flag] = 0;
}
/** @defgroup ChannelModeAPI Channel mode API
* @{
*/
/** Register a new channel mode (Channel mode API).
* @param module The module requesting this channel mode (usually: modinfo->handle)
* @param req Details of the channel mode request
* @param mode Store the mode value (bit) here on success
* @returns the newly created channel mode, or NULL in case of error.
*/
Cmode *CmodeAdd(Module *module, CmodeInfo req, Cmode_t *mode)
{
short i = 0, j = 0;
int paraslot = -1;
int existing = 0;
while (i < EXTCMODETABLESZ)
{
if (!Channelmode_Table[i].flag)
break;
else if (Channelmode_Table[i].flag == req.flag)
{
if (Channelmode_Table[i].unloaded)
{
Channelmode_Table[i].unloaded = 0;
existing = 1;
break;
} else {
if (module)
module->errorcode = MODERR_EXISTS;
return NULL;
}
}
i++;
}
if (i == EXTCMODETABLESZ)
{
Debug((DEBUG_DEBUG, "CmodeAdd failed, no space"));
if (module)
module->errorcode = MODERR_NOSPACE;
return NULL;
}
if (req.paracount == 1)
{
if (existing)
{
/* Re-use parameter slot of the module with the same modechar that is unloading */
paraslot = Channelmode_Table[i].slot;
}
else
{
/* Allocate a new one */
for (paraslot = 0; ParamTable[paraslot]; paraslot++)
{
if (paraslot == MAXPARAMMODES - 1)
{
Debug((DEBUG_DEBUG, "CmodeAdd failed, no space for parameter"));
if (module)
module->errorcode = MODERR_NOSPACE;
return NULL;
}
}
}
}
*mode = Channelmode_Table[i].mode;
/* Update extended channel mode table highest */
Channelmode_Table[i].flag = req.flag;
Channelmode_Table[i].paracount = req.paracount;
Channelmode_Table[i].is_ok = req.is_ok;
Channelmode_Table[i].put_param = req.put_param;
Channelmode_Table[i].get_param = req.get_param;
Channelmode_Table[i].conv_param = req.conv_param;
Channelmode_Table[i].free_param = req.free_param;
Channelmode_Table[i].dup_struct = req.dup_struct;
Channelmode_Table[i].sjoin_check = req.sjoin_check;
Channelmode_Table[i].local = req.local;
Channelmode_Table[i].unset_with_param = req.unset_with_param;
Channelmode_Table[i].owner = module;
Channelmode_Table[i].unloaded = 0;
for (j = 0; j < EXTCMODETABLESZ; j++)
if (Channelmode_Table[j].flag)
if (j > Channelmode_highest)
Channelmode_highest = j;
if (Channelmode_Table[i].paracount == 1)
extcmode_para_addslot(&Channelmode_Table[i], paraslot);
if (module)
{
ModuleObject *cmodeobj = safe_alloc(sizeof(ModuleObject));
cmodeobj->object.cmode = &Channelmode_Table[i];
cmodeobj->type = MOBJ_CMODE;
AddListItem(cmodeobj, module->objects);
module->errorcode = MODERR_NOERROR;
}
return &(Channelmode_Table[i]);
}
/** Delete a previously registered channel mode - not called by modules.
* For modules this is done automatically on unload, no need to call this explicitly.
*/
void CmodeDel(Cmode *cmode)
{
if (cmode->owner)
{
ModuleObject *cmodeobj;
for (cmodeobj = cmode->owner->objects; cmodeobj; cmodeobj = cmodeobj->next) {
if (cmodeobj->type == MOBJ_CMODE && cmodeobj->object.cmode == cmode) {
DelListItem(cmodeobj, cmode->owner->objects);
safe_free(cmodeobj);
break;
}
}
cmode->owner = NULL;
}
if (loop.ircd_rehashing)
cmode->unloaded = 1;
else
unload_extcmode_commit(cmode);
}
/** @} */
/** After a channel mode is deregistered for sure, unload it completely.
* This is done after a REHASH when no new module has registered the mode.
* Then we can unload it for good. This also sends MODE -.. out etc.
*/
static void unload_extcmode_commit(Cmode *cmode)
{
Channel *channel;
if (!cmode)
return;
/* Unset channel mode and send MODE to everyone */
if (cmode->paracount == 0)
{
/* Paramless mode, easy */
for (channel = channels; channel; channel = channel->nextch)
{
if (channel->mode.extmode & cmode->mode)
{
MessageTag *mtags = NULL;
new_message(&me, NULL, &mtags);
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags,
":%s MODE %s -%c",
me.name, channel->chname, cmode->flag);
sendto_server(NULL, 0, 0, mtags,
":%s MODE %s -%c 0",
me.id, channel->chname, cmode->flag);
free_message_tags(mtags);
channel->mode.extmode &= ~cmode->mode;
}
}
} else
{
/* Parameter mode, more complicated */
for (channel = channels; channel; channel = channel->nextch)
{
if (channel->mode.extmode & cmode->mode)
{
MessageTag *mtags = NULL;
new_message(&me, NULL, &mtags);
if (cmode->unset_with_param)
{
char *param = cmode->get_param(GETPARASTRUCT(channel, cmode->flag));
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags,
":%s MODE %s -%c %s",
me.name, channel->chname, cmode->flag, param);
sendto_server(NULL, 0, 0, mtags,
":%s MODE %s -%c %s 0",
me.id, channel->chname, cmode->flag, param);
} else {
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags,
":%s MODE %s -%c",
me.name, channel->chname, cmode->flag);
sendto_server(NULL, 0, 0, mtags,
":%s MODE %s -%c 0",
me.id, channel->chname, cmode->flag);
}
free_message_tags(mtags);
cmode->free_param(GETPARASTRUCT(channel, cmode->flag));
channel->mode.extmode &= ~cmode->mode;
}
}
extcmode_para_delslot(cmode, cmode->slot);
}
cmode->flag = '\0';
}
/** Unload all unused channel modes after a REHASH */
void unload_all_unused_extcmodes(void)
{
int i;
for (i = 0; i < EXTCMODETABLESZ; i++)
if (Channelmode_Table[i].flag && Channelmode_Table[i].unloaded)
{
unload_extcmode_commit(&Channelmode_Table[i]);
}
}
/** @defgroup ChannelModeAPI Channel mode API
* @{
*/
/** Get parameter for a channel mode.
* @param channel The channel
* @param mode The mode character (eg: 'f')
*/
char *cm_getparameter(Channel *channel, char mode)
{
return GETPARAMHANDLERBYLETTER(mode)->get_param(GETPARASTRUCT(channel, mode));
}
/** Set parameter for a channel mode.
* @param channel The channel
* @param mode The mode character (eg: 'f')
* @param str The parameter string
* @note Module users should not use this function directly, it is only used by MODE and SJOIN.
*/
void cm_putparameter(Channel *channel, char mode, char *str)
{
GETPARASTRUCT(channel, mode) = GETPARAMHANDLERBYLETTER(mode)->put_param(GETPARASTRUCT(channel, mode), str);
}
/** Free a channel mode parameter.
* @param channel The channel
* @param mode The mode character (eg: 'f')
*/
void cm_freeparameter(Channel *channel, char mode)
{
GETPARAMHANDLERBYLETTER(mode)->free_param(GETPARASTRUCT(channel, mode));
GETPARASTRUCT(channel, mode) = NULL;
}
/** Get parameter for a channel mode - special version for SJOIN.
* This version doesn't take a channel, but a mode.extmodeparams.
* It is only used by SJOIN and should not be used in 3rd party modules.
* @param p The list, eg oldmode.extmodeparams
* @param mode The mode letter
*/
char *cm_getparameter_ex(void **p, char mode)
{
return GETPARAMHANDLERBYLETTER(mode)->get_param(GETPARASTRUCTEX(p, mode));
}
/** Set parameter for a channel mode - special version for SJOIN.
* This version doesn't take a channel, but a mode.extmodeparams.
* It is only used by SJOIN and should not be used in 3rd party modules.
* @param p The list, eg oldmode.extmodeparams
* @param mode The mode letter
* @param str The mode parameter string to set
*/
void cm_putparameter_ex(void **p, char mode, char *str)
{
GETPARASTRUCTEX(p, mode) = GETPARAMHANDLERBYLETTER(mode)->put_param(GETPARASTRUCTEX(p, mode), str);
}
/** Default handler for - require channel operator or higher (+o/+a/+q)
* @param client The client issueing the MODE
* @param channel The channel
* @param mode The mode letter (eg: 'f')
* @param para The parameter, if any (can be NULL)
* @param checkt The check type, one of .....
* @param what MODE_ADD / MODE_DEL (???)
* @returns EX_ALLOW or EX_DENY
*/
int extcmode_default_requirechop(Client *client, Channel *channel, char mode, char *para, int checkt, int what)
{
if (IsUser(client) && is_chan_op(client, channel))
return EX_ALLOW;
if (checkt == EXCHK_ACCESS_ERR) /* can only be due to being halfop */
sendnumeric(client, ERR_NOTFORHALFOPS, mode);
return EX_DENY;
}
/** Default handler for - require halfop or higher (+h/+o/+a/+q)
* @param client The client issueing the MODE
* @param channel The channel
* @param mode The mode letter (eg: 'f')
* @param para The parameter, if any (can be NULL)
* @param checkt The check type, one of .....
* @param what MODE_ADD / MODE_DEL (???)
* @returns EX_ALLOW or EX_DENY
*/
int extcmode_default_requirehalfop(Client *client, Channel *channel, char mode, char *para, int checkt, int what)
{
if (IsUser(client) && (is_chan_op(client, channel) || is_half_op(client, channel)))
return EX_ALLOW;
return EX_DENY;
}
/** Duplicate all channel mode parameters - only used by SJOIN.
* @param xi Input list
* @param xi Output list
*/
void extcmode_duplicate_paramlist(void **xi, void **xo)
{
int i;
Cmode *handler;
void *inx;
for (i = 0; i < MAXPARAMMODES; i++)
{
handler = CMP_GETHANDLERBYSLOT(i);
if (!handler)
continue; /* nothing there.. */
inx = xi[handler->slot]; /* paramter data of input is here */
if (!inx)
continue; /* not set */
xo[handler->slot] = handler->dup_struct(inx); /* call dup_struct with that input and set the output param to that */
}
}
/** Free all channel mode parameters - only used by SJOIN.
* @param ar The list
*/
void extcmode_free_paramlist(void **ar)
{
int i;
Cmode *handler;
for (i = 0; i < MAXPARAMMODES; i++)
{
handler = GETPARAMHANDLERBYSLOT(i);
if (!handler)
continue; /* nothing here... */
handler->free_param(ar[handler->slot]);
ar[handler->slot] = NULL;
}
}
/** @} */
/** Internal function: returns 1 if the specified module has 1 or more extended channel modes registered */
int module_has_extcmode_param_mode(Module *mod)
{
int i = 0;
while (i < EXTCMODETABLESZ)
{
if ((Channelmode_Table[i].flag) &&
(Channelmode_Table[i].owner == mod) &&
(Channelmode_Table[i].paracount))
{
return 1;
}
i++;
}
return 0;
}

372
src/api-clicap.c Normal file
View File

@ -0,0 +1,372 @@
/************************************************************************
* UnrealIRCd - Unreal Internet Relay Chat Daemon - src/api-clicap.c
* (c) 2015- Bram Matthys and The UnrealIRCd team
*
* 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 "unrealircd.h"
MODVAR ClientCapability *clicaps = NULL; /* List of client capabilities */
void clicap_init(void)
{
}
/**
* Returns an clicap handle based on the given token name.
*
* @param token The clicap token to search for.
* @return Returns the handle to the clicap token if it was found,
* otherwise NULL is returned.
*/
ClientCapability *ClientCapabilityFindReal(const char *token)
{
ClientCapability *clicap;
for (clicap = clicaps; clicap; clicap = clicap->next)
{
if (!strcasecmp(token, clicap->name))
return clicap;
}
return NULL;
}
/**
* Returns an clicap handle based on the given token name.
*
* @param token The clicap token to search for.
* @return Returns the handle to the clicap token if it was found,
* otherwise NULL is returned.
*/
ClientCapability *ClientCapabilityFind(const char *token, Client *client)
{
ClientCapability *clicap;
for (clicap = clicaps; clicap; clicap = clicap->next)
{
if (!strcasecmp(token, clicap->name))
{
if (clicap->visible && !clicap->visible(client))
return NULL; /* hidden */
return clicap;
}
}
return NULL;
}
/** Find the bit that will be set if 'token' is enabled */
long ClientCapabilityBit(const char *token)
{
ClientCapability *clicap = ClientCapabilityFindReal(token);
#ifdef DEBUGMODE
if (!clicap)
{
ircd_log(LOG_ERROR, "WARNING: ClientCapabilityBit(): unknown token '%s'", token);
}
#endif
return clicap ? clicap->cap : 0L;
}
void SetCapability(Client *client, const char *token)
{
client->local->caps |= ClientCapabilityBit(token);
}
void ClearCapability(Client *client, const char *token)
{
client->local->caps &= ~(ClientCapabilityBit(token));
}
long clicap_allocate_cap(void)
{
long v = 1;
ClientCapability *clicap;
for (v=1; v < 2147483648; v = v * 2)
{
unsigned char found = 0;
for (clicap = clicaps; clicap; clicap = clicap->next)
{
if (clicap->cap == v)
{
found = 1;
break;
}
}
if (!found)
return v; /* free bit found */
}
return 0;
}
/**
* Adds a new clicap token.
*
* @param module The module which owns this token.
* @param clicap_request The details of the requested token, handlers, etc.
* @param cap The assigned capability bit.
* @return Returns the handle to the new token if successful, otherwise NULL.
* The module's error code contains specific information about the
* error.
*/
ClientCapability *ClientCapabilityAdd(Module *module, ClientCapabilityInfo *clicap_request, long *cap)
{
ClientCapability *clicap;
int exists = 0;
if (cap)
*cap = 0; /* Initialize early */
clicap = ClientCapabilityFindReal(clicap_request->name);
if (clicap)
{
exists = 1;
if (clicap->unloaded)
{
clicap->unloaded = 0;
} else {
if (module)
module->errorcode = MODERR_EXISTS;
return NULL;
}
} else {
long v = 0;
/* Allocate a bit, but only if the module needs it.
* (some clicaps are advertise-only and never gets set,
* hence they don't need a bit allocated to them)
*/
if (cap != NULL)
{
v = clicap_allocate_cap();
if (v == 0)
{
sendto_realops("ClientCapabilityAdd: out of space!!!");
ircd_log(LOG_ERROR, "ClientCapabilityAdd: out of space!!!");
if (module)
module->errorcode = MODERR_NOSPACE;
return NULL;
}
}
/* New client capability */
clicap = safe_alloc(sizeof(ClientCapability));
safe_strdup(clicap->name, clicap_request->name);
clicap->cap = v;
}
/* Add or update the following fields: */
clicap->owner = module;
clicap->flags = clicap_request->flags;
clicap->visible = clicap_request->visible;
clicap->parameter = clicap_request->parameter;
if (!exists)
AddListItem(clicap, clicaps);
if (clicap->cap && !cap)
abort(); /* module API call error */
if (cap)
*cap = clicap->cap;
if (module)
{
ModuleObject *clicapobj = safe_alloc(sizeof(ModuleObject));
clicapobj->object.clicap = clicap;
clicapobj->type = MOBJ_CLICAP;
AddListItem(clicapobj, module->objects);
module->errorcode = MODERR_NOERROR;
}
return clicap;
}
void unload_clicap_commit(ClientCapability *clicap)
{
/* This is an unusual operation, I think we should log it. */
ircd_log(LOG_ERROR, "Unloading client capability '%s'", clicap->name);
sendto_realops("Unloading client capability '%s'", clicap->name);
/* NOTE: Stripping the CAP from local clients is done
* in clicap_post_rehash(), so not here.
*/
/* A message tag handler may depend on us, remove it */
/* NOTE: This assumes there is a 0:1 or 1:1 relationship between
* the two, but in theory there could be multiple message tags
* introduced by 1 capability. Ah well, we'll cross that
* bridge when we come to it ;)
*/
if (clicap->mtag_handler)
clicap->mtag_handler->clicap_handler = NULL;
/* Destroy the capability */
DelListItem(clicap, clicaps);
safe_free(clicap->name);
safe_free(clicap);
}
/**
* Removes the specified clicap token.
*
* @param clicap The token to remove.
*/
void ClientCapabilityDel(ClientCapability *clicap)
{
if (clicap->owner)
{
ModuleObject *mobj;
for (mobj = clicap->owner->objects; mobj; mobj = mobj->next) {
if (mobj->type == MOBJ_CLICAP && mobj->object.clicap == clicap) {
DelListItem(mobj, clicap->owner->objects);
safe_free(mobj);
break;
}
}
clicap->owner = NULL;
}
if (loop.ircd_rehashing)
clicap->unloaded = 1;
else
unload_clicap_commit(clicap);
}
void unload_all_unused_caps(void)
{
ClientCapability *clicap, *clicap_next;
for (clicap = clicaps; clicap; clicap = clicap_next)
{
clicap_next = clicap->next;
if (clicap->unloaded)
unload_clicap_commit(clicap);
}
}
#define MAXCLICAPS 64
static char *old_caps[MAXCLICAPS]; /**< List of old CAP names - used for /rehash */
int old_caps_proto[MAXCLICAPS]; /**< List of old CAP protocol values - used for /rehash */
/** Called before REHASH. This saves the list of cap names and protocol values */
void clicap_pre_rehash(void)
{
ClientCapability *clicap;
int i = 0;
memset(&old_caps, 0, sizeof(old_caps));
for (clicap = clicaps; clicap; clicap = clicap->next)
{
if (i == MAXCLICAPS)
{
ircd_log(LOG_ERROR, "More than %d caps loaded - what???", MAXCLICAPS);
break;
}
safe_strdup(old_caps[i], clicap->name);
old_caps_proto[i] = clicap->cap;
i++;
}
}
/** Clear 'proto' protocol for all users */
void clear_cap_for_users(long cap)
{
Client *client;
if (cap == 0)
return;
list_for_each_entry(client, &lclient_list, lclient_node)
{
client->local->caps &= ~cap;
}
list_for_each_entry(client, &unknown_list, lclient_node)
{
client->local->caps &= ~cap;
}
}
/** Called after REHASH. This will deal with:
* 1. Clearing flags for caps that are deleted
* 2. Sending any CAP DEL
* 3. Sending any CAP NEW
*/
void clicap_post_rehash(void)
{
ClientCapability *clicap;
char *name;
int i;
int found;
if (!loop.ircd_rehashing)
return; /* First boot */
/* Let's deal with CAP DEL first:
* Go through the old caps and see what's missing now.
*/
for (i = 0; old_caps[i]; i++)
{
name = old_caps[i];
found = 0;
for (clicap = clicaps; clicap; clicap = clicap->next)
{
if (!strcmp(clicap->name, name))
{
found = 1;
break;
}
}
if (!found)
{
/* Broadcast CAP DEL to local users */
send_cap_notify(0, name);
clear_cap_for_users(old_caps_proto[i]);
}
}
/* Now deal with CAP ADD:
* Go through the new caps and see if it was missing from old caps.
*/
for (clicap = clicaps; clicap; clicap = clicap->next)
{
name = clicap->name;
found = 0;
for (i = 0; old_caps[i]; i++)
{
if (!strcmp(old_caps[i], name))
{
found = 1;
break;
}
}
if (!found)
{
/* Broadcast CAP NEW to local users */
send_cap_notify(1, name);
}
}
/* Now free the old caps. */
for (i = 0; old_caps[i]; i++)
safe_free(old_caps[i]);
}

Some files were not shown because too many files have changed in this diff Show More