ソースを参照

Merge upstream version 27

Christoph Biedl 2 年 前
コミット
fdf924e952

+ 1 - 0
AUTHORS.md

@@ -68,6 +68,7 @@ Or join the "#ngircd" channel in IRC on irc.barton.de:
 - Tom Ryder <tom@sanctum.geek.nz>
 - Unit 193 <unit193@ubuntu.com>
 - Valentin Lorentz <progval+git@progval.net>
+- Val Lorentz <progval+git@progval.net>
 - William Pitcock <nenolod@dereferenced.org>
 - Windree <57554809+Windree@users.noreply.github.com>
 - xnaas <8271327+xnaas@users.noreply.github.com>

+ 19 - 1
ChangeLog

@@ -8,7 +8,25 @@
 
                                -- ChangeLog --
 
-ngIRCd 27
+ngIRCd 27 (2024-04-26)
+
+  - Update ChangeLog, NEWS, AUTHORS.md & doc/Platforms.txt for ngIRCd 27.
+  - Clarify in the sample configuration file and the ngircd.conf(5) manual
+    page that the "CAFile" option is unset by default.
+  - Fix channel symbol returned in the RPL_NAMREPLY(353) numeric of NAMES
+    commands for secret (mode +s) channels: this should be "@", not "=".
+    Thanks Val Lorentz <progval+git@progval.net> for the patch!
+    Closes #313.
+  - Add an example filter file for "Fail2Ban": contrib/ngircd-fail2ban.conf.
+  - Don't abort startup when setgid/setuid() fails with EINVAL: Both setgid(2)
+    as well as setuid(2) can fail with EINVAL in addition to EPERM, their
+    manual pages state "EINVAL: The user/group ID specified in uid/gid is not
+    valid in this user namespace ". So not only treat EPERM as an "acceptable
+    error" and continue with logging the error, but do the same for EINVAL.
+    This was triggered by the Void Linux xbps-uunshare(1) tool used for
+    building "XBPS source packages" and reported by luca in #ngircd. Thanks!
+  - Test suite: Don't use "pgrep -u" when LOGNAME and USER are not set
+    Thanks for reporting this on IRC, luca!
 
   ngIRCd 27~rc1 (2024-04-13)
   - Validate certificates on server links. Up to now, ngIRCd optionally used

+ 3 - 1
NEWS

@@ -8,7 +8,9 @@
 
                                   -- NEWS --
 
-ngIRCd 27
+ngIRCd 27 (2024-04-26)
+
+  - Add an example filter file for "Fail2Ban": contrib/ngircd-fail2ban.conf.
 
   ngIRCd 27~rc1 (2024-04-13)
   - Validate certificates on server links. Up to now, ngIRCd optionally used

+ 10 - 10
configure

@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for ngIRCd 27~rc1.
+# Generated by GNU Autoconf 2.71 for ngIRCd 27.
 #
 # Report bugs to <ngircd@lists.barton.de>.
 #
@@ -611,8 +611,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='ngIRCd'
 PACKAGE_TARNAME='ngircd'
-PACKAGE_VERSION='27~rc1'
-PACKAGE_STRING='ngIRCd 27~rc1'
+PACKAGE_VERSION='27'
+PACKAGE_STRING='ngIRCd 27'
 PACKAGE_BUGREPORT='ngircd@lists.barton.de'
 PACKAGE_URL='https://ngircd.barton.de/'
 
