Browse Source

Import upstream version 24

Alexander Barton 7 years ago
parent
commit
a1970979f7
60 changed files with 1009 additions and 422 deletions
  1. 5 4
      AUTHORS
  2. 77 1
      ChangeLog
  3. 1 1
      INSTALL
  4. 39 1
      NEWS
  5. 31 35
      README
  6. 19 18
      autogen.sh
  7. 108 66
      config.guess
  8. 52 21
      config.sub
  9. 24 24
      configure
  10. 2 2
      configure.ac
  11. 2 2
      configure.ng
  12. 3 2
      contrib/Debian/Makefile.am
  13. 3 2
      contrib/Debian/Makefile.in
  14. 18 0
      contrib/Debian/changelog
  15. 1 1
      contrib/Debian/compat
  16. 5 4
      contrib/Debian/control
  17. 1 1
      contrib/Debian/ngircd.postinst
  18. 19 8
      contrib/Debian/rules
  19. 1 0
      contrib/Debian/source/format
  20. 34 1
      contrib/MacOSX/ngIRCd.xcodeproj/project.pbxproj
  21. 5 5
      contrib/ngindent
  22. 0 0
      contrib/ngircd-bsd.sh
  23. 0 0
      contrib/ngircd-redhat.init
  24. 26 5
      contrib/ngircd.service
  25. 1 0
      contrib/ngircd.socket
  26. 2 2
      contrib/ngircd.spec
  27. 71 24
      contrib/platformtest.sh
  28. 1 1
      doc/Commands.txt
  29. 2 3
      doc/HowToRelease.txt
  30. 8 4
      doc/Modes.txt
  31. 4 0
      doc/PAM.txt
  32. 29 20
      doc/Platforms.txt
  33. 6 6
      doc/RFC.txt
  34. 9 0
      doc/sample-ngircd.conf.tmpl
  35. 1 1
      man/ngircd.8.tmpl
  36. 10 2
      man/ngircd.conf.5.tmpl
  37. 2 2
      src/config.h.in
  38. 8 0
      src/ngircd/conf.c
  39. 3 0
      src/ngircd/conf.h
  40. 2 0
      src/ngircd/conn-ssl.c
  41. 45 64
      src/ngircd/conn.c
  42. 6 0
      src/ngircd/defines.h
  43. 6 6
      src/ngircd/irc-info.c
  44. 11 2
      src/ngircd/irc-oper.c
  45. 79 48
      src/ngircd/irc-server.c
  46. 2 2
      src/ngircd/irc-write.c
  47. 76 20
      src/ngircd/irc.c
  48. 2 2
      src/ngircd/lists.c
  49. 2 1
      src/ngircd/messages.h
  50. 2 2
      src/ngircd/ngircd.c
  51. 3 1
      src/ngircd/numeric.c
  52. 4 2
      src/ngircd/op.c
  53. 2 1
      src/ngircd/pam.c
  54. 4 0
      src/portab/portab.h
  55. 6 0
      src/testsuite/Makefile.am
  56. 6 0
      src/testsuite/Makefile.in
  57. 6 0
      src/testsuite/Makefile.ng
  58. 13 2
      src/testsuite/message-test.e
  59. 5 0
      src/testsuite/ngircd-test1.conf
  60. 94 0
      src/testsuite/server-login-test.e

+ 5 - 4
AUTHORS

@@ -2,7 +2,7 @@
                      ngIRCd - Next Generation IRC Server
                      ngIRCd - Next Generation IRC Server
                            http://ngircd.barton.de/
                            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
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
                    terms of the GNU General Public License.
 
 
@@ -33,10 +33,11 @@ Brandon Beresini <beresini@google.com>
 Brett Smith <brett@w3.org>
 Brett Smith <brett@w3.org>
 Brian Collins <bricollins@gmail.com>
 Brian Collins <bricollins@gmail.com>
 Bryan Caldwell <bcaldwel@ucsd.edu>
 Bryan Caldwell <bcaldwel@ucsd.edu>
+Christian Aistleitner <christian@quelltextlich.at>
 Christoph Biedl <ngircd.anoy@manchmal.in-ulm.de>
 Christoph Biedl <ngircd.anoy@manchmal.in-ulm.de>
-DNS <dns@rbose.org>
 Dana Dahlstrom <dana+ngIRCd@cs.ucsd.edu>
 Dana Dahlstrom <dana+ngIRCd@cs.ucsd.edu>
 David Kingston <deathking1337@aim.com>
 David Kingston <deathking1337@aim.com>
+DNS <dns@rbose.org>
 Eric Grunow <egrunow@ucsd.edu>
 Eric Grunow <egrunow@ucsd.edu>
 Federico G. Schwindt <fgsch@lodoss.net>
 Federico G. Schwindt <fgsch@lodoss.net>
 Gabor Adam Toth <tg@tgbit.net>
 Gabor Adam Toth <tg@tgbit.net>
@@ -63,6 +64,6 @@ xor <xorboy@gmail.com>
 
 
 Code snippets
 Code snippets
 ~~~~~~~~~~~~~
 ~~~~~~~~~~~~~
-J. Kercheval: pattern matching functions
-Patrick Powell <papowell@astart.com>: snprintf()-function
 Andrew Tridgell & Martin Pool: strl{cpy|cat}()-functions
 Andrew Tridgell & Martin Pool: strl{cpy|cat}()-functions
+John Kercheval: pattern matching functions
+Patrick Powell <papowell@astart.com>: snprintf()-function

+ 77 - 1
ChangeLog

@@ -2,13 +2,89 @@
                      ngIRCd - Next Generation IRC Server
                      ngIRCd - Next Generation IRC Server
                            http://ngircd.barton.de/
                            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
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
                    terms of the GNU General Public License.
 
 
                                -- ChangeLog --
                                -- 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
+    <ngircd.anoy@manchmal.in-ulm.de> 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 <christian@quelltextlich.at> 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)
 ngIRCd 23 (2015-11-16)
 
 
   - Explicitly cast time_t to long when printing it out: this prevents
   - Explicitly cast time_t to long when printing it out: this prevents

+ 1 - 1
INSTALL

@@ -2,7 +2,7 @@
                      ngIRCd - Next Generation IRC Server
                      ngIRCd - Next Generation IRC Server
                            http://ngircd.barton.de/
                            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
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
                    terms of the GNU General Public License.
 
 

+ 39 - 1
NEWS

@@ -2,13 +2,51 @@
                      ngIRCd - Next Generation IRC Server
                      ngIRCd - Next Generation IRC Server
                            http://ngircd.barton.de/
                            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
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
                    terms of the GNU General Public License.
 
 
                                   -- NEWS --
                                   -- 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 <christian@quelltextlich.at> 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 (2015-11-16)
 
 
   ngIRCd 23~rc1 (2015-09-06)
   ngIRCd 23~rc1 (2015-09-06)

+ 31 - 35
README

@@ -2,7 +2,7 @@
                      ngIRCd - Next Generation IRC Server
                      ngIRCd - Next Generation IRC Server
                            http://ngircd.barton.de/
                            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
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
                    terms of the GNU General Public License.
 
 
@@ -28,31 +28,26 @@ Please see the INSTALL document for installation and upgrade information!
 II. Status
 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
 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
 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?)
 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.
   IRIX, Linux, Mac OS X, NetBSD, OpenBSD, Solaris, and Windows with Cygwin.
 - ngIRCd is being actively developed since 2001.
 - 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
 More documentation can be found in the "doc/" directory and the homepage of
-the ngIRCd: <http://ngircd.barton.de/>.
+ngIRCd: <http://ngircd.barton.de/>.
 
 
 
 
 V. Download
 V. Download
 ~~~~~~~~~~~
 ~~~~~~~~~~~
 
 
-The homepage of the ngIRCd is: <http://ngircd.barton.de/>; you will find
+The homepage of the ngIRCd is <http://ngircd.barton.de/>; you will find
 the newest information about the ngIRCd and the most recent ("stable")
 the newest information about the ngIRCd and the most recent ("stable")
 releases there.
 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: <http://git-scm.com/>).
+Visit our source code repository at GitHub if you are interested in the
+latest development version: <https://github.com/ngircd/ngircd>.
 
 
 
 
-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:
 
 
-<https://github.com/ngircd/ngircd/issues>
+- On IRC: <irc://irc.barton.de/ngircd>
+- Via the mailing list: <ngircd-ml@ngircd.barton.de>
 
 
-There you can read about known bugs and limitations, too.
+See <http://ngircd.barton.de/support.php> for details.
 
 
-If you have comments, patches or something else, please feel free to post
-a mail to the ngIRCd mailing list: <ngircd-ml@ngircd.barton.de> (please see
-<http://ngircd.barton.de/support.php> for details) or join the ngIRCd IRC
-channel: <irc://irc.barton.de/ngircd>.
+If you find bugs in ngIRCd (which will be there most probably ...), please
+report them to our issue tracker at GitHub:
+
+- Bug tracker: <https://github.com/ngircd/ngircd/issues>
+- Patches, "pull requests": <https://github.com/ngircd/ngircd/pulls>
+
+There you can read about known bugs and limitations, too.

+ 19 - 18
autogen.sh

@@ -1,7 +1,7 @@
 #!/bin/sh
 #!/bin/sh
 #
 #
 # ngIRCd -- The Next Generation IRC Daemon
 # 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
 # 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
 # it under the terms of the GNU General Public License as published by
@@ -95,7 +95,7 @@ Search()
 				return 0
 				return 0
 			fi
 			fi
 		done
 		done
-		minor=`expr $minor - 1`
+		minor=$(expr $minor - 1)
 	done
 	done
 	return 1
 	return 1
 }
 }
@@ -139,26 +139,26 @@ fi
 # Try to detect the needed tools when no environment variable already
 # Try to detect the needed tools when no environment variable already
 # specifies one:
 # specifies one:
 echo "Searching for required tools ..."
 echo "Searching for required tools ..."
-[ -z "$ACLOCAL" ] && ACLOCAL=`Search aclocal 1`
+[ -z "$ACLOCAL" ] && ACLOCAL=$(Search aclocal 1)
 [ "$VERBOSE" = "1" ] && echo " - ACLOCAL=$ACLOCAL"
 [ "$VERBOSE" = "1" ] && echo " - ACLOCAL=$ACLOCAL"
-[ -z "$AUTOHEADER" ] && AUTOHEADER=`Search autoheader 2`
+[ -z "$AUTOHEADER" ] && AUTOHEADER=$(Search autoheader 2)
 [ "$VERBOSE" = "1" ] && echo " - AUTOHEADER=$AUTOHEADER"
 [ "$VERBOSE" = "1" ] && echo " - AUTOHEADER=$AUTOHEADER"
-[ -z "$AUTOMAKE" ] && AUTOMAKE=`Search automake 1`
+[ -z "$AUTOMAKE" ] && AUTOMAKE=$(Search automake 1)
 [ "$VERBOSE" = "1" ] && echo " - AUTOMAKE=$AUTOMAKE"
 [ "$VERBOSE" = "1" ] && echo " - AUTOMAKE=$AUTOMAKE"
