Browse Source

Import upstream version 24

Alexander Barton 3 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
                            http://ngircd.barton.de/
 
-               (c)2001-2015 Alexander Barton and Contributors.
+               (c)2001-2017 Alexander Barton and Contributors.
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
 
@@ -33,10 +33,11 @@ Brandon Beresini <beresini@google.com>
 Brett Smith <brett@w3.org>
 Brian Collins <bricollins@gmail.com>
 Bryan Caldwell <bcaldwel@ucsd.edu>
+Christian Aistleitner <christian@quelltextlich.at>
 Christoph Biedl <ngircd.anoy@manchmal.in-ulm.de>
-DNS <dns@rbose.org>
 Dana Dahlstrom <dana+ngIRCd@cs.ucsd.edu>
 David Kingston <deathking1337@aim.com>
+DNS <dns@rbose.org>
 Eric Grunow <egrunow@ucsd.edu>
 Federico G. Schwindt <fgsch@lodoss.net>
 Gabor Adam Toth <tg@tgbit.net>
@@ -63,6 +64,6 @@ xor <xorboy@gmail.com>
 
 Code snippets
 ~~~~~~~~~~~~~
-J. Kercheval: pattern matching functions
-Patrick Powell <papowell@astart.com>: snprintf()-function
 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
                            http://ngircd.barton.de/
 
-               (c)2001-2015 Alexander Barton and Contributors.
+               (c)2001-2017 Alexander Barton and Contributors.
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
 
                                -- ChangeLog --
 
 
+ngIRCd 24 (2017-01-20)
+
+  - Make sure that ./contrib/platformtest.sh aborts when ./autogen.sh fails.
+  - Update config.guess (2016-10-02) and config.sub (2016-11-04) files.
+  - Build Debian packages with OpenSSL instead of GnuTLS: OpenSSL allows
+    to reload used certificates on runtime for example (which is very
+    useful when using Let's Encrypt), and therefore is preferred. And
+    explicitly specify the "source format".
+  - Fix handling of connection pool allocation and enlargement: up to now,
+    the daemon only enlarged its connection pool when accepting new incoming
+    client or server connections, not when establishing new outgoing server
+    links, which could lead to problems when hitting the configured limit,
+    see "MaxConnections". Thanks to Lukas Braun (k00mi) for reporting this!
+    Closes #231.
+
+  ngIRCd 24~rc1 (2017-01-07)
+  - Enhance systemd service file, and install it in Debian package.
+  - Update configuration of Debian package.
+  - Log privilege violations and failed OPER request with log level "error"
+    and send it to the "&SERVER" channel, too.
+  - Immediately shut down connection when receiving an "ERROR" command,
+    don't wait for the peer to close the connection. This allows the daemon
+    to forward the received "ERROR" message in the network, instead of the
+    very generic "client closed connection" message.
+  - Fix sending of entry duration (no negative values!) when synchronizing
+    "x-lines" (G-LINES).
+  - List expiration (G-LINES): use same log level as when setting, and log
+    this event to the &SERVER channel, too.
+  - Explicitly forbid remote servers to modify "x-lines" (G-LINES) when the
+    "AllowRemoteOper" configuration option isn't set, even when the command
+    seems to originate from the remote server itself: this prevents GLINE's
+    to become set during server handshake in this case (what wouldn't be
+    possible during regular runtime when a remote IRC Op sends the command)
+    and what can't be undone by IRC Ops later on (because of the missing
+    "AllowRemoteOper" option) ...
+  - Make scripts and init-files in ./contrib executable.
+  - Fix building ngIRCd with OpenSSL 1.1. Thanks to Christoph Biedl
+    <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)
 
   - Explicitly cast time_t to long when printing it out: this prevents

+ 1 - 1
INSTALL

@@ -2,7 +2,7 @@
                      ngIRCd - Next Generation IRC Server
                            http://ngircd.barton.de/
 
-               (c)2001-2015 Alexander Barton and Contributors.
+               (c)2001-2017 Alexander Barton and Contributors.
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
 

+ 39 - 1
NEWS

@@ -2,13 +2,51 @@
                      ngIRCd - Next Generation IRC Server
                            http://ngircd.barton.de/
 
-               (c)2001-2015 Alexander Barton and Contributors.
+               (c)2001-2017 Alexander Barton and Contributors.
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
 
                                   -- NEWS --
 
 
+ngIRCd 24 (2017-01-20)
+
+  ngIRCd 24~rc1 (2017-01-07)
+  - Log privilege violations and failed OPER request with log level "error"
+    and send it to the "&SERVER" channel, too.
+  - Immediately shut down connection when receiving an "ERROR" command,
+    don't wait for the peer to close the connection. This allows the daemon
+    to forward the received "ERROR" message in the network, instead of the
+    very generic "client closed connection" message.
+  - Explicitly forbid remote servers to modify "x-lines" (G-LINES) when the
+    "AllowRemoteOper" configuration option isn't set, even when the command
+    seems to originate from the remote server itself: this prevents GLINE's
+    to become set during server handshake in this case (what wouldn't be
+    possible during regular runtime when a remote IRC Op sends the command)
+    and what can't be undone by IRC Ops later on (because of the missing
+    "AllowRemoteOper" option) ...
+  - Update Xcode project for latest Xcode version (8.0), and fix "duplicate
+    symbols" error messages when building (linking) the binary.
+  - Add "Documentation" variables to systemd configuration files.
+  - Make sure that SYSCONFDIR is always set, which can be handy when
+    using source code linters when ./configure hasn't been run already.
+  - Add the new "PAMServiceName" configuration option to specify the name
+    used as PAM service name. This setting allows to run multiple ngIRCd
+    instances with different PAM configurations for each instance.
+    Thanks to Christian Aistleitner <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~rc1 (2015-09-06)

+ 31 - 35
README

@@ -2,7 +2,7 @@
                      ngIRCd - Next Generation IRC Server
                            http://ngircd.barton.de/
 
-               (c)2001-2015 Alexander Barton and Contributors.
+               (c)2001-2017 Alexander Barton and Contributors.
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
 
@@ -28,31 +28,26 @@ Please see the INSTALL document for installation and upgrade information!
 II. Status
 ~~~~~~~~~~~
 
+ngIRCd should be quite feature complete and stable to be used as daemon in
+real world IRC networks.
+
 It is not the goal of ngIRCd to implement all the nasty behaviors of the
 original ircd, but to implement most of the useful commands and semantics
-specified by the RFCs.
-
-In the meantime ngIRCd should be quite feature complete and stable to be
-used in real IRC networks.
+specified by the RFCs that are used by existing clients.
 
-Implemented IRC-commands are:
-
-ADMIN, AWAY, CHANINFO, CONNECT, DIE, DISCONNECT, ERROR, GLINE, HELP, INFO,
-INVITE, ISON, JOIN, KICK, KILL, KLINE, LINKS, LIST, LUSERS, MODE, MOTD,
-NAMES, NICK, NJOIN, NOTICE, OPER, PART, PASS, PING, PONG, PRIVMSG, QUIT,
-REHASH, RESTART, SERVER, SERVICE, SERVLIST, SQUERY, SQUIT, STATS, SUMMON,
-TIME, TOPIC, TRACE, USER, USERHOST, USERS, VERSION, WALLOPS, WEBIRC, WHO,
-WHOIS, WHOWAS.
 
 III. Features (or: why use ngIRCd?)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-- well arranged (lean) configuration file
-- simple to build/install, configure and maintain
-- supports IPv6 and SSL
-- no problems with servers that have dynamic IP addresses
-- freely available, modern, portable and tidy C-source
-- wide field of supported platforms, including AIX, A/UX, FreeBSD, HP-UX,
+- Well arranged (lean) configuration file.
+- Simple to build, install, configure, and maintain.
+- Supports IPv6 and SSL.
+- Can use PAM for user authentication.
+- Lots of popular user and channel modes are implemented.
+- Supports "cloaking" of users.
+- No problems with servers that have dynamic IP addresses.
+- Freely available, modern, portable and tidy C source.
+- Wide field of supported platforms, including AIX, A/UX, FreeBSD, HP-UX,
   IRIX, Linux, Mac OS X, NetBSD, OpenBSD, Solaris, and Windows with Cygwin.
 - ngIRCd is being actively developed since 2001.
 
@@ -61,33 +56,34 @@ IV. Documentation
 ~~~~~~~~~~~~~~~~~
 
 More documentation can be found in the "doc/" directory and the homepage of
-the ngIRCd: <http://ngircd.barton.de/>.
+ngIRCd: <http://ngircd.barton.de/>.
 
 
 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")
 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
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors
+# Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -95,7 +95,7 @@ Search()
 				return 0
 			fi
 		done
-		minor=`expr $minor - 1`
+		minor=$(expr $minor - 1)
 	done
 	return 1
 }
@@ -139,26 +139,26 @@ fi
 # Try to detect the needed tools when no environment variable already
 # specifies one:
 echo "Searching for required tools ..."
-[ -z "$ACLOCAL" ] && ACLOCAL=`Search aclocal 1`
+[ -z "$ACLOCAL" ] && ACLOCAL=$(Search aclocal 1)
 [ "$VERBOSE" = "1" ] && echo " - ACLOCAL=$ACLOCAL"
-[ -z "$AUTOHEADER" ] && AUTOHEADER=`Search autoheader 2`
+[ -z "$AUTOHEADER" ] && AUTOHEADER=$(Search autoheader 2)
 [ "$VERBOSE" = "1" ] && echo " - AUTOHEADER=$AUTOHEADER"
-[ -z "$AUTOMAKE" ] && AUTOMAKE=`Search automake 1`
+[ -z "$AUTOMAKE" ] && AUTOMAKE=$(Search automake 1)
 [ "$VERBOSE" = "1" ] && echo " - AUTOMAKE=$AUTOMAKE"
-[ -z "$AUTOCONF" ] && AUTOCONF=`Search autoconf 2`
+[ -z "$AUTOCONF" ] && AUTOCONF=$(Search autoconf 2)
 [ "$VERBOSE" = "1" ] && echo " - AUTOCONF=$AUTOCONF"
 
