Browse Source

Import upstream version 21.1

Alexander Barton 10 years ago
parent
commit
1316aae536

+ 1 - 1
AUTHORS

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

+ 48 - 2
ChangeLog

@@ -2,19 +2,65 @@
                      ngIRCd - Next Generation IRC Server
                            http://ngircd.barton.de/
 
-               (c)2001-2013 Alexander Barton and Contributors.
+               (c)2001-2014 Alexander Barton and Contributors.
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
 
                                -- ChangeLog --
 
 
+ngIRCd 21.1 (2014-03-25)
+
+  - Don't ignore but use the server password when PAM is compiled in but
+    disabled. Thanks to Roy Sindre Norangshol <roy.sindre@norangshol.no>!
+  - doc/Platforms.txt: Update from master branch.
+  - Really kill connections that send "spoofed prefixes" on non-server links.
+    This fixes commit 6cbe1308 which only killed the connection when the
+    spoofed prefix itself belonged to a non-server client.
+  - CHARCONV command: Fix handling conversion errors, don't overwrite already
+    converted text!
+  - doc/Services.txt: Update information for Anope 2.x.
+  - Correctly use cloaked IRC masks on "INVITE nickname": The cloaked IRC mask
+    of a user is his visible mask, so the daemon has to use it for generating
+    the "one time" entries for the invite list of the given channel, and not
+    the "real" mask which will never match while the target client is "+x", and
+    even worse, will disclose the real mask on "MODE #channel +I" commands :-/
+    Bug reported by Cahata on #ngircd, thanks!
+  - configure: Only link "contrib/Debian" if it exists. This isn't the case on
+    "VPATH builds", for example.
+  - Use $(MKDIR_P) instead of $(mkinstalldirs) in Makefile's and test for
+    "mkdir -p" using AC_PROG_MKDIR_P in "configure".
+  - Fix configure script and "make check" for TCP Wrappers (problems spotted on
+    OpenBSD): add missing #include's and static variables, and add libwrap at
+    the end of the configure run because if libwrap becomes added earlier,
+    other tests may fail.
+  - configure: add support for the LDFLAGS_END and LIBS_END variables to add
+    linker flags and libraries at the end of the configure run (CFLAGS_END has
+    been implemented already).
+  - platformtest.sh and Makefile.am: Don't use "test -e", it isn't portable.
+  - Update Copyright notices for 2014 :-)
+  - Fix permanent {G|K}LINES (with a timeout of 0 seconds).
+  - WEBIRC: Don't set the hostname received by the WEBIRC command when DNS
+    lookups are disabled, but use the IP address instead.
+    Reported by Toni Spets <toni.spets@iki.fi>, thanks!
+  - Check for working getaddrinfo() function: At least AIX 4.3.3 and 5.1 have a
+    broken implementation of getaddrinfo() which doesn't handle "0" as numeric
+    service correctly. This patch adds a configure check for this case and
+    changes all calling functions to only use getaddrinfo() if it "works".
+    See <http://www.stacken.kth.se/lists/heimdal-discuss/2004-05/msg00059.html>
+  - Only use the unsetenv() function when it is available (AIX 4.3 doesn't
+    support it, for example).
+  - Make sure that the source code is still compatible with the "ansi2knr" tool
+    and builds using non-ANSI K&R C compilers. Tested with Apple C on A/UX.
+  - Fix building ngIRCd without support for ZLIB compression.  Reported by
+    "der_baer" on #ngircd, thanks!
+
 ngIRCd 21 (2013-10-30)
 
   - ./contrib/Debian/ngircd.init: Make sure no stale PID file is left over
     when (re-)starting ngIRCd.
   - Change ./contrib/platformtest.sh and update ./doc/Platforms.txt to
-    allow usernames up to 8 characters.
+    allow user names up to 8 characters.
   - Call arc4random_stir() in forked subprocesses, when available. This
     is required by FreeBSD <10 and current NetBSD at least to correctly
     initialize the "arc4" random number generator on these platforms.

+ 1 - 1
INSTALL

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

+ 1 - 1
Makefile.am

@@ -69,7 +69,7 @@ osxpkg: have-packagemaker osxpkg-dest
 	make osxpkg-clean
 
 osxpkg-clean:
-	[ ! -e ngircd.dest ] || sudo -n rm -rf ngircd.dest
+	[ ! -r ngircd.dest ] || sudo -n rm -rf ngircd.dest
 	rm -rf ngircd.dest $(distdir).mpkg
 
 osxpkg-dest: have-xcodebuild osxpkg-clean clean

+ 1 - 1
Makefile.in

@@ -741,7 +741,7 @@ osxpkg: have-packagemaker osxpkg-dest
 	make osxpkg-clean
 
 osxpkg-clean:
-	[ ! -e ngircd.dest ] || sudo -n rm -rf ngircd.dest
+	[ ! -r ngircd.dest ] || sudo -n rm -rf ngircd.dest
 	rm -rf ngircd.dest $(distdir).mpkg
 
 osxpkg-dest: have-xcodebuild osxpkg-clean clean

+ 12 - 1
NEWS

@@ -2,13 +2,24 @@
                      ngIRCd - Next Generation IRC Server
                            http://ngircd.barton.de/
 
-               (c)2001-2013 Alexander Barton and Contributors.
+               (c)2001-2014 Alexander Barton and Contributors.
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
 
                                   -- NEWS --
 
 
+ngIRCd 21.1 (2014-03-25)
+
+  - Don't ignore but use the server password when PAM is compiled in but
+    disabled. Thanks to Roy Sindre Norangshol <roy.sindre@norangshol.no>!
+  - doc/Platforms.txt: Update from master branch.
+  - doc/Services.txt: Update information for Anope 2.x.
+  - configure: add support for the LDFLAGS_END and LIBS_END variables to add
+    linker flags and libraries at the end of the configure run (CFLAGS_END has
+    been implemented already).
+  - Update Copyright notices for 2014 :-)
+
 ngIRCd 21 (2013-10-30)
 
   - Call arc4random_stir() in forked subprocesses, when available. This

