From 96edd0a9dabf6262ebb9ccf3c472c433921e2472 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Mon, 1 Jul 2002 23:42:05 +0000 Subject: [PATCH] * syscalls.c (seteuid32): Do not return an error when the token cannot be created only because of a problem with the gid. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/errno.cc | 2 +- winsup/cygwin/sec_helper.cc | 2 +- winsup/cygwin/syscalls.cc | 8 +++++++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 7049bcad4..6e8d3933f 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2002-07-01 Pierre Humblet + + * syscalls.c (seteuid32): Do not return an error when the token cannot + be created only because of a problem with the gid. + 2002-07-01 Christopher Faylor * fhandler_clipboard.c (fhandler_dev_clipboard::open): Force text mode. diff --git a/winsup/cygwin/errno.cc b/winsup/cygwin/errno.cc index 17ac6a61b..088f1a18d 100644 --- a/winsup/cygwin/errno.cc +++ b/winsup/cygwin/errno.cc @@ -135,7 +135,7 @@ geterrno_from_win_error (DWORD code, int deferrno) void __stdcall seterrno_from_win_error (const char *file, int line, DWORD code) { - syscall_printf ("%s:%d errno %d", file, line, code); + syscall_printf ("%s:%d windows error %d", file, line, code); set_errno (geterrno_from_win_error (code, EACCES)); return; } diff --git a/winsup/cygwin/sec_helper.cc b/winsup/cygwin/sec_helper.cc index 6aaf7f607..5c7eb26d2 100644 --- a/winsup/cygwin/sec_helper.cc +++ b/winsup/cygwin/sec_helper.cc @@ -390,7 +390,7 @@ out: if (hToken) CloseHandle (hToken); - syscall_printf ("%d = set_process_privilege (%s, %d)",ret, privilege, enable); + syscall_printf ("%d = set_process_privilege (%s, %d)", ret, privilege, enable); return ret; } diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 006a9b758..2b0bc82f1 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -2054,7 +2054,8 @@ seteuid32 (__uid32_t uid) /* create_token failed. Try subauthentication. */ debug_printf ("create token failed, try subauthentication."); cygheap->user.token = subauth (pw_new); - if (cygheap->user.token == INVALID_HANDLE_VALUE) goto failed; + if (cygheap->user.token == INVALID_HANDLE_VALUE) + goto failed; } } @@ -2098,6 +2099,11 @@ seteuid32 (__uid32_t uid) return 0; failed: + if (uid == myself->uid) + { + system_printf ("special case, returning 0"); + return 0; + } cygheap->user.token = sav_token; cygheap->user.impersonated = sav_impersonated; if (cygheap->user.issetuid ()