-AUTOCONF_VERSION=`echo $AUTOCONF | cut -d'-' -f2-`
-[ -n "$AUTOCONF_VERSION" -a "$AUTOCONF_VERSION" != "autoconf" ] \
+AUTOCONF_VERSION=$(echo "$AUTOCONF" | cut -d'-' -f2-)
+[ -n "$AUTOCONF_VERSION" ] && [ "$AUTOCONF_VERSION" != "autoconf" ] \
 	&& export AUTOCONF_VERSION || unset AUTOCONF_VERSION
 [ "$VERBOSE" = "1" ] && echo " - AUTOCONF_VERSION=$AUTOCONF_VERSION"
-AUTOMAKE_VERSION=`echo $AUTOMAKE | cut -d'-' -f2-`
-[ -n "$AUTOMAKE_VERSION" -a "$AUTOMAKE_VERSION" != "automake" ] \
+AUTOMAKE_VERSION=$(echo $AUTOMAKE | cut -d'-' -f2-)
+[ -n "$AUTOMAKE_VERSION" ] && [ "$AUTOMAKE_VERSION" != "automake" ] \
 	&& export AUTOMAKE_VERSION || unset AUTOMAKE_VERSION
 [ "$VERBOSE" = "1" ] && echo " - AUTOMAKE_VERSION=$AUTOMAKE_VERSION"
 
 [ $# -gt 0 ] && CONFIGURE_ARGS=" $*" || CONFIGURE_ARGS=""
-[ -z "$GO" -a -n "$CONFIGURE_ARGS" ] && GO=1
+[ -z "$GO" ] && [ -n "$CONFIGURE_ARGS" ] && GO=1
 
 # Verify that all tools have been found
 [ -z "$ACLOCAL" ] && Notfound aclocal
@@ -166,15 +166,15 @@ AUTOMAKE_VERSION=`echo $AUTOMAKE | cut -d'-' -f2-`
 [ -z "$AUTOMAKE" ] && Notfound automake
 [ -z "$AUTOCONF" ] && Notfound autoconf
 
-AM_VERSION=`$AUTOMAKE --version | head -n 1 | sed -e 's/.* //g'`
+AM_VERSION=$($AUTOMAKE --version | head -n 1 | sed -e 's/.* //g')
 ifs=$IFS; IFS="."; set $AM_VERSION; IFS=$ifs
-AM_MAJOR="$1"; AM_MINOR="$2"; AM_PATCHLEVEL="$3"
+AM_MAJOR="$1"; AM_MINOR="$2"
 echo "Detected automake $AM_VERSION ..."
 
 AM_MAKEFILES="src/ipaddr/Makefile.ng src/ngircd/Makefile.ng src/testsuite/Makefile.ng src/tool/Makefile.ng"
 
 # De-ANSI-fication?
-if [ "$AM_MAJOR" -eq "1" -a "$AM_MINOR" -lt "12" ]; then
+if [ "$AM_MAJOR" -eq "1" ] && [ "$AM_MINOR" -lt "12" ]; then
 	# automake < 1.12 => automatic de-ANSI-fication support available
 	echo " - Enabling de-ANSI-fication support."
 	sed -e "s|^__ng_PROTOTYPES__|AM_C_PROTOTYPES|g" configure.ng >configure.ac
@@ -188,19 +188,20 @@ else
 	DEANSI_END=" (disabled by ./autogen.sh script)"
 fi
 # Serial test harness?
-if [ "$AM_MAJOR" -eq "1" -a "$AM_MINOR" -ge "13" ]; then
+if [ "$AM_MAJOR" -eq "1" ] && [ "$AM_MINOR" -ge "13" ]; then
 	# automake >= 1.13 => enforce "serial test harness"
 	echo " - Enforcing serial test harness."
 	SERIAL_TESTS="serial-tests"
 else
 	# automake < 1.13 => no new test harness, nothing to do
+	# shellcheck disable=SC2034
 	SERIAL_TEST=""
 fi
 
 sed -e "s|^__ng_Makefile_am_template__|AUTOMAKE_OPTIONS = ${SERIAL_TESTS} ${DEANSI_START}ansi2knr${DEANSI_END}|g" \
 	src/portab/Makefile.ng >src/portab/Makefile.am
 for makefile_ng in $AM_MAKEFILES; do
-	makefile_am=`echo "$makefile_ng" | sed -e "s|\.ng\$|\.am|g"`
+	makefile_am=$(echo "$makefile_ng" | sed -e "s|\.ng\$|\.am|g")
 	sed -e "s|^__ng_Makefile_am_template__|AUTOMAKE_OPTIONS = ${SERIAL_TESTS} ${DEANSI_START}../portab/ansi2knr${DEANSI_END}|g" \
 		$makefile_ng >$makefile_am
 done
@@ -214,10 +215,10 @@ Run $ACLOCAL && \
 	Run $AUTOHEADER && \
 	Run $AUTOMAKE --add-missing --no-force
 
-if [ $? -eq 0 -a -x ./configure ]; then
+if [ $? -eq 0 ] && [ -x ./configure ]; then
 	# Success: if we got some parameters we call ./configure and pass
 	# all of them to it.
-	NAME=`grep PACKAGE_STRING= configure | cut -d"'" -f2`
+	NAME=$(grep PACKAGE_STRING= configure | cut -d"'" -f2)
 	if [ "$GO" = "1" ]; then
 		[ -n "$PREFIX" ] && p=" --prefix=$PREFIX" || p=""
 		c="./configure${p}${CONFIGURE_ARGS}"

+ 108 - 66
config.guess

@@ -1,8 +1,8 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2014 Free Software Foundation, Inc.
+#   Copyright 1992-2016 Free Software Foundation, Inc.
 
-timestamp='2014-03-23'
+timestamp='2016-10-02'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -24,12 +24,12 @@ timestamp='2014-03-23'
 # program.  This Exception is an additional permission under section 7
 # of the GNU General Public License, version 3 ("GPLv3").
 #
-# Originally written by Per Bothner.
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
 #
 # You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
 #
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+# Please send patches to <config-patches@gnu.org>.
 
 
 me=`echo "$0" | sed -e 's,.*/,,'`
@@ -50,7 +50,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright 1992-2016 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -168,19 +168,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	# Note: NetBSD doesn't particularly care about the vendor
 	# portion of the name.  We always set it to "unknown".
 	sysctl="sysctl -n hw.machine_arch"
-	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
-	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
+	    /sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || \
+	    echo unknown)`
 	case "${UNAME_MACHINE_ARCH}" in
 	    armeb) machine=armeb-unknown ;;
 	    arm*) machine=arm-unknown ;;
 	    sh3el) machine=shl-unknown ;;
 	    sh3eb) machine=sh-unknown ;;
 	    sh5el) machine=sh5le-unknown ;;
+	    earmv*)
+		arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+		endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
+		machine=${arch}${endian}-unknown
+		;;
 	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
 	esac
 	# The Operating System including object format, if it has switched
-	# to ELF recently, or will in the future.
+	# to ELF recently (or will in the future) and ABI.
 	case "${UNAME_MACHINE_ARCH}" in
+	    earm*)
+		os=netbsdelf
+		;;
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
 		eval $set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
@@ -197,6 +207,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		os=netbsd
 		;;
 	esac
+	# Determine ABI tags.
+	case "${UNAME_MACHINE_ARCH}" in
+	    earm*)
+		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
+		abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
+		;;
+	esac
 	# The OS release
 	# Debian GNU/NetBSD machines have a different userland, and
 	# thus, need a distinct triplet. However, they do not need
@@ -207,13 +224,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		release='-gnu'
 		;;
 	    *)
-		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
 		;;
 	esac
 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
 	# contains redundant information, the shorter form:
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-	echo "${machine}-${os}${release}"
+	echo "${machine}-${os}${release}${abi}"
 	exit ;;
     *:Bitrig:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
@@ -223,6 +240,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
 	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
 	exit ;;
+    *:LibertyBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
+	exit ;;
     *:ekkoBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
 	exit ;;
@@ -235,6 +256,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:MirBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
 	exit ;;
+    *:Sortix:*:*)
+	echo ${UNAME_MACHINE}-unknown-sortix
+	exit ;;
     alpha:OSF1:*:*)
 	case $UNAME_RELEASE in
 	*4.0)
@@ -251,42 +275,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
 	case "$ALPHA_CPU_TYPE" in
 	    "EV4 (21064)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "EV4.5 (21064)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "LCA4 (21066/21068)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "EV5 (21164)")
-		UNAME_MACHINE="alphaev5" ;;
+		UNAME_MACHINE=alphaev5 ;;
 	    "EV5.6 (21164A)")
-		UNAME_MACHINE="alphaev56" ;;
+		UNAME_MACHINE=alphaev56 ;;
 	    "EV5.6 (21164PC)")
-		UNAME_MACHINE="alphapca56" ;;
+		UNAME_MACHINE=alphapca56 ;;
 	    "EV5.7 (21164PC)")
-		UNAME_MACHINE="alphapca57" ;;
+		UNAME_MACHINE=alphapca57 ;;
 	    "EV6 (21264)")
-		UNAME_MACHINE="alphaev6" ;;
+		UNAME_MACHINE=alphaev6 ;;
 	    "EV6.7 (21264A)")
-		UNAME_MACHINE="alphaev67" ;;
+		UNAME_MACHINE=alphaev67 ;;
 	    "EV6.8CB (21264C)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.8AL (21264B)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.8CX (21264D)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.9A (21264/EV69A)")
-		UNAME_MACHINE="alphaev69" ;;
+		UNAME_MACHINE=alphaev69 ;;
 	    "EV7 (21364)")
-		UNAME_MACHINE="alphaev7" ;;
+		UNAME_MACHINE=alphaev7 ;;
 	    "EV7.9 (21364A)")
-		UNAME_MACHINE="alphaev79" ;;
+		UNAME_MACHINE=alphaev79 ;;
 	esac
 	# A Pn.n version is a patched version.
 	# A Vn.n version is a released version.
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
 	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
 	exitcode=$?
 	trap '' 0
@@ -359,16 +383,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	exit ;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
 	eval $set_cc_for_build
-	SUN_ARCH="i386"
+	SUN_ARCH=i386
 	# If there is a compiler, see if it is configured for 64-bit objects.
 	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
 	# This test works for both compilers.
-	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
 	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
-		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
 		grep IS_64BIT_ARCH >/dev/null
 	    then
-		SUN_ARCH="x86_64"
+		SUN_ARCH=x86_64
 	    fi
 	fi
 	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
@@ -393,7 +417,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	exit ;;
     sun*:*:4.2BSD:*)
 	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
-	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
 	case "`/bin/arch`" in
 	    sun3)
 		echo m68k-sun-sunos${UNAME_RELEASE}
@@ -579,8 +603,9 @@ EOF
 	else
 		IBM_ARCH=powerpc
 	fi
-	if [ -x /usr/bin/oslevel ] ; then
-		IBM_REV=`/usr/bin/oslevel`
+	if [ -x /usr/bin/lslpp ] ; then
+		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
+			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
 	else
 		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
 	fi
@@ -617,13 +642,13 @@ EOF
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
 		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
 		    case "${sc_cpu_version}" in
-		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
+		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
 		      532)                      # CPU_PA_RISC2_0
 			case "${sc_kernel_bits}" in
-			  32) HP_ARCH="hppa2.0n" ;;
-			  64) HP_ARCH="hppa2.0w" ;;
-			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+			  32) HP_ARCH=hppa2.0n ;;
+			  64) HP_ARCH=hppa2.0w ;;
+			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
 			esac ;;
 		    esac
 		fi
@@ -662,11 +687,11 @@ EOF
 		    exit (0);
 		}
 EOF
-		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
 		fi ;;
 	esac
-	if [ ${HP_ARCH} = "hppa2.0w" ]
+	if [ ${HP_ARCH} = hppa2.0w ]
 	then
 	    eval $set_cc_for_build
 
@@ -679,12 +704,12 @@ EOF
 	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
 	    # => hppa64-hp-hpux11.23
 
-	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
 		grep -q __LP64__
 	    then
-		HP_ARCH="hppa2.0w"
+		HP_ARCH=hppa2.0w
 	    else
-		HP_ARCH="hppa64"
+		HP_ARCH=hppa64
 	    fi
 	fi
 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
@@ -789,14 +814,14 @@ EOF
 	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
-	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
 	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
 	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     5000:UNIX_System_V:4.*:*)
-	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
 	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
@@ -878,7 +903,7 @@ EOF
 	exit ;;
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
 	exit ;;
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
@@ -901,7 +926,7 @@ EOF
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
 	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
-	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     arc:Linux:*:* | arceb:Linux:*:*)
@@ -932,6 +957,9 @@ EOF
     crisv32:Linux:*:*)
 	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	exit ;;
+    e2k:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     frv:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
@@ -944,6 +972,9 @@ EOF
     ia64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
+    k1om:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     m32r*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
@@ -969,6 +1000,9 @@ EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
 	;;
+    mips64el:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     openrisc*:Linux:*:*)
 	echo or1k-unknown-linux-${LIBC}
 	exit ;;
@@ -1001,6 +1035,9 @@ EOF
     ppcle:Linux:*:*)
 	echo powerpcle-unknown-linux-${LIBC}
 	exit ;;
+    riscv32:Linux:*:* | riscv64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
 	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
 	exit ;;
@@ -1020,7 +1057,7 @@ EOF
 	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
 	exit ;;
     x86_64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
 	exit ;;
     xtensa*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
@@ -1099,7 +1136,7 @@ EOF
 	# uname -m prints for DJGPP always 'pc', but it prints nothing about
 	# the processor, so we play safe by assuming i586.
 	# Note: whatever this is, it MUST be the same as what config.sub
-	# prints for the "djgpp" host, or else GDB configury will decide that
+	# prints for the "djgpp" host, or else GDB configure will decide that
 	# this is a cross-build.
 	echo i586-pc-msdosdjgpp
 	exit ;;
@@ -1248,6 +1285,9 @@ EOF
     SX-8R:SUPER-UX:*:*)
 	echo sx8r-nec-superux${UNAME_RELEASE}
 	exit ;;
+    SX-ACE:SUPER-UX:*:*)
+	echo sxace-nec-superux${UNAME_RELEASE}
+	exit ;;
     Power*:Rhapsody:*:*)
 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
 	exit ;;
@@ -1261,9 +1301,9 @@ EOF
 	    UNAME_PROCESSOR=powerpc
 	fi
 	if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
-	    if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
 		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
-		    (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		    (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
 		    grep IS_64BIT_ARCH >/dev/null
 		then
 		    case $UNAME_PROCESSOR in
@@ -1285,7 +1325,7 @@ EOF
 	exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
 	UNAME_PROCESSOR=`uname -p`
-	if test "$UNAME_PROCESSOR" = "x86"; then
+	if test "$UNAME_PROCESSOR" = x86; then
 		UNAME_PROCESSOR=i386
 		UNAME_MACHINE=pc
 	fi
@@ -1316,7 +1356,7 @@ EOF
 	# "uname -m" is not consistent, so use $cputype instead. 386
 	# is converted to i386 for consistency with other x86
 	# operating systems.
-	if test "$cputype" = "386"; then
+	if test "$cputype" = 386; then
 	    UNAME_MACHINE=i386
 	else
 	    UNAME_MACHINE="$cputype"
@@ -1358,7 +1398,7 @@ EOF
 	echo i386-pc-xenix
 	exit ;;
     i*86:skyos:*:*)
-	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
 	exit ;;
     i*86:rdos:*:*)
 	echo ${UNAME_MACHINE}-pc-rdos
@@ -1369,23 +1409,25 @@ EOF
     x86_64:VMkernel:*:*)
 	echo ${UNAME_MACHINE}-unknown-esx
 	exit ;;
+    amd64:Isilon\ OneFS:*:*)
+	echo x86_64-unknown-onefs
+	exit ;;
 esac
 
 cat >&2 <<EOF
 $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
-  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
 

+ 52 - 21
config.sub

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

+ 24 - 24
configure

@@ -1,6 +1,6 @@
 #! /bin/sh
 # 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>.
 #
@@ -580,8 +580,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='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_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.
   # This message is too long to be a string in the A/UX 3.1 sh.
   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]...
 
@@ -1370,7 +1370,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of ngIRCd 23:";;
+     short | recursive ) echo "Configuration of ngIRCd 24:";;
    esac
   cat <<\_ACEOF
 
@@ -1483,7 +1483,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-ngIRCd configure 23
+ngIRCd configure 24
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2017,7 +2017,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by 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
 
   $ $0 $@
@@ -2934,7 +2934,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='ngircd'
- VERSION='23'
+ VERSION='24'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -6899,9 +6899,9 @@ _ACEOF
 
 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
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -6915,27 +6915,27 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char SSL_library_init ();
+char SSL_new ();
 int
 main ()
 {
-return SSL_library_init ();
+return SSL_new ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_ssl_SSL_library_init=yes
+  ac_cv_lib_ssl_SSL_new=yes
 else
-  ac_cv_lib_ssl_SSL_library_init=no
+  ac_cv_lib_ssl_SSL_new=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 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
 #define HAVE_LIBSSL 1
 _ACEOF
@@ -6944,12 +6944,12 @@ _ACEOF
 
 fi
 
-			for ac_func in SSL_library_init
+			for ac_func in SSL_new
 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
-#define HAVE_SSL_LIBRARY_INIT 1
+#define HAVE_SSL_NEW 1
 _ACEOF
  x_ssl_openssl=yes
 else
@@ -8098,7 +8098,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by 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
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -8165,7 +8165,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-ngIRCd config.status 23
+ngIRCd config.status 24
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 

+ 2 - 2
configure.ac

@@ -418,8 +418,8 @@ AC_ARG_WITH(openssl,
 				LDFLAGS="-L$withval/lib $LDFLAGS"
 			fi
 			AC_CHECK_LIB(crypto, BIO_s_mem)
-			AC_CHECK_LIB(ssl, SSL_library_init)
-			AC_CHECK_FUNCS(SSL_library_init, x_ssl_openssl=yes,
+			AC_CHECK_LIB(ssl, SSL_new)
+			AC_CHECK_FUNCS(SSL_new, x_ssl_openssl=yes,
 				AC_MSG_ERROR([Can't enable openssl])
 			)
 		fi

+ 2 - 2
configure.ng

@@ -418,8 +418,8 @@ AC_ARG_WITH(openssl,
 				LDFLAGS="-L$withval/lib $LDFLAGS"
 			fi
 			AC_CHECK_LIB(crypto, BIO_s_mem)
-			AC_CHECK_LIB(ssl, SSL_library_init)
-			AC_CHECK_FUNCS(SSL_library_init, x_ssl_openssl=yes,
+			AC_CHECK_LIB(ssl, SSL_new)
+			AC_CHECK_FUNCS(SSL_new, x_ssl_openssl=yes,
 				AC_MSG_ERROR([Can't enable openssl])
 			)
 		fi

+ 3 - 2
contrib/Debian/Makefile.am

@@ -1,6 +1,6 @@
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
+# Copyright (c)2001-2017 Alexander Barton (alex@barton.de) and Contributors
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -10,7 +10,8 @@
 #
 
 EXTRA_DIST = rules changelog compat control copyright \
-	ngircd.init ngircd.default ngircd.pam ngircd.postinst
+	ngircd.init ngircd.default ngircd.pam ngircd.postinst \
+	source/format
 
 maintainer-clean-local:
 	rm -f Makefile Makefile.in

+ 3 - 2
contrib/Debian/Makefile.in

@@ -17,7 +17,7 @@
 
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
+# Copyright (c)2001-2017 Alexander Barton (alex@barton.de) and Contributors
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -186,7 +186,8 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 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
 

+ 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
 
   * 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
 Priority: optional
 Maintainer: Alexander Barton <alex@barton.de>
-Build-Depends: debhelper (>> 4.0.0),
+Build-Depends: debhelper (>> 9.0.0),
     autotools-dev,
+    dh-systemd (>= 1.5),
     expect,
-    libz-dev,
-    libwrap0-dev,
     libident-dev,
-    libgnutls-dev,
     libpam0g-dev,
+    libssl-dev,
+    libwrap0-dev,
+    libz-dev,
     telnet | telnet-ssl,
 Standards-Version: 3.9.1
 

+ 1 - 1
contrib/Debian/ngircd.postinst

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

+ 19 - 8
contrib/Debian/rules

@@ -1,7 +1,7 @@
 #!/usr/bin/make -f
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors
+# Copyright (c)2001-2016 Alexander Barton (alex@barton.de) and Contributors
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -55,7 +55,7 @@ configure-ngircd-full: configure
 	  --mandir=\$${prefix}/share/man \
 	  --docdir=\$${prefix}/share/doc/ngircd-full \
 	  --with-syslog --with-zlib \
-	  --with-gnutls --with-iconv --with-ident --with-tcp-wrappers \
+	  --with-openssl --with-iconv --with-ident --with-tcp-wrappers \
 	  --with-pam \
 	  --enable-ipv6
 
@@ -70,12 +70,12 @@ configure-ngircd-full-dbg: configure
 	  --docdir=\$${prefix}/share/doc/ngircd-full-dbg \
 	  --enable-debug --enable-sniffer \
 	  --with-syslog --with-zlib \
-	  --with-gnutls --with-iconv --with-ident --with-tcp-wrappers \
+	  --with-openssl --with-iconv --with-ident --with-tcp-wrappers \
 	  --with-pam \
 	  --enable-ipv6
 
 build:
-	dh_clean -k
+	dh_prep
 
 build-ngircd: build-stamp-ngircd
 build-stamp-ngircd: configure-ngircd
@@ -111,12 +111,15 @@ clean:
 	dh_testdir
 	dh_testroot
 	rm -f build-stamp*
+	rm -f $(CURDIR)/debian/ngircd.service
 	rm -f $(CURDIR)/debian/ngircd-full.default
 	rm -f $(CURDIR)/debian/ngircd-full.init
 	rm -f $(CURDIR)/debian/ngircd-full.postinst
+	rm -f $(CURDIR)/debian/ngircd-full.service
 	rm -f $(CURDIR)/debian/ngircd-full-dbg.default
 	rm -f $(CURDIR)/debian/ngircd-full-dbg.postinst
 	rm -f $(CURDIR)/debian/ngircd-full-dbg.init
+	rm -f $(CURDIR)/debian/ngircd-full-dbg.service
 
 	# Add here commands to clean up after the build process:
 	[ ! -f Makefile ] || $(MAKE) distclean
@@ -140,7 +143,6 @@ install-ngircd: build-ngircd
 	$(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd
 	rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/INSTALL*
 	rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/COPYING*
-	mkdir -p $(CURDIR)/debian/ngircd/var/run/ircd
 	cat $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/sample-ngircd.conf | \
 	 sed -e "s|;ServerUID = 65534|ServerUID = irc|g" | \
 	 sed -e "s|;ServerGID = 65534|ServerGID = irc|g" | \
@@ -157,7 +159,6 @@ install-ngircd-full: build-ngircd-full
 	$(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd-full
 	rm $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full/INSTALL*
 	rm $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full/COPYING*
-	mkdir -p $(CURDIR)/debian/ngircd-full/var/run/ircd
 	cat $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full/sample-ngircd.conf | \
 	 sed -e "s|;ServerUID = 65534|ServerUID = irc|g" | \
 	 sed -e "s|;ServerGID = 65534|ServerGID = irc|g" | \
@@ -176,7 +177,6 @@ install-ngircd-full-dbg: build-ngircd-full-dbg
 	$(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd-full-dbg
 	rm $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg/INSTALL*
 	rm $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg/COPYING*
-	mkdir -p $(CURDIR)/debian/ngircd-full-dbg/var/run/ircd
 	cat $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg/sample-ngircd.conf | \
 	 sed -e "s|;ServerUID = 65534|ServerUID = irc|g" | \
 	 sed -e "s|;ServerGID = 65534|ServerGID = irc|g" | \
@@ -192,12 +192,18 @@ binary-indep:
 
 # Build architecture-dependent files here.
 binary-arch: build install
+	ln -s $(CURDIR)/contrib/ngircd.service \
+	 $(CURDIR)/debian/ngircd.service
+
 	ln -s $(CURDIR)/debian/ngircd.default \
 	 $(CURDIR)/debian/ngircd-full.default
 	ln -s $(CURDIR)/debian/ngircd.init \
 	 $(CURDIR)/debian/ngircd-full.init
 	ln -s $(CURDIR)/debian/ngircd.postinst \
 	 $(CURDIR)/debian/ngircd-full.postinst
+	cp $(CURDIR)/contrib/ngircd.service \
+	 $(CURDIR)/debian/ngircd-full.service
+	echo "Alias=ngircd.service" >>$(CURDIR)/debian/ngircd-full.service
 
 	ln -s $(CURDIR)/debian/ngircd.default \
 	 $(CURDIR)/debian/ngircd-full-dbg.default
@@ -205,12 +211,17 @@ binary-arch: build install
 	 $(CURDIR)/debian/ngircd-full-dbg.init
 	ln -s $(CURDIR)/debian/ngircd.postinst \
 	 $(CURDIR)/debian/ngircd-full-dbg.postinst
+	cp $(CURDIR)/contrib/ngircd.service \
+	 $(CURDIR)/debian/ngircd-full-dbg.service
+	echo "Alias=ngircd.service" >>$(CURDIR)/debian/ngircd-full-dbg.service
 
 	dh_testdir
 	dh_testroot
 	dh_installchangelogs -a -A ChangeLog
 	dh_installdocs -a
+	dh_systemd_enable -a
 	dh_installinit -a
+	dh_systemd_start -a
 	dh_strip -a --no-package=ngircd-full-dbg
 	dh_compress -a -XCommands.txt
 	dh_fixperms -a
@@ -222,6 +233,6 @@ binary-arch: build install
 
 binary: binary-indep binary-arch
 
-.PHONY: build clean binary-indep binary-arch binary install 
+.PHONY: build clean binary-indep binary-arch binary install
 
 # -eof-

+ 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 */ = {
 			isa = PBXProject;
 			attributes = {
-				LastUpgradeCheck = 0630;
+				LastUpgradeCheck = 0800;
 			};
 			buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "ngIRCd" */;
 			compatibilityVersion = "Xcode 3.2";
@@ -742,9 +742,25 @@
 		1DEB928B08733DD80010E9CD /* Default */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INFINITE_RECURSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				CODE_SIGN_IDENTITY = "";
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				GCC_NO_COMMON_BLOCKS = NO;
 				GCC_VERSION = "";
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				MACOSX_DEPLOYMENT_TARGET = 10.6;
 				SDKROOT = "";
@@ -754,10 +770,27 @@
 		FAB0570C105D917F006AF9E2 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INFINITE_RECURSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				ENABLE_TESTABILITY = YES;
 				GCC_DEBUGGING_SYMBOLS = full;
+				GCC_NO_COMMON_BLOCKS = NO;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_VERSION = "";
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				MACOSX_DEPLOYMENT_TARGET = 10.6;
 				ONLY_ACTIVE_ARCH = YES;

+ 5 - 5
contrib/ngindent

@@ -1,17 +1,17 @@
-#/bin/sh
+#!/bin/sh
 
 INDENTARGS="-kr -i8 -ts8 -l80 -c3 -cd41 -ss -ncs -psl"
 
 # check if indent(1) is available
-type indent >/dev/null 2>&1 && INDENT="indent"
-type gindent >/dev/null 2>&1 && INDENT="gindent"
-type gnuindent >/dev/null 2>&1 && INDENT="gnuindent"
+command -v indent >/dev/null 2>&1 && INDENT="indent"
+command -v gindent >/dev/null 2>&1 && INDENT="gindent"
+command -v gnuindent >/dev/null 2>&1 && INDENT="gnuindent"
 
 if [ -z "$INDENT" ]; then
 	echo "Error: GNU \"indent\" not found!"
 	exit 1
 fi
 
-$INDENT -v $INDENTARGS $*
+$INDENT -v $INDENTARGS "$@"
 
 # -eof-

+ 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]
 Description=Next Generation IRC Daemon
+Documentation=man:ngircd(8) man:ngircd.conf(5) https://ngircd.barton.de
 After=network.target
+Wants=anope.service atheme.service irc-services.service
+Wants=bopm.service
+Before=anope.service atheme.service irc-services.service
+Before=bopm.service
 
 [Service]
 Type=forking
 User=irc
 Group=irc
-CapabilityBoundingSet=CAP_SETUID CAP_SETGID CAP_SYS_CHROOT CAP_NET_BIND_SERVICE
-PrivateTmp=yes
+# Settings & limits:
+CapabilityBoundingSet=CAP_SYS_CHROOT CAP_NET_BIND_SERVICE
+MemoryDenyWriteExecute=yes
+NoNewPrivileges=yes
 PrivateDevices=yes
+PrivateTmp=yes
+ProtectControlGroups=yes
+ProtectHome=yes
+ProtectKernelModules=yes
+ProtectKernelTunables=yes
 ProtectSystem=full
-ProtectHome=true
-NoNewPrivileges=true
+RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
+RestrictRealtime=yes
 RuntimeDirectory=ircd
 RuntimeDirectoryMode=750
-ExecStart=/usr/sbin/ngircd
+# Try to load "default files" from any Debian package variant to keep this
+# unit generic.
+EnvironmentFile=-/etc/default/ngircd
+EnvironmentFile=-/etc/default/ngircd-full
+EnvironmentFile=-/etc/default/ngircd-full-dbg
+# Start ngIRCd. Note: systemd doesn't allow to use $DAEMON here!
+ExecStart=/usr/sbin/ngircd $PARAMS
 ExecReload=/bin/kill -HUP $MAINPID
 Restart=on-failure
 

+ 1 - 0
contrib/ngircd.socket

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

+ 2 - 2
contrib/ngircd.spec

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

+ 71 - 24
contrib/platformtest.sh

@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors
+# Copyright (c)2001-2016 Alexander Barton (alex@barton.de) and Contributors
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -14,14 +14,14 @@
 # suitable for inclusion in doc/Platforms.txt -- please send reports
 # to the ngIRCd mailing list: <ngircd-ml@ngircd.barton.de>.
 
-NAME=`basename "$0"`
+NAME=$(basename "$0")
 VERBOSE=
 CLEAN=1
 
 PLATFORM=
 COMPILER="unknown"
 VERSION="unknown"
-DATE=`date "+%y-%m-%d"`
+DATE=$(date "+%y-%m-%d")
 COMMENT=
 
 R_CONFIGURE=
@@ -30,7 +30,7 @@ R_CHECK=
 R_CHECK_Y="?"
 R_RUN=
 
-SRC_D=`dirname "$0"`
+SRC_D=$(dirname "$0")
 MY_D="$PWD"
 
 [ -n "$MAKE" ] || MAKE="make"
@@ -55,6 +55,11 @@ while [ $# -gt 0 ]; do
 	shift
 done
 
+for cmd in telnet expect; do
+	command -v "$cmd" >/dev/null 2>&1 \
+		|| echo "$NAME: WARNING: $cmd(1) not found, \"make check\" won't run all tests!"
+done
+
 echo "$NAME: Checking ngIRCd base source directory ..."
 grep "ngIRCd" "$SRC_D/ChangeLog" >/dev/null 2>&1
 if [ $? -ne 0 ]; then
@@ -72,10 +77,14 @@ echo "$NAME: Checking for GIT tree ..."
 if [ -d "$SRC_D/.git" ]; then
 	echo "$NAME: Checking for \"git\" command ..."
 	git version >/dev/null 2>&1
-	if [ $? -eq 0 -a -n "$CLEAN" ]; then
+	if [ $? -eq 0 ] && [ -n "$CLEAN" ]; then
 		echo "$NAME: Running \"git clean\" ..."
 		cd "$SRC_D" || exit 1
-		[ -n "$VERBOSE" ] && git clean -dxf || git clean -dxf >/dev/null
+		if [ -n "$VERBOSE" ]; then
+			git clean -dxf
+		else
+			git clean -dxf >/dev/null
+		fi
 		cd "$MY_D" || exit 1
 	fi
 fi
@@ -84,21 +93,42 @@ echo "$NAME: Checking for \"$SRC_D/configure\" script ..."
 if [ ! -r "$SRC_D/configure" ]; then
 	echo "$NAME: Running \"$SRC_D/autogen.sh\" ..."
 	cd "$SRC_D" || exit 1
-	[ -n "$VERBOSE" ] && ./autogen.sh || ./autogen.sh >/dev/null
+	if [ -n "$VERBOSE" ]; then
+		./autogen.sh
+	else
+		./autogen.sh >/dev/null
+	fi
+	if [ $? -ne 0 ]; then
+		echo "$NAME: \"$SRC_D/autogen.sh\" script failed, aborting!"
+		exit 1
+	fi
 	cd "$MY_D" || exit 1
 fi
 
 if [ -r "$SRC_D/configure" ]; then
 	echo "$NAME: Running \"$SRC_D/configure\" script ..."
-	[ -n "$VERBOSE" ] && "$SRC_D/configure" -C || "$SRC_D/configure" -C >/dev/null
-	if [ $? -eq 0 -a -r ./Makefile ]; then
+	if [ -n "$VERBOSE" ]; then
+		"$SRC_D/configure" -C
+	else
+		"$SRC_D/configure" -C >/dev/null
+	fi
+	if [ $? -eq 0 ] && [ -r ./Makefile ]; then
 		R_CONFIGURE=1
+		rm -f "src/ngircd/ngircd"
 		echo "$NAME: Running \"$MAKE\" ..."
-		[ -n "$VERBOSE" ] && "$MAKE" || "$MAKE" >/dev/null
-		if [ $? -eq 0 -a -x src/ngircd/ngircd ]; then
+		if [ -n "$VERBOSE" ]; then
+			"$MAKE"
+		else
+			"$MAKE" >/dev/null
+		fi
+		if [ $? -eq 0 ] && [ -x src/ngircd/ngircd ]; then
 			R_MAKE=1
 			echo "$NAME: Running \"$MAKE check\" ..."
-			[ -n "$VERBOSE" ] && "$MAKE" check || "$MAKE" check >/dev/null
+			if [ -n "$VERBOSE" ]; then
+				"$MAKE" check
+			else
+				"$MAKE" check >/dev/null
+			fi
 			if [ $? -eq 0 ]; then
 				R_CHECK=1
 				R_RUN=$R_CHECK
@@ -115,13 +145,13 @@ fi
 
 # Get target platform information
 if [ -r "src/config.h" ]; then
-	CPU=`grep "HOST_CPU" "src/config.h" | cut -d'"' -f2`
-	OS=`grep "HOST_OS" "src/config.h" | cut -d'"' -f2`
-	VENDOR=`grep "HOST_VENDOR" "src/config.h" | cut -d'"' -f2`
+	CPU=$(grep "HOST_CPU" "src/config.h" | cut -d'"' -f2)
+	OS=$(grep "HOST_OS" "src/config.h" | cut -d'"' -f2)
+	VENDOR=$(grep "HOST_VENDOR" "src/config.h" | cut -d'"' -f2)
 	PLATFORM="$CPU/$VENDOR/$OS"
 fi
 if [ -z "$PLATFORM" ]; then
-	PLATFORM="`uname 2>/dev/null` `uname -r 2>/dev/null`, `uname -m 2>/dev/null`"
+	PLATFORM="$(uname 2>/dev/null) $(uname -r 2>/dev/null), $(uname -m 2>/dev/null)"
 fi
 
 # Get compiler information
@@ -153,8 +183,8 @@ if [ -r "Makefile" ]; then
 			  | cut -d'(' -f1 | sed -e 's/version //g')
 		fi
 		if [ "$COMPILER" = "unknown" ]; then
-			v="`$CC --version 2>/dev/null | head -1`"
-			[ -z "$v" ] && v="`$CC -version 2>/dev/null | head -1`"
+			v="$($CC --version 2>/dev/null | head -1)"
+			[ -z "$v" ] && v="$($CC -version 2>/dev/null | head -1)"
 			[ -n "$v" ] && COMPILER="$v"
 		fi
 	fi
@@ -164,7 +194,7 @@ fi
 eval "$(grep "^VERSION = " Makefile | sed -e 's/ //g')"
 case "$VERSION" in
 	*~*-*)
-		VERSION=`echo "$VERSION" | cut -b1-10`
+		VERSION=$(echo "$VERSION" | cut -b1-10)
 		;;
 esac
 [ -n "$VERSION" ] || VERSION="unknown"
@@ -184,7 +214,12 @@ fi
 [ -n "$R_CONFIGURE" ] && C="Y" || C="N"
 [ -n "$R_MAKE" ] && M="Y" || M="N"
 [ -n "$R_CHECK" ] && T="$R_CHECK_Y" || T="N"
-[ -n "$R_RUN" ] && R="Y" || R="N"
+if [ -n "$R_RUN" ]; then
+	# Mark "runs" with "Y" only when the test suite succeeded:
+	[ "$T" = "N" ] && R="?" || R="Y"
+else
+	R="N"
+fi
 [ -n "$COMMENT" ] && COMMENT=" $COMMENT"
 
 echo
@@ -195,17 +230,29 @@ echo "                                                  ./configure works --+ |
 echo "                                                                      | | | |"
 echo "Platform                    Compiler     ngIRCd     Date     Tester   C M T R *"
 echo "--------------------------- ------------ ---------- -------- -------- - - - - -"
-type printf >/dev/null 2>&1
+command -v printf >/dev/null 2>&1
 if [ $? -eq 0 ]; then
 	printf "%-27s %-12s %-10s %s %-8s %s %s %s %s%s\n" \
-	 "$PLATFORM" "$COMPILER" "$VERSION" "$DATE" "$USER" \
+	 "$PLATFORM" "$COMPILER" "$VERSION" "$DATE" "$LOGNAME" \
 	 "$C" "$M" "$T" "$R" "$COMMENT"
 else
-	echo "$PLATFORM $COMPILER $VERSION $DATE $USER" \
+	echo "$PLATFORM $COMPILER $VERSION $DATE $LOGNAME" \
 	 "$C" "$M" "$T" "$R" "$COMMENT"
 fi
 echo
+
+double_check() {
+	echo "Please double check that the ngIRCd daemon starts up, runs and handles IRC"
+	echo "connections successfully!"
+}
+
 if [ "$R_CHECK_Y" = "y" ]; then
-	echo "$NAME: Warning: Some tests have been skipped!"
+	echo "WARNING: Some tests have been skipped!"
+	double_check
+	echo
+fi
+if [ "$R" = "?" ]; then
+	echo "WARNING: The resulting binary passed simple tests, but the test suite failed!"
+	double_check
 	echo
 fi

+ 1 - 1
doc/Commands.txt

@@ -324,7 +324,7 @@ General Commands
 	In addition, IRC Ops can use these two forms to specify the <target>:
 	.
 	 - #<hostmask>
-	 - #<servermask>
+	 - $<servermask>
 	.
 	The <mask> can contain the wildcard characters "*" and "?", but must
 	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
+                           http://ngircd.barton.de/
 
-                        (c)2001-2010 Alexander Barton,
-                    alex@barton.de, http://www.barton.de/
-
+               (c)2001-2017 Alexander Barton and Contributors.
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
 

+ 8 - 4
doc/Modes.txt

@@ -75,13 +75,17 @@ channel of which he is a member.
 
   mode	since	description
 
-  q	20	User is channel owner can only be set by a service, other
-		owner and irc op. Can promote other users to q, a, o, h, v.
-  a	20	User is channel admin and can promote other users to v, h, o
+  q	20	User is channel owner. This mode can only be set by an IRC
+		service, other owner or IRC operator. Channel owners can
+		promote other users to all levels: q, a, o, h, v. Prefix: "~".
+  a	20	User is channel admin and can promote other users to v, h, o.
+		Prefix: "&".
   o	0.2.0	User is channel operator and can op/kick/... other members.
+		Prefix: "@".
   h	20	User is half op and can set channel modes imntvIbek and kick
-		voiced and normal users.
+		voiced and normal users. Prefix: "%".
   v	0.2.0	User is "voiced" and can speak even if channel is moderated.
+		Prefix: "+".
 
 
 Notes

+ 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
 the ngIRCd and has sent its PASS, NICK, and USER commands.
 
+The PAM library used by the ngIRCd daemon must be able to access its
+configuration file, so don't forget to check permissions and run something
+like this: "chmod 644 /etc/pam.d/ngircd".
+
 Please note ONE VERY IMPORTANT THING:
 
 All the PAM modules are executed with the privileges of the user ngIRCd

+ 29 - 20
doc/Platforms.txt

@@ -2,7 +2,7 @@
                      ngIRCd - Next Generation IRC Server
                            http://ngircd.barton.de/
 
-               (c)2001-2013 Alexander Barton and Contributors.
+               (c)2001-2016 Alexander Barton and Contributors.
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
 
@@ -32,6 +32,7 @@ armv6l/unk./linux-gnueabihf gcc 4.6.3    21~rc2     13-10-26 pi       Y Y Y Y 5
 armv7l/unk./linux-gnueabi   gcc 4.4.3    19.1       12-04-29 goetz    Y Y Y Y 5
 armv7l/unk./linux-gnueabihf gcc 4.6.3    22~rc1-3   14-10-10 alex     Y Y Y Y 5
 armv7l/unk./linux-gnueabihf gcc 4.8.2    21.1       14-07-15 goetz    Y Y Y Y 5
+armv7l/unk./linux-gnueabihf gcc 4.9.2    23         16-01-10 alex     Y Y Y Y 5
 hppa/unknown/openbsd3.5     gcc 2.95.3   CVSHEAD    04-05-25 alex     Y Y Y Y
 hppa/unknown/openbsd5.4     gcc 4.2.1    22~rc1-3   14-10-10 alex     Y Y y Y 3
 hppa1.1/unknown/linux-gnu   gcc 3.3.3    0.8.0      04-05-30 alex     Y Y Y Y
@@ -40,34 +41,37 @@ hppa2.0w-hp-hpux11.11       gcc 4.2.3    14.1       09-07-22 goetz    Y Y Y Y
 i386/apple/darwin9.7.0      gcc 4.0.1    14.1       09-08-04 alex     Y Y Y Y 3
 i386/apple/darwin10.8.0     gcc 4.2.1    19         12-02-26 alex     Y Y Y Y 3
 i386/apple/darwin11.3.0     gcc 4.2.1    19         12-02-26 alex     Y Y Y Y 3
+i386/pc/linux-gnu           gcc 4.1.2    13~rc1     08-12-05 alex     Y Y Y Y 1
+i386/pc/linux-gnu           gcc 4.4.5    22~rc1-3   14-10-10 alex     Y Y Y Y 1
+i386/pc/minix               clang 3.4    23         16-01-06 goetz    Y Y N Y
 i386/pc/solaris2.9          gcc 3.2.2    CVSHEAD    04-02-24 alex     Y Y Y Y
-i386/pc/solaris2.11         gcc 4.5.2    21~rc2     13-10-27 alex     Y Y N Y 4
+i386/pc/solaris2.11         gcc 4.8.2    23         16-02-07 goetz    Y Y Y Y 4
 i386/unknown/freebsd5.2.1   gcc 3.3.3    0.8.0      04-05-30 alex     Y Y Y Y
 i386/unknown/freebsd6.2     gcc 3.4.6    20~rc1     12-11-13 alex     Y Y Y Y 3
-i386/unknown/freebsd7.3     gcc 4.2.1    20~rc1     12-11-13 alex     Y Y Y Y 3
-i686/pc/minix               gcc 4.4.6    21~rc2     13-10-27 alex     Y Y N N
-i686/unknown/gnu0.3         gcc 4.4.5    19         12-02-29 alex     Y Y Y Y
-i686/unknown/gnu0.5         gcc 4.9.1    22~rc1-3   14-10-11 alex     Y Y Y Y
-i686/unkn./kfreebsd7.2-gnu  gcc 4.3.4    15         09-12-02 alex     Y Y Y Y 3
+i386/unknown/freebsd7.3     gcc 4.2.1    24~rc1-7   17-01-20 alex     Y Y Y Y 3
 i386/unknown/netbsdelf1.5.2 egcs-1.1.2   21         13-11-25 goetz    Y Y N Y
 i386/unknown/netbsdelf1.6.2 gcc 2.95.3   18         11-07-10 goetz    Y Y Y Y
 i386/unknown/netbsdelf3.0.1 gcc 3.3.3    0.10.0-p1  06-08-30 alex     Y Y Y Y 3
-i386/unknown/netbsdelf4.0   gcc 4.1.2    19         12-02-29 alex     Y Y Y Y 3
+i386/unknown/netbsdelf4.0   gcc 4.1.2    24~rc1-7   17-01-20 alex     Y Y Y Y 3
 i386/unknown/netbsdelf5.0.2 gcc 4.1.3    19         12-02-26 alex     Y Y Y Y 3
-i386/unknown/openbsd3.5     gcc 2.95.3   21         13-11-17 goetz    Y Y Y Y 3
+i386/unknown/openbsd3.5     gcc 2.95.3   23         15-11-27 goetz    Y Y y Y 3
 i386/unknown/openbsd3.9     gcc 3.3.5    0.10.0-p1  06-08-30 alex     Y Y Y Y 3
 i386/unknown/openbsd4.1     gcc 3.3.5    16         10-04-11 alex     Y Y Y Y 3
 i386/unknown/openbsd5.3     gcc 4.2.1    21         13-11-28 goetz    Y Y Y Y 3
 i386/unknown/openbsd5.4     gcc 4.2.1    21         13-11-28 goetz    Y Y Y Y 3
 i586/pc/haiku               gcc 2.95.3   19.2~138   12-10-11 user     Y Y N N
-i586/pc/interix3.5          gcc 3.3      19         12-02-29 alex     Y Y N Y
-i686/pc/cygwin              gcc 4.8.3    22~rc1-3   14-10-10 alex     Y Y N Y
-i686/pc/linux-gnu           gcc 2.7.2    21~38      14-01-06 goetz    Y Y Y Y 1
+i586/pc/interix3.5          gcc 3.3      23         16-01-29 alex     Y Y N Y
+i686/pc/cygwin              gcc 4.9.3    23         16-01-06 alex     Y Y Y Y
+i686/pc/linux-gnu           gcc 2.6.3    23         16-01-06 goetz    Y Y y Y 1
+i686/pc/linux-gnu           gcc 2.7.2.1  23         15-11-30 goetz    Y Y N Y 1
+i686/pc/linux-gnu           gcc 2.95.2   23         15-12-23 goetz    Y Y Y Y 1
 i686/pc/linux-gnu           gcc 2.95.4   0.8.0      04-05-30 alex     Y Y Y Y 1
 i686/pc/linux-gnu           gcc 3.3.5    14.1       09-08-04 alex     Y Y Y Y 1
-i386/pc/linux-gnu           gcc 4.1.2    13~rc1     08-12-05 alex     Y Y Y Y 1
-i386/pc/linux-gnu           gcc 4.4.5    22~rc1-3   14-10-10 alex     Y Y Y Y 1
 i686/pc/linux-gnu           gcc 4.3.2    14.1       09-08-04 alex     Y Y Y Y 1
+i686/pc/minix               gcc 4.4.6    21~rc2     13-10-27 alex     Y Y N N
+i686/unknown/gnu0.3         gcc 4.4.5    19         12-02-29 alex     Y Y Y Y
+i686/unknown/gnu0.5         gcc 4.9.1    22~rc1-3   14-10-11 alex     Y Y Y Y
+i686/unkn./kfreebsd7.2-gnu  gcc 4.3.4    15         09-12-02 alex     Y Y Y Y 3
 m68k/apple/aux3.0.1         gcc 2.7.2    17         10-11-07 alex     Y Y N Y
 m68k/apple/aux3.0.1         Orig. A/UX   17         10-11-07 alex     Y Y N Y 2
 m68k/apple/aux3.1.1         gcc 2.7.2    19         12-02-26 alex     Y Y N Y
@@ -90,21 +94,26 @@ x86_64/apple/darwin10.8.0   gcc 4.2.1    21~rc2     13-10-30 alex     Y Y Y Y 3
 x86_64/apple/darwin12.3.0   gcc 4.2.1    20.2       13-04-01 alex     Y Y Y Y 3
 x86_64/apple/darwin13.0.0   A-clang 5.0  21         14-01-02 alex     Y Y Y Y 3
 x86_64/apple/darwin14.5.0   A-clang 6.1  23~rc1     15-09-06 alex     Y Y Y Y 3
+x86_64/apple/darwin15.6.0   A-clang 8.0  23~38-g455 16-11-04 alex     Y Y Y Y 3
+x86_64/apple/darwin16.3.0   A-clang 8.0  24~rc1-7   17-01-20 alex     Y Y Y Y 3
 x86_64/unknown/dragonfly3.4 gcc 4.7.2    21         13-11-12 goetz    Y Y N Y 3
-x86_64/unknown/freebsd8.4   gcc 4.2.1    22~rc1-3   14-10-10 alex     Y Y y Y 3
+x86_64/unkn./freebsd8.1-gnu gcc 4.4.5    19         12-02-26 alex     Y Y Y Y 3
+x86_64/unknown/freebsd8.4   gcc 4.2.1    24~rc1-7   17-01-20 alex     Y Y Y Y 3
 x86_64/unknown/freebsd9.2   gcc 4.2.1    22~rc1-3   14-10-10 alex     Y Y Y Y 3
 x86_64/unknown/freebsd10.0  F-clang 3.3  22~rc1-3   14-10-10 alex     Y Y Y Y 3
-x86_64/unkn./freebsd8.1-gnu gcc 4.4.5    19         12-02-26 alex     Y Y Y Y 3
 x86_64/unknown/linux-gnu    clang 3.3    21         14-01-07 alex     Y Y Y Y 1
 x86_64/unknown/linux-gnu    clang 3.4    22~rc1-3   14-10-11 alex     Y Y Y Y 1
-x86_64/unknown/linux-gnu    gcc 4.4.5    23~rc1-3   15-11-15 alex     Y Y Y Y 1
+x86_64/pc/linux-gnu         gcc 4.4.5    24~rc1-7   17-01-20 alex     Y Y Y Y 1
 x86_64/unknown/linux-gnu    gcc 4.7.2    23~rc1-3   15-11-15 alex     Y Y Y Y 1
-x86_64/unknown/linux-gnu    gcc 4.8.2    21         13-12-29 alex     Y Y Y Y 1
-x86_64/unknown/linux-gnu    gcc 4.9.2    23~rc1-3   15-11-15 alex     Y Y Y Y 1
+x86_64/pc/linux-gnu         gcc 4.8.4    24~rc1-7   17-01-20 alex     Y Y Y Y 1
+x86_64/pc/linux-gnu         gcc 4.9.2    24~rc1-7   17-01-20 alex     Y Y Y Y 1
+x86_64/unknown/linux-gnu    gcc 5.3.0    23         15-12-14 goetz    Y Y Y Y 1
+x86_64/pc/linux-gnu         gcc 6.2.1    24~rc1-7   17-01-20 alex     Y Y Y Y 1
+x86_64/pc/linux-gnu         gcc 6.3.1    24~rc1-7   17-01-20 alex     Y Y Y Y 1
+x86_64/unknown/linux-gnu    icc 16       23         16-01-13 goetz    Y Y Y Y 1
 x86_64/unknown/linux-gnu    nwcc 0.8.2   21         13-12-01 goetz    Y Y Y Y 1
 x86_64/unknown/linux-gnu    Open64       21.1       14-03-27 goetz    Y Y Y Y 1
 x86_64/unknown/linux-gnu    Sun C 5.12   21.1       14-03-27 goetz    Y Y Y Y 1
-x86_64/unknown/linux-gnu    tcc 0.9.25   21.1       14-03-27 goetz    Y Y Y Y 1
 x86_64/unknown/openbsd4.7   gcc 3.3.5    20~rc1     12-02-26 alex     Y Y Y Y 3
 x86_64/unknown/openbsd4.8   gcc 4.2.1    22~rc1-3   14-10-10 alex     Y Y y Y 3
 x86_64/unknown/openbsd5.1   gcc 4.2.1    21         13-12-28 alex     Y Y Y Y 3

+ 6 - 6
doc/RFC.txt

@@ -1,9 +1,8 @@
 
                      ngIRCd - Next Generation IRC Server
+                           http://ngircd.barton.de/
 
-                      (c)2001-2003 by Alexander Barton,
-                    alex@barton.de, http://www.barton.de/
-
+               (c)2001-2017 Alexander Barton and Contributors.
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
 
@@ -11,7 +10,8 @@
 
 
 The Internet Relay Chat (IRC) protocol is documented in these Request for
-Comments (RFC), which you can get e.g. via <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",
 	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",
 	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!
 	;PAMIsOptional = no
 
+	# When PAM is enabled, this value determines the used PAM
+	# configuration.
+	# This setting allows to run multiple ngIRCd instances with
+	# different PAM configurations on each instance.
+	# If you set it to "ngircd-foo", PAM will use
+	# /etc/pam.d/ngircd-foo instead of the default
+	# /etc/pam.d/ngircd.
+	;PAMServiceName = ngircd
+
 	# Let ngIRCd send an "authentication PING" when a new client connects,
 	# and register this client only after receiving the corresponding
 	# "PONG" reply.

+ 1 - 1
man/ngircd.8.tmpl

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

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

@@ -1,7 +1,7 @@
 .\"
 .\" ngircd.conf(5) manual page template
 .\"
-.TH ngircd.conf 5 "Oct 2014" ngIRCd "ngIRCd Manual"
+.TH ngircd.conf 5 "Jan 2017" ngIRCd "ngIRCd Manual"
 .SH NAME
 ngircd.conf \- configuration file of ngIRCd
 .SH SYNOPSIS
@@ -83,7 +83,7 @@ blocks are used to configure pre-defined ("persistent") IRC channels.
 .PP
 There can be more than one [Operator], [Server] and [Channel] section per
 configuration file, one for each operator, server, and channel. [Global],
-[Limits], [Options], and [SSL] sections can occure multiple times, too, but
+[Limits], [Options], and [SSL] sections can occur multiple times, too, but
 each variable overwrites itself, only the last assignment is relevant.
 .SH [GLOBAL]
 The
@@ -339,6 +339,14 @@ able to distinguish between Ident'ified and PAM-authenticated users: both
 don't have a "~" character prepended to their respective user names!
 Default: no.
 .TP
+\fBPAMServiceName\fR (string)
+When PAM is enabled, this value determines the used PAM configuration.
+This setting allows to run multiple ngIRCd instances with different
+PAM configurations on each instance. If you set it to "ngircd-foo",
+PAM will use /etc/pam.d/ngircd-foo instead of the default
+/etc/pam.d/ngircd.
+Default: ngircd.
+.TP
 \fBRequireAuthPing\fR (boolean)
 Let ngIRCd send an "authentication PING" when a new client connects, and
 register this client only after receiving the corresponding "PONG" reply.

+ 2 - 2
src/config.h.in

@@ -168,8 +168,8 @@
 /* Define to 1 if you have the `socket' function. */
 #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. */
 #undef HAVE_STDBOOL_H