-[ -z "$AUTOCONF" ] && AUTOCONF=`Search autoconf 2`
+[ -z "$AUTOCONF" ] && AUTOCONF=$(Search autoconf 2)
 [ "$VERBOSE" = "1" ] && echo " - AUTOCONF=$AUTOCONF"
 [ "$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
 	&& export AUTOCONF_VERSION || unset AUTOCONF_VERSION
 [ "$VERBOSE" = "1" ] && echo " - AUTOCONF_VERSION=$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
 	&& export AUTOMAKE_VERSION || unset AUTOMAKE_VERSION
 [ "$VERBOSE" = "1" ] && echo " - AUTOMAKE_VERSION=$AUTOMAKE_VERSION"
 [ "$VERBOSE" = "1" ] && echo " - AUTOMAKE_VERSION=$AUTOMAKE_VERSION"
 
 
 [ $# -gt 0 ] && CONFIGURE_ARGS=" $*" || CONFIGURE_ARGS=""
 [ $# -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
 # Verify that all tools have been found
 [ -z "$ACLOCAL" ] && Notfound aclocal
 [ -z "$ACLOCAL" ] && Notfound aclocal
@@ -166,15 +166,15 @@ AUTOMAKE_VERSION=`echo $AUTOMAKE | cut -d'-' -f2-`
 [ -z "$AUTOMAKE" ] && Notfound automake
 [ -z "$AUTOMAKE" ] && Notfound automake
 [ -z "$AUTOCONF" ] && Notfound autoconf
 [ -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
 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 ..."
 echo "Detected automake $AM_VERSION ..."
 
 
 AM_MAKEFILES="src/ipaddr/Makefile.ng src/ngircd/Makefile.ng src/testsuite/Makefile.ng src/tool/Makefile.ng"
 AM_MAKEFILES="src/ipaddr/Makefile.ng src/ngircd/Makefile.ng src/testsuite/Makefile.ng src/tool/Makefile.ng"
 
 
 # De-ANSI-fication?
 # 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
 	# automake < 1.12 => automatic de-ANSI-fication support available
 	echo " - Enabling de-ANSI-fication support."
 	echo " - Enabling de-ANSI-fication support."
 	sed -e "s|^__ng_PROTOTYPES__|AM_C_PROTOTYPES|g" configure.ng >configure.ac
 	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)"
 	DEANSI_END=" (disabled by ./autogen.sh script)"
 fi
 fi
 # Serial test harness?
 # 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"
 	# automake >= 1.13 => enforce "serial test harness"
 	echo " - Enforcing serial test harness."
 	echo " - Enforcing serial test harness."
 	SERIAL_TESTS="serial-tests"
 	SERIAL_TESTS="serial-tests"
 else
 else
 	# automake < 1.13 => no new test harness, nothing to do
 	# automake < 1.13 => no new test harness, nothing to do
+	# shellcheck disable=SC2034
 	SERIAL_TEST=""
 	SERIAL_TEST=""
 fi
 fi
 
 
 sed -e "s|^__ng_Makefile_am_template__|AUTOMAKE_OPTIONS = ${SERIAL_TESTS} ${DEANSI_START}ansi2knr${DEANSI_END}|g" \
 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
 	src/portab/Makefile.ng >src/portab/Makefile.am
 for makefile_ng in $AM_MAKEFILES; do
 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" \
 	sed -e "s|^__ng_Makefile_am_template__|AUTOMAKE_OPTIONS = ${SERIAL_TESTS} ${DEANSI_START}../portab/ansi2knr${DEANSI_END}|g" \
 		$makefile_ng >$makefile_am
 		$makefile_ng >$makefile_am
 done
 done
@@ -214,10 +215,10 @@ Run $ACLOCAL && \
 	Run $AUTOHEADER && \
 	Run $AUTOHEADER && \
 	Run $AUTOMAKE --add-missing --no-force
 	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
 	# Success: if we got some parameters we call ./configure and pass
 	# all of them to it.
 	# 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
 	if [ "$GO" = "1" ]; then
 		[ -n "$PREFIX" ] && p=" --prefix=$PREFIX" || p=""
 		[ -n "$PREFIX" ] && p=" --prefix=$PREFIX" || p=""
 		c="./configure${p}${CONFIGURE_ARGS}"
 		c="./configure${p}${CONFIGURE_ARGS}"

+ 108 - 66
config.guess

@@ -1,8 +1,8 @@
 #! /bin/sh
 #! /bin/sh
 # Attempt to guess a canonical system name.
 # 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
 # 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
 # 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
 # program.  This Exception is an additional permission under section 7
 # of the GNU General Public License, version 3 ("GPLv3").
 # 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:
 # 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 <config-patches@gnu.org>.
 
 
 
 
 me=`echo "$0" | sed -e 's,.*/,,'`
 me=`echo "$0" | sed -e 's,.*/,,'`
@@ -50,7 +50,7 @@ version="\
 GNU config.guess ($timestamp)
 GNU config.guess ($timestamp)
 
 
 Originally written by Per Bothner.
 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
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
 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
 	# Note: NetBSD doesn't particularly care about the vendor
 	# portion of the name.  We always set it to "unknown".
 	# portion of the name.  We always set it to "unknown".
 	sysctl="sysctl -n hw.machine_arch"
 	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
 	case "${UNAME_MACHINE_ARCH}" in
 	    armeb) machine=armeb-unknown ;;
 	    armeb) machine=armeb-unknown ;;
 	    arm*) machine=arm-unknown ;;
 	    arm*) machine=arm-unknown ;;
 	    sh3el) machine=shl-unknown ;;
 	    sh3el) machine=shl-unknown ;;
 	    sh3eb) machine=sh-unknown ;;
 	    sh3eb) machine=sh-unknown ;;
 	    sh5el) machine=sh5le-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 ;;
 	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
 	esac
 	esac
 	# The Operating System including object format, if it has switched
 	# 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
 	case "${UNAME_MACHINE_ARCH}" in
+	    earm*)
+		os=netbsdelf
+		;;
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
 		eval $set_cc_for_build
 		eval $set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
 		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
 		os=netbsd
 		;;
 		;;
 	esac
 	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
 	# The OS release
 	# Debian GNU/NetBSD machines have a different userland, and
 	# Debian GNU/NetBSD machines have a different userland, and
 	# thus, need a distinct triplet. However, they do not need
 	# 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='-gnu'
 		;;
 		;;
 	    *)
 	    *)
-		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
 		;;
 		;;
 	esac
 	esac
 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
 	# contains redundant information, the shorter form:
 	# contains redundant information, the shorter form:
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-	echo "${machine}-${os}${release}"
+	echo "${machine}-${os}${release}${abi}"
 	exit ;;
 	exit ;;
     *:Bitrig:*:*)
     *:Bitrig:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/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.//'`
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
 	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
 	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
 	exit ;;
 	exit ;;
+    *:LibertyBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
+	exit ;;
     *:ekkoBSD:*:*)
     *:ekkoBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
 	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
 	exit ;;
 	exit ;;
@@ -235,6 +256,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:MirBSD:*:*)
     *:MirBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
 	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
 	exit ;;
 	exit ;;
+    *:Sortix:*:*)
+	echo ${UNAME_MACHINE}-unknown-sortix
+	exit ;;
     alpha:OSF1:*:*)
     alpha:OSF1:*:*)
 	case $UNAME_RELEASE in
 	case $UNAME_RELEASE in
 	*4.0)
 	*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`
 	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
 	case "$ALPHA_CPU_TYPE" in
 	case "$ALPHA_CPU_TYPE" in
 	    "EV4 (21064)")
 	    "EV4 (21064)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "EV4.5 (21064)")
 	    "EV4.5 (21064)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "LCA4 (21066/21068)")
 	    "LCA4 (21066/21068)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "EV5 (21164)")
 	    "EV5 (21164)")
-		UNAME_MACHINE="alphaev5" ;;
+		UNAME_MACHINE=alphaev5 ;;
 	    "EV5.6 (21164A)")
 	    "EV5.6 (21164A)")
-		UNAME_MACHINE="alphaev56" ;;
+		UNAME_MACHINE=alphaev56 ;;
 	    "EV5.6 (21164PC)")
 	    "EV5.6 (21164PC)")
-		UNAME_MACHINE="alphapca56" ;;
+		UNAME_MACHINE=alphapca56 ;;
 	    "EV5.7 (21164PC)")
 	    "EV5.7 (21164PC)")
-		UNAME_MACHINE="alphapca57" ;;
+		UNAME_MACHINE=alphapca57 ;;
 	    "EV6 (21264)")
 	    "EV6 (21264)")
-		UNAME_MACHINE="alphaev6" ;;
+		UNAME_MACHINE=alphaev6 ;;
 	    "EV6.7 (21264A)")
 	    "EV6.7 (21264A)")
-		UNAME_MACHINE="alphaev67" ;;
+		UNAME_MACHINE=alphaev67 ;;
 	    "EV6.8CB (21264C)")
 	    "EV6.8CB (21264C)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.8AL (21264B)")
 	    "EV6.8AL (21264B)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.8CX (21264D)")
 	    "EV6.8CX (21264D)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.9A (21264/EV69A)")
 	    "EV6.9A (21264/EV69A)")
-		UNAME_MACHINE="alphaev69" ;;
+		UNAME_MACHINE=alphaev69 ;;
 	    "EV7 (21364)")
 	    "EV7 (21364)")
-		UNAME_MACHINE="alphaev7" ;;
+		UNAME_MACHINE=alphaev7 ;;
 	    "EV7.9 (21364A)")
 	    "EV7.9 (21364A)")
-		UNAME_MACHINE="alphaev79" ;;
+		UNAME_MACHINE=alphaev79 ;;
 	esac
 	esac
 	# A Pn.n version is a patched version.
 	# A Pn.n version is a patched version.
 	# A Vn.n version is a released version.
 	# A Vn.n version is a released version.
 	# A Tn.n version is a released field test version.
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
 	# 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.
 	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
 	exitcode=$?
 	exitcode=$?
 	trap '' 0
 	trap '' 0
@@ -359,16 +383,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	exit ;;
 	exit ;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
 	eval $set_cc_for_build
 	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.
 	# 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.
 	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
 	# This test works for both compilers.
 	# 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') | \
 	    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
 		grep IS_64BIT_ARCH >/dev/null
 	    then
 	    then
-		SUN_ARCH="x86_64"
+		SUN_ARCH=x86_64
 	    fi
 	    fi
 	fi
 	fi
 	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	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 ;;
 	exit ;;
     sun*:*:4.2BSD:*)
     sun*:*:4.2BSD:*)
 	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
 	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
 	case "`/bin/arch`" in
 	    sun3)
 	    sun3)
 		echo m68k-sun-sunos${UNAME_RELEASE}
 		echo m68k-sun-sunos${UNAME_RELEASE}
@@ -579,8 +603,9 @@ EOF
 	else
 	else
 		IBM_ARCH=powerpc
 		IBM_ARCH=powerpc
 	fi
 	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
 	else
 		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
 		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
 	fi
 	fi
@@ -617,13 +642,13 @@ EOF
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
 		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
 		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
 		    case "${sc_cpu_version}" in
 		    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
 		      532)                      # CPU_PA_RISC2_0
 			case "${sc_kernel_bits}" in
 			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 ;;
 		    esac
 		    esac
 		fi
 		fi
@@ -662,11 +687,11 @@ EOF
 		    exit (0);
 		    exit (0);
 		}
 		}
 EOF
 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
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
 		fi ;;
 		fi ;;
 	esac
 	esac
-	if [ ${HP_ARCH} = "hppa2.0w" ]
+	if [ ${HP_ARCH} = hppa2.0w ]
 	then
 	then
 	    eval $set_cc_for_build
 	    eval $set_cc_for_build
 
 
@@ -679,12 +704,12 @@ EOF
 	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
 	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
 	    # => hppa64-hp-hpux11.23
 	    # => 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__
 		grep -q __LP64__
 	    then
 	    then
-		HP_ARCH="hppa2.0w"
+		HP_ARCH=hppa2.0w
 	    else
 	    else
-		HP_ARCH="hppa64"
+		HP_ARCH=hppa64
 	    fi
 	    fi
 	fi
 	fi
 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
@@ -789,14 +814,14 @@ EOF
 	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
 	exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
     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/ /_/'`
 	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
 	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
 	exit ;;
     5000:UNIX_System_V:4.*:*)
     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}"
 	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
 	exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
