From: Volker Lendecke Date: Mon, 5 Aug 2024 11:42:09 +0000 (+0200) Subject: smbd: Introduce "ace" helper variable X-Git-Tag: tdb-1.4.13~1293 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=367bea1ca5387484046f4c7105b31b2f48eb9141;p=thirdparty%2Fsamba.git smbd: Introduce "ace" helper variable Use "psd->dacl->aces[0]" once instead of 3 times Signed-off-by: Volker Lendecke Reviewed-by: Jennifer Sutton --- diff --git a/source3/smbd/smb2_nttrans.c b/source3/smbd/smb2_nttrans.c index f61848334ba..4bff0e42eac 100644 --- a/source3/smbd/smb2_nttrans.c +++ b/source3/smbd/smb2_nttrans.c @@ -177,6 +177,7 @@ static bool check_smb2_posix_chmod_ace(const struct files_struct *fsp, struct security_descriptor *psd, mode_t *pmode) { + struct security_ace *ace = NULL; int cmp; /* @@ -203,18 +204,18 @@ static bool check_smb2_posix_chmod_ace(const struct files_struct *fsp, if (psd->dacl->num_aces != 1) { return false; } + ace = &psd->dacl->aces[0]; - if (psd->dacl->aces[0].trustee.num_auths != 3) { + if (ace->trustee.num_auths != 3) { return false; } - cmp = dom_sid_compare_domain(&global_sid_Unix_NFS_Mode, - &psd->dacl->aces[0].trustee); + cmp = dom_sid_compare_domain(&global_sid_Unix_NFS_Mode, &ace->trustee); if (cmp != 0) { return false; } - *pmode = (mode_t)psd->dacl->aces[0].trustee.sub_auths[2]; + *pmode = (mode_t)ace->trustee.sub_auths[2]; *pmode &= (S_IRWXU | S_IRWXG | S_IRWXO); return true;