+ 1 - 1
README

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

+ 89 - 14
configure

@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.67 for ngIRCd 21.
+# Generated by GNU Autoconf 2.67 for ngIRCd 21.1.
 #
 # Report bugs to <ngircd-ml@ngircd.barton.de>.
 #
@@ -552,8 +552,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='ngIRCd'
 PACKAGE_TARNAME='ngircd'
-PACKAGE_VERSION='21'
-PACKAGE_STRING='ngIRCd 21'
+PACKAGE_VERSION='21.1'
+PACKAGE_STRING='ngIRCd 21.1'
 PACKAGE_BUGREPORT='ngircd-ml@ngircd.barton.de'
 PACKAGE_URL='http://ngircd.barton.de/'
 
@@ -1269,7 +1269,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 21 to adapt to many kinds of systems.
+\`configure' configures ngIRCd 21.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1339,7 +1339,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of ngIRCd 21:";;
+     short | recursive ) echo "Configuration of ngIRCd 21.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1452,7 +1452,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-ngIRCd configure 21
+ngIRCd configure 21.1
 generated by GNU Autoconf 2.67
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1985,7 +1985,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 21, which was
+It was created by ngIRCd $as_me 21.1, which was
 generated by GNU Autoconf 2.67.  Invocation command line was
 
   $ $0 $@
@@ -2277,7 +2277,6 @@ as_fn_append ac_header_list " varargs.h"
 as_fn_append ac_func_list " arc4random"
 as_fn_append ac_func_list " arc4random_stir"
 as_fn_append ac_func_list " gai_strerror"
-as_fn_append ac_func_list " getaddrinfo"
 as_fn_append ac_func_list " getnameinfo"
 as_fn_append ac_func_list " inet_aton"
 as_fn_append ac_func_list " sigaction"
@@ -2289,6 +2288,7 @@ as_fn_append ac_func_list " strndup"
 as_fn_append ac_func_list " strlcpy"
 as_fn_append ac_func_list " strlcat"
 as_fn_append ac_func_list " strtok_r"
+as_fn_append ac_func_list " unsetenv"
 as_fn_append ac_func_list " waitpid"
 # Check that the precious variables saved in the cache have kept the same
 # value.
@@ -2901,7 +2901,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='ngircd'
- VERSION='21'
+ VERSION='21.1'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -4339,6 +4339,7 @@ $as_echo "no" >&6; }
   SET_MAKE="MAKE=${MAKE-make}"
 fi
 
+
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
@@ -4996,6 +4997,8 @@ done
 
 
 
+
+
 if test "$GCC" = "yes"; then
 	# We are using the GNU C compiler. Good!
 	CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
@@ -6005,6 +6008,68 @@ done
 
 
 
+
+	for ac_func in getaddrinfo
+do :
+  ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo"
+if test "x$ac_cv_func_getaddrinfo" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_GETADDRINFO 1
+_ACEOF
+
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getaddrinfo() works" >&5
+$as_echo_n "checking whether getaddrinfo() works... " >&6; }
+		if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+int
+main(int argc, char **argv)
+{
+	struct addrinfo hints, *ai;
+	memset(&hints, 0, sizeof(hints));
+	hints.ai_flags = AI_PASSIVE;
+	hints.ai_socktype = SOCK_STREAM;
+	hints.ai_family = PF_UNSPEC;
+	if(getaddrinfo(NULL, "0", &hints, &ai) != 0)
+		return 1;
+	return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+
+$as_echo "#define HAVE_WORKING_GETADDRINFO 1" >>confdefs.h
+
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+fi
+done
+
+
+
 # -- Configuration options --
 
 # use syslog?
@@ -6805,10 +6870,14 @@ if test "${with_tcp_wrappers+set}" = set; then :
 			fi
 			{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for hosts_access" >&5
 $as_echo_n "checking for hosts_access... " >&6; }
+			saved_LIBS="$LIBS"
 			LIBS="-lwrap $LIBS"
+			LIBS_END="-lwrap $LIBS_END"
 			cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+#include <sys/types.h>
+#include <sys/socket.h>
 #include <tcpd.h>
 int allow_severity = 0;
 int deny_severity = 0;
@@ -6840,6 +6909,7 @@ $as_echo "no" >&6; }
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
+			LIBS="$saved_LIBS"
 		fi
 
 
@@ -7302,9 +7372,12 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-# Add additional CFLAGS, eventually specified on the command line, but after
-# running this configure script. Useful for "-Werror" for example.
+# Add additional CFLAGS, LDFLAGS and LIBS which were specified on the command
+# line or by some tests from above, but after running this script. Useful for
+# adding "-Werror", for example:
 test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
+test -n "$LDFLAGS_END" && LDFLAGS="$LDFLAGS $LDFLAGS_END"
+test -n "$LIBS_END" && LIBS="$LIBS $LIBS_END"
 
 # -- Generate files --
 
@@ -7832,7 +7905,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 21, which was
+This file was extended by ngIRCd $as_me 21.1, which was
 generated by GNU Autoconf 2.67.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -7899,7 +7972,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 21
+ngIRCd config.status 21.1
 configured by $0, generated by GNU Autoconf 2.67,
   with options \\"\$ac_cs_config\\"
 
@@ -8776,7 +8849,9 @@ if test $? -eq 0; then
 	# Generate debian/ link if the dpkg command exists
 	# (read: if we are running on a debian compatible system)
 	echo "creating Debian-specific links ..."
-	test -f debian/rules || ln -s contrib/Debian debian
+	if test ! -f debian/rules -a -f contrib/Debian/rules; then
+		ln -s contrib/Debian debian
+	fi
 fi
 
 # -- Result --

+ 48 - 6
configure.ac

@@ -67,6 +67,7 @@ AC_PROG_AWK
 AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_MAKE_SET
+AC_PROG_MKDIR_P
 AC_PROG_RANLIB
 
 # -- Compiler Features --
@@ -92,6 +93,35 @@ AC_DEFUN([GCC_STACK_PROTECT_CC],[
   fi
 ])
 
+AC_DEFUN([WORKING_GETADDRINFO],[
+	AC_CHECK_FUNCS([getaddrinfo],[
+		AC_MSG_CHECKING([whether getaddrinfo() works])
+		AC_TRY_RUN([
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+int
+main(int argc, char **argv)
+{
+	struct addrinfo hints, *ai;
+	memset(&hints, 0, sizeof(hints));
+	hints.ai_flags = AI_PASSIVE;
+	hints.ai_socktype = SOCK_STREAM;
+	hints.ai_family = PF_UNSPEC;
+	if(getaddrinfo(NULL, "0", &hints, &ai) != 0)
+		return 1;
+	return 0;
+}
+		],[
+		AC_DEFINE([HAVE_WORKING_GETADDRINFO], 1, [getaddrinfo(0)])
+		AC_MSG_RESULT(yes)
+		],[
+		AC_MSG_RESULT(no)
+		])
+	])
+])
+
 if test "$GCC" = "yes"; then
 	# We are using the GNU C compiler. Good!
 	CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
@@ -186,10 +216,12 @@ AC_CHECK_FUNCS([ \
 	AC_MSG_ERROR([required function missing!]))
 
 # Optional functions
-AC_CHECK_FUNCS_ONCE([ \
-	arc4random arc4random_stir gai_strerror getaddrinfo getnameinfo inet_aton
+AC_CHECK_FUNCS_ONCE([
+	arc4random arc4random_stir gai_strerror getnameinfo inet_aton \
 	sigaction sigprocmask snprintf vsnprintf strdup strndup strlcpy strlcat \
-	strtok_r waitpid])
+	strtok_r unsetenv waitpid])
+
+WORKING_GETADDRINFO
 
 # -- Configuration options --
 
@@ -432,8 +464,12 @@ AC_ARG_WITH(tcp-wrappers,
 				LDFLAGS="-L$withval/lib $LDFLAGS"
 			fi
 			AC_MSG_CHECKING(for hosts_access)
+			saved_LIBS="$LIBS"
 			LIBS="-lwrap $LIBS"
+			LIBS_END="-lwrap $LIBS_END"
 			AC_TRY_LINK([
+#include <sys/types.h>
+#include <sys/socket.h>
 #include <tcpd.h>
 int allow_severity = 0;
 int deny_severity = 0;
@@ -447,6 +483,7 @@ int deny_severity = 0;
 				AC_MSG_RESULT(no)
 				AC_MSG_ERROR([Can't enable TCP wrappers!])
 			])
+			LIBS="$saved_LIBS"
 		fi
 	]
 )
@@ -602,9 +639,12 @@ AC_DEFINE_UNQUOTED(HOST_CPU, "$host_cpu" )
 AC_DEFINE_UNQUOTED(HOST_VENDOR, "$host_vendor" )
 AC_DEFINE_UNQUOTED(HOST_OS, "$host_os" )
 
-# Add additional CFLAGS, eventually specified on the command line, but after
-# running this configure script. Useful for "-Werror" for example.
+# Add additional CFLAGS, LDFLAGS and LIBS which were specified on the command
+# line or by some tests from above, but after running this script. Useful for
+# adding "-Werror", for example:
 test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
+test -n "$LDFLAGS_END" && LDFLAGS="$LDFLAGS $LDFLAGS_END"
+test -n "$LIBS_END" && LIBS="$LIBS $LIBS_END"
 
 # -- Generate files --
 
@@ -633,7 +673,9 @@ if test $? -eq 0; then
 	# Generate debian/ link if the dpkg command exists
 	# (read: if we are running on a debian compatible system)
 	echo "creating Debian-specific links ..."
-	test -f debian/rules || ln -s contrib/Debian debian
+	if test ! -f debian/rules -a -f contrib/Debian/rules; then
+		ln -s contrib/Debian debian
+	fi
 fi
 
 # -- Result --

+ 48 - 6
configure.ng

@@ -67,6 +67,7 @@ AC_PROG_AWK
 AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_MAKE_SET
+AC_PROG_MKDIR_P
 AC_PROG_RANLIB
 
 # -- Compiler Features --
@@ -92,6 +93,35 @@ AC_DEFUN([GCC_STACK_PROTECT_CC],[
   fi
 ])
 
+AC_DEFUN([WORKING_GETADDRINFO],[
+	AC_CHECK_FUNCS([getaddrinfo],[
+		AC_MSG_CHECKING([whether getaddrinfo() works])
+		AC_TRY_RUN([
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+int
+main(int argc, char **argv)
+{
+	struct addrinfo hints, *ai;
+	memset(&hints, 0, sizeof(hints));
+	hints.ai_flags = AI_PASSIVE;
+	hints.ai_socktype = SOCK_STREAM;
+	hints.ai_family = PF_UNSPEC;
+	if(getaddrinfo(NULL, "0", &hints, &ai) != 0)
+		return 1;
+	return 0;
+}
+		],[
+		AC_DEFINE([HAVE_WORKING_GETADDRINFO], 1, [getaddrinfo(0)])
+		AC_MSG_RESULT(yes)
+		],[
+		AC_MSG_RESULT(no)
+		])
+	])
+])
+
 if test "$GCC" = "yes"; then
 	# We are using the GNU C compiler. Good!
 	CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
@@ -186,10 +216,12 @@ AC_CHECK_FUNCS([ \
 	AC_MSG_ERROR([required function missing!]))
 
 # Optional functions
-AC_CHECK_FUNCS_ONCE([ \
-	arc4random arc4random_stir gai_strerror getaddrinfo getnameinfo inet_aton
+AC_CHECK_FUNCS_ONCE([
+	arc4random arc4random_stir gai_strerror getnameinfo inet_aton \
 	sigaction sigprocmask snprintf vsnprintf strdup strndup strlcpy strlcat \
-	strtok_r waitpid])
+	strtok_r unsetenv waitpid])
+
+WORKING_GETADDRINFO
 
 # -- Configuration options --
 
@@ -432,8 +464,12 @@ AC_ARG_WITH(tcp-wrappers,
 				LDFLAGS="-L$withval/lib $LDFLAGS"
 			fi
 			AC_MSG_CHECKING(for hosts_access)
+			saved_LIBS="$LIBS"
 			LIBS="-lwrap $LIBS"
+			LIBS_END="-lwrap $LIBS_END"
 			AC_TRY_LINK([
+#include <sys/types.h>
+#include <sys/socket.h>
 #include <tcpd.h>
 int allow_severity = 0;
 int deny_severity = 0;
@@ -447,6 +483,7 @@ int deny_severity = 0;
 				AC_MSG_RESULT(no)
 				AC_MSG_ERROR([Can't enable TCP wrappers!])
 			])
+			LIBS="$saved_LIBS"
 		fi
 	]
 )
@@ -602,9 +639,12 @@ AC_DEFINE_UNQUOTED(HOST_CPU, "$host_cpu" )
 AC_DEFINE_UNQUOTED(HOST_VENDOR, "$host_vendor" )
 AC_DEFINE_UNQUOTED(HOST_OS, "$host_os" )
 
-# Add additional CFLAGS, eventually specified on the command line, but after
-# running this configure script. Useful for "-Werror" for example.
+# Add additional CFLAGS, LDFLAGS and LIBS which were specified on the command
+# line or by some tests from above, but after running this script. Useful for
+# adding "-Werror", for example:
 test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
+test -n "$LDFLAGS_END" && LDFLAGS="$LDFLAGS $LDFLAGS_END"
+test -n "$LIBS_END" && LIBS="$LIBS $LIBS_END"
 
 # -- Generate files --
 
@@ -633,7 +673,9 @@ if test $? -eq 0; then
 	# Generate debian/ link if the dpkg command exists
 	# (read: if we are running on a debian compatible system)
 	echo "creating Debian-specific links ..."
-	test -f debian/rules || ln -s contrib/Debian debian
+	if test ! -f debian/rules -a -f contrib/Debian/rules; then
+		ln -s contrib/Debian debian
+	fi
 fi
 
 # -- Result --

+ 6 - 0
contrib/Debian/changelog

@@ -1,3 +1,9 @@
+ngircd (21.1-0ab1) unstable; urgency=low
+
+  * New "upstream" release: ngIRCd 21.1.
+
+ -- Alexander Barton <alex@barton.de>  Tue, 25 Mar 2014 14:44:59 +0100
+
 ngircd (21-0ab1) unstable; urgency=low
 
   * New "upstream" release: ngIRCd 21.

+ 2 - 0
contrib/MacOSX/config.h

@@ -105,6 +105,8 @@
 #define HAVE_INET_ATON 1
 /* Define to 1 if you have the `getaddrinfo' function. */
 #define HAVE_GETADDRINFO 1