@@ -878,7 +903,7 @@ EOF
 	exit ;;
 	exit ;;
     *:GNU/*:*:*)
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
 	# 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 ;;
 	exit ;;
     i*86:Minix:*:*)
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	echo ${UNAME_MACHINE}-pc-minix
@@ -901,7 +926,7 @@ EOF
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
 	esac
 	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
 	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}
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
 	exit ;;
     arc:Linux:*:* | arceb:Linux:*:*)
     arc:Linux:*:* | arceb:Linux:*:*)
@@ -932,6 +957,9 @@ EOF
     crisv32:Linux:*:*)
     crisv32:Linux:*:*)
 	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	exit ;;
 	exit ;;
+    e2k:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     frv:Linux:*:*)
     frv:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
 	exit ;;
@@ -944,6 +972,9 @@ EOF
     ia64:Linux:*:*)
     ia64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
 	exit ;;
+    k1om:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     m32r*:Linux:*:*)
     m32r*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
 	exit ;;
@@ -969,6 +1000,9 @@ EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
 	;;
 	;;
+    mips64el:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     openrisc*:Linux:*:*)
     openrisc*:Linux:*:*)
 	echo or1k-unknown-linux-${LIBC}
 	echo or1k-unknown-linux-${LIBC}
 	exit ;;
 	exit ;;
@@ -1001,6 +1035,9 @@ EOF
     ppcle:Linux:*:*)
     ppcle:Linux:*:*)
 	echo powerpcle-unknown-linux-${LIBC}
 	echo powerpcle-unknown-linux-${LIBC}
 	exit ;;
 	exit ;;
+    riscv32:Linux:*:* | riscv64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
     s390:Linux:*:* | s390x:Linux:*:*)
 	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
 	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
 	exit ;;
 	exit ;;
@@ -1020,7 +1057,7 @@ EOF
 	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
 	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
 	exit ;;
 	exit ;;
     x86_64:Linux:*:*)
     x86_64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
 	exit ;;
 	exit ;;
     xtensa*:Linux:*:*)
     xtensa*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
@@ -1099,7 +1136,7 @@ EOF
 	# uname -m prints for DJGPP always 'pc', but it prints nothing about
 	# uname -m prints for DJGPP always 'pc', but it prints nothing about
 	# the processor, so we play safe by assuming i586.
 	# the processor, so we play safe by assuming i586.
 	# Note: whatever this is, it MUST be the same as what config.sub
 	# 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.
 	# this is a cross-build.
 	echo i586-pc-msdosdjgpp
 	echo i586-pc-msdosdjgpp
 	exit ;;
 	exit ;;
@@ -1248,6 +1285,9 @@ EOF
     SX-8R:SUPER-UX:*:*)
     SX-8R:SUPER-UX:*:*)
 	echo sx8r-nec-superux${UNAME_RELEASE}
 	echo sx8r-nec-superux${UNAME_RELEASE}
 	exit ;;
 	exit ;;
+    SX-ACE:SUPER-UX:*:*)
+	echo sxace-nec-superux${UNAME_RELEASE}
+	exit ;;
     Power*:Rhapsody:*:*)
     Power*:Rhapsody:*:*)
 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
 	exit ;;
 	exit ;;
@@ -1261,9 +1301,9 @@ EOF
 	    UNAME_PROCESSOR=powerpc
 	    UNAME_PROCESSOR=powerpc
 	fi
 	fi
 	if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
 	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') | \
 		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
 		    grep IS_64BIT_ARCH >/dev/null
 		then
 		then
 		    case $UNAME_PROCESSOR in
 		    case $UNAME_PROCESSOR in
@@ -1285,7 +1325,7 @@ EOF
 	exit ;;
 	exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
 	UNAME_PROCESSOR=`uname -p`
 	UNAME_PROCESSOR=`uname -p`
-	if test "$UNAME_PROCESSOR" = "x86"; then
+	if test "$UNAME_PROCESSOR" = x86; then
 		UNAME_PROCESSOR=i386
 		UNAME_PROCESSOR=i386
 		UNAME_MACHINE=pc
 		UNAME_MACHINE=pc
 	fi
 	fi
@@ -1316,7 +1356,7 @@ EOF
 	# "uname -m" is not consistent, so use $cputype instead. 386
 	# "uname -m" is not consistent, so use $cputype instead. 386
 	# is converted to i386 for consistency with other x86
 	# is converted to i386 for consistency with other x86
 	# operating systems.
 	# operating systems.
-	if test "$cputype" = "386"; then
+	if test "$cputype" = 386; then
 	    UNAME_MACHINE=i386
 	    UNAME_MACHINE=i386
 	else
 	else
 	    UNAME_MACHINE="$cputype"
 	    UNAME_MACHINE="$cputype"
@@ -1358,7 +1398,7 @@ EOF
 	echo i386-pc-xenix
 	echo i386-pc-xenix
 	exit ;;
 	exit ;;
     i*86:skyos:*:*)
     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 ;;
 	exit ;;
     i*86:rdos:*:*)
     i*86:rdos:*:*)
 	echo ${UNAME_MACHINE}-pc-rdos
 	echo ${UNAME_MACHINE}-pc-rdos
@@ -1369,23 +1409,25 @@ EOF
     x86_64:VMkernel:*:*)
     x86_64:VMkernel:*:*)
 	echo ${UNAME_MACHINE}-unknown-esx
 	echo ${UNAME_MACHINE}-unknown-esx
 	exit ;;
 	exit ;;
+    amd64:Isilon\ OneFS:*:*)
+	echo x86_64-unknown-onefs
+	exit ;;
 esac
 esac
 
 
 cat >&2 <<EOF
 cat >&2 <<EOF
 $0: unable to guess system type
 $0: unable to guess system type
 
 
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
+This script (version $timestamp), has failed to recognize the
+operating system you are using. If your script is old, overwrite
+config.guess and config.sub with the latest versions 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
 and
 and
-  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
 
 
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> 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
 config.guess timestamp = $timestamp
 
 

+ 52 - 21
config.sub

@@ -1,8 +1,8 @@
 #! /bin/sh
 #! /bin/sh
 # Configuration validation subroutine script.
 # 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
 # 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
 # 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").
 # 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 <config-patches@gnu.org>.
 #
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
 # 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.
 # Otherwise, we print the canonical config type on stdout and succeed.
 
 
 # You can get the latest version of this script from:
 # 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
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
 # and recognize all the CPU types, system types and aliases
@@ -53,8 +53,7 @@ timestamp='2014-05-01'
 me=`echo "$0" | sed -e 's,.*/,,'`
 me=`echo "$0" | sed -e 's,.*/,,'`
 
 
 usage="\
 usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
-       $0 [OPTION] ALIAS
+Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
 
 
 Canonicalize a configuration name.
 Canonicalize a configuration name.
 
 
@@ -68,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
 version="\
 version="\
 GNU config.sub ($timestamp)
 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
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
 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
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
   linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
   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*)
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -255,12 +254,13 @@ case $basic_machine in
 	| arc | arceb \
 	| arc | arceb \
 	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
 	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
 	| avr | avr32 \
 	| avr | avr32 \
+	| ba \
 	| be32 | be64 \
 	| be32 | be64 \
 	| bfin \
 	| bfin \
 	| c4x | c8051 | clipper \
 	| c4x | c8051 | clipper \
 	| d10v | d30v | dlx | dsp16xx \
 	| 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 \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| hexagon \
 	| hexagon \
 	| i370 | i860 | i960 | ia64 \
 	| i370 | i860 | i960 | ia64 \
@@ -301,10 +301,12 @@ case $basic_machine in
 	| open8 | or1k | or1knd | or32 \
 	| open8 | or1k | or1knd | or32 \
 	| pdp10 | pdp11 | pj | pjl \
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle \
 	| powerpc | powerpc64 | powerpc64le | powerpcle \
+	| pru \
 	| pyramid \
 	| pyramid \
+	| riscv32 | riscv64 \
 	| rl78 | rx \
 	| rl78 | rx \
 	| score \
 	| 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 \
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@@ -312,6 +314,7 @@ case $basic_machine in
 	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
 	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
 	| ubicom32 \
 	| ubicom32 \
 	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
 	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+	| visium \
 	| we32k \
 	| we32k \
 	| x86 | xc16x | xstormy16 | xtensa \
 	| x86 | xc16x | xstormy16 | xtensa \
 	| z8k | z80)
 	| z8k | z80)
@@ -326,6 +329,9 @@ case $basic_machine in
 	c6x)
 	c6x)
 		basic_machine=tic6x-unknown
 		basic_machine=tic6x-unknown
 		;;
 		;;
+	leon|leon[3-9])
+		basic_machine=sparc-$basic_machine
+		;;
 	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
 	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
 		basic_machine=$basic_machine-unknown
 		basic_machine=$basic_machine-unknown
 		os=-none
 		os=-none
@@ -371,12 +377,13 @@ case $basic_machine in
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* | avr32-* \
 	| avr-* | avr32-* \
+	| ba-* \
 	| be32-* | be64-* \
 	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
 	| bfin-* | bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* \
 	| c8051-* | clipper-* | craynv-* | cydra-* \
 	| c8051-* | clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| d10v-* | d30v-* | dlx-* \
-	| elxsi-* \
+	| e2k-* | elxsi-* \
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
@@ -422,13 +429,15 @@ case $basic_machine in
 	| orion-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+	| pru-* \
 	| pyramid-* \
 	| pyramid-* \
+	| riscv32-* | riscv64-* \
 	| rl78-* | romp-* | rs6000-* | rx-* \
 	| rl78-* | romp-* | rs6000-* | rx-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
 	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
 	| tahoe-* \
 	| tahoe-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
 	| tile*-* \
 	| tile*-* \
@@ -436,6 +445,7 @@ case $basic_machine in
 	| ubicom32-* \
 	| ubicom32-* \
 	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
 	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
 	| vax-* \
 	| vax-* \
+	| visium-* \
 	| we32k-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xc16x-* | xps100-* \
 	| x86-* | x86_64-* | xc16x-* | xps100-* \
 	| xstormy16-* | xtensa*-* \
 	| xstormy16-* | xtensa*-* \
@@ -512,6 +522,9 @@ case $basic_machine in
 		basic_machine=i386-pc
 		basic_machine=i386-pc
 		os=-aros
 		os=-aros
 		;;
 		;;
+	asmjs)
+		basic_machine=asmjs-unknown
+		;;
 	aux)
 	aux)
 		basic_machine=m68k-apple
 		basic_machine=m68k-apple
 		os=-aux
 		os=-aux
@@ -632,6 +645,14 @@ case $basic_machine in
 		basic_machine=m68k-bull
 		basic_machine=m68k-bull
 		os=-sysv3
 		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)
 	ebmon29k)
 		basic_machine=a29k-amd
 		basic_machine=a29k-amd
 		os=-ebmon
 		os=-ebmon
@@ -773,6 +794,9 @@ case $basic_machine in
 		basic_machine=m68k-isi
 		basic_machine=m68k-isi
 		os=-sysv
 		os=-sysv
 		;;
 		;;
+	leon-*|leon[3-9]-*)
+		basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
+		;;
 	m68knommu)
 	m68knommu)
 		basic_machine=m68k-unknown
 		basic_machine=m68k-unknown
 		os=-linux
 		os=-linux
@@ -828,6 +852,10 @@ case $basic_machine in
 		basic_machine=powerpc-unknown
 		basic_machine=powerpc-unknown
 		os=-morphos
 		os=-morphos
 		;;
 		;;
+	moxiebox)
+		basic_machine=moxie-unknown
+		os=-moxiebox
+		;;
 	msdos)
 	msdos)
 		basic_machine=i386-pc
 		basic_machine=i386-pc
 		os=-msdos
 		os=-msdos
@@ -1004,7 +1032,7 @@ case $basic_machine in
 	ppc-* | ppcbe-*)
 	ppc-* | ppcbe-*)
 		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
 		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 		;;
-	ppcle | powerpclittle | ppc-le | powerpc-little)
+	ppcle | powerpclittle)
 		basic_machine=powerpcle-unknown
 		basic_machine=powerpcle-unknown
 		;;
 		;;
 	ppcle-* | powerpclittle-*)
 	ppcle-* | powerpclittle-*)
@@ -1014,7 +1042,7 @@ case $basic_machine in
 		;;
 		;;
 	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
 	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 		;;
-	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+	ppc64le | powerpc64little)
 		basic_machine=powerpc64le-unknown
 		basic_machine=powerpc64le-unknown
 		;;
 		;;
 	ppc64le-* | powerpc64little-*)
 	ppc64le-* | powerpc64little-*)
@@ -1360,27 +1388,28 @@ case $os in
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
 	      | -sym* | -kopensolaris* | -plan9* \
 	      | -sym* | -kopensolaris* | -plan9* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-	      | -aos* | -aros* \
+	      | -aos* | -aros* | -cloudabi* | -sortix* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-	      | -bitrig* | -openbsd* | -solidbsd* \
+	      | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* | -cegcc* \
 	      | -chorusos* | -chorusrdb* | -cegcc* \
 	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
 	      | -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* \
 	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
-	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
 	      | -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.
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 		;;
 	-qnx*)
 	-qnx*)
@@ -1512,6 +1541,8 @@ case $os in
 		;;
 		;;
 	-nacl*)
 	-nacl*)
 		;;
 		;;
+	-ios)
+		;;
 	-none)
 	-none)
 		;;
 		;;
 	*)
 	*)

+ 24 - 24
configure

@@ -1,6 +1,6 @@
 #! /bin/sh
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for ngIRCd 23.
+# Generated by GNU Autoconf 2.69 for ngIRCd 24.
 #
 #
 # Report bugs to <ngircd-ml@ngircd.barton.de>.
 # Report bugs to <ngircd-ml@ngircd.barton.de>.
 #
 #
@@ -580,8 +580,8 @@ MAKEFLAGS=
 # Identity of this package.
 # Identity of this package.
 PACKAGE_NAME='ngIRCd'
 PACKAGE_NAME='ngIRCd'
 PACKAGE_TARNAME='ngircd'
 PACKAGE_TARNAME='ngircd'
-PACKAGE_VERSION='23'
-PACKAGE_STRING='ngIRCd 23'
+PACKAGE_VERSION='24'
+PACKAGE_STRING='ngIRCd 24'
 PACKAGE_BUGREPORT='ngircd-ml@ngircd.barton.de'
 PACKAGE_BUGREPORT='ngircd-ml@ngircd.barton.de'
 PACKAGE_URL='http://ngircd.barton.de/'
 PACKAGE_URL='http://ngircd.barton.de/'
 
 
@@ -1300,7 +1300,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
   cat <<_ACEOF
