This is the mail archive of the cygwin-cvs@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[newlib-cygwin] Workaround owner/group SIDs being NULL


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

commit de67909ac180f15531e1a1bf4b5c54f17caae5d5
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Thu Apr 16 18:29:16 2015 +0200

    Workaround owner/group SIDs being NULL
    
    	* sec_acl.cc (set_posix_access): Workaround owner/group SIDs being NULL.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 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 9adade0..f645031 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,7 @@
+2015-04-16  Corinna Vinschen  <corinna@vinschen.de>
+
+	* sec_acl.cc (set_posix_access): Workaround owner/group SIDs being NULL.
+
 2015-04-15  Corinna Vinschen  <corinna@vinschen.de>
 
 	* 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 a8ffbf0..6c96977 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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]