Added Cygwin uid kludge. (verified working)

This commit is contained in:
ashemira@ucsd.edu 2008-05-07 22:38:00 -07:00 committed by Alexander Barton
parent 75b719a0c8
commit 5cf5ba31eb
1 changed files with 13 additions and 0 deletions

View File

@ -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;