-\`configure' configures ngIRCd 23 to adapt to many kinds of systems.
+\`configure' configures ngIRCd 24 to adapt to many kinds of systems.
 
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
 
@@ -1370,7 +1370,7 @@ fi
 
 
 if test -n "$ac_init_help"; then
 if test -n "$ac_init_help"; then
   case $ac_init_help in
   case $ac_init_help in
-     short | recursive ) echo "Configuration of ngIRCd 23:";;
+     short | recursive ) echo "Configuration of ngIRCd 24:";;
    esac
    esac
   cat <<\_ACEOF
   cat <<\_ACEOF
 
 
@@ -1483,7 +1483,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
 if $ac_init_version; then
   cat <<\_ACEOF
   cat <<\_ACEOF
-ngIRCd configure 23
+ngIRCd configure 24
 generated by GNU Autoconf 2.69
 generated by GNU Autoconf 2.69
 
 
 Copyright (C) 2012 Free Software Foundation, Inc.
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2017,7 +2017,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 running configure, to aid debugging if configure makes a mistake.
 
 
-It was created by ngIRCd $as_me 23, which was
+It was created by ngIRCd $as_me 24, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
 
   $ $0 $@
   $ $0 $@
@@ -2934,7 +2934,7 @@ fi
 
 
 # Define the identity of the package.
 # Define the identity of the package.
  PACKAGE='ngircd'
  PACKAGE='ngircd'
- VERSION='23'
+ VERSION='24'
 
 
 
 
 cat >>confdefs.h <<_ACEOF
 cat >>confdefs.h <<_ACEOF
@@ -6899,9 +6899,9 @@ _ACEOF
 
 
 fi
 fi
 
 
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_library_init in -lssl" >&5
-$as_echo_n "checking for SSL_library_init in -lssl... " >&6; }
-if ${ac_cv_lib_ssl_SSL_library_init+:} false; then :
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_new in -lssl" >&5
+$as_echo_n "checking for SSL_new in -lssl... " >&6; }
+if ${ac_cv_lib_ssl_SSL_new+:} false; then :
   $as_echo_n "(cached) " >&6
   $as_echo_n "(cached) " >&6
 else
 else
   ac_check_lib_save_LIBS=$LIBS
   ac_check_lib_save_LIBS=$LIBS
@@ -6915,27 +6915,27 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C"
 extern "C"
 #endif
 #endif
-char SSL_library_init ();
+char SSL_new ();
 int
 int
 main ()
 main ()
 {
 {
-return SSL_library_init ();
+return SSL_new ();
   ;
   ;
   return 0;
   return 0;
 }
 }
 _ACEOF
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_ssl_SSL_library_init=yes
+  ac_cv_lib_ssl_SSL_new=yes
 else
 else
-  ac_cv_lib_ssl_SSL_library_init=no
+  ac_cv_lib_ssl_SSL_new=no
 fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 LIBS=$ac_check_lib_save_LIBS
 fi
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_library_init" >&5
-$as_echo "$ac_cv_lib_ssl_SSL_library_init" >&6; }
-if test "x$ac_cv_lib_ssl_SSL_library_init" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_new" >&5
+$as_echo "$ac_cv_lib_ssl_SSL_new" >&6; }
+if test "x$ac_cv_lib_ssl_SSL_new" = xyes; then :
   cat >>confdefs.h <<_ACEOF
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBSSL 1
 #define HAVE_LIBSSL 1
 _ACEOF
 _ACEOF
@@ -6944,12 +6944,12 @@ _ACEOF
 
 
 fi
 fi
 
 
-			for ac_func in SSL_library_init
+			for ac_func in SSL_new
 do :
 do :
-  ac_fn_c_check_func "$LINENO" "SSL_library_init" "ac_cv_func_SSL_library_init"
-if test "x$ac_cv_func_SSL_library_init" = xyes; then :
+  ac_fn_c_check_func "$LINENO" "SSL_new" "ac_cv_func_SSL_new"
+if test "x$ac_cv_func_SSL_new" = xyes; then :
   cat >>confdefs.h <<_ACEOF
   cat >>confdefs.h <<_ACEOF
-#define HAVE_SSL_LIBRARY_INIT 1
+#define HAVE_SSL_NEW 1
 _ACEOF
 _ACEOF
  x_ssl_openssl=yes
  x_ssl_openssl=yes
 else
 else
@@ -8098,7 +8098,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 # values after options handling.
 ac_log="
 ac_log="
-This file was extended by ngIRCd $as_me 23, which was
+This file was extended by ngIRCd $as_me 24, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_FILES    = $CONFIG_FILES
@@ -8165,7 +8165,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 ac_cs_version="\\
-ngIRCd config.status 23
+ngIRCd config.status 24
 configured by $0, generated by GNU Autoconf 2.69,
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
   with options \\"\$ac_cs_config\\"
 
 

+ 2 - 2
configure.ac

@@ -418,8 +418,8 @@ AC_ARG_WITH(openssl,
 				LDFLAGS="-L$withval/lib $LDFLAGS"
 				LDFLAGS="-L$withval/lib $LDFLAGS"
 			fi
 			fi
 			AC_CHECK_LIB(crypto, BIO_s_mem)
 			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])
 				AC_MSG_ERROR([Can't enable openssl])
 			)
 			)
 		fi
 		fi

+ 2 - 2
configure.ng

@@ -418,8 +418,8 @@ AC_ARG_WITH(openssl,
 				LDFLAGS="-L$withval/lib $LDFLAGS"
 				LDFLAGS="-L$withval/lib $LDFLAGS"
 			fi
 			fi
 			AC_CHECK_LIB(crypto, BIO_s_mem)
 			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])
 				AC_MSG_ERROR([Can't enable openssl])
 			)
 			)
 		fi
 		fi

+ 3 - 2
contrib/Debian/Makefile.am

@@ -1,6 +1,6 @@
 #
 #
 # ngIRCd -- The Next Generation IRC Daemon
 # 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
 # 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
 # it under the terms of the GNU General Public License as published by
@@ -10,7 +10,8 @@
 #
 #
 
 
 EXTRA_DIST = rules changelog compat control copyright \
 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:
 maintainer-clean-local:
 	rm -f Makefile Makefile.in
 	rm -f Makefile Makefile.in

+ 3 - 2
contrib/Debian/Makefile.in

@@ -17,7 +17,7 @@
 
 
 #
 #
 # ngIRCd -- The Next Generation IRC Daemon
 # 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
 # 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
 # it under the terms of the GNU General Public License as published by
@@ -186,7 +186,8 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 top_srcdir = @top_srcdir@
 EXTRA_DIST = rules changelog compat control copyright \
 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
 
 
 all: all-am
 all: all-am
 
 

+ 18 - 0
contrib/Debian/changelog

@@ -1,3 +1,21 @@
+ngircd (24-0ab1) unstable; urgency=low
+
+  * New "upstream" release: ngIRCd 24.
+
+ -- Alexander Barton <alex@barton.de>  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 <alex@barton.de>  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 <alex@barton.de>  Sat, 07 Jan 2017 18:58:02 +0100
+
 ngircd (23-0ab1) unstable; urgency=low
 ngircd (23-0ab1) unstable; urgency=low
 
 
   * New "upstream" release: ngIRCd 23.
   * New "upstream" release: ngIRCd 23.

+ 1 - 1
contrib/Debian/compat

@@ -1 +1 @@
-4
+9

+ 5 - 4
contrib/Debian/control

@@ -2,14 +2,15 @@ Source: ngircd
 Section: net
 Section: net
 Priority: optional
 Priority: optional
 Maintainer: Alexander Barton <alex@barton.de>
 Maintainer: Alexander Barton <alex@barton.de>
-Build-Depends: debhelper (>> 4.0.0),
+Build-Depends: debhelper (>> 9.0.0),
     autotools-dev,
     autotools-dev,
+    dh-systemd (>= 1.5),
     expect,
     expect,
-    libz-dev,
-    libwrap0-dev,
     libident-dev,
     libident-dev,
-    libgnutls-dev,
     libpam0g-dev,
     libpam0g-dev,
+    libssl-dev,
+    libwrap0-dev,
+    libz-dev,
     telnet | telnet-ssl,
     telnet | telnet-ssl,
 Standards-Version: 3.9.1
 Standards-Version: 3.9.1
 
 

+ 1 - 1
contrib/Debian/ngircd.postinst

@@ -1,7 +1,6 @@
 #!/bin/sh
 #!/bin/sh
 #
 #
 # Debian post-installation script
 # Debian post-installation script
-# $Id: ngircd.postinst,v 1.2 2006/12/26 14:44:40 alex Exp $
 #
 #
 
 
 set -e
 set -e
@@ -12,6 +11,7 @@ case "$1" in
 			# make sure that the configuration file is not
 			# make sure that the configuration file is not
 			# world-readable, it contains passwords!
 			# world-readable, it contains passwords!
 			chmod o= /etc/ngircd/ngircd.conf
 			chmod o= /etc/ngircd/ngircd.conf
+			chgrp irc /etc/ngircd/ngircd.conf
 		fi
 		fi
 		;;
 		;;
 esac
 esac

+ 19 - 8
contrib/Debian/rules

@@ -1,7 +1,7 @@
 #!/usr/bin/make -f
 #!/usr/bin/make -f
 #
 #
 # ngIRCd -- The Next Generation IRC Daemon
 # 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
 # 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
 # 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 \
 	  --mandir=\$${prefix}/share/man \
 	  --docdir=\$${prefix}/share/doc/ngircd-full \
 	  --docdir=\$${prefix}/share/doc/ngircd-full \
 	  --with-syslog --with-zlib \
 	  --with-syslog --with-zlib \
-	  --with-gnutls --with-iconv --with-ident --with-tcp-wrappers \
+	  --with-openssl --with-iconv --with-ident --with-tcp-wrappers \
 	  --with-pam \
 	  --with-pam \
 	  --enable-ipv6
 	  --enable-ipv6
 
 
@@ -70,12 +70,12 @@ configure-ngircd-full-dbg: configure
 	  --docdir=\$${prefix}/share/doc/ngircd-full-dbg \
 	  --docdir=\$${prefix}/share/doc/ngircd-full-dbg \
 	  --enable-debug --enable-sniffer \
 	  --enable-debug --enable-sniffer \
 	  --with-syslog --with-zlib \
 	  --with-syslog --with-zlib \
-	  --with-gnutls --with-iconv --with-ident --with-tcp-wrappers \
+	  --with-openssl --with-iconv --with-ident --with-tcp-wrappers \
 	  --with-pam \
 	  --with-pam \
 	  --enable-ipv6
 	  --enable-ipv6
 
 
 build:
 build:
-	dh_clean -k
+	dh_prep
 
 
 build-ngircd: build-stamp-ngircd
 build-ngircd: build-stamp-ngircd
 build-stamp-ngircd: configure-ngircd
 build-stamp-ngircd: configure-ngircd
@@ -111,12 +111,15 @@ clean:
 	dh_testdir
 	dh_testdir
 	dh_testroot
 	dh_testroot
 	rm -f build-stamp*
 	rm -f build-stamp*
+	rm -f $(CURDIR)/debian/ngircd.service
 	rm -f $(CURDIR)/debian/ngircd-full.default
 	rm -f $(CURDIR)/debian/ngircd-full.default
 	rm -f $(CURDIR)/debian/ngircd-full.init
 	rm -f $(CURDIR)/debian/ngircd-full.init
 	rm -f $(CURDIR)/debian/ngircd-full.postinst
 	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.default
 	rm -f $(CURDIR)/debian/ngircd-full-dbg.postinst
 	rm -f $(CURDIR)/debian/ngircd-full-dbg.postinst
 	rm -f $(CURDIR)/debian/ngircd-full-dbg.init
 	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:
 	# Add here commands to clean up after the build process:
 	[ ! -f Makefile ] || $(MAKE) distclean
 	[ ! -f Makefile ] || $(MAKE) distclean
@@ -140,7 +143,6 @@ install-ngircd: build-ngircd
 	$(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd
 	$(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd
 	rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/INSTALL*
 	rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/INSTALL*
 	rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/COPYING*
 	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 | \
 	cat $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/sample-ngircd.conf | \
 	 sed -e "s|;ServerUID = 65534|ServerUID = irc|g" | \
 	 sed -e "s|;ServerUID = 65534|ServerUID = irc|g" | \
 	 sed -e "s|;ServerGID = 65534|ServerGID = 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
 	$(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/INSTALL*
 	rm $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full/COPYING*
 	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 | \
 	cat $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full/sample-ngircd.conf | \
 	 sed -e "s|;ServerUID = 65534|ServerUID = irc|g" | \
 	 sed -e "s|;ServerUID = 65534|ServerUID = irc|g" | \
 	 sed -e "s|;ServerGID = 65534|ServerGID = 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
 	$(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/INSTALL*
 	rm $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg/COPYING*
 	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 | \
 	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|;ServerUID = 65534|ServerUID = irc|g" | \
 	 sed -e "s|;ServerGID = 65534|ServerGID = irc|g" | \
 	 sed -e "s|;ServerGID = 65534|ServerGID = irc|g" | \
@@ -192,12 +192,18 @@ binary-indep:
 
 
 # Build architecture-dependent files here.
 # Build architecture-dependent files here.
 binary-arch: build install
 binary-arch: build install
+	ln -s $(CURDIR)/contrib/ngircd.service \
+	 $(CURDIR)/debian/ngircd.service
+
 	ln -s $(CURDIR)/debian/ngircd.default \
 	ln -s $(CURDIR)/debian/ngircd.default \
 	 $(CURDIR)/debian/ngircd-full.default
 	 $(CURDIR)/debian/ngircd-full.default
 	ln -s $(CURDIR)/debian/ngircd.init \
 	ln -s $(CURDIR)/debian/ngircd.init \
 	 $(CURDIR)/debian/ngircd-full.init
 	 $(CURDIR)/debian/ngircd-full.init
 	ln -s $(CURDIR)/debian/ngircd.postinst \
 	ln -s $(CURDIR)/debian/ngircd.postinst \
 	 $(CURDIR)/debian/ngircd-full.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 \
 	ln -s $(CURDIR)/debian/ngircd.default \
 	 $(CURDIR)/debian/ngircd-full-dbg.default
 	 $(CURDIR)/debian/ngircd-full-dbg.default
@@ -205,12 +211,17 @@ binary-arch: build install
 	 $(CURDIR)/debian/ngircd-full-dbg.init
 	 $(CURDIR)/debian/ngircd-full-dbg.init
 	ln -s $(CURDIR)/debian/ngircd.postinst \
 	ln -s $(CURDIR)/debian/ngircd.postinst \
 	 $(CURDIR)/debian/ngircd-full-dbg.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_testdir
 	dh_testroot
 	dh_testroot
 	dh_installchangelogs -a -A ChangeLog
 	dh_installchangelogs -a -A ChangeLog
 	dh_installdocs -a
 	dh_installdocs -a
+	dh_systemd_enable -a
 	dh_installinit -a
 	dh_installinit -a
+	dh_systemd_start -a
 	dh_strip -a --no-package=ngircd-full-dbg
 	dh_strip -a --no-package=ngircd-full-dbg
 	dh_compress -a -XCommands.txt
 	dh_compress -a -XCommands.txt
 	dh_fixperms -a
 	dh_fixperms -a
@@ -222,6 +233,6 @@ binary-arch: build install
 
 
 binary: binary-indep binary-arch
 binary: binary-indep binary-arch
 
 
-.PHONY: build clean binary-indep binary-arch binary install 
+.PHONY: build clean binary-indep binary-arch binary install
 
 
 # -eof-
 # -eof-

+ 1 - 0
contrib/Debian/source/format

@@ -0,0 +1 @@
+1.0

+ 34 - 1
contrib/MacOSX/ngIRCd.xcodeproj/project.pbxproj

@@ -635,7 +635,7 @@
 		08FB7793FE84155DC02AAC07 /* Project object */ = {
 		08FB7793FE84155DC02AAC07 /* Project object */ = {
 			isa = PBXProject;
 			isa = PBXProject;
 			attributes = {
 			attributes = {
-				LastUpgradeCheck = 0630;
+				LastUpgradeCheck = 0800;
 			};
 			};
 			buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "ngIRCd" */;
 			buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "ngIRCd" */;
 			compatibilityVersion = "Xcode 3.2";
 			compatibilityVersion = "Xcode 3.2";
@@ -742,9 +742,25 @@
 		1DEB928B08733DD80010E9CD /* Default */ = {
 		1DEB928B08733DD80010E9CD /* Default */ = {
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			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 = "";
 				CODE_SIGN_IDENTITY = "";
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				GCC_NO_COMMON_BLOCKS = NO;
 				GCC_VERSION = "";
 				GCC_VERSION = "";
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 				GCC_WARN_ABOUT_RETURN_TYPE = 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;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				MACOSX_DEPLOYMENT_TARGET = 10.6;
 				MACOSX_DEPLOYMENT_TARGET = 10.6;
 				SDKROOT = "";
 				SDKROOT = "";
@@ -754,10 +770,27 @@
 		FAB0570C105D917F006AF9E2 /* Debug */ = {
 		FAB0570C105D917F006AF9E2 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			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_DEBUGGING_SYMBOLS = full;
+				GCC_NO_COMMON_BLOCKS = NO;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_VERSION = "";
 				GCC_VERSION = "";
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 				GCC_WARN_ABOUT_RETURN_TYPE = 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;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				MACOSX_DEPLOYMENT_TARGET = 10.6;
 				MACOSX_DEPLOYMENT_TARGET = 10.6;
 				ONLY_ACTIVE_ARCH = YES;
 				ONLY_ACTIVE_ARCH = YES;

+ 5 - 5
contrib/ngindent

@@ -1,17 +1,17 @@
-#/bin/sh
+#!/bin/sh
 
 
 INDENTARGS="-kr -i8 -ts8 -l80 -c3 -cd41 -ss -ncs -psl"
 INDENTARGS="-kr -i8 -ts8 -l80 -c3 -cd41 -ss -ncs -psl"
 
 
 # check if indent(1) is available
 # 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
 if [ -z "$INDENT" ]; then
 	echo "Error: GNU \"indent\" not found!"
 	echo "Error: GNU \"indent\" not found!"
 	exit 1
 	exit 1
 fi
 fi
 
 
-$INDENT -v $INDENTARGS $*
+$INDENT -v $INDENTARGS "$@"
 
 
 # -eof-
 # -eof-

+ 0 - 0
contrib/ngircd-bsd.sh


+ 0 - 0
contrib/ngircd-redhat.init


+ 26 - 5
contrib/ngircd.service

@@ -1,20 +1,41 @@
+# ngIRCd systemd service unit.
+# See systemd(1), systemd.unit(5), systemd.service(5), systemd.exec(5).
+
 [Unit]
 [Unit]
 Description=Next Generation IRC Daemon
 Description=Next Generation IRC Daemon
+Documentation=man:ngircd(8) man:ngircd.conf(5) https://ngircd.barton.de
 After=network.target
 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]
 [Service]
 Type=forking
 Type=forking
 User=irc
 User=irc
 Group=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
 PrivateDevices=yes
+PrivateTmp=yes
+ProtectControlGroups=yes
+ProtectHome=yes
+ProtectKernelModules=yes
+ProtectKernelTunables=yes
 ProtectSystem=full
 ProtectSystem=full
-ProtectHome=true
-NoNewPrivileges=true
+RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
+RestrictRealtime=yes
 RuntimeDirectory=ircd
 RuntimeDirectory=ircd
 RuntimeDirectoryMode=750
 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
 ExecReload=/bin/kill -HUP $MAINPID
 Restart=on-failure
 Restart=on-failure
 
 

+ 1 - 0
contrib/ngircd.socket

@@ -1,5 +1,6 @@
 [Unit]
 [Unit]
 Description=Next Generation IRC Daemon (Socket)
 Description=Next Generation IRC Daemon (Socket)
+Documentation=man:ngircd(8) man:ngircd.conf(5)
 
 
 [Socket]
 [Socket]
 BindIPv6Only=ipv6-only
 BindIPv6Only=ipv6-only

+ 2 - 2
contrib/ngircd.spec

@@ -1,5 +1,5 @@
 %define name    ngircd
 %define name    ngircd
-%define version 23
+%define version 24
 %define release 1
 %define release 1
 %define prefix  %{_prefix}
 %define prefix  %{_prefix}
 
 
@@ -27,7 +27,7 @@ Advantages:
  - supports IPv6 and SSL
  - supports IPv6 and SSL
  - no problems with servers that have dynamic IP addresses
  - no problems with servers that have dynamic IP addresses
  - freely available, modern, portable and tidy C-source
  - freely available, modern, portable and tidy C-source
- - ngIRCd is being actively developed since 11 years.
+ - ngIRCd is being actively developed since 2001
 
 
 %prep
 %prep
 %setup -q
 %setup -q

+ 71 - 24
contrib/platformtest.sh

@@ -1,7 +1,7 @@
 #!/bin/sh
 #!/bin/sh
 #
 #
 # ngIRCd -- The Next Generation IRC Daemon
 # 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
 # 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
 # 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
 # suitable for inclusion in doc/Platforms.txt -- please send reports
 # to the ngIRCd mailing list: <ngircd-ml@ngircd.barton.de>.
 # to the ngIRCd mailing list: <ngircd-ml@ngircd.barton.de>.
 
 
-NAME=`basename "$0"`
+NAME=$(basename "$0")
 VERBOSE=
 VERBOSE=
 CLEAN=1
 CLEAN=1
 
 
 PLATFORM=
 PLATFORM=
 COMPILER="unknown"
 COMPILER="unknown"
 VERSION="unknown"
 VERSION="unknown"
-DATE=`date "+%y-%m-%d"`
+DATE=$(date "+%y-%m-%d")
 COMMENT=
 COMMENT=
 
 
 R_CONFIGURE=
 R_CONFIGURE=
@@ -30,7 +30,7 @@ R_CHECK=
 R_CHECK_Y="?"
 R_CHECK_Y="?"
 R_RUN=
 R_RUN=
 
 
-SRC_D=`dirname "$0"`
+SRC_D=$(dirname "$0")
 MY_D="$PWD"
 MY_D="$PWD"
 
 
 [ -n "$MAKE" ] || MAKE="make"
 [ -n "$MAKE" ] || MAKE="make"
@@ -55,6 +55,11 @@ while [ $# -gt 0 ]; do
 	shift
 	shift
 done
 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 ..."
 echo "$NAME: Checking ngIRCd base source directory ..."
 grep "ngIRCd" "$SRC_D/ChangeLog" >/dev/null 2>&1
 grep "ngIRCd" "$SRC_D/ChangeLog" >/dev/null 2>&1
 if [ $? -ne 0 ]; then
 if [ $? -ne 0 ]; then
@@ -72,10 +77,14 @@ echo "$NAME: Checking for GIT tree ..."
 if [ -d "$SRC_D/.git" ]; then
 if [ -d "$SRC_D/.git" ]; then
 	echo "$NAME: Checking for \"git\" command ..."
 	echo "$NAME: Checking for \"git\" command ..."
 	git version >/dev/null 2>&1
 	git version >/dev/null 2>&1
-	if [ $? -eq 0 -a -n "$CLEAN" ]; then
+	if [ $? -eq 0 ] && [ -n "$CLEAN" ]; then
 		echo "$NAME: Running \"git clean\" ..."
 		echo "$NAME: Running \"git clean\" ..."
 		cd "$SRC_D" || exit 1
 		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
 		cd "$MY_D" || exit 1
 	fi
 	fi
 fi
 fi
@@ -84,21 +93,42 @@ echo "$NAME: Checking for \"$SRC_D/configure\" script ..."
 if [ ! -r "$SRC_D/configure" ]; then
 if [ ! -r "$SRC_D/configure" ]; then
 	echo "$NAME: Running \"$SRC_D/autogen.sh\" ..."
 	echo "$NAME: Running \"$SRC_D/autogen.sh\" ..."
 	cd "$SRC_D" || exit 1
 	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
 	cd "$MY_D" || exit 1
 fi
 fi
 
 
 if [ -r "$SRC_D/configure" ]; then
 if [ -r "$SRC_D/configure" ]; then
 	echo "$NAME: Running \"$SRC_D/configure\" script ..."
 	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
 		R_CONFIGURE=1
+		rm -f "src/ngircd/ngircd"
 		echo "$NAME: Running \"$MAKE\" ..."
 		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
 			R_MAKE=1
 			echo "$NAME: Running \"$MAKE check\" ..."
 			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
 			if [ $? -eq 0 ]; then
 				R_CHECK=1
 				R_CHECK=1
 				R_RUN=$R_CHECK
 				R_RUN=$R_CHECK
@@ -115,13 +145,13 @@ fi
 
 
 # Get target platform information
 # Get target platform information
 if [ -r "src/config.h" ]; then
 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"
 	PLATFORM="$CPU/$VENDOR/$OS"
 fi
 fi
 if [ -z "$PLATFORM" ]; then
 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
 fi
 
 
 # Get compiler information
 # Get compiler information
@@ -153,8 +183,8 @@ if [ -r "Makefile" ]; then
 			  | cut -d'(' -f1 | sed -e 's/version //g')
 			  | cut -d'(' -f1 | sed -e 's/version //g')
 		fi
 		fi
 		if [ "$COMPILER" = "unknown" ]; then
 		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"
 			[ -n "$v" ] && COMPILER="$v"
 		fi
 		fi
 	fi
 	fi
@@ -164,7 +194,7 @@ fi
 eval "$(grep "^VERSION = " Makefile | sed -e 's/ //g')"
 eval "$(grep "^VERSION = " Makefile | sed -e 's/ //g')"
 case "$VERSION" in
 case "$VERSION" in
 	*~*-*)
 	*~*-*)
-		VERSION=`echo "$VERSION" | cut -b1-10`
+		VERSION=$(echo "$VERSION" | cut -b1-10)
 		;;
 		;;
 esac
 esac
 [ -n "$VERSION" ] || VERSION="unknown"
 [ -n "$VERSION" ] || VERSION="unknown"
@@ -184,7 +214,12 @@ fi
 [ -n "$R_CONFIGURE" ] && C="Y" || C="N"
 [ -n "$R_CONFIGURE" ] && C="Y" || C="N"
 [ -n "$R_MAKE" ] && M="Y" || M="N"
 [ -n "$R_MAKE" ] && M="Y" || M="N"
 [ -n "$R_CHECK" ] && T="$R_CHECK_Y" || T="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"
 [ -n "$COMMENT" ] && COMMENT=" $COMMENT"
 
 
 echo
 echo
@@ -195,17 +230,29 @@ echo "                                                  ./configure works --+ |
 echo "                                                                      | | | |"
 echo "                                                                      | | | |"
 echo "Platform                    Compiler     ngIRCd     Date     Tester   C M T R *"
 echo "Platform                    Compiler     ngIRCd     Date     Tester   C M T R *"
 echo "--------------------------- ------------ ---------- -------- -------- - - - - -"
 echo "--------------------------- ------------ ---------- -------- -------- - - - - -"
-type printf >/dev/null 2>&1
+command -v printf >/dev/null 2>&1
 if [ $? -eq 0 ]; then
 if [ $? -eq 0 ]; then
 	printf "%-27s %-12s %-10s %s %-8s %s %s %s %s%s\n" \
 	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"
 	 "$C" "$M" "$T" "$R" "$COMMENT"
 else
 else
-	echo "$PLATFORM $COMPILER $VERSION $DATE $USER" \
+	echo "$PLATFORM $COMPILER $VERSION $DATE $LOGNAME" \
 	 "$C" "$M" "$T" "$R" "$COMMENT"
 	 "$C" "$M" "$T" "$R" "$COMMENT"
 fi
 fi
 echo
 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
 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
 	echo
 fi
 fi

+ 1 - 1
doc/Commands.txt

@@ -324,7 +324,7 @@ General Commands
 	In addition, IRC Ops can use these two forms to specify the <target>:
 	In addition, IRC Ops can use these two forms to specify the <target>:
 	.
 	.
 	 - #<hostmask>
 	 - #<hostmask>
-	 - #<servermask>
+	 - $<servermask>
 	.
 	.
 	The <mask> can contain the wildcard characters "*" and "?", but must
 	The <mask> can contain the wildcard characters "*" and "?", but must
 	contain at least one dot (".") and no wildcard after the last one.
 	contain at least one dot (".") and no wildcard after the last one.

+ 2 - 3
doc/HowToRelease.txt

@@ -1,9 +1,8 @@
 
 
                      ngIRCd - Next Generation IRC Server
                      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
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
                    terms of the GNU General Public License.
 
 

+ 8 - 4
doc/Modes.txt

@@ -75,13 +75,17 @@ channel of which he is a member.
 
 
   mode	since	description
   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.
   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
   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.
   v	0.2.0	User is "voiced" and can speak even if channel is moderated.
+		Prefix: "+".
 
 
 
 
 Notes
 Notes

+ 4 - 0
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
 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 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:
 Please note ONE VERY IMPORTANT THING:
 
 
 All the PAM modules are executed with the privileges of the user ngIRCd
 All the PAM modules are executed with the privileges of the user ngIRCd

+ 29 - 20
doc/Platforms.txt

@@ -2,7 +2,7 @@
                      ngIRCd - Next Generation IRC Server
                      ngIRCd - Next Generation IRC Server
                            http://ngircd.barton.de/
                            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
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
                    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-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.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.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/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
 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
 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/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/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/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.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/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/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.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/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/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/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/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/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.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
 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/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 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
 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/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         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.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
 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/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/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/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/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/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/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.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    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.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    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    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    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.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/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
 x86_64/unknown/openbsd5.1   gcc 4.2.1    21         13-12-28 alex     Y Y Y Y 3

+ 6 - 6
doc/RFC.txt

@@ -1,9 +1,8 @@
 
 
                      ngIRCd - Next Generation IRC Server
                      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
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
                    terms of the GNU General Public License.
 
 
@@ -11,7 +10,8 @@
 
 
 
 
 The Internet Relay Chat (IRC) protocol is documented in these Request for
 The Internet Relay Chat (IRC) protocol is documented in these Request for
-Comments (RFC), which you can get e.g. via <http://www.faqs.org/>:
+Comments (RFCs), which you can get via <http://www.faqs.org/rfcs/> or
+<https://www.ietf.org/rfc.html> for example.
 
 
   1459	Oikarinen, J. & D. Reed, "Internet Relay Chat Protocol",
   1459	Oikarinen, J. & D. Reed, "Internet Relay Chat Protocol",
 	May 1993, [IRC].
 	May 1993, [IRC].
@@ -28,6 +28,5 @@ Comments (RFC), which you can get e.g. via <http://www.faqs.org/>:
   2813	Kalt, C., "Internet Relay Chat: Server Protocol",
   2813	Kalt, C., "Internet Relay Chat: Server Protocol",
 	April 2000, [IRC-SERVER].
 	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.

+ 9 - 0
doc/sample-ngircd.conf.tmpl

@@ -226,6 +226,15 @@
 	# character prepended to their respective user names!
 	# character prepended to their respective user names!
 	;PAMIsOptional = no
 	;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,
 	# Let ngIRCd send an "authentication PING" when a new client connects,
 	# and register this client only after receiving the corresponding
 	# and register this client only after receiving the corresponding
 	# "PONG" reply.
 	# "PONG" reply.

+ 1 - 1
man/ngircd.8.tmpl

@@ -1,7 +1,7 @@
 .\"
 .\"
 .\" ngircd(8) manual page template
 .\" ngircd(8) manual page template
 .\"
 .\"
-.TH ngircd 8 "Oct 2013" ngIRCd "ngIRCd Manual"
+.TH ngircd 8 "Jan 2017" ngIRCd "ngIRCd Manual"
 .SH NAME
 .SH NAME
 ngIRCd \- the "next generation" IRC daemon
 ngIRCd \- the "next generation" IRC daemon
 .SH SYNOPSIS
 .SH SYNOPSIS

+ 10 - 2
man/ngircd.conf.5.tmpl

@@ -1,7 +1,7 @@
 .\"
 .\"
 .\" ngircd.conf(5) manual page template
 .\" 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
 .SH NAME
 ngircd.conf \- configuration file of ngIRCd
 ngircd.conf \- configuration file of ngIRCd
 .SH SYNOPSIS
 .SH SYNOPSIS
@@ -83,7 +83,7 @@ blocks are used to configure pre-defined ("persistent") IRC channels.
 .PP
 .PP
 There can be more than one [Operator], [Server] and [Channel] section per
 There can be more than one [Operator], [Server] and [Channel] section per
 configuration file, one for each operator, server, and channel. [Global],
 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.
 each variable overwrites itself, only the last assignment is relevant.
 .SH [GLOBAL]
 .SH [GLOBAL]
 The
 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!
 don't have a "~" character prepended to their respective user names!
 Default: no.
 Default: no.
 .TP
 .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)
 \fBRequireAuthPing\fR (boolean)
 Let ngIRCd send an "authentication PING" when a new client connects, and
 Let ngIRCd send an "authentication PING" when a new client connects, and
 register this client only after receiving the corresponding "PONG" reply.
 register this client only after receiving the corresponding "PONG" reply.

+ 2 - 2
src/config.h.in

@@ -168,8 +168,8 @@
 /* Define to 1 if you have the `socket' function. */
 /* Define to 1 if you have the `socket' function. */
 #undef HAVE_SOCKET
 #undef HAVE_SOCKET
 
 