+/* getaddrinfo(0) */
+#define HAVE_WORKING_GETADDRINFO 1
 /* Define to 1 if you have the `getnameinfo' function. */
 #define HAVE_GETNAMEINFO 1
 /* Define to 1 if you have the `sigaction' function. */

+ 1 - 1
contrib/MacOSX/ngIRCd.pmdoc/index.xml

@@ -5,7 +5,7 @@
 \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\qc\pardirnatural
 
 \f0\i\fs24 \cf0 ngIRCd -- The Next Generation IRC Daemon\
-Copyright (c)2001-2013 Alexander Barton and Contributors.\
+Copyright (c)2001-2014 Alexander Barton and Contributors.\
 \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural
 
 \i0 \cf0 \

+ 1 - 1
contrib/ngircd.spec

@@ -1,5 +1,5 @@
 %define name    ngircd
-%define version 21
+%define version 21.1
 %define release 1
 %define prefix  %{_prefix}
 

+ 2 - 2
contrib/platformtest.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-2014 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
@@ -65,7 +65,7 @@ if [ -d .git ]; then
 fi
 
 echo "$NAME: Checking for \"./configure\" script ..."
-if [ ! -e ./configure ]; then
+if [ ! -r ./configure ]; then
 	echo "$NAME: Running \"./autogen.sh\" ..."
 	[ -n "$VERBOSE" ] && ./autogen.sh || ./autogen.sh >/dev/null
 fi

