From: Jeremy Allison Date: Fri, 17 Apr 2020 21:20:13 +0000 (-0700) Subject: s3: smbd: Reformat code in SEC_FLAG_SYSTEM_SECURITY check in create_file_unixpath(). X-Git-Tag: ldb-2.2.0~899 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d53c3f2b8376ffc743455e3300f38c15d9b87335;p=thirdparty%2Fsamba.git s3: smbd: Reformat code in SEC_FLAG_SYSTEM_SECURITY check in create_file_unixpath(). No logic change but uses modern formatting and will make it easier to add another clause in the next commit. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 9beabb6a109..d4c77602daf 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -5420,14 +5420,18 @@ static NTSTATUS create_file_unixpath(connection_struct *conn, } } - if ((access_mask & SEC_FLAG_SYSTEM_SECURITY) && - !security_token_has_privilege(get_current_nttok(conn), - SEC_PRIV_SECURITY)) { - DEBUG(10, ("create_file_unixpath: open on %s " - "failed - SEC_FLAG_SYSTEM_SECURITY denied.\n", - smb_fname_str_dbg(smb_fname))); - status = NT_STATUS_PRIVILEGE_NOT_HELD; - goto fail; + if (access_mask & SEC_FLAG_SYSTEM_SECURITY) { + bool ok; + + ok = security_token_has_privilege(get_current_nttok(conn), + SEC_PRIV_SECURITY); + if (!ok) { + DBG_DEBUG("open on %s failed - " + "SEC_FLAG_SYSTEM_SECURITY denied.\n", + smb_fname_str_dbg(smb_fname)); + status = NT_STATUS_PRIVILEGE_NOT_HELD; + goto fail; + } } /*