.editorconfig | 20 +++ .gitignore | 1 + .travis.yml | 14 +- AUTHORS | 9 +- ChangeLog | 78 ++++++++++- INSTALL | 2 +- NEWS | 40 +++++- README | 66 +++++---- autogen.sh | 37 ++--- config.guess | 174 +++++++++++++++--------- config.sub | 73 +++++++--- configure.ng | 4 +- contrib/Debian/.gitignore | 3 + contrib/Debian/Makefile.am | 5 +- contrib/Debian/changelog | 18 +++ contrib/Debian/compat | 2 +- contrib/Debian/control | 9 +- contrib/Debian/ngircd.postinst | 2 +- contrib/Debian/rules | 27 ++-- contrib/Debian/source/format | 1 + contrib/MacOSX/ngIRCd.xcodeproj/project.pbxproj | 35 ++++- contrib/ngindent | 10 +- contrib/ngircd-bsd.sh | 0 contrib/ngircd-redhat.init | 0 contrib/ngircd.service | 31 ++++- contrib/ngircd.socket | 1 + contrib/ngircd.spec | 4 +- contrib/platformtest.sh | 95 +++++++++---- doc/Commands.txt | 2 +- doc/HowToRelease.txt | 5 +- doc/Modes.txt | 12 +- doc/PAM.txt | 4 + doc/Platforms.txt | 49 ++++--- doc/RFC.txt | 13 +- doc/sample-ngircd.conf.tmpl | 9 ++ man/ngircd.8.tmpl | 2 +- man/ngircd.conf.5.tmpl | 12 +- src/ngircd/conf.c | 8 ++ src/ngircd/conf.h | 3 + src/ngircd/conn-ssl.c | 2 + src/ngircd/conn.c | 109 ++++++--------- src/ngircd/defines.h | 6 + src/ngircd/irc-info.c | 12 +- src/ngircd/irc-oper.c | 13 +- src/ngircd/irc-server.c | 127 ++++++++++------- src/ngircd/irc-write.c | 4 +- src/ngircd/irc.c | 96 ++++++++++--- src/ngircd/lists.c | 4 +- src/ngircd/messages.h | 3 +- src/ngircd/ngircd.c | 4 +- src/ngircd/numeric.c | 4 +- src/ngircd/op.c | 6 +- src/ngircd/pam.c | 3 +- src/portab/portab.h | 4 + src/testsuite/Makefile.ng | 6 + src/testsuite/message-test.e | 15 +- src/testsuite/ngircd-test1.conf | 5 + src/testsuite/server-login-test.e | 94 +++++++++++++ 58 files changed, 1001 insertions(+), 396 deletions(-) diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..829ac5e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +# ngIRCd -- The Next Generation IRC Daemon +# Copyright (c)2001-2016 Alexander Barton (alex@barton.de) and Contributors. +# +# 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. +# Please read the file COPYING, README and AUTHORS for more information. + +# .editorconfig: Editor settings, see . + +root = true + +[*] +indent_style = tab +indent_size = 8 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/.gitignore b/.gitignore index e8b9f31..e9b186a 100644 --- a/.gitignore +++ b/.gitignore @@ -56,6 +56,7 @@ src/testsuite/ngircd-test2.log src/testsuite/ngircd-test2.motd src/testsuite/opless-channel-test src/testsuite/server-link-test +src/testsuite/server-login-test src/testsuite/T-ngircd1 src/testsuite/T-ngircd1.exe src/testsuite/T-ngircd2 diff --git a/.travis.yml b/.travis.yml index 55577ba..3b82280 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,15 @@ language: c -before_install: - - sudo apt-get update -qq - - sudo apt-get install -qq libident-dev libpam0g-dev libssl-dev libwrap0-dev zlib1g-dev expect telnet +sudo: false +addons: + apt: + packages: + - libident-dev + - libpam0g-dev + - libssl-dev + - libwrap0-dev + - zlib1g-dev + - expect + - telnet compiler: - gcc - clang diff --git a/AUTHORS b/AUTHORS index 749dc3a..0248666 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2,7 +2,7 @@ ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ - (c)2001-2015 Alexander Barton and Contributors. + (c)2001-2017 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. @@ -33,10 +33,11 @@ Brandon Beresini Brett Smith Brian Collins Bryan Caldwell +Christian Aistleitner Christoph Biedl -DNS Dana Dahlstrom David Kingston +DNS Eric Grunow Federico G. Schwindt Gabor Adam Toth @@ -63,6 +64,6 @@ xor Code snippets ~~~~~~~~~~~~~ -J. Kercheval: pattern matching functions -Patrick Powell : snprintf()-function Andrew Tridgell & Martin Pool: strl{cpy|cat}()-functions +John Kercheval: pattern matching functions +Patrick Powell : snprintf()-function diff --git a/ChangeLog b/ChangeLog index 18194ce..e540c52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,13 +2,89 @@ ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ - (c)2001-2015 Alexander Barton and Contributors. + (c)2001-2017 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. -- ChangeLog -- +ngIRCd 24 (2017-01-20) + + - Make sure that ./contrib/platformtest.sh aborts when ./autogen.sh fails. + - Update config.guess (2016-10-02) and config.sub (2016-11-04) files. + - Build Debian packages with OpenSSL instead of GnuTLS: OpenSSL allows + to reload used certificates on runtime for example (which is very + useful when using Let's Encrypt), and therefore is preferred. And + explicitly specify the "source format". + - Fix handling of connection pool allocation and enlargement: up to now, + the daemon only enlarged its connection pool when accepting new incoming + client or server connections, not when establishing new outgoing server + links, which could lead to problems when hitting the configured limit, + see "MaxConnections". Thanks to Lukas Braun (k00mi) for reporting this! + Closes #231. + + ngIRCd 24~rc1 (2017-01-07) + - Enhance systemd service file, and install it in Debian package. + - Update configuration of Debian package. + - Log privilege violations and failed OPER request with log level "error" + and send it to the "&SERVER" channel, too. + - Immediately shut down connection when receiving an "ERROR" command, + don't wait for the peer to close the connection. This allows the daemon + to forward the received "ERROR" message in the network, instead of the + very generic "client closed connection" message. + - Fix sending of entry duration (no negative values!) when synchronizing + "x-lines" (G-LINES). + - List expiration (G-LINES): use same log level as when setting, and log + this event to the &SERVER channel, too. + - Explicitly forbid remote servers to modify "x-lines" (G-LINES) when the + "AllowRemoteOper" configuration option isn't set, even when the command + seems to originate from the remote server itself: this prevents GLINE's + to become set during server handshake in this case (what wouldn't be + possible during regular runtime when a remote IRC Op sends the command) + and what can't be undone by IRC Ops later on (because of the missing + "AllowRemoteOper" option) ... + - Make scripts and init-files in ./contrib executable. + - Fix building ngIRCd with OpenSSL 1.1. Thanks to Christoph Biedl + for the patch! + - Fix code indentation warnings of gcc 6.2. + - Update config.guess (2016-04-02) and config.sub (2016-03-30) files. + - Fix warnings of the "shellcheck" linter in autogen.sh, contrib/ngindent + and contrib/platformtest.sh. + - Update Xcode project for latest Xcode version (8.0), and fix "duplicate + symbols" error messages when building (linking) the binary. + - Add "Documentation" variables to systemd configuration files. + - Make sure that SYSCONFDIR is always set, which can be handy when + using source code linters when ./configure hasn't been run already. + - Add the new "PAMServiceName" configuration option to specify the name + used as PAM service name. This setting allows to run multiple ngIRCd + instances with different PAM configurations for each instance. + Thanks to Christian Aistleitner for the + patch, closes #226. + - Add an ".editorconfig" file to the project. + - Travis-CI: use "container-based infrastructure". + - Limit the number of message targets, and suppress duplicates: This + prevents an user from flooding the server using commands like this: + "PRIVMSG nick1,nick1,nick1,...". + Duplicate targets are suppressed silently (channels and clients). + In addition, the maximum number of targets per PRIVMSG, NOTICE, ... + command are limited to MAX_HNDL_TARGETS (25). If there are more, the + daemon sends the new 407 (ERR_TOOMANYTARGETS_MSG) numeric, containing + the first target that hasn't been handled any more. Closes #187. + - Test suite: Add new test for server-server logins. + - contrib/ngindent: Fix shebang line. + - Make contrib/platformtest.sh script more portable, and only show + "runs=Y" when the test suite really has been passed successfully. + - Code cleanup in the NJON handler and the function killing clients as + well as the function sending messages to a "mask" (cleaner code, more + fault tolerant, better code comments). + - Update and enhance documentation: README file, doc/Platforms.txt, + doc/Modes.txt, doc/Commands.txt, doc/PAM.txt. + - Fix NJOIN not propagating "half ops" status: ngIRCd tested for the wrong + prefix of "half ops" when processing NJOIN commands and therefore never + classified a remote user as "half op". + Thanks to wowaname for pointing this out on #ngircd! + ngIRCd 23 (2015-11-16) - Explicitly cast time_t to long when printing it out: this prevents diff --git a/INSTALL b/INSTALL index 3f19065..5a1bf3c 100644 --- a/INSTALL +++ b/INSTALL @@ -2,7 +2,7 @@ ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ - (c)2001-2015 Alexander Barton and Contributors. + (c)2001-2017 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. diff --git a/NEWS b/NEWS index 3fe47c3..1eab60d 100644 --- a/NEWS +++ b/NEWS @@ -2,13 +2,51 @@ ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ - (c)2001-2015 Alexander Barton and Contributors. + (c)2001-2017 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. -- NEWS -- +ngIRCd 24 (2017-01-20) + + ngIRCd 24~rc1 (2017-01-07) + - Log privilege violations and failed OPER request with log level "error" + and send it to the "&SERVER" channel, too. + - Immediately shut down connection when receiving an "ERROR" command, + don't wait for the peer to close the connection. This allows the daemon + to forward the received "ERROR" message in the network, instead of the + very generic "client closed connection" message. + - Explicitly forbid remote servers to modify "x-lines" (G-LINES) when the + "AllowRemoteOper" configuration option isn't set, even when the command + seems to originate from the remote server itself: this prevents GLINE's + to become set during server handshake in this case (what wouldn't be + possible during regular runtime when a remote IRC Op sends the command) + and what can't be undone by IRC Ops later on (because of the missing + "AllowRemoteOper" option) ... + - Update Xcode project for latest Xcode version (8.0), and fix "duplicate + symbols" error messages when building (linking) the binary. + - Add "Documentation" variables to systemd configuration files. + - Make sure that SYSCONFDIR is always set, which can be handy when + using source code linters when ./configure hasn't been run already. + - Add the new "PAMServiceName" configuration option to specify the name + used as PAM service name. This setting allows to run multiple ngIRCd + instances with different PAM configurations for each instance. + Thanks to Christian Aistleitner for the + patch, closes #226. + - Add an ".editorconfig" file to the project. + - Limit the number of message target, and suppress duplicates: This + prevents an user from flooding the server using commands like this: + "PRIVMSG nick1,nick1,nick1,...". + Duplicate targets are suppressed silently (channels and clients). + In addition, the maximum number of targets per PRIVMSG, NOTICE, ... + command are limited to MAX_HNDL_TARGETS (25). If there are more, the + daemon sends the new 407 (ERR_TOOMANYTARGETS_MSG) numeric, containing + the first target that hasn't been handled any more. Closes #187. + - Make contrib/platformtest.sh script more portable, and only show + "runs=Y" when the test suite really has been passed successfully. + ngIRCd 23 (2015-11-16) ngIRCd 23~rc1 (2015-09-06) diff --git a/README b/README index 52cc11f..45cabd6 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ - (c)2001-2015 Alexander Barton and Contributors. + (c)2001-2017 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. @@ -28,31 +28,26 @@ Please see the INSTALL document for installation and upgrade information! II. Status ~~~~~~~~~~~ +ngIRCd should be quite feature complete and stable to be used as daemon in +real world IRC networks. + It is not the goal of ngIRCd to implement all the nasty behaviors of the original ircd, but to implement most of the useful commands and semantics -specified by the RFCs. - -In the meantime ngIRCd should be quite feature complete and stable to be -used in real IRC networks. +specified by the RFCs that are used by existing clients. -Implemented IRC-commands are: - -ADMIN, AWAY, CHANINFO, CONNECT, DIE, DISCONNECT, ERROR, GLINE, HELP, INFO, -INVITE, ISON, JOIN, KICK, KILL, KLINE, LINKS, LIST, LUSERS, MODE, MOTD, -NAMES, NICK, NJOIN, NOTICE, OPER, PART, PASS, PING, PONG, PRIVMSG, QUIT, -REHASH, RESTART, SERVER, SERVICE, SERVLIST, SQUERY, SQUIT, STATS, SUMMON, -TIME, TOPIC, TRACE, USER, USERHOST, USERS, VERSION, WALLOPS, WEBIRC, WHO, -WHOIS, WHOWAS. III. Features (or: why use ngIRCd?) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- well arranged (lean) configuration file -- simple to build/install, configure and maintain -- supports IPv6 and SSL -- no problems with servers that have dynamic IP addresses -- freely available, modern, portable and tidy C-source -- wide field of supported platforms, including AIX, A/UX, FreeBSD, HP-UX, +- Well arranged (lean) configuration file. +- Simple to build, install, configure, and maintain. +- Supports IPv6 and SSL. +- Can use PAM for user authentication. +- Lots of popular user and channel modes are implemented. +- Supports "cloaking" of users. +- No problems with servers that have dynamic IP addresses. +- Freely available, modern, portable and tidy C source. +- Wide field of supported platforms, including AIX, A/UX, FreeBSD, HP-UX, IRIX, Linux, Mac OS X, NetBSD, OpenBSD, Solaris, and Windows with Cygwin. - ngIRCd is being actively developed since 2001. @@ -61,33 +56,34 @@ IV. Documentation ~~~~~~~~~~~~~~~~~ More documentation can be found in the "doc/" directory and the homepage of -the ngIRCd: . +ngIRCd: . V. Download ~~~~~~~~~~~ -The homepage of the ngIRCd is: ; you will find +The homepage of the ngIRCd is ; you will find the newest information about the ngIRCd and the most recent ("stable") releases there. -If you are interested in the latest development versions (which are not -always stable), then please read the section about "GIT" on the homepage and -the file "doc/GIT.txt" which describes the use of GIT, the version control -system used by ngIRCd (homepage: ). +Visit our source code repository at GitHub if you are interested in the +latest development version: . -VI. Bugs -~~~~~~~~ +VI. Problems, Bugs, Patches +~~~~~~~~~~~~~~~~~~~~~~~~~~~ -If you find bugs in the ngIRCd (which might be there :-), please report -them at the following URL: +Please don't hesitate to contact us if you encounter problems: - +- On IRC: +- Via the mailing list: -There you can read about known bugs and limitations, too. +See for details. -If you have comments, patches or something else, please feel free to post -a mail to the ngIRCd mailing list: (please see - for details) or join the ngIRCd IRC -channel: . +If you find bugs in ngIRCd (which will be there most probably ...), please +report them to our issue tracker at GitHub: + +- Bug tracker: +- Patches, "pull requests": + +There you can read about known bugs and limitations, too. diff --git a/autogen.sh b/autogen.sh index 6323752..3a3f717 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,7 +1,7 @@ #!/bin/sh # # ngIRCd -- The Next Generation IRC Daemon -# Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors +# Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors # # 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 @@ -95,7 +95,7 @@ Search() return 0 fi done - minor=`expr $minor - 1` + minor=$(expr $minor - 1) done return 1 } @@ -139,26 +139,26 @@ fi # Try to detect the needed tools when no environment variable already # specifies one: echo "Searching for required tools ..." -[ -z "$ACLOCAL" ] && ACLOCAL=`Search aclocal 1` +[ -z "$ACLOCAL" ] && ACLOCAL=$(Search aclocal 1) [ "$VERBOSE" = "1" ] && echo " - ACLOCAL=$ACLOCAL" -[ -z "$AUTOHEADER" ] && AUTOHEADER=`Search autoheader 2` +[ -z "$AUTOHEADER" ] && AUTOHEADER=$(Search autoheader 2) [ "$VERBOSE" = "1" ] && echo " - AUTOHEADER=$AUTOHEADER" -[ -z "$AUTOMAKE" ] && AUTOMAKE=`Search automake 1` +[ -z "$AUTOMAKE" ] && AUTOMAKE=$(Search automake 1) [ "$VERBOSE" = "1" ] && echo " - AUTOMAKE=$AUTOMAKE" -[ -z "$AUTOCONF" ] && AUTOCONF=`Search autoconf 2` +[ -z "$AUTOCONF" ] && AUTOCONF=$(Search autoconf 2) [ "$VERBOSE" = "1" ] && echo " - AUTOCONF=$AUTOCONF" -AUTOCONF_VERSION=`echo $AUTOCONF | cut -d'-' -f2-` -[ -n "$AUTOCONF_VERSION" -a "$AUTOCONF_VERSION" != "autoconf" ] \ +AUTOCONF_VERSION=$(echo "$AUTOCONF" | cut -d'-' -f2-) +[ -n "$AUTOCONF_VERSION" ] && [ "$AUTOCONF_VERSION" != "autoconf" ] \ && export AUTOCONF_VERSION || unset AUTOCONF_VERSION [ "$VERBOSE" = "1" ] && echo " - AUTOCONF_VERSION=$AUTOCONF_VERSION" -AUTOMAKE_VERSION=`echo $AUTOMAKE | cut -d'-' -f2-` -[ -n "$AUTOMAKE_VERSION" -a "$AUTOMAKE_VERSION" != "automake" ] \ +AUTOMAKE_VERSION=$(echo $AUTOMAKE | cut -d'-' -f2-) +[ -n "$AUTOMAKE_VERSION" ] && [ "$AUTOMAKE_VERSION" != "automake" ] \ && export AUTOMAKE_VERSION || unset AUTOMAKE_VERSION [ "$VERBOSE" = "1" ] && echo " - AUTOMAKE_VERSION=$AUTOMAKE_VERSION" [ $# -gt 0 ] && CONFIGURE_ARGS=" $*" || CONFIGURE_ARGS="" -[ -z "$GO" -a -n "$CONFIGURE_ARGS" ] && GO=1 +[ -z "$GO" ] && [ -n "$CONFIGURE_ARGS" ] && GO=1 # Verify that all tools have been found [ -z "$ACLOCAL" ] && Notfound aclocal @@ -166,15 +166,15 @@ AUTOMAKE_VERSION=`echo $AUTOMAKE | cut -d'-' -f2-` [ -z "$AUTOMAKE" ] && Notfound automake [ -z "$AUTOCONF" ] && Notfound autoconf -AM_VERSION=`$AUTOMAKE --version | head -n 1 | sed -e 's/.* //g'` +AM_VERSION=$($AUTOMAKE --version | head -n 1 | sed -e 's/.* //g') ifs=$IFS; IFS="."; set $AM_VERSION; IFS=$ifs -AM_MAJOR="$1"; AM_MINOR="$2"; AM_PATCHLEVEL="$3" +AM_MAJOR="$1"; AM_MINOR="$2" echo "Detected automake $AM_VERSION ..." AM_MAKEFILES="src/ipaddr/Makefile.ng src/ngircd/Makefile.ng src/testsuite/Makefile.ng src/tool/Makefile.ng" # De-ANSI-fication? -if [ "$AM_MAJOR" -eq "1" -a "$AM_MINOR" -lt "12" ]; then +if [ "$AM_MAJOR" -eq "1" ] && [ "$AM_MINOR" -lt "12" ]; then # automake < 1.12 => automatic de-ANSI-fication support available echo " - Enabling de-ANSI-fication support." sed -e "s|^__ng_PROTOTYPES__|AM_C_PROTOTYPES|g" configure.ng >configure.ac @@ -188,19 +188,20 @@ else DEANSI_END=" (disabled by ./autogen.sh script)" fi # Serial test harness? -if [ "$AM_MAJOR" -eq "1" -a "$AM_MINOR" -ge "13" ]; then +if [ "$AM_MAJOR" -eq "1" ] && [ "$AM_MINOR" -ge "13" ]; then # automake >= 1.13 => enforce "serial test harness" echo " - Enforcing serial test harness." SERIAL_TESTS="serial-tests" else # automake < 1.13 => no new test harness, nothing to do + # shellcheck disable=SC2034 SERIAL_TEST="" fi sed -e "s|^__ng_Makefile_am_template__|AUTOMAKE_OPTIONS = ${SERIAL_TESTS} ${DEANSI_START}ansi2knr${DEANSI_END}|g" \ src/portab/Makefile.ng >src/portab/Makefile.am for makefile_ng in $AM_MAKEFILES; do - makefile_am=`echo "$makefile_ng" | sed -e "s|\.ng\$|\.am|g"` + makefile_am=$(echo "$makefile_ng" | sed -e "s|\.ng\$|\.am|g") sed -e "s|^__ng_Makefile_am_template__|AUTOMAKE_OPTIONS = ${SERIAL_TESTS} ${DEANSI_START}../portab/ansi2knr${DEANSI_END}|g" \ $makefile_ng >$makefile_am done @@ -214,10 +215,10 @@ Run $ACLOCAL && \ Run $AUTOHEADER && \ Run $AUTOMAKE --add-missing --no-force -if [ $? -eq 0 -a -x ./configure ]; then +if [ $? -eq 0 ] && [ -x ./configure ]; then # Success: if we got some parameters we call ./configure and pass # all of them to it. - NAME=`grep PACKAGE_STRING= configure | cut -d"'" -f2` + NAME=$(grep PACKAGE_STRING= configure | cut -d"'" -f2) if [ "$GO" = "1" ]; then [ -n "$PREFIX" ] && p=" --prefix=$PREFIX" || p="" c="./configure${p}${CONFIGURE_ARGS}" diff --git a/config.guess b/config.guess index 1f5c50c..2e9ad7f 100644 --- a/config.guess +++ b/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2014 Free Software Foundation, Inc. +# Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2014-03-23' +timestamp='2016-10-02' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,12 +24,12 @@ timestamp='2014-03-23' # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # -# Originally written by Per Bothner. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # -# Please send patches with a ChangeLog entry to config-patches@gnu.org. +# Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` @@ -50,7 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2014 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -168,19 +168,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || \ + echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. + # to ELF recently (or will in the future) and ABI. case "${UNAME_MACHINE_ARCH}" in + earm*) + os=netbsdelf + ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ @@ -197,6 +207,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in os=netbsd ;; esac + # Determine ABI tags. + case "${UNAME_MACHINE_ARCH}" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + ;; + esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -207,13 +224,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" + echo "${machine}-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` @@ -223,6 +240,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; @@ -235,6 +256,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; + *:Sortix:*:*) + echo ${UNAME_MACHINE}-unknown-sortix + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -251,42 +275,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; + UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; + UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; + UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; + UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; + UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; + UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; + UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; + UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; + UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 @@ -359,16 +383,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build - SUN_ARCH="i386" + SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH="x86_64" + SUN_ARCH=x86_64 fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -393,7 +417,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} @@ -579,8 +603,9 @@ EOF else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -617,13 +642,13 @@ EOF sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi @@ -662,11 +687,11 @@ EOF exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ ${HP_ARCH} = "hppa2.0w" ] + if [ ${HP_ARCH} = hppa2.0w ] then eval $set_cc_for_build @@ -679,12 +704,12 @@ EOF # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH="hppa2.0w" + HP_ARCH=hppa2.0w else - HP_ARCH="hppa64" + HP_ARCH=hppa64 fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} @@ -789,14 +814,14 @@ EOF echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) @@ -878,7 +903,7 @@ EOF exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix @@ -901,7 +926,7 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) @@ -932,6 +957,9 @@ EOF crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; + e2k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -944,6 +972,9 @@ EOF ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; + k1om:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -969,6 +1000,9 @@ EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; + mips64el:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; @@ -1001,6 +1035,9 @@ EOF ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; @@ -1020,7 +1057,7 @@ EOF echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} @@ -1099,7 +1136,7 @@ EOF # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that + # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; @@ -1248,6 +1285,9 @@ EOF SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1261,9 +1301,9 @@ EOF UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in @@ -1285,7 +1325,7 @@ EOF exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then + if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi @@ -1316,7 +1356,7 @@ EOF # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = "386"; then + if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" @@ -1358,7 +1398,7 @@ EOF echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos @@ -1369,23 +1409,25 @@ EOF x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; esac cat >&2 < in order to provide the needed -information to handle your system. +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches@gnu.org to +provide the necessary information to handle your system. config.guess timestamp = $timestamp diff --git a/config.sub b/config.sub index d654d03..dd2ca93 100644 --- a/config.sub +++ b/config.sub @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2014 Free Software Foundation, Inc. +# Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2014-05-01' +timestamp='2016-11-04' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ timestamp='2014-05-01' # of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches with a ChangeLog entry to config-patches@gnu.org. +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -33,7 +33,7 @@ timestamp='2014-05-01' # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -53,8 +53,7 @@ timestamp='2014-05-01' me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. @@ -68,7 +67,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright 1992-2014 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -117,8 +116,8 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ + kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` @@ -255,12 +254,13 @@ case $basic_machine in | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ + | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ + | e2k | epiphany \ + | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ @@ -301,10 +301,12 @@ case $basic_machine in | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pru \ | pyramid \ + | riscv32 | riscv64 \ | rl78 | rx \ | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ @@ -312,6 +314,7 @@ case $basic_machine in | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -326,6 +329,9 @@ case $basic_machine in c6x) basic_machine=tic6x-unknown ;; + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none @@ -371,12 +377,13 @@ case $basic_machine in | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ + | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ @@ -422,13 +429,15 @@ case $basic_machine in | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ | pyramid-* \ + | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ @@ -436,6 +445,7 @@ case $basic_machine in | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ + | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -512,6 +522,9 @@ case $basic_machine in basic_machine=i386-pc os=-aros ;; + asmjs) + basic_machine=asmjs-unknown + ;; aux) basic_machine=m68k-apple os=-aux @@ -632,6 +645,14 @@ case $basic_machine in basic_machine=m68k-bull os=-sysv3 ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" + ;; + e500v[12]-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + os=$os"spe" + ;; ebmon29k) basic_machine=a29k-amd os=-ebmon @@ -773,6 +794,9 @@ case $basic_machine in basic_machine=m68k-isi os=-sysv ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -828,6 +852,10 @@ case $basic_machine in basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos @@ -1004,7 +1032,7 @@ case $basic_machine in ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppcle | powerpclittle | ppc-le | powerpc-little) + ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) @@ -1014,7 +1042,7 @@ case $basic_machine in ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) + ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) @@ -1360,27 +1388,28 @@ case $os in | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ + | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ + | -onefs* | -tirtos* | -phoenix* | -fuchsia*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1512,6 +1541,8 @@ case $os in ;; -nacl*) ;; + -ios) + ;; -none) ;; *) diff --git a/configure.ng b/configure.ng index 34094a4..5613996 100644 --- a/configure.ng +++ b/configure.ng @@ -418,8 +418,8 @@ AC_ARG_WITH(openssl, LDFLAGS="-L$withval/lib $LDFLAGS" fi AC_CHECK_LIB(crypto, BIO_s_mem) - AC_CHECK_LIB(ssl, SSL_library_init) - AC_CHECK_FUNCS(SSL_library_init, x_ssl_openssl=yes, + AC_CHECK_LIB(ssl, SSL_new) + AC_CHECK_FUNCS(SSL_new, x_ssl_openssl=yes, AC_MSG_ERROR([Can't enable openssl]) ) fi diff --git a/contrib/Debian/.gitignore b/contrib/Debian/.gitignore index 111d4ac..73c000d 100644 --- a/contrib/Debian/.gitignore +++ b/contrib/Debian/.gitignore @@ -4,10 +4,13 @@ files ngircd/ ngircd-full/ +ngircd.service ngircd-full.default ngircd-full.init ngircd-full.postinst +ngircd-full.service ngircd-full-dbg/ ngircd-full-dbg.default ngircd-full-dbg.init ngircd-full-dbg.postinst +ngircd-full-dbg.service diff --git a/contrib/Debian/Makefile.am b/contrib/Debian/Makefile.am index dd7c753..2cd5277 100644 --- a/contrib/Debian/Makefile.am +++ b/contrib/Debian/Makefile.am @@ -1,6 +1,6 @@ # # ngIRCd -- The Next Generation IRC Daemon -# Copyright (c)2001-2010 Alexander Barton (alex@barton.de) +# Copyright (c)2001-2017 Alexander Barton (alex@barton.de) and Contributors # # 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 @@ -10,7 +10,8 @@ # EXTRA_DIST = rules changelog compat control copyright \ - ngircd.init ngircd.default ngircd.pam ngircd.postinst + ngircd.init ngircd.default ngircd.pam ngircd.postinst \ + source/format maintainer-clean-local: rm -f Makefile Makefile.in diff --git a/contrib/Debian/changelog b/contrib/Debian/changelog index 4e3a1ae..19b52ab 100644 --- a/contrib/Debian/changelog +++ b/contrib/Debian/changelog @@ -1,3 +1,21 @@ +ngircd (24-0ab1) unstable; urgency=low + + * New "upstream" release: ngIRCd 24. + + -- Alexander Barton Fri, 20 Jan 2017 16:43:09 +0100 + +ngircd (24~rc1-0ab2) unstable; urgency=low + + * Use OpenSSL instead of GnuTLS for SSL-enabled packages. + + -- Alexander Barton Fri, 20 Jan 2017 15:20:07 +0100 + +ngircd (24~rc1-0ab1) unstable; urgency=low + + * New "upstream" release candidate 1 for ngIRCd Release 24. + + -- Alexander Barton Sat, 07 Jan 2017 18:58:02 +0100 + ngircd (23-0ab1) unstable; urgency=low * New "upstream" release: ngIRCd 23. diff --git a/contrib/Debian/compat b/contrib/Debian/compat index b8626c4..ec63514 100644 --- a/contrib/Debian/compat +++ b/contrib/Debian/compat @@ -1 +1 @@ -4 +9 diff --git a/contrib/Debian/control b/contrib/Debian/control index 59a74ab..82e506c 100644 --- a/contrib/Debian/control +++ b/contrib/Debian/control @@ -2,14 +2,15 @@ Source: ngircd Section: net Priority: optional Maintainer: Alexander Barton -Build-Depends: debhelper (>> 4.0.0), +Build-Depends: debhelper (>> 9.0.0), autotools-dev, + dh-systemd (>= 1.5), expect, - libz-dev, - libwrap0-dev, libident-dev, - libgnutls-dev, libpam0g-dev, + libssl-dev, + libwrap0-dev, + libz-dev, telnet | telnet-ssl, Standards-Version: 3.9.1 diff --git a/contrib/Debian/ngircd.postinst b/contrib/Debian/ngircd.postinst index 5567934..f6e3c4f 100755 --- a/contrib/Debian/ngircd.postinst +++ b/contrib/Debian/ngircd.postinst @@ -1,7 +1,6 @@ #!/bin/sh # # Debian post-installation script -# $Id: ngircd.postinst,v 1.2 2006/12/26 14:44:40 alex Exp $ # set -e @@ -12,6 +11,7 @@ case "$1" in # make sure that the configuration file is not # world-readable, it contains passwords! chmod o= /etc/ngircd/ngircd.conf + chgrp irc /etc/ngircd/ngircd.conf fi ;; esac diff --git a/contrib/Debian/rules b/contrib/Debian/rules index 1630a01..cdc1225 100755 --- a/contrib/Debian/rules +++ b/contrib/Debian/rules @@ -1,7 +1,7 @@ #!/usr/bin/make -f # # ngIRCd -- The Next Generation IRC Daemon -# Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors +# Copyright (c)2001-2016 Alexander Barton (alex@barton.de) and Contributors # # 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 @@ -55,7 +55,7 @@ configure-ngircd-full: configure --mandir=\$${prefix}/share/man \ --docdir=\$${prefix}/share/doc/ngircd-full \ --with-syslog --with-zlib \ - --with-gnutls --with-iconv --with-ident --with-tcp-wrappers \ + --with-openssl --with-iconv --with-ident --with-tcp-wrappers \ --with-pam \ --enable-ipv6 @@ -70,12 +70,12 @@ configure-ngircd-full-dbg: configure --docdir=\$${prefix}/share/doc/ngircd-full-dbg \ --enable-debug --enable-sniffer \ --with-syslog --with-zlib \ - --with-gnutls --with-iconv --with-ident --with-tcp-wrappers \ + --with-openssl --with-iconv --with-ident --with-tcp-wrappers \ --with-pam \ --enable-ipv6 build: - dh_clean -k + dh_prep build-ngircd: build-stamp-ngircd build-stamp-ngircd: configure-ngircd @@ -111,12 +111,15 @@ clean: dh_testdir dh_testroot rm -f build-stamp* + rm -f $(CURDIR)/debian/ngircd.service rm -f $(CURDIR)/debian/ngircd-full.default rm -f $(CURDIR)/debian/ngircd-full.init rm -f $(CURDIR)/debian/ngircd-full.postinst + rm -f $(CURDIR)/debian/ngircd-full.service rm -f $(CURDIR)/debian/ngircd-full-dbg.default rm -f $(CURDIR)/debian/ngircd-full-dbg.postinst rm -f $(CURDIR)/debian/ngircd-full-dbg.init + rm -f $(CURDIR)/debian/ngircd-full-dbg.service # Add here commands to clean up after the build process: [ ! -f Makefile ] || $(MAKE) distclean @@ -140,7 +143,6 @@ install-ngircd: build-ngircd $(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/INSTALL* rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/COPYING* - mkdir -p $(CURDIR)/debian/ngircd/var/run/ircd cat $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/sample-ngircd.conf | \ sed -e "s|;ServerUID = 65534|ServerUID = irc|g" | \ sed -e "s|;ServerGID = 65534|ServerGID = irc|g" | \ @@ -157,7 +159,6 @@ install-ngircd-full: build-ngircd-full $(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd-full rm $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full/INSTALL* rm $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full/COPYING* - mkdir -p $(CURDIR)/debian/ngircd-full/var/run/ircd cat $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full/sample-ngircd.conf | \ sed -e "s|;ServerUID = 65534|ServerUID = irc|g" | \ sed -e "s|;ServerGID = 65534|ServerGID = irc|g" | \ @@ -176,7 +177,6 @@ install-ngircd-full-dbg: build-ngircd-full-dbg $(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd-full-dbg rm $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg/INSTALL* rm $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg/COPYING* - mkdir -p $(CURDIR)/debian/ngircd-full-dbg/var/run/ircd cat $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg/sample-ngircd.conf | \ sed -e "s|;ServerUID = 65534|ServerUID = irc|g" | \ sed -e "s|;ServerGID = 65534|ServerGID = irc|g" | \ @@ -192,12 +192,18 @@ binary-indep: # Build architecture-dependent files here. binary-arch: build install + ln -s $(CURDIR)/contrib/ngircd.service \ + $(CURDIR)/debian/ngircd.service + ln -s $(CURDIR)/debian/ngircd.default \ $(CURDIR)/debian/ngircd-full.default ln -s $(CURDIR)/debian/ngircd.init \ $(CURDIR)/debian/ngircd-full.init ln -s $(CURDIR)/debian/ngircd.postinst \ $(CURDIR)/debian/ngircd-full.postinst + cp $(CURDIR)/contrib/ngircd.service \ + $(CURDIR)/debian/ngircd-full.service + echo "Alias=ngircd.service" >>$(CURDIR)/debian/ngircd-full.service ln -s $(CURDIR)/debian/ngircd.default \ $(CURDIR)/debian/ngircd-full-dbg.default @@ -205,12 +211,17 @@ binary-arch: build install $(CURDIR)/debian/ngircd-full-dbg.init ln -s $(CURDIR)/debian/ngircd.postinst \ $(CURDIR)/debian/ngircd-full-dbg.postinst + cp $(CURDIR)/contrib/ngircd.service \ + $(CURDIR)/debian/ngircd-full-dbg.service + echo "Alias=ngircd.service" >>$(CURDIR)/debian/ngircd-full-dbg.service dh_testdir dh_testroot dh_installchangelogs -a -A ChangeLog dh_installdocs -a + dh_systemd_enable -a dh_installinit -a + dh_systemd_start -a dh_strip -a --no-package=ngircd-full-dbg dh_compress -a -XCommands.txt dh_fixperms -a @@ -222,6 +233,6 @@ binary-arch: build install binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install +.PHONY: build clean binary-indep binary-arch binary install # -eof- diff --git a/contrib/Debian/source/format b/contrib/Debian/source/format new file mode 100644 index 0000000..d3827e7 --- /dev/null +++ b/contrib/Debian/source/format @@ -0,0 +1 @@ +1.0 diff --git a/contrib/MacOSX/ngIRCd.xcodeproj/project.pbxproj b/contrib/MacOSX/ngIRCd.xcodeproj/project.pbxproj index 31e804b..91bfa7d 100644 --- a/contrib/MacOSX/ngIRCd.xcodeproj/project.pbxproj +++ b/contrib/MacOSX/ngIRCd.xcodeproj/project.pbxproj @@ -635,7 +635,7 @@ 08FB7793FE84155DC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0630; + LastUpgradeCheck = 0800; }; buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "ngIRCd" */; compatibilityVersion = "Xcode 3.2"; @@ -742,9 +742,25 @@ 1DEB928B08733DD80010E9CD /* Default */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = ""; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = NO; GCC_VERSION = ""; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.6; SDKROOT = ""; @@ -754,10 +770,27 @@ FAB0570C105D917F006AF9E2 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_DEBUGGING_SYMBOLS = full; + GCC_NO_COMMON_BLOCKS = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_VERSION = ""; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.6; ONLY_ACTIVE_ARCH = YES; diff --git a/contrib/ngindent b/contrib/ngindent index 2ce1a26..69636a4 100755 --- a/contrib/ngindent +++ b/contrib/ngindent @@ -1,17 +1,17 @@ -#/bin/sh +#!/bin/sh INDENTARGS="-kr -i8 -ts8 -l80 -c3 -cd41 -ss -ncs -psl" # check if indent(1) is available -type indent >/dev/null 2>&1 && INDENT="indent" -type gindent >/dev/null 2>&1 && INDENT="gindent" -type gnuindent >/dev/null 2>&1 && INDENT="gnuindent" +command -v indent >/dev/null 2>&1 && INDENT="indent" +command -v gindent >/dev/null 2>&1 && INDENT="gindent" +command -v gnuindent >/dev/null 2>&1 && INDENT="gnuindent" if [ -z "$INDENT" ]; then echo "Error: GNU \"indent\" not found!" exit 1 fi -$INDENT -v $INDENTARGS $* +$INDENT -v $INDENTARGS "$@" # -eof- diff --git a/contrib/ngircd-bsd.sh b/contrib/ngircd-bsd.sh old mode 100644 new mode 100755 diff --git a/contrib/ngircd-redhat.init b/contrib/ngircd-redhat.init old mode 100644 new mode 100755 diff --git a/contrib/ngircd.service b/contrib/ngircd.service index f24ef60..e4c30e2 100644 --- a/contrib/ngircd.service +++ b/contrib/ngircd.service @@ -1,20 +1,41 @@ +# ngIRCd systemd service unit. +# See systemd(1), systemd.unit(5), systemd.service(5), systemd.exec(5). + [Unit] Description=Next Generation IRC Daemon +Documentation=man:ngircd(8) man:ngircd.conf(5) https://ngircd.barton.de After=network.target +Wants=anope.service atheme.service irc-services.service +Wants=bopm.service +Before=anope.service atheme.service irc-services.service +Before=bopm.service [Service] Type=forking User=irc Group=irc -CapabilityBoundingSet=CAP_SETUID CAP_SETGID CAP_SYS_CHROOT CAP_NET_BIND_SERVICE -PrivateTmp=yes +# Settings & limits: +CapabilityBoundingSet=CAP_SYS_CHROOT CAP_NET_BIND_SERVICE +MemoryDenyWriteExecute=yes +NoNewPrivileges=yes PrivateDevices=yes +PrivateTmp=yes +ProtectControlGroups=yes +ProtectHome=yes +ProtectKernelModules=yes +ProtectKernelTunables=yes ProtectSystem=full -ProtectHome=true -NoNewPrivileges=true +RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX +RestrictRealtime=yes RuntimeDirectory=ircd RuntimeDirectoryMode=750 -ExecStart=/usr/sbin/ngircd +# Try to load "default files" from any Debian package variant to keep this +# unit generic. +EnvironmentFile=-/etc/default/ngircd +EnvironmentFile=-/etc/default/ngircd-full +EnvironmentFile=-/etc/default/ngircd-full-dbg +# Start ngIRCd. Note: systemd doesn't allow to use $DAEMON here! +ExecStart=/usr/sbin/ngircd $PARAMS ExecReload=/bin/kill -HUP $MAINPID Restart=on-failure diff --git a/contrib/ngircd.socket b/contrib/ngircd.socket index 1c0cc00..1aee546 100644 --- a/contrib/ngircd.socket +++ b/contrib/ngircd.socket @@ -1,5 +1,6 @@ [Unit] Description=Next Generation IRC Daemon (Socket) +Documentation=man:ngircd(8) man:ngircd.conf(5) [Socket] BindIPv6Only=ipv6-only diff --git a/contrib/ngircd.spec b/contrib/ngircd.spec index 8ea7b22..479ec4d 100644 --- a/contrib/ngircd.spec +++ b/contrib/ngircd.spec @@ -1,5 +1,5 @@ %define name ngircd -%define version 23 +%define version 24 %define release 1 %define prefix %{_prefix} @@ -27,7 +27,7 @@ Advantages: - supports IPv6 and SSL - no problems with servers that have dynamic IP addresses - freely available, modern, portable and tidy C-source - - ngIRCd is being actively developed since 11 years. + - ngIRCd is being actively developed since 2001 %prep %setup -q diff --git a/contrib/platformtest.sh b/contrib/platformtest.sh index e7e5ffe..e054d06 100755 --- a/contrib/platformtest.sh +++ b/contrib/platformtest.sh @@ -1,7 +1,7 @@ #!/bin/sh # # ngIRCd -- The Next Generation IRC Daemon -# Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors +# Copyright (c)2001-2016 Alexander Barton (alex@barton.de) and Contributors # # 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 @@ -14,14 +14,14 @@ # suitable for inclusion in doc/Platforms.txt -- please send reports # to the ngIRCd mailing list: . -NAME=`basename "$0"` +NAME=$(basename "$0") VERBOSE= CLEAN=1 PLATFORM= COMPILER="unknown" VERSION="unknown" -DATE=`date "+%y-%m-%d"` +DATE=$(date "+%y-%m-%d") COMMENT= R_CONFIGURE= @@ -30,7 +30,7 @@ R_CHECK= R_CHECK_Y="?" R_RUN= -SRC_D=`dirname "$0"` +SRC_D=$(dirname "$0") MY_D="$PWD" [ -n "$MAKE" ] || MAKE="make" @@ -55,6 +55,11 @@ while [ $# -gt 0 ]; do shift done +for cmd in telnet expect; do + command -v "$cmd" >/dev/null 2>&1 \ + || echo "$NAME: WARNING: $cmd(1) not found, \"make check\" won't run all tests!" +done + echo "$NAME: Checking ngIRCd base source directory ..." grep "ngIRCd" "$SRC_D/ChangeLog" >/dev/null 2>&1 if [ $? -ne 0 ]; then @@ -72,10 +77,14 @@ echo "$NAME: Checking for GIT tree ..." if [ -d "$SRC_D/.git" ]; then echo "$NAME: Checking for \"git\" command ..." git version >/dev/null 2>&1 - if [ $? -eq 0 -a -n "$CLEAN" ]; then + if [ $? -eq 0 ] && [ -n "$CLEAN" ]; then echo "$NAME: Running \"git clean\" ..." cd "$SRC_D" || exit 1 - [ -n "$VERBOSE" ] && git clean -dxf || git clean -dxf >/dev/null + if [ -n "$VERBOSE" ]; then + git clean -dxf + else + git clean -dxf >/dev/null + fi cd "$MY_D" || exit 1 fi fi @@ -84,21 +93,42 @@ echo "$NAME: Checking for \"$SRC_D/configure\" script ..." if [ ! -r "$SRC_D/configure" ]; then echo "$NAME: Running \"$SRC_D/autogen.sh\" ..." cd "$SRC_D" || exit 1 - [ -n "$VERBOSE" ] && ./autogen.sh || ./autogen.sh >/dev/null + if [ -n "$VERBOSE" ]; then + ./autogen.sh + else + ./autogen.sh >/dev/null + fi + if [ $? -ne 0 ]; then + echo "$NAME: \"$SRC_D/autogen.sh\" script failed, aborting!" + exit 1 + fi cd "$MY_D" || exit 1 fi if [ -r "$SRC_D/configure" ]; then echo "$NAME: Running \"$SRC_D/configure\" script ..." - [ -n "$VERBOSE" ] && "$SRC_D/configure" -C || "$SRC_D/configure" -C >/dev/null - if [ $? -eq 0 -a -r ./Makefile ]; then + if [ -n "$VERBOSE" ]; then + "$SRC_D/configure" -C + else + "$SRC_D/configure" -C >/dev/null + fi + if [ $? -eq 0 ] && [ -r ./Makefile ]; then R_CONFIGURE=1 + rm -f "src/ngircd/ngircd" echo "$NAME: Running \"$MAKE\" ..." - [ -n "$VERBOSE" ] && "$MAKE" || "$MAKE" >/dev/null - if [ $? -eq 0 -a -x src/ngircd/ngircd ]; then + if [ -n "$VERBOSE" ]; then + "$MAKE" + else + "$MAKE" >/dev/null + fi + if [ $? -eq 0 ] && [ -x src/ngircd/ngircd ]; then R_MAKE=1 echo "$NAME: Running \"$MAKE check\" ..." - [ -n "$VERBOSE" ] && "$MAKE" check || "$MAKE" check >/dev/null + if [ -n "$VERBOSE" ]; then + "$MAKE" check + else + "$MAKE" check >/dev/null + fi if [ $? -eq 0 ]; then R_CHECK=1 R_RUN=$R_CHECK @@ -115,13 +145,13 @@ fi # Get target platform information if [ -r "src/config.h" ]; then - CPU=`grep "HOST_CPU" "src/config.h" | cut -d'"' -f2` - OS=`grep "HOST_OS" "src/config.h" | cut -d'"' -f2` - VENDOR=`grep "HOST_VENDOR" "src/config.h" | cut -d'"' -f2` + CPU=$(grep "HOST_CPU" "src/config.h" | cut -d'"' -f2) + OS=$(grep "HOST_OS" "src/config.h" | cut -d'"' -f2) + VENDOR=$(grep "HOST_VENDOR" "src/config.h" | cut -d'"' -f2) PLATFORM="$CPU/$VENDOR/$OS" fi if [ -z "$PLATFORM" ]; then - PLATFORM="`uname 2>/dev/null` `uname -r 2>/dev/null`, `uname -m 2>/dev/null`" + PLATFORM="$(uname 2>/dev/null) $(uname -r 2>/dev/null), $(uname -m 2>/dev/null)" fi # Get compiler information @@ -153,8 +183,8 @@ if [ -r "Makefile" ]; then | cut -d'(' -f1 | sed -e 's/version //g') fi if [ "$COMPILER" = "unknown" ]; then - v="`$CC --version 2>/dev/null | head -1`" - [ -z "$v" ] && v="`$CC -version 2>/dev/null | head -1`" + v="$($CC --version 2>/dev/null | head -1)" + [ -z "$v" ] && v="$($CC -version 2>/dev/null | head -1)" [ -n "$v" ] && COMPILER="$v" fi fi @@ -164,7 +194,7 @@ fi eval "$(grep "^VERSION = " Makefile | sed -e 's/ //g')" case "$VERSION" in *~*-*) - VERSION=`echo "$VERSION" | cut -b1-10` + VERSION=$(echo "$VERSION" | cut -b1-10) ;; esac [ -n "$VERSION" ] || VERSION="unknown" @@ -184,7 +214,12 @@ fi [ -n "$R_CONFIGURE" ] && C="Y" || C="N" [ -n "$R_MAKE" ] && M="Y" || M="N" [ -n "$R_CHECK" ] && T="$R_CHECK_Y" || T="N" -[ -n "$R_RUN" ] && R="Y" || R="N" +if [ -n "$R_RUN" ]; then + # Mark "runs" with "Y" only when the test suite succeeded: + [ "$T" = "N" ] && R="?" || R="Y" +else + R="N" +fi [ -n "$COMMENT" ] && COMMENT=" $COMMENT" echo @@ -195,17 +230,29 @@ echo " ./configure works --+ | echo " | | | |" echo "Platform Compiler ngIRCd Date Tester C M T R *" echo "--------------------------- ------------ ---------- -------- -------- - - - - -" -type printf >/dev/null 2>&1 +command -v printf >/dev/null 2>&1 if [ $? -eq 0 ]; then printf "%-27s %-12s %-10s %s %-8s %s %s %s %s%s\n" \ - "$PLATFORM" "$COMPILER" "$VERSION" "$DATE" "$USER" \ + "$PLATFORM" "$COMPILER" "$VERSION" "$DATE" "$LOGNAME" \ "$C" "$M" "$T" "$R" "$COMMENT" else - echo "$PLATFORM $COMPILER $VERSION $DATE $USER" \ + echo "$PLATFORM $COMPILER $VERSION $DATE $LOGNAME" \ "$C" "$M" "$T" "$R" "$COMMENT" fi echo + +double_check() { + echo "Please double check that the ngIRCd daemon starts up, runs and handles IRC" + echo "connections successfully!" +} + if [ "$R_CHECK_Y" = "y" ]; then - echo "$NAME: Warning: Some tests have been skipped!" + echo "WARNING: Some tests have been skipped!" + double_check + echo +fi +if [ "$R" = "?" ]; then + echo "WARNING: The resulting binary passed simple tests, but the test suite failed!" + double_check echo fi diff --git a/doc/Commands.txt b/doc/Commands.txt index d350e8d..c4bd3a1 100644 --- a/doc/Commands.txt +++ b/doc/Commands.txt @@ -324,7 +324,7 @@ General Commands In addition, IRC Ops can use these two forms to specify the : . - # - - # + - $ . The can contain the wildcard characters "*" and "?", but must contain at least one dot (".") and no wildcard after the last one. diff --git a/doc/HowToRelease.txt b/doc/HowToRelease.txt index af78cee..c9f0deb 100644 --- a/doc/HowToRelease.txt +++ b/doc/HowToRelease.txt @@ -1,9 +1,8 @@ ngIRCd - Next Generation IRC Server + http://ngircd.barton.de/ - (c)2001-2010 Alexander Barton, - alex@barton.de, http://www.barton.de/ - + (c)2001-2017 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. diff --git a/doc/Modes.txt b/doc/Modes.txt index 18930f7..92e6613 100644 --- a/doc/Modes.txt +++ b/doc/Modes.txt @@ -75,13 +75,17 @@ channel of which he is a member. mode since description - q 20 User is channel owner can only be set by a service, other - owner and irc op. Can promote other users to q, a, o, h, v. - a 20 User is channel admin and can promote other users to v, h, o + q 20 User is channel owner. This mode can only be set by an IRC + service, other owner or IRC operator. Channel owners can + promote other users to all levels: q, a, o, h, v. Prefix: "~". + a 20 User is channel admin and can promote other users to v, h, o. + Prefix: "&". o 0.2.0 User is channel operator and can op/kick/... other members. + Prefix: "@". h 20 User is half op and can set channel modes imntvIbek and kick - voiced and normal users. + voiced and normal users. Prefix: "%". v 0.2.0 User is "voiced" and can speak even if channel is moderated. + Prefix: "+". Notes diff --git a/doc/PAM.txt b/doc/PAM.txt index 671f071..818c4f1 100644 --- a/doc/PAM.txt +++ b/doc/PAM.txt @@ -26,6 +26,10 @@ A very simple -- and quite useless ;-) -- example would be: Here the "pam_debug" module will be called each time a client connects to the ngIRCd and has sent its PASS, NICK, and USER commands. +The PAM library used by the ngIRCd daemon must be able to access its +configuration file, so don't forget to check permissions and run something +like this: "chmod 644 /etc/pam.d/ngircd". + Please note ONE VERY IMPORTANT THING: All the PAM modules are executed with the privileges of the user ngIRCd diff --git a/doc/Platforms.txt b/doc/Platforms.txt index 341ff6d..fd8cccc 100644 --- a/doc/Platforms.txt +++ b/doc/Platforms.txt @@ -2,7 +2,7 @@ ngIRCd - Next Generation IRC Server http://ngircd.barton.de/ - (c)2001-2013 Alexander Barton and Contributors. + (c)2001-2016 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. @@ -32,6 +32,7 @@ armv6l/unk./linux-gnueabihf gcc 4.6.3 21~rc2 13-10-26 pi Y Y Y Y 5 armv7l/unk./linux-gnueabi gcc 4.4.3 19.1 12-04-29 goetz Y Y Y Y 5 armv7l/unk./linux-gnueabihf gcc 4.6.3 22~rc1-3 14-10-10 alex Y Y Y Y 5 armv7l/unk./linux-gnueabihf gcc 4.8.2 21.1 14-07-15 goetz Y Y Y Y 5 +armv7l/unk./linux-gnueabihf gcc 4.9.2 23 16-01-10 alex Y Y Y Y 5 hppa/unknown/openbsd3.5 gcc 2.95.3 CVSHEAD 04-05-25 alex Y Y Y Y hppa/unknown/openbsd5.4 gcc 4.2.1 22~rc1-3 14-10-10 alex Y Y y Y 3 hppa1.1/unknown/linux-gnu gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y @@ -40,34 +41,37 @@ hppa2.0w-hp-hpux11.11 gcc 4.2.3 14.1 09-07-22 goetz Y Y Y Y i386/apple/darwin9.7.0 gcc 4.0.1 14.1 09-08-04 alex Y Y Y Y 3 i386/apple/darwin10.8.0 gcc 4.2.1 19 12-02-26 alex Y Y Y Y 3 i386/apple/darwin11.3.0 gcc 4.2.1 19 12-02-26 alex Y Y Y Y 3 +i386/pc/linux-gnu gcc 4.1.2 13~rc1 08-12-05 alex Y Y Y Y 1 +i386/pc/linux-gnu gcc 4.4.5 22~rc1-3 14-10-10 alex Y Y Y Y 1 +i386/pc/minix clang 3.4 23 16-01-06 goetz Y Y N Y i386/pc/solaris2.9 gcc 3.2.2 CVSHEAD 04-02-24 alex Y Y Y Y -i386/pc/solaris2.11 gcc 4.5.2 21~rc2 13-10-27 alex Y Y N Y 4 +i386/pc/solaris2.11 gcc 4.8.2 23 16-02-07 goetz Y Y Y Y 4 i386/unknown/freebsd5.2.1 gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y i386/unknown/freebsd6.2 gcc 3.4.6 20~rc1 12-11-13 alex Y Y Y Y 3 -i386/unknown/freebsd7.3 gcc 4.2.1 20~rc1 12-11-13 alex Y Y Y Y 3 -i686/pc/minix gcc 4.4.6 21~rc2 13-10-27 alex Y Y N N -i686/unknown/gnu0.3 gcc 4.4.5 19 12-02-29 alex Y Y Y Y -i686/unknown/gnu0.5 gcc 4.9.1 22~rc1-3 14-10-11 alex Y Y Y Y -i686/unkn./kfreebsd7.2-gnu gcc 4.3.4 15 09-12-02 alex Y Y Y Y 3 +i386/unknown/freebsd7.3 gcc 4.2.1 24~rc1-7 17-01-20 alex Y Y Y Y 3 i386/unknown/netbsdelf1.5.2 egcs-1.1.2 21 13-11-25 goetz Y Y N Y i386/unknown/netbsdelf1.6.2 gcc 2.95.3 18 11-07-10 goetz Y Y Y Y i386/unknown/netbsdelf3.0.1 gcc 3.3.3 0.10.0-p1 06-08-30 alex Y Y Y Y 3 -i386/unknown/netbsdelf4.0 gcc 4.1.2 19 12-02-29 alex Y Y Y Y 3 +i386/unknown/netbsdelf4.0 gcc 4.1.2 24~rc1-7 17-01-20 alex Y Y Y Y 3 i386/unknown/netbsdelf5.0.2 gcc 4.1.3 19 12-02-26 alex Y Y Y Y 3 -i386/unknown/openbsd3.5 gcc 2.95.3 21 13-11-17 goetz Y Y Y Y 3 +i386/unknown/openbsd3.5 gcc 2.95.3 23 15-11-27 goetz Y Y y Y 3 i386/unknown/openbsd3.9 gcc 3.3.5 0.10.0-p1 06-08-30 alex Y Y Y Y 3 i386/unknown/openbsd4.1 gcc 3.3.5 16 10-04-11 alex Y Y Y Y 3 i386/unknown/openbsd5.3 gcc 4.2.1 21 13-11-28 goetz Y Y Y Y 3 i386/unknown/openbsd5.4 gcc 4.2.1 21 13-11-28 goetz Y Y Y Y 3 i586/pc/haiku gcc 2.95.3 19.2~138 12-10-11 user Y Y N N -i586/pc/interix3.5 gcc 3.3 19 12-02-29 alex Y Y N Y -i686/pc/cygwin gcc 4.8.3 22~rc1-3 14-10-10 alex Y Y N Y -i686/pc/linux-gnu gcc 2.7.2 21~38 14-01-06 goetz Y Y Y Y 1 +i586/pc/interix3.5 gcc 3.3 23 16-01-29 alex Y Y N Y +i686/pc/cygwin gcc 4.9.3 23 16-01-06 alex Y Y Y Y +i686/pc/linux-gnu gcc 2.6.3 23 16-01-06 goetz Y Y y Y 1 +i686/pc/linux-gnu gcc 2.7.2.1 23 15-11-30 goetz Y Y N Y 1 +i686/pc/linux-gnu gcc 2.95.2 23 15-12-23 goetz Y Y Y Y 1 i686/pc/linux-gnu gcc 2.95.4 0.8.0 04-05-30 alex Y Y Y Y 1 i686/pc/linux-gnu gcc 3.3.5 14.1 09-08-04 alex Y Y Y Y 1 -i386/pc/linux-gnu gcc 4.1.2 13~rc1 08-12-05 alex Y Y Y Y 1 -i386/pc/linux-gnu gcc 4.4.5 22~rc1-3 14-10-10 alex Y Y Y Y 1 i686/pc/linux-gnu gcc 4.3.2 14.1 09-08-04 alex Y Y Y Y 1 +i686/pc/minix gcc 4.4.6 21~rc2 13-10-27 alex Y Y N N +i686/unknown/gnu0.3 gcc 4.4.5 19 12-02-29 alex Y Y Y Y +i686/unknown/gnu0.5 gcc 4.9.1 22~rc1-3 14-10-11 alex Y Y Y Y +i686/unkn./kfreebsd7.2-gnu gcc 4.3.4 15 09-12-02 alex Y Y Y Y 3 m68k/apple/aux3.0.1 gcc 2.7.2 17 10-11-07 alex Y Y N Y m68k/apple/aux3.0.1 Orig. A/UX 17 10-11-07 alex Y Y N Y 2 m68k/apple/aux3.1.1 gcc 2.7.2 19 12-02-26 alex Y Y N Y @@ -90,21 +94,26 @@ x86_64/apple/darwin10.8.0 gcc 4.2.1 21~rc2 13-10-30 alex Y Y Y Y 3 x86_64/apple/darwin12.3.0 gcc 4.2.1 20.2 13-04-01 alex Y Y Y Y 3 x86_64/apple/darwin13.0.0 A-clang 5.0 21 14-01-02 alex Y Y Y Y 3 x86_64/apple/darwin14.5.0 A-clang 6.1 23~rc1 15-09-06 alex Y Y Y Y 3 +x86_64/apple/darwin15.6.0 A-clang 8.0 23~38-g455 16-11-04 alex Y Y Y Y 3 +x86_64/apple/darwin16.3.0 A-clang 8.0 24~rc1-7 17-01-20 alex Y Y Y Y 3 x86_64/unknown/dragonfly3.4 gcc 4.7.2 21 13-11-12 goetz Y Y N Y 3 -x86_64/unknown/freebsd8.4 gcc 4.2.1 22~rc1-3 14-10-10 alex Y Y y Y 3 +x86_64/unkn./freebsd8.1-gnu gcc 4.4.5 19 12-02-26 alex Y Y Y Y 3 +x86_64/unknown/freebsd8.4 gcc 4.2.1 24~rc1-7 17-01-20 alex Y Y Y Y 3 x86_64/unknown/freebsd9.2 gcc 4.2.1 22~rc1-3 14-10-10 alex Y Y Y Y 3 x86_64/unknown/freebsd10.0 F-clang 3.3 22~rc1-3 14-10-10 alex Y Y Y Y 3 -x86_64/unkn./freebsd8.1-gnu gcc 4.4.5 19 12-02-26 alex Y Y Y Y 3 x86_64/unknown/linux-gnu clang 3.3 21 14-01-07 alex Y Y Y Y 1 x86_64/unknown/linux-gnu clang 3.4 22~rc1-3 14-10-11 alex Y Y Y Y 1 -x86_64/unknown/linux-gnu gcc 4.4.5 23~rc1-3 15-11-15 alex Y Y Y Y 1 +x86_64/pc/linux-gnu gcc 4.4.5 24~rc1-7 17-01-20 alex Y Y Y Y 1 x86_64/unknown/linux-gnu gcc 4.7.2 23~rc1-3 15-11-15 alex Y Y Y Y 1 -x86_64/unknown/linux-gnu gcc 4.8.2 21 13-12-29 alex Y Y Y Y 1 -x86_64/unknown/linux-gnu gcc 4.9.2 23~rc1-3 15-11-15 alex Y Y Y Y 1 +x86_64/pc/linux-gnu gcc 4.8.4 24~rc1-7 17-01-20 alex Y Y Y Y 1 +x86_64/pc/linux-gnu gcc 4.9.2 24~rc1-7 17-01-20 alex Y Y Y Y 1 +x86_64/unknown/linux-gnu gcc 5.3.0 23 15-12-14 goetz Y Y Y Y 1 +x86_64/pc/linux-gnu gcc 6.2.1 24~rc1-7 17-01-20 alex Y Y Y Y 1 +x86_64/pc/linux-gnu gcc 6.3.1 24~rc1-7 17-01-20 alex Y Y Y Y 1 +x86_64/unknown/linux-gnu icc 16 23 16-01-13 goetz Y Y Y Y 1 x86_64/unknown/linux-gnu nwcc 0.8.2 21 13-12-01 goetz Y Y Y Y 1 x86_64/unknown/linux-gnu Open64 21.1 14-03-27 goetz Y Y Y Y 1 x86_64/unknown/linux-gnu Sun C 5.12 21.1 14-03-27 goetz Y Y Y Y 1 -x86_64/unknown/linux-gnu tcc 0.9.25 21.1 14-03-27 goetz Y Y Y Y 1 x86_64/unknown/openbsd4.7 gcc 3.3.5 20~rc1 12-02-26 alex Y Y Y Y 3 x86_64/unknown/openbsd4.8 gcc 4.2.1 22~rc1-3 14-10-10 alex Y Y y Y 3 x86_64/unknown/openbsd5.1 gcc 4.2.1 21 13-12-28 alex Y Y Y Y 3 diff --git a/doc/RFC.txt b/doc/RFC.txt index 3e4142f..1524852 100644 --- a/doc/RFC.txt +++ b/doc/RFC.txt @@ -1,9 +1,8 @@ ngIRCd - Next Generation IRC Server + http://ngircd.barton.de/ - (c)2001-2003 by Alexander Barton, - alex@barton.de, http://www.barton.de/ - + (c)2001-2017 Alexander Barton and Contributors. ngIRCd is free software and published under the terms of the GNU General Public License. @@ -11,7 +10,8 @@ The Internet Relay Chat (IRC) protocol is documented in these Request for -Comments (RFC), which you can get e.g. via : +Comments (RFCs), which you can get via or + for example. 1459 Oikarinen, J. & D. Reed, "Internet Relay Chat Protocol", May 1993, [IRC]. @@ -28,6 +28,5 @@ Comments (RFC), which you can get e.g. via : 2813 Kalt, C., "Internet Relay Chat: Server Protocol", April 2000, [IRC-SERVER]. - --- -$Id: RFC.txt,v 1.6 2003/03/07 20:42:20 alex Exp $ + 7194 Hartmann, R., "Default Port for Internet Relay Chat (IRC) via TLS/SSL", + August 2014. diff --git a/doc/sample-ngircd.conf.tmpl b/doc/sample-ngircd.conf.tmpl index a4346b1..3f9ba08 100644 --- a/doc/sample-ngircd.conf.tmpl +++ b/doc/sample-ngircd.conf.tmpl @@ -226,6 +226,15 @@ # character prepended to their respective user names! ;PAMIsOptional = no + # When PAM is enabled, this value determines the used PAM + # configuration. + # This setting allows to run multiple ngIRCd instances with + # different PAM configurations on each instance. + # If you set it to "ngircd-foo", PAM will use + # /etc/pam.d/ngircd-foo instead of the default + # /etc/pam.d/ngircd. + ;PAMServiceName = ngircd + # Let ngIRCd send an "authentication PING" when a new client connects, # and register this client only after receiving the corresponding # "PONG" reply. diff --git a/man/ngircd.8.tmpl b/man/ngircd.8.tmpl index 524fe3c..a037c4c 100644 --- a/man/ngircd.8.tmpl +++ b/man/ngircd.8.tmpl @@ -1,7 +1,7 @@ .\" .\" ngircd(8) manual page template .\" -.TH ngircd 8 "Oct 2013" ngIRCd "ngIRCd Manual" +.TH ngircd 8 "Jan 2017" ngIRCd "ngIRCd Manual" .SH NAME ngIRCd \- the "next generation" IRC daemon .SH SYNOPSIS diff --git a/man/ngircd.conf.5.tmpl b/man/ngircd.conf.5.tmpl index 8c62709..30e1e5a 100644 --- a/man/ngircd.conf.5.tmpl +++ b/man/ngircd.conf.5.tmpl @@ -1,7 +1,7 @@ .\" .\" ngircd.conf(5) manual page template .\" -.TH ngircd.conf 5 "Oct 2014" ngIRCd "ngIRCd Manual" +.TH ngircd.conf 5 "Jan 2017" ngIRCd "ngIRCd Manual" .SH NAME ngircd.conf \- configuration file of ngIRCd .SH SYNOPSIS @@ -83,7 +83,7 @@ blocks are used to configure pre-defined ("persistent") IRC channels. .PP There can be more than one [Operator], [Server] and [Channel] section per configuration file, one for each operator, server, and channel. [Global], -[Limits], [Options], and [SSL] sections can occure multiple times, too, but +[Limits], [Options], and [SSL] sections can occur multiple times, too, but each variable overwrites itself, only the last assignment is relevant. .SH [GLOBAL] The @@ -339,6 +339,14 @@ able to distinguish between Ident'ified and PAM-authenticated users: both don't have a "~" character prepended to their respective user names! Default: no. .TP +\fBPAMServiceName\fR (string) +When PAM is enabled, this value determines the used PAM configuration. +This setting allows to run multiple ngIRCd instances with different +PAM configurations on each instance. If you set it to "ngircd-foo", +PAM will use /etc/pam.d/ngircd-foo instead of the default +/etc/pam.d/ngircd. +Default: ngircd. +.TP \fBRequireAuthPing\fR (boolean) Let ngIRCd send an "authentication PING" when a new client connects, and register this client only after receiving the corresponding "PONG" reply. diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c index 98a2c1d..01ec3c0 100644 --- a/src/ngircd/conf.c +++ b/src/ngircd/conf.c @@ -419,6 +419,7 @@ Conf_Test( void ) #ifdef PAM printf(" PAM = %s\n", yesno_to_str(Conf_PAM)); printf(" PAMIsOptional = %s\n", yesno_to_str(Conf_PAMIsOptional)); + printf(" PAMServiceName = %s\n", Conf_PAMServiceName); #endif #ifndef STRICT_RFC printf(" RequireAuthPing = %s\n", yesno_to_str(Conf_AuthPing)); @@ -807,6 +808,7 @@ Set_Defaults(bool InitServers) Conf_PAM = false; #endif Conf_PAMIsOptional = false; + strcpy(Conf_PAMServiceName, "ngircd"); Conf_ScrubCTCP = false; #ifdef SYSLOG #ifdef LOG_LOCAL5 @@ -1833,6 +1835,12 @@ Handle_OPTIONS(const char *File, int Line, char *Var, char *Arg) Conf_PAMIsOptional = Check_ArgIsTrue(Arg); return; } + if (strcasecmp(Var, "PAMServiceName") == 0) { + len = strlcpy(Conf_PAMServiceName, Arg, sizeof(Conf_PAMServiceName)); + if (len >= sizeof(Conf_PAMServiceName)) + Config_Error_TooLong(File, Line, Var); + return; + } if (strcasecmp(Var, "PredefChannelsOnly") == 0) { /* * TODO: This section and support for "PredefChannelsOnly" diff --git a/src/ngircd/conf.h b/src/ngircd/conf.h index 70de20a..7203b86 100644 --- a/src/ngircd/conf.h +++ b/src/ngircd/conf.h @@ -203,6 +203,9 @@ GLOBAL bool Conf_PAM; /** Don't require all clients to send a password an to be PAM authenticated */ GLOBAL bool Conf_PAMIsOptional; +/** The service name to use for PAM */ +GLOBAL char Conf_PAMServiceName[MAX_PAM_SERVICE_NAME_LEN]; + /** Disable all CTCP commands except for /me ? */ GLOBAL bool Conf_ScrubCTCP; diff --git a/src/ngircd/conn-ssl.c b/src/ngircd/conn-ssl.c index 2cb734d..705c29d 100644 --- a/src/ngircd/conn-ssl.c +++ b/src/ngircd/conn-ssl.c @@ -283,10 +283,12 @@ ConnSSL_InitLibrary( void ) #ifdef HAVE_LIBSSL SSL_CTX *newctx; +#if OPENSSL_API_COMPAT < 0x10100000L if (!ssl_ctx) { SSL_library_init(); SSL_load_error_strings(); } +#endif if (!RAND_status()) { Log(LOG_ERR, "OpenSSL PRNG not seeded: /dev/urandom missing?"); diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index 4a028ac..16cf13c 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -182,7 +182,6 @@ cb_connserver(int sock, UNUSED short what) CONN_ID idx = Socket2Index( sock ); if (idx <= NONE) { - LogDebug("cb_connserver wants to write on unknown socket?!"); io_close(sock); return; } @@ -280,12 +279,11 @@ cb_clientserver(int sock, short what) { CONN_ID idx = Socket2Index(sock); - assert(idx >= 0); - - if (idx < 0) { + if (idx <= NONE) { io_close(sock); return; } + #ifdef SSL_SUPPORT if (what & IO_WANTREAD || (Conn_OPTION_ISSET(&My_Connections[idx], CONN_SSL_WANT_WRITE))) { @@ -307,32 +305,20 @@ cb_clientserver(int sock, short what) GLOBAL void Conn_Init( void ) { - CONN_ID i; + int size; - Pool_Size = CONNECTION_POOL; - if ((Conf_MaxConnections > 0) && - (Pool_Size > Conf_MaxConnections)) - Pool_Size = Conf_MaxConnections; - - if (!array_alloc(&My_ConnArray, sizeof(CONNECTION), (size_t)Pool_Size)) { - Log(LOG_EMERG, "Can't allocate memory! [Conn_Init]"); + /* Initialize the "connection pool". + * FIXME: My_Connetions/Pool_Size is needed by other parts of the + * code; remove them! */ + Pool_Size = 0; + size = Conf_MaxConnections > 0 ? Conf_MaxConnections : CONNECTION_POOL; + if (Socket2Index(size) <= NONE) { + Log(LOG_EMERG, "Failed to initialize connection pool!"); exit(1); } - /* FIXME: My_Connetions/Pool_Size is needed by other parts of the - * code; remove them! */ - My_Connections = (CONNECTION*) array_start(&My_ConnArray); - - LogDebug("Allocated connection pool for %d items (%ld bytes).", - array_length(&My_ConnArray, sizeof(CONNECTION)), - array_bytes(&My_ConnArray)); - - assert(array_length(&My_ConnArray, sizeof(CONNECTION)) >= (size_t)Pool_Size); - + /* Initialize "listener" array. */ array_free( &My_Listeners ); - - for (i = 0; i < Pool_Size; i++) - Init_Conn_Struct(i); } /* Conn_Init */ /** @@ -1378,8 +1364,8 @@ New_Connection(int Sock, UNUSED bool IsSSL) /* Check global connection limit */ if ((Conf_MaxConnections > 0) && (NumConnections >= (size_t) Conf_MaxConnections)) { - Log(LOG_ALERT, "Can't accept connection: limit (%d) reached!", - Conf_MaxConnections); + Log(LOG_ALERT, "Can't accept new connection on socket %d: Limit (%d) reached!", + Sock, Conf_MaxConnections); Simple_Message(new_sock, "ERROR :Connection limit reached"); close(new_sock); return -1; @@ -1398,23 +1384,10 @@ New_Connection(int Sock, UNUSED bool IsSSL) return -1; } - if (new_sock >= Pool_Size) { - if (!array_alloc(&My_ConnArray, sizeof(CONNECTION), - (size_t) new_sock)) { - Log(LOG_EMERG, - "Can't allocate memory! [New_Connection]"); - Simple_Message(new_sock, "ERROR: Internal error"); - close(new_sock); - return -1; - } - LogDebug("Bumped connection pool to %ld items (internal: %ld items, %ld bytes)", - new_sock, array_length(&My_ConnArray, - sizeof(CONNECTION)), array_bytes(&My_ConnArray)); - - /* Adjust pointer to new block */ - My_Connections = array_start(&My_ConnArray); - while (Pool_Size <= new_sock) - Init_Conn_Struct(Pool_Size++); + if (Socket2Index(new_sock) <= NONE) { + Simple_Message(new_sock, "ERROR: Internal error"); + close(new_sock); + return -1; } /* register callback */ @@ -1523,24 +1496,38 @@ Account_Connection(void) } /* Account_Connection */ /** - * Translate socket handle into connection index. + * Translate socket handle into connection index (for historical reasons, it is + * a 1:1 mapping today) and enlarge the "connection pool" accordingly. * * @param Sock Socket handle. - * @returns Connecion index or NONE, if no connection could be found. + * @returns Connecion index or NONE when the pool is too small. */ static CONN_ID Socket2Index( int Sock ) { - assert( Sock >= 0 ); + assert(Sock > 0); + assert(Pool_Size >= 0); + + if (Sock < Pool_Size) + return Sock; - if( Sock >= Pool_Size || My_Connections[Sock].sock != Sock ) { - /* the Connection was already closed again, likely due to - * an error. */ - LogDebug("Socket2Index: can't get connection for socket %d!", Sock); + /* Try to allocate more memory ... */ + if (!array_alloc(&My_ConnArray, sizeof(CONNECTION), (size_t)Sock)) { + Log(LOG_EMERG, + "Can't allocate memory to enlarge connection pool!"); return NONE; } + LogDebug("Enlarged connection pool for %ld sockets (%ld items, %ld bytes)", + Sock, array_length(&My_ConnArray, sizeof(CONNECTION)), + array_bytes(&My_ConnArray)); + + /* Adjust pointer to new block, update size and initialize new items. */ + My_Connections = array_start(&My_ConnArray); + while (Pool_Size <= Sock) + Init_Conn_Struct(Pool_Size++); + return Sock; -} /* Socket2Index */ +} /** * Read data from the network to the read buffer. If an error occurs, @@ -2007,10 +1994,7 @@ New_Server( int Server , ng_ipaddr_t *dest) return; } - if (!array_alloc(&My_ConnArray, sizeof(CONNECTION), (size_t)new_sock)) { - Log(LOG_ALERT, - "Cannot allocate memory for server connection (socket %d)", - new_sock); + if (Socket2Index(new_sock) <= NONE) { close( new_sock ); Conf_Server[Server].conn_id = NONE; return; @@ -2024,8 +2008,6 @@ New_Server( int Server , ng_ipaddr_t *dest) return; } - My_Connections = array_start(&My_ConnArray); - assert(My_Connections[new_sock].sock <= 0); Init_Conn_Struct(new_sock); @@ -2472,9 +2454,7 @@ cb_clientserver_ssl(int sock, UNUSED short what) { CONN_ID idx = Socket2Index(sock); - assert(idx >= 0); - - if (idx < 0) { + if (idx <= NONE) { io_close(sock); return; } @@ -2524,12 +2504,13 @@ cb_connserver_login_ssl(int sock, short unused) { CONN_ID idx = Socket2Index(sock); - assert(idx >= 0); - if (idx < 0) { + (void) unused; + + if (idx <= NONE) { io_close(sock); return; } - (void) unused; + switch (ConnSSL_Connect( &My_Connections[idx])) { case 1: break; case 0: LogDebug("ConnSSL_Connect: not ready"); diff --git a/src/ngircd/defines.h b/src/ngircd/defines.h index ff849bb..f266690 100644 --- a/src/ngircd/defines.h +++ b/src/ngircd/defines.h @@ -61,6 +61,9 @@ /** Size of default connection pool. */ #define CONNECTION_POOL 100 +/** Size of buffer for PAM service name. */ +#define MAX_PAM_SERVICE_NAME_LEN 64 + /* Hard-coded (default) options */ @@ -206,6 +209,9 @@ /** Max. number of channel modes with arguments per MODE command. */ #define MAX_HNDL_MODES_ARG 5 +/** Max. number of targets per PRIVMSG/NOTICE/... command. */ +#define MAX_HNDL_TARGETS 25 + /** Max. number of WHO replies. */ #define MAX_RPL_WHO 25 diff --git a/src/ngircd/irc-info.c b/src/ngircd/irc-info.c index 1788bf6..82bd551 100644 --- a/src/ngircd/irc-info.c +++ b/src/ngircd/irc-info.c @@ -894,16 +894,16 @@ IRC_STATS( CLIENT *Client, REQUEST *Req ) list = Class_GetList(CLASS_GLINE); else list = Class_GetList(CLASS_KLINE); - list_item = Lists_GetFirst(list); - while (list_item) { - if (!IRC_WriteStrClient(from, RPL_STATSXLINE_MSG, + list_item = Lists_GetFirst(list); + while (list_item) { + if (!IRC_WriteStrClient(from, RPL_STATSXLINE_MSG, Client_ID(from), query, Lists_GetMask(list_item), Lists_GetValidity(list_item), Lists_GetReason(list_item))) - return DISCONNECTED; - list_item = Lists_GetNext(list_item); - } + return DISCONNECTED; + list_item = Lists_GetNext(list_item); + } break; case 'L': /* Link status (servers and user links) */ if (!Op_Check(from, Req)) diff --git a/src/ngircd/irc-oper.c b/src/ngircd/irc-oper.c index ee0a556..e877213 100644 --- a/src/ngircd/irc-oper.c +++ b/src/ngircd/irc-oper.c @@ -47,7 +47,7 @@ static bool Bad_OperPass(CLIENT *Client, char *errtoken, char *errmsg) { - Log(LOG_WARNING, "Got invalid OPER from \"%s\": \"%s\" -- %s!", + Log(LOG_ERR|LOG_snotice, "Got invalid OPER from \"%s\": \"%s\" -- %s!", Client_Mask(Client), errtoken, errmsg); /* Increase penalty to slow down possible brute force attacks */ IRC_SetPenalty(Client, 10); @@ -398,7 +398,16 @@ IRC_xLINE(CLIENT *Client, REQUEST *Req) return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command); - from = Op_Check(Client, Req); + if (!Conf_AllowRemoteOper && Client_Type(Client) == CLIENT_SERVER) { + /* Explicitely forbid remote servers to modify "x-lines" when + * the "AllowRemoteOper" configuration option isn't set, even + * when the command seems to originate from the remote server + * itself: this prevents GLINE's to become set during server + * handshake in this case (what wouldn't be possible during + * regular runtime when a remote IRC Op sends the command). */ + from = NULL; + } else + from = Op_Check(Client, Req); if (!from) return Op_NoPrivileges(Client, Req); diff --git a/src/ngircd/irc-server.c b/src/ngircd/irc-server.c index 92186af..317a3e1 100644 --- a/src/ngircd/irc-server.c +++ b/src/ngircd/irc-server.c @@ -31,6 +31,7 @@ #include "parse.h" #include "numeric.h" #include "ngircd.h" +#include "irc.h" #include "irc-info.h" #include "irc-write.h" #include "op.h" @@ -245,66 +246,96 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req ) CHANNEL *chan; CLIENT *c; - assert( Client != NULL ); - assert( Req != NULL ); + assert(Client != NULL); + assert(Req != NULL); - strlcpy( nick_in, Req->argv[1], sizeof( nick_in )); - strcpy( nick_out, "" ); + strlcpy(nick_in, Req->argv[1], sizeof(nick_in)); + strcpy(nick_out, ""); channame = Req->argv[0]; - ptr = strtok( nick_in, "," ); - while( ptr ) - { + + ptr = strtok(nick_in, ","); + while (ptr) { is_owner = is_chanadmin = is_op = is_halfop = is_voiced = false; /* cut off prefixes */ - while(( *ptr == '~') || ( *ptr == '&' ) || ( *ptr == '@' ) || - ( *ptr == '%') || ( *ptr == '+' )) - { - if( *ptr == '~' ) is_owner = true; - if( *ptr == '&' ) is_chanadmin = true; - if( *ptr == '@' ) is_op = true; - if( *ptr == 'h' ) is_halfop = true; - if( *ptr == '+' ) is_voiced = true; + while ((*ptr == '~') || (*ptr == '&') || (*ptr == '@') || + (*ptr == '%') || (*ptr == '+')) { + if (*ptr == '~') + is_owner = true; + if (*ptr == '&') + is_chanadmin = true; + if (*ptr == '@') + is_op = true; + if (*ptr == '%') + is_halfop = true; + if (*ptr == '+') + is_voiced = true; ptr++; } - c = Client_Search( ptr ); - if( c ) - { - Channel_Join( c, channame ); - chan = Channel_Search( channame ); - assert( chan != NULL ); - - if( is_owner ) Channel_UserModeAdd( chan, c, 'q' ); - if( is_chanadmin ) Channel_UserModeAdd( chan, c, 'a' ); - if( is_op ) Channel_UserModeAdd( chan, c, 'o' ); - if( is_halfop ) Channel_UserModeAdd( chan, c, 'h' ); - if( is_voiced ) Channel_UserModeAdd( chan, c, 'v' ); - - /* announce to channel... */ - IRC_WriteStrChannelPrefix( Client, chan, c, false, "JOIN :%s", channame ); - - /* set Channel-User-Modes */ - strlcpy( modes, Channel_UserModes( chan, c ), sizeof( modes )); - if( modes[0] ) - { - /* send modes to channel */ - IRC_WriteStrChannelPrefix( Client, chan, Client, false, "MODE %s +%s %s", channame, modes, Client_ID( c )); - } + c = Client_Search(ptr); + if (!c) { + /* Client not found? */ + Log(LOG_ERR, + "Got NJOIN for unknown nick \"%s\" for channel \"%s\"!", + ptr, channame); + goto skip_njoin; + } - if( nick_out[0] != '\0' ) strlcat( nick_out, ",", sizeof( nick_out )); - if( is_owner ) strlcat( nick_out, "~", sizeof( nick_out )); - if( is_chanadmin ) strlcat( nick_out, "&", sizeof( nick_out )); - if( is_op ) strlcat( nick_out, "@", sizeof( nick_out )); - if( is_halfop ) strlcat( nick_out, "%", sizeof( nick_out )); - if( is_voiced ) strlcat( nick_out, "+", sizeof( nick_out )); - strlcat( nick_out, ptr, sizeof( nick_out )); + if (!Channel_Join(c, channame)) { + /* Failed to join channel. Ooops!? */ + Log(LOG_ALERT, + "Failed to join client \"%s\" to channel \"%s\" (NJOIN): killing it!", + ptr, channame); + IRC_KillClient(NULL, NULL, ptr, "Internal NJOIN error!"); + Log(LOG_DEBUG, "... done."); + goto skip_njoin; } - else Log( LOG_ERR, "Got NJOIN for unknown nick \"%s\" for channel \"%s\"!", ptr, channame ); - /* search for next Nick */ - ptr = strtok( NULL, "," ); + chan = Channel_Search(channame); + assert(chan != NULL); + + if (is_owner) + Channel_UserModeAdd(chan, c, 'q'); + if (is_chanadmin) + Channel_UserModeAdd(chan, c, 'a'); + if (is_op) + Channel_UserModeAdd(chan, c, 'o'); + if (is_halfop) + Channel_UserModeAdd(chan, c, 'h'); + if (is_voiced) + Channel_UserModeAdd(chan, c, 'v'); + + /* Announce client to the channel */ + IRC_WriteStrChannelPrefix(Client, chan, c, false, + "JOIN :%s", channame); + + /* Announce "channel user modes" to the channel, if any */ + strlcpy(modes, Channel_UserModes(chan, c), sizeof(modes)); + if (modes[0]) + IRC_WriteStrChannelPrefix(Client, chan, Client, false, + "MODE %s +%s %s", channame, + modes, Client_ID(c)); + + /* Build nick list for forwarding command */ + if (nick_out[0] != '\0') + strlcat(nick_out, ",", sizeof(nick_out)); + if (is_owner) + strlcat(nick_out, "~", sizeof(nick_out)); + if (is_chanadmin) + strlcat(nick_out, "&", sizeof(nick_out)); + if (is_op) + strlcat(nick_out, "@", sizeof(nick_out)); + if (is_halfop) + strlcat(nick_out, "%", sizeof(nick_out)); + if (is_voiced) + strlcat(nick_out, "+", sizeof(nick_out)); + strlcat(nick_out, ptr, sizeof(nick_out)); + + skip_njoin: + /* Get next nick, if any ... */ + ptr = strtok(NULL, ","); } /* forward to other servers */ diff --git a/src/ngircd/irc-write.c b/src/ngircd/irc-write.c index 8d09f9b..92e8cfe 100644 --- a/src/ngircd/irc-write.c +++ b/src/ngircd/irc-write.c @@ -521,12 +521,12 @@ va_dcl if (Client_HasMode(to, 'w')) IRC_WriteStrClientPrefix(to, From, "WALLOPS :%s", msg); - break; + break; case CLIENT_SERVER: if (to != Client) IRC_WriteStrClientPrefix(to, From, "WALLOPS :%s", msg); - break; + break; } } } /* IRC_SendWallops */ diff --git a/src/ngircd/irc.c b/src/ngircd/irc.c index cfe616f..d5e4bde 100644 --- a/src/ngircd/irc.c +++ b/src/ngircd/irc.c @@ -85,6 +85,8 @@ IRC_CheckListTooBig(CLIENT *From, const int Count, const int Limit, GLOBAL bool IRC_ERROR(CLIENT *Client, REQUEST *Req) { + char *msg; + assert( Client != NULL ); assert( Req != NULL ); @@ -99,12 +101,20 @@ IRC_ERROR(CLIENT *Client, REQUEST *Req) return CONNECTED; } - if (Req->argc < 1) + if (Req->argc < 1) { + msg = "Got ERROR command"; Log(LOG_NOTICE, "Got ERROR from \"%s\"!", Client_Mask(Client)); - else + } else { + msg = Req->argv[0]; Log(LOG_NOTICE, "Got ERROR from \"%s\": \"%s\"!", - Client_Mask(Client), Req->argv[0]); + Client_Mask(Client), msg); + } + + if (Client_Conn(Client) != NONE) { + Client_Destroy(Client, NULL, msg, false); + return DISCONNECTED; + } return CONNECTED; } /* IRC_ERROR */ @@ -339,9 +349,12 @@ GLOBAL bool IRC_KillClient(CLIENT *Client, CLIENT *From, const char *Nick, const char *Reason) { const char *msg; - CONN_ID my_conn, conn; + CONN_ID my_conn = NONE, conn; CLIENT *c; + assert(Nick != NULL); + assert(Reason != NULL); + /* Do we know such a client in the network? */ c = Client_Search(Nick); if (!c) { @@ -376,7 +389,8 @@ IRC_KillClient(CLIENT *Client, CLIENT *From, const char *Nick, const char *Reaso } /* Save ID of this connection */ - my_conn = Client_Conn(Client); + if (Client) + my_conn = Client_Conn(Client); /* Kill the client NOW: * - Close the local connection (if there is one), @@ -489,11 +503,22 @@ Option_String(UNUSED CONN_ID Idx) if(options & CONN_ZIP) /* zlib compression enabled */ strlcat(option_txt, "z", sizeof(option_txt)); #endif - LogDebug(" *** %d: %d = %s", Idx, options, option_txt); return option_txt; } /* Option_String */ +/** + * Send a message to target(s). + * + * This function is used by IRC_{PRIVMSG|NOTICE|SQUERY} to actualy + * send the message(s). + * + * @param Client The client from which this command has been received. + * @param Req Request structure with prefix and all parameters. + * @param ForceType Required type of the destination of the message(s). + * @param SendErrors Whether to report errors back to the client or not. + * @return CONNECTED or DISCONNECTED. + */ static bool Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors) { @@ -501,8 +526,10 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors) CL2CHAN *cl2chan; CHANNEL *chan; char *currentTarget = Req->argv[0]; - char *lastCurrentTarget = NULL; + char *strtok_last = NULL; char *message = NULL; + char *targets[MAX_HNDL_TARGETS]; + int i, target_nr = 0; assert(Client != NULL); assert(Req != NULL); @@ -542,10 +569,19 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors) message = Req->argv[1]; /* handle msgtarget = msgto *("," msgto) */ - currentTarget = strtok_r(currentTarget, ",", &lastCurrentTarget); + currentTarget = strtok_r(currentTarget, ",", &strtok_last); ngt_UpperStr(Req->command); + /* Please note that "currentTarget" is NULL when the target contains + * the separator character only, e. g. "," or ",,,," etc.! */ while (currentTarget) { + /* Make sure that there hasn't been such a target already: */ + targets[target_nr++] = currentTarget; + for(i = 0; i < target_nr - 1; i++) { + if (strcasecmp(currentTarget, targets[i]) == 0) + goto send_next_target; + } + /* Check for and handle valid of form: * RFC 2812 2.3.1: * msgto = channel / ( user [ "%" host ] "@" servername ) @@ -689,14 +725,14 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors) return DISCONNECTED; } else if (ForceType != CLIENT_SERVICE && (chan = Channel_Search(currentTarget))) { + /* Target is a channel */ if (!Channel_Write(chan, from, Client, Req->command, SendErrors, message)) return DISCONNECTED; } else if (ForceType != CLIENT_SERVICE - /* $#: server/target mask, RFC 2812, sec. 3.3.1 */ && strchr("$#", currentTarget[0]) && strchr(currentTarget, '.')) { - /* targetmask */ + /* $#: server/host mask, RFC 2812, sec. 3.3.1 */ if (!Send_Message_Mask(from, Req->command, currentTarget, message, SendErrors)) return DISCONNECTED; @@ -709,14 +745,35 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors) } send_next_target: - currentTarget = strtok_r(NULL, ",", &lastCurrentTarget); - if (currentTarget) - Conn_SetPenalty(Client_Conn(Client), 1); + currentTarget = strtok_r(NULL, ",", &strtok_last); + if (!currentTarget) + break; + + Conn_SetPenalty(Client_Conn(Client), 1); + + if (target_nr >= MAX_HNDL_TARGETS) { + /* Too many targets given! */ + return IRC_WriteErrClient(Client, + ERR_TOOMANYTARGETS_MSG, + currentTarget); + } } return CONNECTED; } /* Send_Message */ +/** + * Send a message to "target mask" target(s). + * + * See RFC 2812, sec. 3.3.1 for details. + * + * @param from The client from which this command has been received. + * @param command The command to use (PRIVMSG, NOTICE, ...). + * @param targetMask The "target mask" (will be verified by this function). + * @param message The message to send. + * @param SendErrors Whether to report errors back to the client or not. + * @return CONNECTED or DISCONNECTED. + */ static bool Send_Message_Mask(CLIENT * from, char * command, char * targetMask, char * message, bool SendErrors) @@ -740,17 +797,15 @@ Send_Message_Mask(CLIENT * from, char * command, char * targetMask, * dot (".") and no wildcards ("*", "?") following the last one. */ check_wildcards = strrchr(targetMask, '.'); - assert(check_wildcards != NULL); - if (check_wildcards && - check_wildcards[strcspn(check_wildcards, "*?")]) - { + if (!check_wildcards || check_wildcards[strcspn(check_wildcards, "*?")]) { if (!SendErrors) return true; - return IRC_WriteErrClient(from, ERR_WILDTOPLEVEL, targetMask); + return IRC_WriteErrClient(from, ERR_WILDTOPLEVEL_MSG, + targetMask); } - /* #: hostmask, see RFC 2812, sec. 3.3.1 */ if (targetMask[0] == '#') { + /* #: hostmask, see RFC 2812, sec. 3.3.1 */ for (cl = Client_First(); cl != NULL; cl = Client_Next(cl)) { if (Client_Type(cl) != CLIENT_USER) continue; @@ -761,7 +816,8 @@ Send_Message_Mask(CLIENT * from, char * command, char * targetMask, return false; } } else { - assert(targetMask[0] == '$'); /* $: server mask, see RFC 2812, sec. 3.3.1 */ + /* $: server mask, see RFC 2812, sec. 3.3.1 */ + assert(targetMask[0] == '$'); for (cl = Client_First(); cl != NULL; cl = Client_Next(cl)) { if (Client_Type(cl) != CLIENT_USER) continue; diff --git a/src/ngircd/lists.c b/src/ngircd/lists.c index a091add..b842ec8 100644 --- a/src/ngircd/lists.c +++ b/src/ngircd/lists.c @@ -381,11 +381,11 @@ Lists_Expire(struct list_head *h, const char *ListName) if (e->valid_until > 0 && e->valid_until < now) { /* Entry is expired, delete it */ if (e->reason) - Log(LOG_INFO, + Log(LOG_NOTICE|LOG_snotice, "Deleted \"%s\" (\"%s\") from %s list (expired).", e->mask, e->reason, ListName); else - Log(LOG_INFO, + Log(LOG_NOTICE|LOG_snotice, "Deleted \"%s\" from %s list (expired).", e->mask, ListName); Lists_Unlink(h, last, e); diff --git a/src/ngircd/messages.h b/src/ngircd/messages.h index 4f1632b..90292a2 100644 --- a/src/ngircd/messages.h +++ b/src/ngircd/messages.h @@ -110,11 +110,12 @@ #define ERR_CANNOTSENDTOCHAN_MSG "404 %s %s :Cannot send to channel" #define ERR_TOOMANYCHANNELS_MSG "405 %s %s :You have joined too many channels" #define ERR_WASNOSUCHNICK_MSG "406 %s %s :There was no such nickname" +#define ERR_TOOMANYTARGETS_MSG "407 %s :Too many recipients" #define ERR_NOORIGIN_MSG "409 %s :No origin specified" #define ERR_INVALIDCAP_MSG "410 %s %s :Invalid CAP subcommand" #define ERR_NORECIPIENT_MSG "411 %s :No recipient given (%s)" #define ERR_NOTEXTTOSEND_MSG "412 %s :No text to send" -#define ERR_WILDTOPLEVEL "414 %s :Wildcard in toplevel domain" +#define ERR_WILDTOPLEVEL_MSG "414 %s :Wildcard in toplevel domain" #define ERR_UNKNOWNCOMMAND_MSG "421 %s %s :Unknown command" #define ERR_NOMOTD_MSG "422 %s :MOTD file is missing" #define ERR_NONICKNAMEGIVEN_MSG "431 %s :No nickname given" diff --git a/src/ngircd/ngircd.c b/src/ngircd/ngircd.c index 347c41f..0a62b02 100644 --- a/src/ngircd/ngircd.c +++ b/src/ngircd/ngircd.c @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors. + * Copyright (c)2001-2017 Alexander Barton (alex@barton.de) and Contributors. * * 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 @@ -451,7 +451,7 @@ static void Show_Version( void ) { puts( NGIRCd_Version ); - puts( "Copyright (c)2001-2014 Alexander Barton () and Contributors." ); + puts( "Copyright (c)2001-2017 Alexander Barton () and Contributors." ); puts( "Homepage: \n" ); puts( "This is free software; see the source for copying conditions. There is NO" ); puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." ); diff --git a/src/ngircd/numeric.c b/src/ngircd/numeric.c index 82e0cf0..380b907 100644 --- a/src/ngircd/numeric.c +++ b/src/ngircd/numeric.c @@ -176,6 +176,7 @@ Synchronize_Lists(CLIENT * Client) CHANNEL *c; struct list_head *head; struct list_elem *elem; + time_t t; assert(Client != NULL); @@ -183,9 +184,10 @@ Synchronize_Lists(CLIENT * Client) head = Class_GetList(CLASS_GLINE); elem = Lists_GetFirst(head); while (elem) { + t = Lists_GetValidity(elem) - time(NULL); if (!IRC_WriteStrClient(Client, "GLINE %s %ld :%s", Lists_GetMask(elem), - (long)(Lists_GetValidity(elem) - time(NULL)), + t > 0 ? (long)t : 0, Lists_GetReason(elem))) return DISCONNECTED; elem = Lists_GetNext(elem); diff --git a/src/ngircd/op.c b/src/ngircd/op.c index 4a11355..cd62e12 100644 --- a/src/ngircd/op.c +++ b/src/ngircd/op.c @@ -40,12 +40,14 @@ Op_NoPrivileges(CLIENT * Client, REQUEST * Req) from = Client_Search(Req->prefix); if (from) { - Log(LOG_NOTICE, "No privileges: client \"%s\" (%s), command \"%s\"!", + Log(LOG_ERR|LOG_snotice, + "No privileges: client \"%s\" (%s), command \"%s\"!", Req->prefix, Client_Mask(Client), Req->command); return IRC_WriteErrClient(from, ERR_NOPRIVILEGES_MSG, Client_ID(from)); } else { - Log(LOG_NOTICE, "No privileges: client \"%s\", command \"%s\"!", + Log(LOG_ERR|LOG_snotice, + "No privileges: client \"%s\", command \"%s\"!", Client_Mask(Client), Req->command); return IRC_WriteErrClient(Client, ERR_NOPRIVILEGES_MSG, Client_ID(Client)); diff --git a/src/ngircd/pam.c b/src/ngircd/pam.c index d2a8a54..4e47ddb 100644 --- a/src/ngircd/pam.c +++ b/src/ngircd/pam.c @@ -32,6 +32,7 @@ #include "log.h" #include "conn.h" #include "client.h" +#include "conf.h" #include "pam.h" @@ -101,7 +102,7 @@ PAM_Authenticate(CLIENT *Client) { conv.appdata_ptr = Conn_Password(Client_Conn(Client)); /* Initialize PAM */ - retval = pam_start("ngircd", Client_OrigUser(Client), &conv, &pam); + retval = pam_start(Conf_PAMServiceName, Client_OrigUser(Client), &conv, &pam); if (retval != PAM_SUCCESS) { Log(LOG_ERR, "PAM: Failed to create authenticator! (%d)", retval); return false; diff --git a/src/portab/portab.h b/src/portab/portab.h index 78b6f7e..70d5ed3 100644 --- a/src/portab/portab.h +++ b/src/portab/portab.h @@ -175,6 +175,10 @@ extern int vsnprintf PARAMS(( char *str, size_t count, const char *fmt, va_list # define PACKAGE_VERSION VERSION #endif +#ifndef SYSCONFDIR +# define SYSCONFDIR "/etc" +#endif + #endif /* -eof- */ diff --git a/src/testsuite/Makefile.ng b/src/testsuite/Makefile.ng index d929592..96d37f1 100644 --- a/src/testsuite/Makefile.ng +++ b/src/testsuite/Makefile.ng @@ -21,6 +21,7 @@ EXTRA_DIST = \ join-test.e kick-test.e message-test.e misc-test.e mode-test.e \ opless-channel-test.e server-link-test.e who-test.e whois-test.e \ stress-A.e stress-B.e \ + server-login-test.e \ start-server1 stop-server1 ngircd-test1.conf \ start-server2 stop-server2 ngircd-test2.conf @@ -81,6 +82,10 @@ server-link-test: tests.sh rm -f server-link-test ln -s $(srcdir)/tests.sh server-link-test +server-login-test: tests.sh + rm -f server-login-test + ln -s $(srcdir)/tests.sh server-login-test + who-test: tests.sh rm -f who-test ln -s $(srcdir)/tests.sh who-test @@ -103,6 +108,7 @@ TESTS = start-server1 \ who-test \ whois-test \ server-link-test \ + server-login-test \ stop-server2 \ stress-server.sh \ stop-server1 diff --git a/src/testsuite/message-test.e b/src/testsuite/message-test.e index 5dc325d..9eb22e7 100644 --- a/src/testsuite/message-test.e +++ b/src/testsuite/message-test.e @@ -35,13 +35,24 @@ expect { send "privmsg nick,nick :test\r" expect { timeout { exit 1 } - "@* PRIVMSG nick :test\r*@* PRIVMSG nick :test" + "@* PRIVMSG nick :test" +} + +send "privmsg ,,,, :dummy\r" +send "privmsg ,,,nick,,&server,,, :test\r" +expect { + timeout { exit 1 } + "@* PRIVMSG nick :test" +} +expect { + timeout { exit 1 } + "404" } send "privmsg Nick,#testChannel,nick :test\r" expect { timeout { exit 1 } - "@* PRIVMSG nick :test\r*401*@* PRIVMSG nick :test" + "@* PRIVMSG nick :test\r*401" } send "privmsg doesnotexist :test\r" diff --git a/src/testsuite/ngircd-test1.conf b/src/testsuite/ngircd-test1.conf index 4dec533..5cb7db7 100644 --- a/src/testsuite/ngircd-test1.conf +++ b/src/testsuite/ngircd-test1.conf @@ -29,6 +29,11 @@ MyPassword = pwd1 PeerPassword = pwd2 +[Server] + Name = ngircd.test.server3 + MyPassword = pwd1 + PeerPassword = pwd3 + [Channel] Name = InviteChannel Modes = i diff --git a/src/testsuite/server-login-test.e b/src/testsuite/server-login-test.e new file mode 100644 index 0000000..b5226a7 --- /dev/null +++ b/src/testsuite/server-login-test.e @@ -0,0 +1,94 @@ +# ngIRCd test suite +# server-server login test + +spawn telnet 127.0.0.1 6789 +expect { + timeout { exit 1 } + "Connected" +} + +# Register server +send "PASS pwd1 0210-IRC+ ngIRCd|testsuite0:CHLMSX P\r" +send "SERVER ngircd.test.server3 :Testsuite Server Emulation\r" +expect { + timeout { exit 1 } + ":ngircd.test.server PASS pwd3 0210-IRC+ ngIRCd|" +} +expect { + timeout { exit 1 } + ":ngircd.test.server SERVER ngircd.test.server 1 :" +} +expect { + timeout { exit 1 } + ":ngircd.test.server 005 " +} +expect { + timeout { exit 1 } + ":ngircd.test.server 376 " +} + +# End of handshake +send ":ngircd.test.server3 376 ngircd.test.server :End of MOTD command\r" + +# Receive existing channels +expect { + timeout { exit 1 } + ":ngircd.test.server CHANINFO +ModelessChannel +P :A modeless Channel" +} +expect { + timeout { exit 1 } + ":ngircd.test.server CHANINFO #SecretChannel +Ps :A secret Channel" +} +expect { + timeout { exit 1 } + ":ngircd.test.server CHANINFO #TopicChannel +Pt :the topic" +} +expect { + timeout { exit 1 } + ":ngircd.test.server CHANINFO #FullKeyed +Plk Secret 0 :" +} +expect { + timeout { exit 1 } + ":ngircd.test.server CHANINFO #InviteChannel +Pi" +} +expect { + timeout { exit 1 } + ":ngircd.test.server PING :ngircd.test.server" +} + +# Emulate network burst +send ":ngircd.test.server3 NICK NickName 1 ~User localhost 1 + :Real Name\r" +send ":ngircd.test.server3 NJOIN #Channel :@NickName\r" + +# End of burst +send ":ngircd.test.server3 PONG :ngircd.test.server\r" + +# Test server-server link ... +send ":ngircd.test.server3 VERSION\r" +expect { + timeout { exit 1 } + ":ngircd.test.server 351 ngircd.test.server3 " +} + +# Make sure our test client is still known in the network +send ":ngircd.test.server3 WHOIS NickName\r" +expect { + timeout { exit 1 } + ":ngircd.test.server 311 ngircd.test.server3 NickName ~User localhost * :Real Name" +} +expect { + timeout { exit 1 } + ":ngircd.test.server 319 ngircd.test.server3 NickName :@#Channel" +} + +expect { + timeout { exit 1 } + ":ngircd.test.server 318 ngircd.test.server3 NickName :" +} + +# Logout +send ":ngircd.test.server3 QUIT\r" +expect { + timeout { exit 1 } + "ERROR :Closing connection" +}