+ 2 - 2
doc/Makefile.am

@@ -54,11 +54,11 @@ maintainer-clean-local:
 all: $(generated_docs)
 
 install-data-hook: $(static_docs) $(toplevel_docs) $(generated_docs)
-	$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
+	$(MKDIR_P) -m 755 $(DESTDIR)$(sysconfdir)
 	@if [ ! -f $(DESTDIR)$(sysconfdir)/ngircd.conf ]; then \
 	  make install-config; \
 	 fi
-	$(mkinstalldirs) $(DESTDIR)$(docdir)
+	$(MKDIR_P) -m 755 $(DESTDIR)$(docdir)
 	for f in $(static_docs) $(toplevel_docs); do \
 	  $(INSTALL) -m 644 -c $(srcdir)/$$f $(DESTDIR)$(docdir)/; \
 	 done

+ 2 - 2
doc/Makefile.in

@@ -586,11 +586,11 @@ maintainer-clean-local:
 all: $(generated_docs)
 
 install-data-hook: $(static_docs) $(toplevel_docs) $(generated_docs)
-	$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
+	$(MKDIR_P) -m 755 $(DESTDIR)$(sysconfdir)
 	@if [ ! -f $(DESTDIR)$(sysconfdir)/ngircd.conf ]; then \
 	  make install-config; \
 	 fi
