X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fio-layer%2Fsecurity.c;h=d1bf3d0362c5b355311ab9af67c9c7c636872383;hb=8eeb2cef8fb37b7aaeed5fb0c31550a1701f9bdf;hp=3a5c622de9d08c7620e4cbc3b215a2604e047bf4;hpb=6110fc90713ce59ff0996fcd3520e09a96575820;p=mono.git diff --git a/mono/io-layer/security.c b/mono/io-layer/security.c index 3a5c622de9d..d1bf3d0362c 100644 --- a/mono/io-layer/security.c +++ b/mono/io-layer/security.c @@ -10,28 +10,19 @@ #include #include +#ifdef HAVE_PWD_H #include +#endif + #include #include +#include #include - -/* Disclaimers */ - -#if defined(__GNUC__) -#ifndef HAVE_GETRESUID - #warning getresuid not supported. WindowsImpersonationContext wont work -#endif -#ifndef HAVE_SETRESUID - #warning setresuid not supported. WindowsImpersonationContext wont work -#endif -#endif - - gboolean ImpersonateLoggedOnUser (gpointer handle) { - uid_t token = (uid_t) handle; + uid_t token = (uid_t) GPOINTER_TO_INT (handle); #ifdef HAVE_SETRESUID if (setresuid (-1, token, getuid ()) < 0) return FALSE; @@ -54,6 +45,8 @@ gboolean RevertToSelf (void) #ifdef HAVE_SETRESUID if (setresuid (-1, suid, -1) < 0) return FALSE; +#else + return TRUE; #endif return (geteuid () == suid); }