-/* Define to 1 if you have the `SSL_library_init' function. */
-#undef HAVE_SSL_LIBRARY_INIT
+/* Define to 1 if you have the `SSL_new' function. */
+#undef HAVE_SSL_NEW
 
 
 /* Define to 1 if you have the <stdbool.h> header file. */
 /* Define to 1 if you have the <stdbool.h> header file. */
 #undef HAVE_STDBOOL_H
 #undef HAVE_STDBOOL_H

+ 8 - 0
src/ngircd/conf.c

@@ -419,6 +419,7 @@ Conf_Test( void )
 #ifdef PAM
 #ifdef PAM
 	printf("  PAM = %s\n", yesno_to_str(Conf_PAM));
 	printf("  PAM = %s\n", yesno_to_str(Conf_PAM));
 	printf("  PAMIsOptional = %s\n", yesno_to_str(Conf_PAMIsOptional));
 	printf("  PAMIsOptional = %s\n", yesno_to_str(Conf_PAMIsOptional));
+	printf("  PAMServiceName = %s\n", Conf_PAMServiceName);
 #endif
 #endif
 #ifndef STRICT_RFC
 #ifndef STRICT_RFC
 	printf("  RequireAuthPing = %s\n", yesno_to_str(Conf_AuthPing));
 	printf("  RequireAuthPing = %s\n", yesno_to_str(Conf_AuthPing));
