]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Slightly simplify posix acl handling
authorVolker Lendecke <vl@samba.org>
Sun, 22 Mar 2026 15:10:34 +0000 (16:10 +0100)
committerAnoop C S <anoopcs@samba.org>
Fri, 26 Jun 2026 10:41:34 +0000 (10:41 +0000)
Avoid checking for posix_acl!=NULL in every iteration. We don't change
it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/smbd/smb1_trans2.c

index 0856a5ceb7720a54b9cc596858c8bc8958c21683..5619346f90d0b55e30893dbf093b661f708c1bf9 100644 (file)
@@ -2274,7 +2274,11 @@ static unsigned int count_acl_entries(connection_struct *conn, SMB_ACL_T posix_a
        int entry_id = SMB_ACL_FIRST_ENTRY;
        SMB_ACL_ENTRY_T entry;
 
-       while ( posix_acl && (sys_acl_get_entry(posix_acl, entry_id, &entry) == 1)) {
+       if (posix_acl == NULL) {
+               return 0;
+       }
+
+       while (sys_acl_get_entry(posix_acl, entry_id, &entry) == 1) {
                entry_id = SMB_ACL_NEXT_ENTRY;
                ace_count++;
        }
@@ -2290,7 +2294,11 @@ static bool marshall_posix_acl(connection_struct *conn, char *pdata, SMB_STRUCT_
        int entry_id = SMB_ACL_FIRST_ENTRY;
        SMB_ACL_ENTRY_T entry;
 
-       while ( posix_acl && (sys_acl_get_entry(posix_acl, entry_id, &entry) == 1)) {
+       if (posix_acl == NULL) {
+               return true;
+       }
+
+       while (sys_acl_get_entry(posix_acl, entry_id, &entry) == 1) {
                SMB_ACL_TAG_T tagtype;
                SMB_ACL_PERMSET_T permset;
                unsigned char perms = 0;