On Jan 26 11:25, Corinna Vinschen wrote:
> From: Corinna Vinschen <[email protected]>
> 
> 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]>
> ---
>  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)
> -- 
> 2.52.0

Pushed.

Reply via email to