From: Volker Lendecke Date: Sun, 22 Mar 2026 15:10:34 +0000 (+0100) Subject: smbd: Slightly simplify posix acl handling X-Git-Tag: talloc-2.5.0~372 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6298bb71d5beed3cd6fa6968261c084e0cee5c8;p=thirdparty%2Fsamba.git smbd: Slightly simplify posix acl handling Avoid checking for posix_acl!=NULL in every iteration. We don't change it. Signed-off-by: Volker Lendecke Reviewed-by: Anoop C S --- diff --git a/source3/smbd/smb1_trans2.c b/source3/smbd/smb1_trans2.c index 0856a5ceb77..5619346f90d 100644 --- a/source3/smbd/smb1_trans2.c +++ b/source3/smbd/smb1_trans2.c @@ -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;