@@ -807,6 +808,7 @@ Set_Defaults(bool InitServers)
 	Conf_PAM = false;
 	Conf_PAM = false;
 #endif
 #endif
 	Conf_PAMIsOptional = false;
 	Conf_PAMIsOptional = false;
+	strcpy(Conf_PAMServiceName, "ngircd");
 	Conf_ScrubCTCP = false;
 	Conf_ScrubCTCP = false;
 #ifdef SYSLOG
 #ifdef SYSLOG
 #ifdef LOG_LOCAL5
 #ifdef LOG_LOCAL5
@@ -1833,6 +1835,12 @@ Handle_OPTIONS(const char *File, int Line, char *Var, char *Arg)
 		Conf_PAMIsOptional = Check_ArgIsTrue(Arg);
 		Conf_PAMIsOptional = Check_ArgIsTrue(Arg);
 		return;
 		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) {
 	if (strcasecmp(Var, "PredefChannelsOnly") == 0) {
 		/*
 		/*
 		 * TODO: This section and support for "PredefChannelsOnly"
 		 * TODO: This section and support for "PredefChannelsOnly"

+ 3 - 0
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 */
 /** Don't require all clients to send a password an to be PAM authenticated */
 GLOBAL bool Conf_PAMIsOptional;
 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 ? */
 /** Disable all CTCP commands except for /me ? */
 GLOBAL bool Conf_ScrubCTCP;
 GLOBAL bool Conf_ScrubCTCP;
 
 

+ 2 - 0
src/ngircd/conn-ssl.c

@@ -283,10 +283,12 @@ ConnSSL_InitLibrary( void )
 #ifdef HAVE_LIBSSL
 #ifdef HAVE_LIBSSL
 	SSL_CTX *newctx;
 	SSL_CTX *newctx;
 
 
+#if OPENSSL_API_COMPAT < 0x10100000L
 	if (!ssl_ctx) {
 	if (!ssl_ctx) {
 		SSL_library_init();
 		SSL_library_init();
 		SSL_load_error_strings();
 		SSL_load_error_strings();
 	}
 	}
+#endif
 
 
 	if (!RAND_status()) {
 	if (!RAND_status()) {
 		Log(LOG_ERR, "OpenSSL PRNG not seeded: /dev/urandom missing?");
 		Log(LOG_ERR, "OpenSSL PRNG not seeded: /dev/urandom missing?");

+ 45 - 64
src/ngircd/conn.c

@@ -182,7 +182,6 @@ cb_connserver(int sock, UNUSED short what)
 	CONN_ID idx = Socket2Index( sock );
 	CONN_ID idx = Socket2Index( sock );
 
 
 	if (idx <= NONE) {
 	if (idx <= NONE) {
-		LogDebug("cb_connserver wants to write on unknown socket?!");
 		io_close(sock);
 		io_close(sock);
 		return;
 		return;
 	}
 	}
@@ -280,12 +279,11 @@ cb_clientserver(int sock, short what)
 {
 {
 	CONN_ID idx = Socket2Index(sock);
 	CONN_ID idx = Socket2Index(sock);
 
 
-	assert(idx >= 0);
-
-	if (idx < 0) {
+	if (idx <= NONE) {
 		io_close(sock);
 		io_close(sock);
 		return;
 		return;
 	}
 	}
+
 #ifdef SSL_SUPPORT
 #ifdef SSL_SUPPORT
 	if (what & IO_WANTREAD
 	if (what & IO_WANTREAD
 	    || (Conn_OPTION_ISSET(&My_Connections[idx], CONN_SSL_WANT_WRITE))) {
 	    || (Conn_OPTION_ISSET(&My_Connections[idx], CONN_SSL_WANT_WRITE))) {
@@ -307,32 +305,20 @@ cb_clientserver(int sock, short what)
 GLOBAL void
 GLOBAL void
 Conn_Init( 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);
 		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 );
 	array_free( &My_Listeners );
-
-	for (i = 0; i < Pool_Size; i++)
-		Init_Conn_Struct(i);
 } /* Conn_Init */
 } /* Conn_Init */
 
 
 /**
 /**
@@ -1378,8 +1364,8 @@ New_Connection(int Sock, UNUSED bool IsSSL)
 	/* Check global connection limit */
 	/* Check global connection limit */
 	if ((Conf_MaxConnections > 0) &&
 	if ((Conf_MaxConnections > 0) &&
 	    (NumConnections >= (size_t) Conf_MaxConnections)) {
 	    (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");
 		Simple_Message(new_sock, "ERROR :Connection limit reached");
 		close(new_sock);
 		close(new_sock);
 		return -1;
 		return -1;
@@ -1398,23 +1384,10 @@ New_Connection(int Sock, UNUSED bool IsSSL)
 		return -1;
 		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 */
 	/* register callback */
@@ -1523,24 +1496,38 @@ Account_Connection(void)
 } /* Account_Connection */
 } /* 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.
  * @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
 static CONN_ID
 Socket2Index( int Sock )
 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;
 		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;
 	return Sock;
-} /* Socket2Index */
+}
 
 
 /**
 /**
  * Read data from the network to the read buffer. If an error occurs,
  * 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;
 		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 );
 		close( new_sock );
 		Conf_Server[Server].conn_id = NONE;
 		Conf_Server[Server].conn_id = NONE;
 		return;
 		return;
@@ -2024,8 +2008,6 @@ New_Server( int Server , ng_ipaddr_t *dest)
 		return;
 		return;
 	}
 	}
 
 
-	My_Connections = array_start(&My_ConnArray);
-
 	assert(My_Connections[new_sock].sock <= 0);
 	assert(My_Connections[new_sock].sock <= 0);
 
 
 	Init_Conn_Struct(new_sock);
 	Init_Conn_Struct(new_sock);
@@ -2472,9 +2454,7 @@ cb_clientserver_ssl(int sock, UNUSED short what)
 {
 {
 	CONN_ID idx = Socket2Index(sock);
 	CONN_ID idx = Socket2Index(sock);
 
 
-	assert(idx >= 0);
-
-	if (idx < 0) {
+	if (idx <= NONE) {
 		io_close(sock);
 		io_close(sock);
 		return;
 		return;
 	}
 	}
@@ -2524,12 +2504,13 @@ cb_connserver_login_ssl(int sock, short unused)
 {
 {
 	CONN_ID idx = Socket2Index(sock);
 	CONN_ID idx = Socket2Index(sock);
 
 
-	assert(idx >= 0);
-	if (idx < 0) {
+	(void) unused;
+
+	if (idx <= NONE) {
 		io_close(sock);
 		io_close(sock);
 		return;
 		return;
 	}
 	}
-	(void) unused;
+
 	switch (ConnSSL_Connect( &My_Connections[idx])) {
 	switch (ConnSSL_Connect( &My_Connections[idx])) {
 		case 1: break;
 		case 1: break;
 		case 0: LogDebug("ConnSSL_Connect: not ready");
 		case 0: LogDebug("ConnSSL_Connect: not ready");

+ 6 - 0
src/ngircd/defines.h

@@ -61,6 +61,9 @@
 /** Size of default connection pool. */
 /** Size of default connection pool. */
 #define CONNECTION_POOL 100
 #define CONNECTION_POOL 100
 
 
+/** Size of buffer for PAM service name. */
+#define MAX_PAM_SERVICE_NAME_LEN 64
+
 
 
 /* Hard-coded (default) options */
 /* Hard-coded (default) options */
 
 
@@ -206,6 +209,9 @@
 /** Max. number of channel modes with arguments per MODE command. */
 /** Max. number of channel modes with arguments per MODE command. */
 #define MAX_HNDL_MODES_ARG 5
 #define MAX_HNDL_MODES_ARG 5
 
 
+/** Max. number of targets per PRIVMSG/NOTICE/... command. */
+#define MAX_HNDL_TARGETS 25
+
 /** Max. number of WHO replies. */
 /** Max. number of WHO replies. */
 #define MAX_RPL_WHO 25
 #define MAX_RPL_WHO 25
 
 

+ 6 - 6
src/ngircd/irc-info.c

@@ -894,16 +894,16 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
 			list = Class_GetList(CLASS_GLINE);
 			list = Class_GetList(CLASS_GLINE);
 		else
 		else
 			list = Class_GetList(CLASS_KLINE);
 			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,
 						Client_ID(from), query,
 						Lists_GetMask(list_item),
 						Lists_GetMask(list_item),
 						Lists_GetValidity(list_item),
 						Lists_GetValidity(list_item),
 						Lists_GetReason(list_item)))
 						Lists_GetReason(list_item)))
-					return DISCONNECTED;
-				list_item = Lists_GetNext(list_item);
-			}
+				return DISCONNECTED;
+			list_item = Lists_GetNext(list_item);
+		}
 		break;
 		break;
 	case 'L':	/* Link status (servers and user links) */
 	case 'L':	/* Link status (servers and user links) */
 		if (!Op_Check(from, Req))
 		if (!Op_Check(from, Req))