-	$(mkinstalldirs) $(DESTDIR)$(docdir)
+	$(MKDIR_P) -m 755 $(DESTDIR)$(docdir)
 	for f in $(static_docs) $(toplevel_docs); do \
 	  $(INSTALL) -m 644 -c $(srcdir)/$$f $(DESTDIR)$(docdir)/; \
 	 done

+ 24 - 16
doc/Platforms.txt

@@ -31,6 +31,7 @@ armv6l/unk./linux-gnueabi   gcc 4.7.2    20.2       13-03-08 goetz    Y Y Y Y 5
 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
 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    21         13-11-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
 hppa2.0/unknown/linux-gnu   gcc 3.3.5    13~rc1     08-12-02 alex     Y Y Y Y
 hppa2.0w-hp-hpux11.11       gcc 4.2.3    14.1       09-07-22 goetz    Y Y Y Y
@@ -44,19 +45,22 @@ 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.8.1    21~rc2     13-10-27 alex     Y Y Y Y
+i686/unknown/gnu0.5         gcc 4.8.2    21         14-02-09 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/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/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.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~rc2     13-10-21 dspruell 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 3.3.1    0.8.0      04-05-30 alex     Y Y N Y
-i686/pc/linux-gnu           gcc 2.7.2    19.1       12-05-30 goetz    Y Y Y Y 1
+i686/pc/cygwin              gcc 4.8.2    21         14-01-02 alex     Y Y N Y
+i686/pc/linux-gnu           gcc 2.7.2    21~38      14-01-06 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
@@ -68,10 +72,11 @@ m68k/apple/aux3.1.1         Orig. A/UX   19         12-02-26 alex     Y Y N Y 2
 m68k/hp/hp-ux9.10           Orig. HPUX   0.7.x-CVS  03-04-30 goetz    Y Y Y Y
 m88k/dg/dgux5.4R3.10        gcc 2.5.8    CVSHEAD    04-03-15 alex     Y Y ? ?
 mipsel/unknown/linux-gnu    gcc 4.1.2    18         11-07-05 goetz    Y Y N Y 1
-mipsel/unknown/linux-gnu    gcc 4.4.5    18         11-07-30 goetz    Y Y Y Y 1
-powerpc/apple/darwin6.5     gcc 3.1      0.7.x-CVS  03-04-23 alex     Y Y Y Y
-powerpc/apple/darwin7.9.0   gcc 3.3      19.1       12-05-22 goetz    Y Y Y Y 3
+mipsel/unknown/linux-gnu    gcc 4.4.5    21         13-11-24 goetz    Y Y Y Y 1
+powerpc/apple/darwin6.8     gcc 3.1      21         14-01-03 goetz    Y Y Y Y
+powerpc/apple/darwin7.9.0   gcc 3.3      21         14-01-11 goetz    Y Y Y Y 3
 powerpc/apple/darwin8.11.0  gcc 4.0.1    18         11-07-02 goetz    Y Y Y Y 3
+powerpc/apple/darwin9.8.0   gcc 4.0.1    21         14-01-04 goetz    Y Y Y Y 3
 powerpc/unknown/linux-gnu   gcc 3.3.3    0.8.0      04-05-30 alex     Y Y Y Y
 powerpc/unknown/openbsd3.6  gcc 2.95.3   0.10.0     06-10-08 alex     Y Y N Y
 sparc/sun/solaris2.6        gcc 2.95.3   0.7.x-CVS  03-04-22 alex     Y Y Y Y
@@ -79,17 +84,20 @@ sparc/sun/solaris2.7        gcc 3.3      0.8.0      04-05-30 alex     Y Y Y Y
 sparc/unkn./netbsdelf1.6.1  gcc 2.95.3   0.8.0      04-05-30 alex     Y Y Y Y
 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~rc2     13-10-20 alex     Y Y Y Y 3
-x86_64/unknown/freebsd8.4   gcc 4.2.1    21~rc2     13-10-27 alex     Y Y Y Y 3
-x86_64/unknown/freebsd9.1   gcc 4.2.1    21~rc2     13-10-27 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/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    21         14-01-02 alex     Y Y Y Y 3
+x86_64/unknown/freebsd9.1   gcc 4.2.1    21         14-01-02 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.2    21~rc2     13-10-20 alex     Y Y Y Y 1
-x86_64/unknown/linux-gnu    gcc 4.8.1    21~rc2     13-10-20 alex     Y Y Y Y 1
-x86_64/unknown/linux-gnu    Open64       20.3       13-10-16 goetz    Y Y Y Y 1
-x86_64/unknown/linux-gnu    tcc 0.9.25   20.3       13-10-16 goetz    Y Y Y Y 1
+x86_64/unknown/linux-gnu    clang 3.3    21         14-01-07 alex     Y Y Y Y 1
+x86_64/unknown/linux-gnu    gcc 4.8.2    21         13-12-29 alex     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         13-11-30 goetz    Y Y Y Y 1
+x86_64/unknown/linux-gnu    Sun C 5.12   21         13-11-22 goetz    Y Y Y Y 1
+x86_64/unknown/linux-gnu    tcc 0.9.25   21         13-11-30 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    21~rc2     13-10-27 alex     Y Y Y Y 3
-x86_64/unknown/openbsd5.1   gcc 4.2.1    21~rc2     13-10-27 alex     Y Y Y Y 3
+x86_64/unknown/openbsd4.8   gcc 4.2.1    21         13-12-28 alex     Y Y Y Y 3
+x86_64/unknown/openbsd5.1   gcc 4.2.1    21         13-12-28 alex     Y Y Y Y 3
 
 
 * Notes

