From 0e376db8b8b3770b189fbd9b3874406bcafcfd32 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 13 Mar 2012 12:16:26 -0700 Subject: Second part of fix for bug #7933 - samba fails to honor SEC_STD_WRITE_OWNER bit with the acl_xattr module. Error found by Andrew Bartlett and Ricky Nance . Don't use a pointer when you really mean a bool flag. Autobuild-User: Jeremy Allison Autobuild-Date: Tue Mar 13 21:56:15 CET 2012 on sn-devel-104 --- source3/smbd/posix_acls.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index 029eeaeecc..f54bfa1648 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -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")); -- cgit