From de67909ac180f15531e1a1bf4b5c54f17caae5d5 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 16 Apr 2015 18:29:16 +0200 Subject: [PATCH] Workaround owner/group SIDs being NULL * sec_acl.cc (set_posix_access): Workaround owner/group SIDs being NULL. Signed-off-by: Corinna Vinschen --- winsup/cygwin/ChangeLog | 4 ++++ winsup/cygwin/sec_acl.cc | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 9adade060..f645031a0 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +2015-04-16 Corinna Vinschen + + * sec_acl.cc (set_posix_access): Workaround owner/group SIDs being NULL. + 2015-04-15 Corinna Vinschen * sec_acl.cc (set_posix_access): Handle files with owner == group. diff --git a/winsup/cygwin/sec_acl.cc b/winsup/cygwin/sec_acl.cc index a8ffbf038..6c96977b7 100644 --- a/winsup/cygwin/sec_acl.cc +++ b/winsup/cygwin/sec_acl.cc @@ -141,7 +141,7 @@ set_posix_access (mode_t attr, uid_t uid, gid_t gid, mode_t class_obj = 0, other_obj, group_obj, deny; DWORD access; int idx, start_idx, class_idx, tmp_idx; - bool owner_eq_group; + bool owner_eq_group = false; bool dev_saw_admins = false; /* Initialize local security descriptor. */ @@ -166,7 +166,10 @@ set_posix_access (mode_t attr, uid_t uid, gid_t gid, __seterrno_from_nt_status (status); return NULL; } - owner_eq_group = RtlEqualSid (owner, group); + /* If the account DBs are broken, we might end up without SIDs. Better + check them here. */ + if (owner && group) + owner_eq_group = RtlEqualSid (owner, group); /* No POSIX ACL? Use attr to generate one from scratch. */ if (!aclbufp)