Commit Diff


commit - 75b719a0c88b58b6de3024413374b066ac4c6849
commit + 5cf5ba31eb0cae6c28d5754f6e62956f83582b06
blob - 626b8b235245b21f43bf17749cb22d2b9182e5d1
blob + d839618fefb8174de42c96fd008318efe6e56cd2
--- src/ngircd/ngircd.c
+++ src/ngircd/ngircd.c
@@ -671,6 +671,19 @@ NGIRCd_getNobodyID(uid_t *uid, gid_t *gid )
 {
 	struct passwd *pwd;
 
+#ifdef __CYGWIN__
+	/* Cygwin kludge.
+	 * It can return EINVAL instead of EPERM
+	 * so, if we are already unprivileged,
+	 * use id of current user.
+	 */
+	if (geteuid() && getuid()) {
+		*uid = getuid();
+		*gid = getgid();
+		return true;
+	}
+#endif
+
 	pwd = getpwnam("nobody");
 	if (!pwd) return false;