+ 12 - 4
doc/Services.txt

@@ -41,8 +41,8 @@ Example:
      ServiceMask = *Serv
 
 
-Setting up Anope 1.9.x
-~~~~~~~~~~~~~~~~~~~~~~
+Setting up Anope 1.9.x & 2.x
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Anope 1.9.8 or later (<http://www.anope.org/>) can be used with ngIRCd using
 the "ngircd" protocol module.
@@ -66,20 +66,28 @@ In conf/services.conf:
   }
 
   # Load ngIRCd protocol module
-  module { name = "ngircd" }
+  module
+  {
+	name = "ngircd"
+  }
 
   networkinfo
   {
 	# Must be set to the "MaxNickLength" setting of ngIRCd!
 	nicklen = 9
 
+	# When not using "strict mode", which is the default:
+	userlen = 20
+
 	chanlen = 50
   }
 
 In conf/nickserv.conf:
 
-  nickserv
+  module
   {
+	name = "nickserv"
+
 	# not required if you are running ngIRCd with a higher nickname limit
 	# ("MaxNickLength") than 11 characters, but REQUIRED by default!
 	guestnickprefix = "G-"

+ 6 - 0
src/config.h.in

@@ -252,6 +252,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the `unsetenv' function. */
+#undef HAVE_UNSETENV
+
 /* Define to 1 if you have the <varargs.h> header file. */
 #undef HAVE_VARARGS_H
 
@@ -270,6 +273,9 @@
 /* Define to 1 if `fork' works. */
 #undef HAVE_WORKING_FORK
 
+/* getaddrinfo(0) */
+#undef HAVE_WORKING_GETADDRINFO
+
 /* Define to 1 if `vfork' works. */
 #undef HAVE_WORKING_VFORK
 

+ 1 - 1
src/ipaddr/ng_ipaddr.c

@@ -23,7 +23,7 @@
 GLOBAL bool
 ng_ipaddr_init(ng_ipaddr_t *addr, const char *ip_str, UINT16 port)
 {
-#ifdef HAVE_GETADDRINFO
+#ifdef HAVE_WORKING_GETADDRINFO
 	int ret;
 	char portstr[64];
 	struct addrinfo *res0;

+ 4 - 2
src/ngircd/class.c

@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2014 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
@@ -50,11 +50,13 @@ Class_Exit(void)
 GLOBAL bool
 Class_GetMemberReason(const int Class, CLIENT *Client, char *reason, size_t len)
 {
-	char str[COMMAND_LEN] = "listed";
+	char str[COMMAND_LEN];
 
 	assert(Class < CLASS_COUNT);
 	assert(Client != NULL);
 
+	strlcpy(str, "listed", sizeof(str));
+
 	if (!Lists_CheckReason(&My_Classes[Class], Client, str, sizeof(str)))
 		return false;
 

+ 1 - 1
src/ngircd/conf-ssl.h

@@ -42,7 +42,7 @@ struct ConnSSL_State {
 
 #endif
 
-bool	ConnSSL_InitLibrary(void);
+GLOBAL bool ConnSSL_InitLibrary PARAMS((void));
 
 #endif /* conf_ssl_h */
 

+ 10 - 7
src/ngircd/conf.c

@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2014 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
@@ -369,9 +369,8 @@ Conf_Test( void )
 		printf("  MotdPhrase = %s\n", array_bytes(&Conf_Motd)
 		       ? (const char*) array_start(&Conf_Motd) : "");
 	}
-#ifndef PAM
-	printf("  Password = %s\n", Conf_ServerPwd);
-#endif
+	if (!Conf_PAM) 
+		printf("  Password = %s\n", Conf_ServerPwd);
 	printf("  PidFile = %s\n", Conf_PidFile);
 	printf("  Ports = ");
 	ports_puts(&Conf_ListenPorts);
@@ -1052,9 +1051,13 @@ Read_Config(bool TestOnly, bool IsStarting)
 }
 
 /**
- * ...
+ * Read in and handle a configuration file.
+ *
+ * @param File Name of the configuration file.
+ * @param fd File descriptor already opened for reading.
  */
-static void Read_Config_File(const char *File, FILE *fd)
+static void
+Read_Config_File(const char *File, FILE *fd)
 {
 	char section[LINE_LEN], str[LINE_LEN], *var, *arg, *ptr;
 	int i, line = 0;
@@ -2243,7 +2246,7 @@ Validate_Config(bool Configtest, bool Rehash)
 	}
 
 #ifdef PAM
-	if (Conf_ServerPwd[0])
+	if (Conf_PAM && Conf_ServerPwd[0])
 		Config_Error(LOG_ERR,
 			     "This server uses PAM, \"Password\" in [Global] section will be ignored!");
 #endif

+ 1 - 1
src/ngircd/conn-encoding.c

@@ -125,7 +125,7 @@ Convert_Message(iconv_t Handle, char *Message)
 	if (iconv(Handle, &Message, &in_left, &out, &out_left) == (size_t)(-1)) {
 		/* An error occurred! */
 		LogDebug("Error converting message encoding!");
-		strlcpy(Encoding_Buffer, Message, sizeof(Encoding_Buffer));
+		strlcpy(out, Message, sizeof(Encoding_Buffer));
 		iconv(Handle, NULL, NULL, NULL, NULL);
 	} else
 		*out = '\0';

+ 2 - 0
src/ngircd/conn.c

@@ -152,7 +152,9 @@ my_sd_listen_fds(void)
 	if (!e || !*e)
 		return -1;
 	count = atoi(e);
+#ifdef HAVE_UNSETENV
 	unsetenv("LISTEN_FDS");
+#endif
 
 	return count;
 }

+ 4 - 1
src/ngircd/irc-login.c

@@ -613,7 +613,10 @@ IRC_WEBIRC(CLIENT *Client, REQUEST *Req)
 
 	Client_SetUser(Client, Req->argv[1], true);
 	Client_SetOrigUser(Client, Req->argv[1]);
-	Client_SetHostname(Client, Req->argv[2]);
+	if (Conf_DNS)
+		Client_SetHostname(Client, Req->argv[2]);
+	else
+		Client_SetHostname(Client, Req->argv[3]);
 	Client_SetIPAText(Client, Req->argv[3]);
 
 	return CONNECTED;

+ 2 - 1
src/ngircd/irc-op.c

@@ -195,7 +195,8 @@ IRC_INVITE(CLIENT *Client, REQUEST *Req)
 
 		if (remember) {
 			/* We must remember this invite */
-			if (!Channel_AddInvite(chan, Client_Mask(target), true))
+			if (!Channel_AddInvite(chan, Client_MaskCloaked(target),
+						true))
 				return CONNECTED;
 		}
 	}

