From: ashemira@ucsd.edu Date: Thu, 8 May 2008 05:38:00 +0000 (-0700) Subject: Added Cygwin uid kludge. (verified working) X-Git-Tag: rel-13-rc1~118 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5cf5ba31eb0cae6c28d5754f6e62956f83582b06;p=ngircd Added Cygwin uid kludge. (verified working) --- diff --git a/src/ngircd/ngircd.c b/src/ngircd/ngircd.c index 626b8b23..d839618f 100644 --- a/src/ngircd/ngircd.c +++ b/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;