]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Second part of fix for bug #7933 - samba fails to honor SEC_STD_WRITE_OWNER bit with...
authorJeremy Allison <jra@samba.org>
Tue, 13 Mar 2012 19:16:26 +0000 (12:16 -0700)
committerJeremy Allison <jra@samba.org>
Tue, 13 Mar 2012 20:56:15 +0000 (21:56 +0100)
Error found by Andrew Bartlett <abartlet@samba.org> and Ricky Nance
<ricky.nance@weaubleau.k12.mo.us>.

Don't use a pointer when you really mean a bool flag.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Tue Mar 13 21:56:15 CET 2012 on sn-devel-104

source3/smbd/posix_acls.c

index 029eeaeeccb14f65a5d9d57a956d0f274935f177..f54bfa1648aa5c063ac9127e3ad99f52c07c477e 100644 (file)
@@ -1502,20 +1502,22 @@ static bool ensure_canon_entry_valid(connection_struct *conn, canon_ace **pp_ace
                   then if the ownership or group ownership of this file or
                   directory gets changed, the user or group can lose their
                   access. */
+               bool got_duplicate_user = false;
+               bool got_duplicate_group = false;
 
                for (pace = *pp_ace; pace; pace = pace->next) {
                        if (pace->type == SMB_ACL_USER &&
                                        pace->unix_ug.uid == pace_user->unix_ug.uid) {
                                /* Already got one. */
-                               pace_user = NULL;
+                               got_duplicate_user = true;
                        } else if (pace->type == SMB_ACL_USER &&
                                        pace->unix_ug.uid == pace_user->unix_ug.uid) {
                                /* Already got one. */
-                               pace_group = NULL;
+                               got_duplicate_group = true;
                        }
                }
 
-               if (pace_user) {
+               if (!got_duplicate_user) {
                        /* Add a duplicate SMB_ACL_USER entry. */
                        if ((pace = talloc(talloc_tos(), canon_ace)) == NULL) {
                                DEBUG(0,("ensure_canon_entry_valid: talloc fail.\n"));
@@ -1533,7 +1535,7 @@ static bool ensure_canon_entry_valid(connection_struct *conn, canon_ace **pp_ace
                        DLIST_ADD(*pp_ace, pace);
                }
 
-               if (pace_group) {
+               if (!got_duplicate_group) {
                        /* Add a duplicate SMB_ACL_GROUP entry. */
                        if ((pace = talloc(talloc_tos(), canon_ace)) == NULL) {
                                DEBUG(0,("ensure_canon_entry_valid: talloc fail.\n"));