@@ -1347,7 +1347,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 27~rc1 to adapt to many kinds of systems.
+\`configure' configures ngIRCd 27 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1418,7 +1418,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of ngIRCd 27~rc1:";;
+     short | recursive ) echo "Configuration of ngIRCd 27:";;
    esac
   cat <<\_ACEOF
 
@@ -1542,7 +1542,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-ngIRCd configure 27~rc1
+ngIRCd configure 27
 generated by GNU Autoconf 2.71
 
 Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2015,7 +2015,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 27~rc1, which was
+It was created by ngIRCd $as_me 27, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -3350,7 +3350,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='ngircd'
- VERSION='27~rc1'
+ VERSION='27'
 
 
 printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -8622,7 +8622,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 27~rc1, which was
+This file was extended by ngIRCd $as_me 27, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -8691,7 +8691,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
-ngIRCd config.status 27~rc1
+ngIRCd config.status 27
 configured by $0, generated by GNU Autoconf 2.71,
   with options \\"\$ac_cs_config\\"
 

+ 6 - 0
contrib/Debian/changelog

@@ -1,3 +1,9 @@
+ngircd (27-0ab1) unstable; urgency=medium
+
+  * New "upstream" release: ngIRCd 27.
+
+ -- Alexander Barton <alex@barton.de>  Fri, 26 Apr 2024 16:52:14 +0200
+
 ngircd (27~rc1-0ab1) unstable; urgency=medium
 
   * New "upstream" release candidate 1 for ngIRCd Release 27.

+ 5 - 0
contrib/Debian/rules

@@ -53,6 +53,11 @@ execute_after_dh_auto_install:
 	 $(CURDIR)/contrib/ngircd.logcheck \
 	 $(CURDIR)/debian/ngircd/etc/logcheck/ignore.d.paranoid/ngircd
 
+#	Install the fail2ban configuration.
+	install -o root -g root -m 0644 -D \
+	 $(CURDIR)/contrib/ngircd-fail2ban.conf \
+	 $(CURDIR)/debian/ngircd/etc/fail2ban/filter.d/ngircd.conf
+
 #	Make lintian happy :-)
 	rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/COPYING
 	mv $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/ChangeLog \

+ 1 - 0
contrib/Makefile.am

@@ -17,6 +17,7 @@ EXTRA_DIST = README.md \
 	Dockerfile \
 	ngindent.sh \
 	ngircd-bsd.sh \
+	ngircd-fail2ban.conf \
 	ngIRCd-Logo.gif \
 	ngircd-redhat.init \
 	ngircd.logcheck \

+ 1 - 0
contrib/Makefile.in

@@ -238,6 +238,7 @@ EXTRA_DIST = README.md \
 	Dockerfile \
 	ngindent.sh \
 	ngircd-bsd.sh \
+	ngircd-fail2ban.conf \
 	ngIRCd-Logo.gif \
 	ngircd-redhat.init \
 	ngircd.logcheck \

+ 2 - 0
contrib/README.md

@@ -16,6 +16,8 @@ This `contrib/` directory contains the following sub-folders and files:
 
 - `ngircd-bsd.sh`: Start/stop script for FreeBSD.
 
+- `ngircd-fail2ban.conf`: fail2ban(1) filter configuration for ngIRCd.
+
 - `ngircd-redhat.init`: Start/stop script for old(er) RedHat-based
   distributions (like CentOS and Fedora), which did _not_ use systemd(8).
 

+ 1 - 0
contrib/de.barton.ngircd.metainfo.xml

@@ -24,6 +24,7 @@
 	</provides>
 	<launchable type="service">ngircd</launchable>
 	<releases>
+		<release version="27" date="2024-04-26" />
 		<release version="27~rc1" date="2024-04-13" />
 		<release version="26.1" date="2021-01-02" />
 		<release version="26" date="2020-06-20" />

+ 25 - 0
contrib/ngircd-fail2ban.conf

@@ -0,0 +1,25 @@
+# Fail2ban filter for ngIRCd
+#
+# Put into /etc/fail2ban/filter.d/ngircd.conf and enable in your jail.local
+# configuration like this:
+#
+# [ngircd]
+# enabled = true
+# backend = systemd
+#
+
+[INCLUDES]
+
+before = common.conf
+
+[DEFAULT]
+
+_daemon = ngircd
+
+[Definition]
+
+failregex = ^%(__prefix_line)sRefused connection from <ADDR> on socket \d+:
+
+[Init]
+
+journalmatch = _SYSTEMD_UNIT=ngircd.service + _COMM=ngircd

+ 1 - 1
contrib/ngircd.spec

@@ -1,5 +1,5 @@
 %define name    ngircd
-%define version 27~rc1
+%define version 27
 %define release 1
 %define prefix  %{_prefix}
 

+ 14 - 10
doc/Platforms.txt

@@ -2,7 +2,7 @@
                      ngIRCd - Next Generation IRC Server
                            http://ngircd.barton.de/
 
-               (c)2001-2020 Alexander Barton and Contributors.
+               (c)2001-2024 Alexander Barton and Contributors.
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
 
@@ -27,7 +27,8 @@ for inclusion here. Thanks for your help!
 Platform                    Compiler     ngIRCd     Date     Tester   C M T R *
 --------------------------- ------------ ---------- -------- -------- - - - - -
 aarch64/apple/darwin        A-clang 12.0 26         20-12-10 goetz    N Y Y Y 3
-aarch64/apple/darwin23.4.0  A-clang 15.0 26.1~131   24-04-01 alex     Y Y Y Y 3
+aarch64/apple/darwin23.4.0  A-clang 15.0 27~rc1     24-04-13 alex     Y Y Y Y 3
+aarch64/unknown/linux-gnu   gcc 12.2.0   27~rc1     24-04-21 alex     Y Y Y Y 1
 alpha/unknown/netbsd3.0     gcc 3.3.3    CVSHEAD    06-05-07 fw       Y Y Y Y 3
 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
@@ -73,7 +74,7 @@ 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/unknown/gnu0.9         gcc 12.2.0   26.1~131-g 24-04-01 alex     Y Y Y Y
+i686/unknown/gnu0.9         gcc 12.2.0   27~rc1     24-04-21 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
@@ -107,7 +108,7 @@ x86_64/apple/darwin18.2.0   A-clang 10.0 25~rc1-11  19-01-23 alex     Y Y Y Y 3
 x86_64/apple/darwin19.4.0   A-clang 11.0 26~rc1     20-05-10 alex     Y Y Y Y 3
 x86_64/apple/darwin19.6.0   A-clang 12.0 26         20-10-20 alex     Y Y Y Y 3
 x86_64/apple/darwin20.1.0   A-clang 12.0 26         21-01-01 alex     Y Y Y Y 3
-x86_64/apple/darwin23.4.0   A-clang 15.0 26.1~133-g 24-04-03 alex     Y Y Y Y 3
+x86_64/apple/darwin23.4.0   A-clang 15.0 27~rc1     24-04-21 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/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
@@ -115,11 +116,12 @@ 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.3  F-clang 3.4  24         17-01-20 goetz    Y Y Y Y 3
 x86_64/unknown/freebsd11.0  F-clang 3.8  24         17-01-21 goetz    Y Y Y Y 3
 x86_64/unknown/freebsd12.1  F-clang 8.0  26         20-08-28 alex     Y Y Y Y 3
-x86_64/unknown/freebsd14.0  F-clang 16.0 26.1~131   24-04-01 alex     Y Y Y Y 3
+x86_64/unknown/freebsd14.0  F-clang 16.0 27~rc1     24-04-21 alex     Y Y Y Y 3
 x86_64/unknown/haiku        gcc 7.3.0    25~rc1-11  19-01-06 alex     Y Y N Y
-x86_64/unknown/haiku        gcc 13.2.0   26.1~132-g 24-04-02 alex     Y Y Y Y
+x86_64/unknown/haiku        gcc 13.2.0   27~rc1     24-04-21 user     Y Y Y Y
 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/pc/linux-gnu         D-clang 14.0 27~rc1     24-04-21 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/pc/linux-gnu         gcc 4.8.4    24~rc1-7   17-01-20 alex     Y Y Y Y 1
@@ -129,14 +131,16 @@ x86_64/pc/linux-gnu [WSL]   gcc 5.4.0    24         18-03-07 goetz    Y Y y Y 7
 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.0    25~rc1-11  19-01-23 alex     Y Y Y Y 1
 x86_64/pc/linux-gnu         gcc 8.3.0    26         20-08-28 alex     Y Y Y Y 1
-x86_64/pc/linux-gnu         gcc 11.4.0   26.1~133-g 24-04-03 alex     Y Y Y Y 1
-x86_64/pc/linux-gnu         gcc 12.2.0   26.1~132-g 24-04-02 alex     Y Y Y Y 1
+x86_64/pc/linux-gnu         gcc 11.4.0   27~rc1     24-04-21 alex     Y Y Y Y 1
+x86_64/pc/linux-gnu         gcc 12.2.0   27~rc1     24-04-21 alex     Y Y Y Y 1
+x86_64/pc/linux-gnu         gcc 13.2.1   27~rc1     24-04-21 alex     Y Y Y Y 1
+x86_64/pc/solaris2.11       gcc 10.3.0   27~rc1     24-04-26 alex     Y Y y Y 5
 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/netbsd9.0    gcc 7.4.0    26         20-08-28 alex     Y Y y Y 3
-x86_64/unknown/netbsd10.0   gcc 10.5.0   26.1~131-g 24-04-01 alex     Y Y Y Y 3
+x86_64/unknown/netbsd10.0   gcc 10.5.0   27~rc1     24-04-21 alex     Y Y Y Y 3
 x86_64/unknown/openbsd4.7   gcc 3.3.5    20~rc1     12-02-26 alex     Y Y Y Y 3
 x86_64/unknown/openbsd4.8   gcc 4.2.1    22~rc1-3   14-10-10 alex     Y Y y Y 3
 x86_64/unknown/openbsd5.1   gcc 4.2.1    21         13-12-28 alex     Y Y Y Y 3
@@ -144,7 +148,7 @@ x86_64/unknown/openbsd5.5   gcc 4.2.1    22~rc1-3   14-10-10 alex     Y Y Y Y 3
 x86_64/unknown/openbsd6.6   gcc 4.2.1    26         20-08-28 alex     Y Y Y Y 3
 x86_64/unknown/openbsd6.6   O-clang 8.0  26         20-08-28 alex     Y Y Y Y 3
 x86_64/unknown/openbsd6.7   gcc 4.2.1    26         20-09-26 goetz    Y Y y Y 3
-x86_64/unknown/openbsd7.4   O-clang 13.0 26.1~131-g 24-04-01 alex     Y Y Y Y 3
+x86_64/unknown/openbsd7.4   O-clang 13.0 27~rc1     24-04-21 alex     Y Y Y Y 3
 
 
 * Notes

+ 2 - 1
doc/sample-ngircd.conf.tmpl

@@ -273,7 +273,8 @@
 	# is only available when ngIRCd is compiled with support for SSL!
 	# So don't forget to remove the ";" above if this is the case ...
 
-	# SSL Trusted CA Certificates File (for verifying peer certificates)
+	# SSL Trusted CA Certificates File for verifying peer certificates.
+	# (Default: not set; so no certificates are trusted)
 	;CAFile = /etc/ssl/CA/cacert.pem
 
 	# Certificate Revocation File (for marking otherwise valid

+ 1 - 1
man/ngircd.conf.5.tmpl

@@ -399,7 +399,7 @@ when it is compiled with support for SSL using OpenSSL or GnuTLS!
 .TP
 \fBCAFile\fR (string)
 Filename pointing to the Trusted CA Certificates. This is required for
-verifying peer certificates.
+verifying peer certificates. Default: not set, so no certificates are trusted.
 .TP
 \fBCertFile\fR (string)
 SSL Certificate file of the private server key.

+ 2 - 2
src/ngircd/conn.c

@@ -796,10 +796,10 @@ Conn_Handler(void)
 			/* Send the current status to the service manager. */
 			snprintf(status, sizeof(status),
 				 "WATCHDOG=1\nSTATUS=%ld connection%s established (%ld user%s, %ld server%s), %ld maximum. %ld accepted in total.\n",
-				 NumConnections, NumConnections == 1 ? "" : "s",
+				 (long)NumConnections, NumConnections == 1 ? "" : "s",
 				 Client_MyUserCount(), Client_MyUserCount() == 1 ? "" : "s",
 				 Client_MyServerCount(), Client_MyServerCount() == 1 ? "" : "s",
-				 NumConnectionsMax, NumConnectionsAccepted);
+				 (long)NumConnectionsMax, (long)NumConnectionsAccepted);
 			Signal_NotifySvcMgr(status);
 			notify_t = t;
 		}

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

@@ -818,7 +818,7 @@ IRC_NAMES( CLIENT *Client, REQUEST *Req )
 
 	/* Now print all clients which are not in any channel */
 	c = Client_First();
-	snprintf(rpl, sizeof(rpl), RPL_NAMREPLY_MSG, Client_ID(from), "*", "*");
+	snprintf(rpl, sizeof(rpl), RPL_NAMREPLY_MSG, Client_ID(from), '*', "*");
 	while (c) {
 		if (Client_Type(c) == CLIENT_USER
 		    && Channel_FirstChannelOf(c) == NULL
@@ -830,11 +830,11 @@ IRC_NAMES( CLIENT *Client, REQUEST *Req )
 			strlcat(rpl, Client_ID(c), sizeof(rpl));
 
 			if (strlen(rpl) > COMMAND_LEN - CLIENT_NICK_LEN - 4) {
-				/* Line is gwoing too long, send now */
+				/* Line is going too long, send now */
 				if (!IRC_WriteStrClient(from, "%s", rpl))
 					return DISCONNECTED;
 				snprintf(rpl, sizeof(rpl), RPL_NAMREPLY_MSG,
-					 Client_ID(from), "*", "*");
+					 Client_ID(from), '*', "*");
 			}
 		}
 		c = Client_Next(c);
@@ -1500,6 +1500,8 @@ IRC_Send_NAMES(CLIENT * Client, CHANNEL * Chan)
 	char str[COMMAND_LEN];
 	CL2CHAN *cl2chan;
 	CLIENT *cl;
+	bool secret_channel;
+	char chan_symbol;
 
 	assert(Client != NULL);
 	assert(Chan != NULL);
@@ -1514,10 +1516,13 @@ IRC_Send_NAMES(CLIENT * Client, CHANNEL * Chan)
 		return CONNECTED;
 
 	/* Secret channel? */
-	if (!is_member && Channel_HasMode(Chan, 's'))
+	secret_channel = Channel_HasMode(Chan, 's');
+	if (!is_member && secret_channel)
 		return CONNECTED;
 
-	snprintf(str, sizeof(str), RPL_NAMREPLY_MSG, Client_ID(Client), "=",
+	chan_symbol = secret_channel ? '@' : '=';
+
+	snprintf(str, sizeof(str), RPL_NAMREPLY_MSG, Client_ID(Client), chan_symbol,
 		 Channel_Name(Chan));
 	cl2chan = Channel_FirstMember(Chan);
 	while (cl2chan) {
@@ -1540,7 +1545,7 @@ IRC_Send_NAMES(CLIENT * Client, CHANNEL * Chan)
 				if (!IRC_WriteStrClient(Client, "%s", str))
 					return DISCONNECTED;
 				snprintf(str, sizeof(str), RPL_NAMREPLY_MSG,
-					 Client_ID(Client), "=",
+					 Client_ID(Client), chan_symbol,
 					 Channel_Name(Chan));
 			}
 		}

+ 1 - 1
src/ngircd/messages.h

@@ -84,7 +84,7 @@
 #define RPL_ENDOFEXCEPTLIST_MSG		"349 %s %s :End of channel exception list"
 #define RPL_VERSION_MSG			"351 %s %s-%s.%s %s :%s"
 #define RPL_WHOREPLY_MSG		"352 %s %s %s %s %s %s %s :%d %s"
-#define RPL_NAMREPLY_MSG		"353 %s %s %s :"
+#define RPL_NAMREPLY_MSG		"353 %s %c %s :"
 #define RPL_LINKS_MSG			"364 %s %s %s :%d %s"
 #define RPL_ENDOFLINKS_MSG		"365 %s %s :End of LINKS list"
 #define RPL_ENDOFNAMES_MSG		"366 %s %s :End of NAMES list"

+ 2 - 2
src/ngircd/ngircd.c

@@ -722,7 +722,7 @@ NGIRCd_Init(bool NGIRCd_NoDaemon)
 			Log(LOG_ERR, "Can't change group ID to %s(%u): %s!",
 			    grp ? grp->gr_name : "?", Conf_GID,
 			    strerror(real_errno));
-			if (real_errno != EPERM)
+			if (real_errno != EPERM && real_errno != EINVAL)
 				goto out;
 		}
 #ifdef HAVE_SETGROUPS
@@ -748,7 +748,7 @@ NGIRCd_Init(bool NGIRCd_NoDaemon)
 			Log(LOG_ERR, "Can't change user ID to %s(%u): %s!",
 			    pwd ? pwd->pw_name : "?", Conf_UID,
 			    strerror(real_errno));
-			if (real_errno != EPERM)
+			if (real_errno != EPERM && real_errno != EINVAL)
 				goto out;
 		}
 	}

+ 7 - 1
src/testsuite/getpid.sh

@@ -23,7 +23,13 @@ if [ -x /usr/bin/pgrep ]; then
 		*)
 			PGREP_FLAGS=""
 	esac
-	exec /usr/bin/pgrep $PGREP_FLAGS -n -u "${LOGNAME:-$USER}" "$1"
+	if [ -n "${LOGNAME:-}" ] || [ -n "${USER:-}" ]; then
+		# Try to narrow the search down to the current user ...
+		exec /usr/bin/pgrep $PGREP_FLAGS -n -u "${LOGNAME:-$USER}" "$1"
+	else
+		# ... but neither LOGNAME nor USER were set!
+		exec /usr/bin/pgrep $PGREP_FLAGS -n "$1"
+	fi
 fi
 
 # pidof(1) could be a good alternative on elder Linux systems