+ 8 - 0
src/ngircd/conf.c

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

+ 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 */
 GLOBAL bool Conf_PAMIsOptional;
 
+/** The service name to use for PAM */
+GLOBAL char Conf_PAMServiceName[MAX_PAM_SERVICE_NAME_LEN];
+
 /** Disable all CTCP commands except for /me ? */
 GLOBAL bool Conf_ScrubCTCP;
 

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

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

+ 45 - 64
src/ngircd/conn.c

@@ -182,7 +182,6 @@ cb_connserver(int sock, UNUSED short what)
 	CONN_ID idx = Socket2Index( sock );
 
 	if (idx <= NONE) {
-		LogDebug("cb_connserver wants to write on unknown socket?!");
 		io_close(sock);
 		return;
 	}
@@ -280,12 +279,11 @@ cb_clientserver(int sock, short what)
 {
 	CONN_ID idx = Socket2Index(sock);
 
-	assert(idx >= 0);
-
-	if (idx < 0) {
+	if (idx <= NONE) {
 		io_close(sock);
 		return;
 	}
+
 #ifdef SSL_SUPPORT
 	if (what & IO_WANTREAD
 	    || (Conn_OPTION_ISSET(&My_Connections[idx], CONN_SSL_WANT_WRITE))) {
@@ -307,32 +305,20 @@ cb_clientserver(int sock, short what)
 GLOBAL void
 Conn_Init( void )
 {
-	CONN_ID i;
+	int size;
 
-	Pool_Size = CONNECTION_POOL;
-	if ((Conf_MaxConnections > 0) &&
-		(Pool_Size > Conf_MaxConnections))
-			Pool_Size = Conf_MaxConnections;
-
-	if (!array_alloc(&My_ConnArray, sizeof(CONNECTION), (size_t)Pool_Size)) {
-		Log(LOG_EMERG, "Can't allocate memory! [Conn_Init]");
+	/* Initialize the "connection pool".
+	 * FIXME: My_Connetions/Pool_Size is needed by other parts of the
+	 * code; remove them! */
+	Pool_Size = 0;
+	size = Conf_MaxConnections > 0 ? Conf_MaxConnections : CONNECTION_POOL;
+	if (Socket2Index(size) <= NONE) {
+		Log(LOG_EMERG, "Failed to initialize connection pool!");
 		exit(1);
 	}
 
-	/* FIXME: My_Connetions/Pool_Size is needed by other parts of the
-	 * code; remove them! */
-	My_Connections = (CONNECTION*) array_start(&My_ConnArray);
-
-	LogDebug("Allocated connection pool for %d items (%ld bytes).",
-		array_length(&My_ConnArray, sizeof(CONNECTION)),
-		array_bytes(&My_ConnArray));
-
-	assert(array_length(&My_ConnArray, sizeof(CONNECTION)) >= (size_t)Pool_Size);
-
+	/* Initialize "listener" array. */
 	array_free( &My_Listeners );
-
-	for (i = 0; i < Pool_Size; i++)
-		Init_Conn_Struct(i);
 } /* Conn_Init */
 
 /**
@@ -1378,8 +1364,8 @@ New_Connection(int Sock, UNUSED bool IsSSL)
 	/* Check global connection limit */
 	if ((Conf_MaxConnections > 0) &&
 	    (NumConnections >= (size_t) Conf_MaxConnections)) {
-		Log(LOG_ALERT, "Can't accept connection: limit (%d) reached!",
-		    Conf_MaxConnections);
+		Log(LOG_ALERT, "Can't accept new connection on socket %d: Limit (%d) reached!",
+		    Sock, Conf_MaxConnections);
 		Simple_Message(new_sock, "ERROR :Connection limit reached");
 		close(new_sock);
 		return -1;
@@ -1398,23 +1384,10 @@ New_Connection(int Sock, UNUSED bool IsSSL)
 		return -1;
 	}
 
-	if (new_sock >= Pool_Size) {
-		if (!array_alloc(&My_ConnArray, sizeof(CONNECTION),
-				 (size_t) new_sock)) {
-			Log(LOG_EMERG,
-			    "Can't allocate memory! [New_Connection]");
-			Simple_Message(new_sock, "ERROR: Internal error");
-			close(new_sock);
-			return -1;
-		}
-		LogDebug("Bumped connection pool to %ld items (internal: %ld items, %ld bytes)",
-			 new_sock, array_length(&My_ConnArray,
-			 sizeof(CONNECTION)), array_bytes(&My_ConnArray));
-
-		/* Adjust pointer to new block */
-		My_Connections = array_start(&My_ConnArray);
-		while (Pool_Size <= new_sock)
-			Init_Conn_Struct(Pool_Size++);
+	if (Socket2Index(new_sock) <= NONE) {
+		Simple_Message(new_sock, "ERROR: Internal error");
+		close(new_sock);
+		return -1;
 	}
 
 	/* register callback */
@@ -1523,24 +1496,38 @@ Account_Connection(void)
 } /* Account_Connection */
 
 /**
- * Translate socket handle into connection index.
+ * Translate socket handle into connection index (for historical reasons, it is
+ * a 1:1 mapping today) and enlarge the "connection pool" accordingly.
  *
  * @param Sock	Socket handle.
- * @returns	Connecion index or NONE, if no connection could be found.
+ * @returns	Connecion index or NONE when the pool is too small.
  */
 static CONN_ID
 Socket2Index( int Sock )
 {
-	assert( Sock >= 0 );
+	assert(Sock > 0);
+	assert(Pool_Size >= 0);
+
+	if (Sock < Pool_Size)
+		return Sock;
 
-	if( Sock >= Pool_Size || My_Connections[Sock].sock != Sock ) {
-		/* the Connection was already closed again, likely due to
-		 * an error. */
-		LogDebug("Socket2Index: can't get connection for socket %d!", Sock);
+	/* Try to allocate more memory ... */
+	if (!array_alloc(&My_ConnArray, sizeof(CONNECTION), (size_t)Sock)) {
+		Log(LOG_EMERG,
+		    "Can't allocate memory to enlarge connection pool!");
 		return NONE;
 	}
+	LogDebug("Enlarged connection pool for %ld sockets (%ld items, %ld bytes)",
+		 Sock, array_length(&My_ConnArray, sizeof(CONNECTION)),
+		 array_bytes(&My_ConnArray));
+
+	/* Adjust pointer to new block, update size and initialize new items. */
+	My_Connections = array_start(&My_ConnArray);
+	while (Pool_Size <= Sock)
+		Init_Conn_Struct(Pool_Size++);
+
 	return Sock;
-} /* Socket2Index */
+}
 
 /**
  * Read data from the network to the read buffer. If an error occurs,
@@ -2007,10 +1994,7 @@ New_Server( int Server , ng_ipaddr_t *dest)
 		return;
 	}
 
-	if (!array_alloc(&My_ConnArray, sizeof(CONNECTION), (size_t)new_sock)) {
-		Log(LOG_ALERT,
-		    "Cannot allocate memory for server connection (socket %d)",
-		    new_sock);
+	if (Socket2Index(new_sock) <= NONE) {
 		close( new_sock );
 		Conf_Server[Server].conn_id = NONE;
 		return;
@@ -2024,8 +2008,6 @@ New_Server( int Server , ng_ipaddr_t *dest)
 		return;
 	}
 
-	My_Connections = array_start(&My_ConnArray);
-
 	assert(My_Connections[new_sock].sock <= 0);
 
 	Init_Conn_Struct(new_sock);
@@ -2472,9 +2454,7 @@ cb_clientserver_ssl(int sock, UNUSED short what)
 {
 	CONN_ID idx = Socket2Index(sock);
 
-	assert(idx >= 0);
-
-	if (idx < 0) {
+	if (idx <= NONE) {
 		io_close(sock);
 		return;
 	}
@@ -2524,12 +2504,13 @@ cb_connserver_login_ssl(int sock, short unused)
 {
 	CONN_ID idx = Socket2Index(sock);
 
-	assert(idx >= 0);
-	if (idx < 0) {
+	(void) unused;
+
+	if (idx <= NONE) {
 		io_close(sock);
 		return;
 	}
-	(void) unused;
+
 	switch (ConnSSL_Connect( &My_Connections[idx])) {
 		case 1: break;
 		case 0: LogDebug("ConnSSL_Connect: not ready");

+ 6 - 0
src/ngircd/defines.h

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

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

@@ -894,16 +894,16 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
 			list = Class_GetList(CLASS_GLINE);
 		else
 			list = Class_GetList(CLASS_KLINE);
-			list_item = Lists_GetFirst(list);
-			while (list_item) {
-				if (!IRC_WriteStrClient(from, RPL_STATSXLINE_MSG,
+		list_item = Lists_GetFirst(list);
+		while (list_item) {
+			if (!IRC_WriteStrClient(from, RPL_STATSXLINE_MSG,
 						Client_ID(from), query,
 						Lists_GetMask(list_item),
 						Lists_GetValidity(list_item),
 						Lists_GetReason(list_item)))
-					return DISCONNECTED;
-				list_item = Lists_GetNext(list_item);
-			}
+				return DISCONNECTED;
+			list_item = Lists_GetNext(list_item);
+		}
 		break;
 	case 'L':	/* Link status (servers and user links) */
 		if (!Op_Check(from, Req))

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

@@ -47,7 +47,7 @@
 static bool
 Bad_OperPass(CLIENT *Client, char *errtoken, char *errmsg)
 {
-	Log(LOG_WARNING, "Got invalid OPER from \"%s\": \"%s\" -- %s!",
+	Log(LOG_ERR|LOG_snotice, "Got invalid OPER from \"%s\": \"%s\" -- %s!",
 	    Client_Mask(Client), errtoken, errmsg);
 	/* Increase penalty to slow down possible brute force attacks */
 	IRC_SetPenalty(Client, 10);
@@ -398,7 +398,16 @@ IRC_xLINE(CLIENT *Client, REQUEST *Req)
 		return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
 					  Client_ID(Client), Req->command);
 
-	from = Op_Check(Client, Req);
+	if (!Conf_AllowRemoteOper && Client_Type(Client) == CLIENT_SERVER) {
+		/* Explicitely forbid remote servers to modify "x-lines" when
+		 * the "AllowRemoteOper" configuration option isn't set, even
+		 * when the command seems to originate from the remote server
+		 * itself: this prevents GLINE's to become set during server
+		 * handshake in this case (what wouldn't be possible during
+		 * regular runtime when a remote IRC Op sends the command). */
+		from = NULL;
+	} else
+		from = Op_Check(Client, Req);
 	if (!from)
 		return Op_NoPrivileges(Client, Req);
 

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

@@ -31,6 +31,7 @@
 #include "parse.h"
 #include "numeric.h"
 #include "ngircd.h"
+#include "irc.h"
 #include "irc-info.h"
 #include "irc-write.h"
 #include "op.h"
@@ -245,66 +246,96 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req )
 	CHANNEL *chan;
 	CLIENT *c;
 
-	assert( Client != NULL );
-	assert( Req != NULL );
+	assert(Client != NULL);
+	assert(Req != NULL);
 
-	strlcpy( nick_in, Req->argv[1], sizeof( nick_in ));
-	strcpy( nick_out, "" );
+	strlcpy(nick_in, Req->argv[1], sizeof(nick_in));
+	strcpy(nick_out, "");
 
 	channame = Req->argv[0];
-	ptr = strtok( nick_in, "," );
-	while( ptr )
-	{
+
+	ptr = strtok(nick_in, ",");
+	while (ptr) {
 		is_owner = is_chanadmin = is_op = is_halfop = is_voiced = false;
 
 		/* cut off prefixes */
-		while(( *ptr == '~') || ( *ptr == '&' ) || ( *ptr == '@' ) ||
-			( *ptr == '%') || ( *ptr == '+' ))
-		{
-			if( *ptr == '~' ) is_owner = true;
-			if( *ptr == '&' ) is_chanadmin = true;
-			if( *ptr == '@' ) is_op = true;
-			if( *ptr == 'h' ) is_halfop = true;
-			if( *ptr == '+' ) is_voiced = true;
+		while ((*ptr == '~') || (*ptr == '&') || (*ptr == '@') ||
+		       (*ptr == '%') || (*ptr == '+')) {
+			if (*ptr == '~')
+				is_owner = true;
+			if (*ptr == '&')
+				is_chanadmin = true;
+			if (*ptr == '@')
+				is_op = true;
+			if (*ptr == '%')
+				is_halfop = true;
+			if (*ptr == '+')
+				is_voiced = true;
 			ptr++;
 		}
 
-		c = Client_Search( ptr );
-		if( c )
-		{
-			Channel_Join( c, channame );
-			chan = Channel_Search( channame );
-			assert( chan != NULL );
-
-			if( is_owner ) Channel_UserModeAdd( chan, c, 'q' );
-			if( is_chanadmin ) Channel_UserModeAdd( chan, c, 'a' );
-			if( is_op ) Channel_UserModeAdd( chan, c, 'o' );
-			if( is_halfop ) Channel_UserModeAdd( chan, c, 'h' );
-			if( is_voiced ) Channel_UserModeAdd( chan, c, 'v' );
-
-			/* announce to channel... */
-			IRC_WriteStrChannelPrefix( Client, chan, c, false, "JOIN :%s", channame );
-
-			/* set Channel-User-Modes */
-			strlcpy( modes, Channel_UserModes( chan, c ), sizeof( modes ));
-			if( modes[0] )
-			{
-				/* send modes to channel */
-				IRC_WriteStrChannelPrefix( Client, chan, Client, false, "MODE %s +%s %s", channame, modes, Client_ID( c ));
-			}
+		c = Client_Search(ptr);