[Patch] fix for sids new to winbind always map to a uid

Chere Zhou qzhou at isilon.com
Thu Mar 20 01:09:25 GMT 2003


Since the current sid_to_uid does not check for sid type, but sid_to_gid 
does, and for the purpose of supporting foreign sids, I needed to switch the 
order of calling sid_to_uid and sid_to_gid in posix_acl.c.  

If anybody had similar problem as me, this patch should help you.  The 
original problem was posted earlier with the title "3.0a21: add a new group 
using ACL results in a new user in winbindd idmap".


--- smbd/posix_acls.c.orig      Wed Mar 19 16:59:53 2003
+++ smbd/posix_acls.c   Wed Mar 19 17:00:46 2003
@@ -1003,12 +1003,12 @@
                        if (nt4_compatible_acls())
                                psa->flags |= SEC_ACE_FLAG_INHERIT_ONLY;

-               } else if (sid_to_uid( &current_ace->trustee, 
&current_ace->unix_ug.uid, &sid_type)) {
-                       current_ace->owner_type = UID_ACE;
-                       current_ace->type = SMB_ACL_USER;
                } else if (sid_to_gid( &current_ace->trustee, 
&current_ace->unix_ug.gid, &sid_type)) {
                        current_ace->owner_type = GID_ACE;
                        current_ace->type = SMB_ACL_GROUP;
+               } else if (sid_to_uid( &current_ace->trustee, 
&current_ace->unix_ug.uid, &sid_type)) {
+                       current_ace->owner_type = UID_ACE;
+                       current_ace->type = SMB_ACL_USER;
                } else {
                        fstring str;

This patch works better than doing a lookup_sid first, because lookup_sid 
will fail for foreign sids.

Chere


More information about the samba-technical mailing list