+ 11 - 2
src/ngircd/irc-oper.c

@@ -47,7 +47,7 @@
 static bool
 static bool
 Bad_OperPass(CLIENT *Client, char *errtoken, char *errmsg)
 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);
 	    Client_Mask(Client), errtoken, errmsg);
 	/* Increase penalty to slow down possible brute force attacks */
 	/* Increase penalty to slow down possible brute force attacks */
 	IRC_SetPenalty(Client, 10);
 	IRC_SetPenalty(Client, 10);
@@ -398,7 +398,16 @@ IRC_xLINE(CLIENT *Client, REQUEST *Req)
 		return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
 		return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
 					  Client_ID(Client), Req->command);
 					  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)
 	if (!from)
 		return Op_NoPrivileges(Client, Req);
 		return Op_NoPrivileges(Client, Req);
 
 

+ 79 - 48
src/ngircd/irc-server.c

@@ -31,6 +31,7 @@
 #include "parse.h"
 #include "parse.h"
 #include "numeric.h"
 #include "numeric.h"
 #include "ngircd.h"
 #include "ngircd.h"
+#include "irc.h"
 #include "irc-info.h"
 #include "irc-info.h"
 #include "irc-write.h"
 #include "irc-write.h"
 #include "op.h"
 #include "op.h"
@@ -245,66 +246,96 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req )
 	CHANNEL *chan;
 	CHANNEL *chan;
 	CLIENT *c;
 	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];
 	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;
 		is_owner = is_chanadmin = is_op = is_halfop = is_voiced = false;
 
 
 		/* cut off prefixes */
 		/* 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++;
 			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 */
 	/* forward to other servers */

+ 2 - 2
src/ngircd/irc-write.c

@@ -521,12 +521,12 @@ va_dcl
 			if (Client_HasMode(to, 'w'))
 			if (Client_HasMode(to, 'w'))
 				IRC_WriteStrClientPrefix(to, From,
 				IRC_WriteStrClientPrefix(to, From,
 							 "WALLOPS :%s", msg);
 							 "WALLOPS :%s", msg);
-				break;
+			break;
 		case CLIENT_SERVER:
 		case CLIENT_SERVER:
 			if (to != Client)
 			if (to != Client)
 				IRC_WriteStrClientPrefix(to, From,
 				IRC_WriteStrClientPrefix(to, From,
 							 "WALLOPS :%s", msg);
 							 "WALLOPS :%s", msg);
-				break;
+			break;
 		}
 		}
 	}
 	}
 } /* IRC_SendWallops */
 } /* IRC_SendWallops */

+ 76 - 20
src/ngircd/irc.c