+ 5 - 1
src/ngircd/irc-oper.c

@@ -389,6 +389,7 @@ IRC_xLINE(CLIENT *Client, REQUEST *Req)
 	CLIENT *from, *c, *c_next;
 	char reason[COMMAND_LEN], class_c;
 	struct list_head *list;
+	time_t timeout;
 	int class;
 
 	assert(Client != NULL);
@@ -435,8 +436,11 @@ IRC_xLINE(CLIENT *Client, REQUEST *Req)
 		}
 	} else {
 		/* Add new mask to list */
+		timeout = atol(Req->argv[1]);
+		if (timeout > 0)
+			timeout += time(NULL);
 		if (Class_AddMask(class, Req->argv[0],
-				  time(NULL) + atol(Req->argv[1]),
+				  timeout,
 				  Req->argv[2])) {
 			Log(LOG_NOTICE|LOG_snotice,
 			    "\"%s\" added \"%s\" to %c-Line list: \"%s\" (%ld seconds).",

+ 0 - 2
src/ngircd/irc.c

@@ -478,9 +478,7 @@ Option_String(UNUSED CONN_ID Idx)
 #endif
 {
 	static char option_txt[8];
-#ifdef ZLIB
 	UINT16 options;
-#endif
 
 	assert(Idx != NONE);
 

+ 26 - 25
src/ngircd/login.c

@@ -91,13 +91,12 @@ Login_User(CLIENT * Client)
 
 #ifdef PAM
 	if (!Conf_PAM) {
-		/* Don't do any PAM authentication at all, instead emulate
-		 * the behavior of the daemon compiled without PAM support:
-		 * because there can't be any "server password", all
-		 * passwords supplied are classified as "wrong". */
-		if(Conn_Password(conn)[0] == '\0')
+		/* Don't do any PAM authentication at all if PAM is not
+		 * enabled, instead emulate the behavior of the daemon
+		 * compiled without PAM support. */
+		if (strcmp(Conn_Password(conn), Conf_ServerPwd) == 0) 
 			return Login_User_PostAuth(Client);
-		Client_Reject(Client, "Non-empty password", false);
+		Client_Reject(Client, "Bad server password", false);
 		return DISCONNECTED;
 	}
 
@@ -111,25 +110,27 @@ Login_User(CLIENT * Client)
 		return Login_User_PostAuth(Client);
 	}
 
-	/* Fork child process for PAM authentication; and make sure that the
-	 * process timeout is set higher than the login timeout! */
-	pid = Proc_Fork(Conn_GetProcStat(conn), pipefd,
-			cb_Read_Auth_Result, Conf_PongTimeout + 1);
-	if (pid > 0) {
-		LogDebug("Authenticator for connection %d created (PID %d).",
-			 conn, pid);
-		return CONNECTED;
-	} else {
-		/* Sub process */
-		Log_Init_Subprocess("Auth");
-		Conn_CloseAllSockets(NONE);
-		result = PAM_Authenticate(Client);
-		if (write(pipefd[1], &result, sizeof(result)) != sizeof(result))
-			Log_Subprocess(LOG_ERR,
-				       "Failed to pipe result to parent!");
-		Log_Exit_Subprocess("Auth");
-		exit(0);
-	}
+	if (Conf_PAM) {
+		/* Fork child process for PAM authentication; and make sure that the
+		 * process timeout is set higher than the login timeout! */
+		pid = Proc_Fork(Conn_GetProcStat(conn), pipefd,
+				cb_Read_Auth_Result, Conf_PongTimeout + 1);
+		if (pid > 0) {
+			LogDebug("Authenticator for connection %d created (PID %d).",
+				 conn, pid);
+			return CONNECTED;
+		} else {
+			/* Sub process */
+			Log_Init_Subprocess("Auth");
+			Conn_CloseAllSockets(NONE);
+			result = PAM_Authenticate(Client);
+			if (write(pipefd[1], &result, sizeof(result)) != sizeof(result))
+				Log_Subprocess(LOG_ERR,
+					       "Failed to pipe result to parent!");
+			Log_Exit_Subprocess("Auth");
+			exit(0);
+		}
+	} else return CONNECTED;
 #else
 	/* Check global server password ... */
 	if (strcmp(Conn_Password(conn), Conf_ServerPwd) != 0) {

+ 2 - 2
src/ngircd/ngircd.c

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

+ 1 - 1
src/ngircd/parse.c

@@ -345,7 +345,7 @@ Validate_Prefix( CONN_ID Idx, REQUEST *Req, bool *Closed )
 	/* check if the client named in the prefix is expected
 	 * to come from that direction */
 	if (Client_NextHop(c) != client) {
-		if (Client_Type(c) != CLIENT_SERVER) {
+		if (Client_Type(client) != CLIENT_SERVER) {
 			Log(LOG_ERR,
 			    "Spoofed prefix \"%s\" from \"%s\" (connection %d, command \"%s\"), closing connection!",
 			    Req->prefix, Client_ID(client), Idx, Req->command);

+ 1 - 1
src/ngircd/resolve.c

@@ -242,7 +242,7 @@ ForwardLookup(const char *hostname, array *IpAddr, int af)
 {
 	ng_ipaddr_t addr;
 
-#ifdef HAVE_GETADDRINFO
+#ifdef HAVE_WORKING_GETADDRINFO
 	int res;
 	struct addrinfo *a, *ai_results;
 	static struct addrinfo hints;

+ 2 - 0
src/portab/portabtest.c

@@ -24,6 +24,8 @@
 
 #include "exp.h"
 
+int allow_severity = 0, deny_severity = 0;
+
 
 static void Panic PARAMS (( char *Reason, int Code ));
 

+ 44 - 23
src/portab/vsnprintf.c

@@ -109,15 +109,16 @@ void dummy_snprintf PARAMS(( void )) { }
 #define LLONG long
 #endif
 
-static size_t dopr(char *buffer, size_t maxlen, const char *format, 
-		   va_list args);
-static void fmtstr(char *buffer, size_t *currlen, size_t maxlen,
-		    char *value, int flags, int min, int max);
-static void fmtint(char *buffer, size_t *currlen, size_t maxlen,
-		    long value, int base, int min, int max, int flags);
-static void fmtfp(char *buffer, size_t *currlen, size_t maxlen,
-		   LDOUBLE fvalue, int min, int max, int flags);
-static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c);
+static size_t dopr PARAMS((char *buffer, size_t maxlen, const char *format,
+			   va_list args));
+static void fmtstr PARAMS((char *buffer, size_t *currlen, size_t maxlen,
+			   char *value, int flags, int min, int max));
+static void fmtint PARAMS((char *buffer, size_t *currlen, size_t maxlen,
+			   long value, int base, int min, int max, int flags));
+static void fmtfp PARAMS((char *buffer, size_t *currlen, size_t maxlen,
+			  LDOUBLE fvalue, int min, int max, int flags));
+static void dopr_outch PARAMS((char *buffer, size_t *currlen, size_t maxlen,
+			       char c));
 
 /*
  * dopr(): poor man's version of doprintf
@@ -153,7 +154,8 @@ static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c);
 #define MAX(p,q) (((p) >= (q)) ? (p) : (q))
 #endif
 
-static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args)
+static size_t
+dopr(char *buffer, size_t maxlen, const char *format, va_list args)
 {
 	char ch;
 	LLONG value;
@@ -410,8 +412,9 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args
 	return currlen;
 }
 
-static void fmtstr(char *buffer, size_t *currlen, size_t maxlen,
-		    char *value, int flags, int min, int max)
+static void
+fmtstr(char *buffer, size_t *currlen, size_t maxlen, char *value, int flags,
+       int min, int max)
 {
 	int padlen, strln;     /* amount to pad */
 	int cnt = 0;
@@ -448,8 +451,9 @@ static void fmtstr(char *buffer, size_t *currlen, size_t maxlen,
 
 /* Have to handle DP_F_NUM (ie 0x and 0 alternates) */
 
-static void fmtint(char *buffer, size_t *currlen, size_t maxlen,
-		    long value, int base, int min, int max, int flags)
+static void
+fmtint(char *buffer, size_t *currlen, size_t maxlen, long value, int base,
+       int min, int max, int flags)
 {
 	int signvalue = 0;
 	unsigned long uvalue;
@@ -532,7 +536,8 @@ static void fmtint(char *buffer, size_t *currlen, size_t maxlen,
 	}
 }
 
-static LDOUBLE abs_val(LDOUBLE value)
+static LDOUBLE
+abs_val(LDOUBLE value)
 {
 	LDOUBLE result = value;
 
@@ -542,7 +547,8 @@ static LDOUBLE abs_val(LDOUBLE value)
 	return result;
 }
 
-static LDOUBLE POW10(int exp)
+static LDOUBLE
+POW10(int exp)
 {
 	LDOUBLE result = 1;
 	
@@ -554,7 +560,8 @@ static LDOUBLE POW10(int exp)
 	return result;
 }
 
-static LLONG ROUND(LDOUBLE value)
+static LLONG
+ROUND(LDOUBLE value)
 {
 	LLONG intpart;
 
@@ -567,7 +574,8 @@ static LLONG ROUND(LDOUBLE value)
 
 /* a replacement for modf that doesn't need the math library. Should
    be portable, but slow */
-static double my_modf(double x0, double *iptr)
+static double
+my_modf(double x0, double *iptr)
 {
 	int i;
 	long l;
@@ -601,8 +609,9 @@ static double my_modf(double x0, double *iptr)
 }
 
 
-static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
-		   LDOUBLE fvalue, int min, int max, int flags)
+static void
+fmtfp (char *buffer, size_t *currlen, size_t maxlen, LDOUBLE fvalue,
+       int min, int max, int flags)
 {
 	int signvalue = 0;
 	double ufvalue;
@@ -755,7 +764,8 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
 	}
 }
 
-static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c)
+static void
+dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c)
 {
 	if (*currlen < maxlen) {
 		buffer[(*currlen)] = c;
@@ -764,14 +774,25 @@ static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c)
 }
 
 #if !defined(HAVE_VSNPRINTF)
-int vsnprintf (char *str, size_t count, const char *fmt, va_list args)
+int
+vsnprintf (char *str, size_t count, const char *fmt, va_list args)
 {
 	return dopr(str, count, fmt, args);
 }
 #endif
 
 #if !defined(HAVE_SNPRINTF)
-int snprintf(char *str,size_t count,const char *fmt,...)
+#ifdef PROTOTYPES
+int
+snprintf(char *str, size_t count, const char *fmt, ...)
+#else
+int
+snprintf(str, count, fmt, va_alist)
+char *str;
+size_t count;
+const char *fmt;
+va_dcl
+#endif
 {
 	size_t ret;
 	va_list ap;