https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=1539d3248a78f07a5ab8667d59e8901f724896ea

commit 1539d3248a78f07a5ab8667d59e8901f724896ea
Author:     Corinna Vinschen <[email protected]>
AuthorDate: Sun Jan 25 20:25:35 2026 +0100
Commit:     Corinna Vinschen <[email protected]>
CommitDate: Mon Jan 26 10:16:47 2026 +0100

    Cygwin: fhandler_socket::fchown: fix check for admin user
    
    This has never worked as desired.  The check for admin permissions
    is broken.  The call to check_token_membership() expects a PSID
    argument.  What it gets is a pointer to a cygpsid.  There's no
    class-specific type conversion for this to a PSID, so the pointer
    is converted verbatim.
    
    Pass the cygpsid directly, because cygpsid has a type conversion
    method to PSID defined.
    
    Pity that GCC doesn't warn here...
    
    Fixes: 859d215b7e00 ("Cygwin: split out fhandler_socket into inet and local 
classes")
    Signed-off-by: Corinna Vinschen <[email protected]>

Diff:
---
 winsup/cygwin/fhandler/socket.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler/socket.cc b/winsup/cygwin/fhandler/socket.cc
index c0cef7d3eeb1..0e1fb1bd25f1 100644
--- a/winsup/cygwin/fhandler/socket.cc
+++ b/winsup/cygwin/fhandler/socket.cc
@@ -258,7 +258,7 @@ fhandler_socket::fchmod (mode_t newmode)
 int
 fhandler_socket::fchown (uid_t newuid, gid_t newgid)
 {
-  bool perms = check_token_membership (&well_known_admins_sid);
+  bool perms = check_token_membership (well_known_admins_sid);
 
   /* Admin rulez */
   if (!perms)

Reply via email to