@@ -85,6 +85,8 @@ IRC_CheckListTooBig(CLIENT *From, const int Count, const int Limit,
 GLOBAL bool
 GLOBAL bool
 IRC_ERROR(CLIENT *Client, REQUEST *Req)
 IRC_ERROR(CLIENT *Client, REQUEST *Req)
 {
 {
+	char *msg;
+
 	assert( Client != NULL );
 	assert( Client != NULL );
 	assert( Req != NULL );
 	assert( Req != NULL );
 
 
@@ -99,12 +101,20 @@ IRC_ERROR(CLIENT *Client, REQUEST *Req)
 		return CONNECTED;
 		return CONNECTED;
 	}
 	}
 
 
-	if (Req->argc < 1)
+	if (Req->argc < 1) {
+		msg = "Got ERROR command";
 		Log(LOG_NOTICE, "Got ERROR from \"%s\"!",
 		Log(LOG_NOTICE, "Got ERROR from \"%s\"!",
 		    Client_Mask(Client));
 		    Client_Mask(Client));
-	else
+	} else {
+		msg = Req->argv[0];
 		Log(LOG_NOTICE, "Got ERROR from \"%s\": \"%s\"!",
 		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;
 	return CONNECTED;
 } /* IRC_ERROR */
 } /* IRC_ERROR */
@@ -339,9 +349,12 @@ GLOBAL bool
 IRC_KillClient(CLIENT *Client, CLIENT *From, const char *Nick, const char *Reason)
 IRC_KillClient(CLIENT *Client, CLIENT *From, const char *Nick, const char *Reason)
 {
 {
 	const char *msg;
 	const char *msg;
-	CONN_ID my_conn, conn;
+	CONN_ID my_conn = NONE, conn;
 	CLIENT *c;
 	CLIENT *c;
 
 
+	assert(Nick != NULL);
+	assert(Reason != NULL);
+
 	/* Do we know such a client in the network? */
 	/* Do we know such a client in the network? */
 	c = Client_Search(Nick);
 	c = Client_Search(Nick);
 	if (!c) {
 	if (!c) {
@@ -376,7 +389,8 @@ IRC_KillClient(CLIENT *Client, CLIENT *From, const char *Nick, const char *Reaso
 	}
 	}
 
 
 	/* Save ID of this connection */
 	/* Save ID of this connection */
-	my_conn = Client_Conn(Client);
+	if (Client)
+		my_conn = Client_Conn(Client);
 
 
 	/* Kill the client NOW:
 	/* Kill the client NOW:
 	 *  - Close the local connection (if there is one),
 	 *  - 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 */
 	if(options & CONN_ZIP)		/* zlib compression enabled */
 		strlcat(option_txt, "z", sizeof(option_txt));
 		strlcat(option_txt, "z", sizeof(option_txt));
 #endif
 #endif
-	LogDebug(" *** %d: %d = %s", Idx, options, option_txt);
 
 
 	return option_txt;
 	return option_txt;
 } /* Option_String */
 } /* 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
 static bool
 Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
 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;
 	CL2CHAN *cl2chan;
 	CHANNEL *chan;
 	CHANNEL *chan;
 	char *currentTarget = Req->argv[0];
 	char *currentTarget = Req->argv[0];
-	char *lastCurrentTarget = NULL;
+	char *strtok_last = NULL;
 	char *message = NULL;
 	char *message = NULL;
+	char *targets[MAX_HNDL_TARGETS];
+	int i, target_nr = 0;
 
 
 	assert(Client != NULL);
 	assert(Client != NULL);
 	assert(Req != NULL);
 	assert(Req != NULL);
@@ -542,10 +569,19 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
 		message = Req->argv[1];
 		message = Req->argv[1];
 
 
 	/* handle msgtarget = msgto *("," msgto) */
 	/* handle msgtarget = msgto *("," msgto) */
-	currentTarget = strtok_r(currentTarget, ",", &lastCurrentTarget);
+	currentTarget = strtok_r(currentTarget, ",", &strtok_last);
 	ngt_UpperStr(Req->command);
 	ngt_UpperStr(Req->command);
 
 
+	/* Please note that "currentTarget" is NULL when the target contains
+	 * the separator character only, e. g. "," or ",,,," etc.! */
 	while (currentTarget) {
 	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 <msgto> of form:
 		/* Check for and handle valid <msgto> of form:
 		 * RFC 2812 2.3.1:
 		 * RFC 2812 2.3.1:
 		 *   msgto =  channel / ( user [ "%" host ] "@" servername )
 		 *   msgto =  channel / ( user [ "%" host ] "@" servername )
@@ -689,14 +725,14 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
 				return DISCONNECTED;
 				return DISCONNECTED;
 		} else if (ForceType != CLIENT_SERVICE
 		} else if (ForceType != CLIENT_SERVICE
 			   && (chan = Channel_Search(currentTarget))) {
 			   && (chan = Channel_Search(currentTarget))) {
+			/* Target is a channel */
 			if (!Channel_Write(chan, from, Client, Req->command,
 			if (!Channel_Write(chan, from, Client, Req->command,
 					   SendErrors, message))
 					   SendErrors, message))
 					return DISCONNECTED;
 					return DISCONNECTED;
 		} else if (ForceType != CLIENT_SERVICE
 		} else if (ForceType != CLIENT_SERVICE
-			/* $#: server/target mask, RFC 2812, sec. 3.3.1 */
 			   && strchr("$#", currentTarget[0])
 			   && strchr("$#", currentTarget[0])
 			   && strchr(currentTarget, '.')) {
 			   && strchr(currentTarget, '.')) {
-			/* targetmask */
+			/* $#: server/host mask, RFC 2812, sec. 3.3.1 */
 			if (!Send_Message_Mask(from, Req->command, currentTarget,
 			if (!Send_Message_Mask(from, Req->command, currentTarget,
 					       message, SendErrors))
 					       message, SendErrors))
 				return DISCONNECTED;
 				return DISCONNECTED;
@@ -709,14 +745,35 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
 		}
 		}
 
 
 	send_next_target:
 	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;
 	return CONNECTED;
 } /* Send_Message */
 } /* 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
 static bool
 Send_Message_Mask(CLIENT * from, char * command, char * targetMask,
 Send_Message_Mask(CLIENT * from, char * command, char * targetMask,
 		  char * message, bool SendErrors)
 		  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.
 	 * dot (".") and no wildcards ("*", "?") following the last one.
 	 */
 	 */
 	check_wildcards = strrchr(targetMask, '.');
 	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)
 		if (!SendErrors)
 			return true;
 			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] == '#') {
 	if (targetMask[0] == '#') {
+		/* #: hostmask, see RFC 2812, sec. 3.3.1 */
 		for (cl = Client_First(); cl != NULL; cl = Client_Next(cl)) {
 		for (cl = Client_First(); cl != NULL; cl = Client_Next(cl)) {
 			if (Client_Type(cl) != CLIENT_USER)
 			if (Client_Type(cl) != CLIENT_USER)
 				continue;
 				continue;
@@ -761,7 +816,8 @@ Send_Message_Mask(CLIENT * from, char * command, char * targetMask,
 					return false;
 					return false;
 		}
 		}
 	} else {
 	} 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)) {
 		for (cl = Client_First(); cl != NULL; cl = Client_Next(cl)) {
 			if (Client_Type(cl) != CLIENT_USER)
 			if (Client_Type(cl) != CLIENT_USER)
 				continue;
 				continue;

+ 2 - 2
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) {
 		if (e->valid_until > 0 && e->valid_until < now) {
 			/* Entry is expired, delete it */
 			/* Entry is expired, delete it */
 			if (e->reason)
 			if (e->reason)
-				Log(LOG_INFO,
+				Log(LOG_NOTICE|LOG_snotice,
 				    "Deleted \"%s\" (\"%s\") from %s list (expired).",
 				    "Deleted \"%s\" (\"%s\") from %s list (expired).",
 				    e->mask, e->reason, ListName);
 				    e->mask, e->reason, ListName);
 			else
 			else
-				Log(LOG_INFO,
+				Log(LOG_NOTICE|LOG_snotice,
 				    "Deleted \"%s\" from %s list (expired).",
 				    "Deleted \"%s\" from %s list (expired).",
 				    e->mask, ListName);
 				    e->mask, ListName);
 			Lists_Unlink(h, last, e);
 			Lists_Unlink(h, last, e);

+ 2 - 1
src/ngircd/messages.h

@@ -110,11 +110,12 @@
 #define ERR_CANNOTSENDTOCHAN_MSG	"404 %s %s :Cannot send to channel"
 #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_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_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_NOORIGIN_MSG		"409 %s :No origin specified"
 #define ERR_INVALIDCAP_MSG		"410 %s %s :Invalid CAP subcommand"
 #define ERR_INVALIDCAP_MSG		"410 %s %s :Invalid CAP subcommand"
 #define ERR_NORECIPIENT_MSG		"411 %s :No recipient given (%s)"
 #define ERR_NORECIPIENT_MSG		"411 %s :No recipient given (%s)"
 #define ERR_NOTEXTTOSEND_MSG		"412 %s :No text to send"
 #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_UNKNOWNCOMMAND_MSG		"421 %s %s :Unknown command"
 #define ERR_NOMOTD_MSG			"422 %s :MOTD file is missing"
 #define ERR_NOMOTD_MSG			"422 %s :MOTD file is missing"
 #define ERR_NONICKNAMEGIVEN_MSG		"431 %s :No nickname given"
 #define ERR_NONICKNAMEGIVEN_MSG		"431 %s :No nickname given"

+ 2 - 2
src/ngircd/ngircd.c

@@ -1,6 +1,6 @@
 /*
 /*
  * ngIRCd -- The Next Generation IRC Daemon
  * 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
  * 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
  * it under the terms of the GNU General Public License as published by
@@ -451,7 +451,7 @@ static void
 Show_Version( void )
 Show_Version( void )
 {
 {
 	puts( NGIRCd_Version );
 	puts( NGIRCd_Version );
-	puts( "Copyright (c)2001-2014 Alexander Barton (<alex@barton.de>) and Contributors." );
+	puts( "Copyright (c)2001-2017 Alexander Barton (<alex@barton.de>) and Contributors." );
 	puts( "Homepage: <http://ngircd.barton.de/>\n" );
 	puts( "Homepage: <http://ngircd.barton.de/>\n" );
 	puts( "This is free software; see the source for copying conditions. There is NO" );
 	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." );
 	puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." );

+ 3 - 1
src/ngircd/numeric.c

@@ -176,6 +176,7 @@ Synchronize_Lists(CLIENT * Client)
 	CHANNEL *c;
 	CHANNEL *c;
 	struct list_head *head;
 	struct list_head *head;
 	struct list_elem *elem;
 	struct list_elem *elem;
+	time_t t;
 
 
 	assert(Client != NULL);
 	assert(Client != NULL);
 
 
@@ -183,9 +184,10 @@ Synchronize_Lists(CLIENT * Client)
 	head = Class_GetList(CLASS_GLINE);
 	head = Class_GetList(CLASS_GLINE);
 	elem = Lists_GetFirst(head);
 	elem = Lists_GetFirst(head);
 	while (elem) {
 	while (elem) {
+		t = Lists_GetValidity(elem) - time(NULL);
 		if (!IRC_WriteStrClient(Client, "GLINE %s %ld :%s",
 		if (!IRC_WriteStrClient(Client, "GLINE %s %ld :%s",
 					Lists_GetMask(elem),
 					Lists_GetMask(elem),
-					(long)(Lists_GetValidity(elem) - time(NULL)),
+					t > 0 ? (long)t : 0,
 					Lists_GetReason(elem)))
 					Lists_GetReason(elem)))
 			return DISCONNECTED;
 			return DISCONNECTED;
 		elem = Lists_GetNext(elem);
 		elem = Lists_GetNext(elem);

+ 4 - 2
src/ngircd/op.c

@@ -40,12 +40,14 @@ Op_NoPrivileges(CLIENT * Client, REQUEST * Req)
 		from = Client_Search(Req->prefix);
 		from = Client_Search(Req->prefix);
 
 
 	if (from) {
 	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);
 		    Req->prefix, Client_Mask(Client), Req->command);
 		return IRC_WriteErrClient(from, ERR_NOPRIVILEGES_MSG,
 		return IRC_WriteErrClient(from, ERR_NOPRIVILEGES_MSG,
 					  Client_ID(from));
 					  Client_ID(from));
 	} else {
 	} 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);
 		    Client_Mask(Client), Req->command);
 		return IRC_WriteErrClient(Client, ERR_NOPRIVILEGES_MSG,
 		return IRC_WriteErrClient(Client, ERR_NOPRIVILEGES_MSG,
 					  Client_ID(Client));
 					  Client_ID(Client));

+ 2 - 1
src/ngircd/pam.c

@@ -32,6 +32,7 @@
 #include "log.h"
 #include "log.h"
 #include "conn.h"
 #include "conn.h"
 #include "client.h"
 #include "client.h"
+#include "conf.h"
 
 
 #include "pam.h"
 #include "pam.h"
 
 
@@ -101,7 +102,7 @@ PAM_Authenticate(CLIENT *Client) {
 	conv.appdata_ptr = Conn_Password(Client_Conn(Client));
 	conv.appdata_ptr = Conn_Password(Client_Conn(Client));
 
 
 	/* Initialize PAM */
 	/* 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) {
 	if (retval != PAM_SUCCESS) {
 		Log(LOG_ERR, "PAM: Failed to create authenticator! (%d)", retval);
 		Log(LOG_ERR, "PAM: Failed to create authenticator! (%d)", retval);
 		return false;
 		return false;

+ 4 - 0
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
 # define PACKAGE_VERSION VERSION
 #endif
 #endif
 
 
+#ifndef SYSCONFDIR
+# define SYSCONFDIR "/etc"
+#endif
+
 #endif
 #endif
 
 
 /* -eof- */
 /* -eof- */

+ 6 - 0
src/testsuite/Makefile.am

@@ -21,6 +21,7 @@ EXTRA_DIST = \
 	join-test.e kick-test.e message-test.e misc-test.e mode-test.e \
 	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 \
 	opless-channel-test.e server-link-test.e who-test.e whois-test.e \
 	stress-A.e stress-B.e \
 	stress-A.e stress-B.e \
+	server-login-test.e \
 	start-server1 stop-server1 ngircd-test1.conf \
 	start-server1 stop-server1 ngircd-test1.conf \
 	start-server2 stop-server2 ngircd-test2.conf
 	start-server2 stop-server2 ngircd-test2.conf
 
 
@@ -81,6 +82,10 @@ server-link-test: tests.sh
 	rm -f server-link-test
 	rm -f server-link-test
 	ln -s $(srcdir)/tests.sh 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
 who-test: tests.sh
 	rm -f who-test
 	rm -f who-test
 	ln -s $(srcdir)/tests.sh who-test
 	ln -s $(srcdir)/tests.sh who-test
@@ -103,6 +108,7 @@ TESTS = start-server1 \
 	who-test \
 	who-test \
 	whois-test \
 	whois-test \
 	server-link-test \
 	server-link-test \
+	server-login-test \
 	stop-server2 \
 	stop-server2 \
 	stress-server.sh \
 	stress-server.sh \
 	stop-server1
 	stop-server1

+ 6 - 0
src/testsuite/Makefile.in

@@ -210,6 +210,7 @@ EXTRA_DIST = \
 	join-test.e kick-test.e message-test.e misc-test.e mode-test.e \
 	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 \
 	opless-channel-test.e server-link-test.e who-test.e whois-test.e \
 	stress-A.e stress-B.e \
 	stress-A.e stress-B.e \
+	server-login-test.e \
 	start-server1 stop-server1 ngircd-test1.conf \
 	start-server1 stop-server1 ngircd-test1.conf \
 	start-server2 stop-server2 ngircd-test2.conf
 	start-server2 stop-server2 ngircd-test2.conf
 
 
@@ -228,6 +229,7 @@ TESTS = start-server1 \
 	who-test \
 	who-test \
 	whois-test \
 	whois-test \
 	server-link-test \
 	server-link-test \
+	server-login-test \
 	stop-server2 \
 	stop-server2 \
 	stress-server.sh \
 	stress-server.sh \
 	stop-server1
 	stop-server1
@@ -567,6 +569,10 @@ server-link-test: tests.sh
 	rm -f server-link-test
 	rm -f server-link-test
 	ln -s $(srcdir)/tests.sh 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
 who-test: tests.sh
 	rm -f who-test
 	rm -f who-test
 	ln -s $(srcdir)/tests.sh who-test
 	ln -s $(srcdir)/tests.sh who-test

+ 6 - 0
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 \
 	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 \
 	opless-channel-test.e server-link-test.e who-test.e whois-test.e \
 	stress-A.e stress-B.e \
 	stress-A.e stress-B.e \
+	server-login-test.e \
 	start-server1 stop-server1 ngircd-test1.conf \
 	start-server1 stop-server1 ngircd-test1.conf \
 	start-server2 stop-server2 ngircd-test2.conf
 	start-server2 stop-server2 ngircd-test2.conf
 
 
@@ -81,6 +82,10 @@ server-link-test: tests.sh
 	rm -f server-link-test
 	rm -f server-link-test
 	ln -s $(srcdir)/tests.sh 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
 who-test: tests.sh
 	rm -f who-test
 	rm -f who-test
 	ln -s $(srcdir)/tests.sh who-test
 	ln -s $(srcdir)/tests.sh who-test
@@ -103,6 +108,7 @@ TESTS = start-server1 \
 	who-test \
 	who-test \
 	whois-test \
 	whois-test \
 	server-link-test \
 	server-link-test \
+	server-login-test \
 	stop-server2 \
 	stop-server2 \
 	stress-server.sh \
 	stress-server.sh \
 	stop-server1
 	stop-server1

+ 13 - 2
src/testsuite/message-test.e

@@ -35,13 +35,24 @@ expect {
 send "privmsg nick,nick :test\r"
 send "privmsg nick,nick :test\r"
 expect {
 expect {
 	timeout { exit 1 }
 	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"
 send "privmsg Nick,#testChannel,nick :test\r"
 expect {
 expect {
 	timeout { exit 1 }
 	timeout { exit 1 }
-	"@* PRIVMSG nick :test\r*401*@* PRIVMSG nick :test"
+	"@* PRIVMSG nick :test\r*401"
 }
 }
 
 
 send "privmsg doesnotexist :test\r"
 send "privmsg doesnotexist :test\r"

+ 5 - 0
src/testsuite/ngircd-test1.conf

@@ -29,6 +29,11 @@
 	MyPassword = pwd1
 	MyPassword = pwd1
 	PeerPassword = pwd2
 	PeerPassword = pwd2
 
 
+[Server]
+	Name = ngircd.test.server3
+	MyPassword = pwd1
+	PeerPassword = pwd3
+
 [Channel]
 [Channel]
 	Name = InviteChannel
 	Name = InviteChannel
 	Modes = i
 	Modes = i

+ 94 - 0
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"
+}