]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Shed a nested if-expression
authorVolker Lendecke <vl@samba.org>
Mon, 11 Aug 2025 13:12:31 +0000 (15:12 +0200)
committerRalph Boehme <slow@samba.org>
Fri, 22 Aug 2025 13:55:34 +0000 (13:55 +0000)
Review with "git show -w". This is easier to read for me.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/smb2_service.c

index c9daae2aa1c3bc45c84fe445819bff1e432a8368..286a4732f7385250ce0aa9a59fec719cefded4c9 100644 (file)
@@ -536,17 +536,18 @@ NTSTATUS make_connection_snum(struct smbXsrv_connection *xconn,
        conn_setup_case_options(conn);
 
        conn->encrypt_level = lp_server_smb_encrypt(snum);
-       if (conn->encrypt_level > SMB_ENCRYPTION_OFF) {
-               if (lp_server_smb_encrypt(-1) == SMB_ENCRYPTION_OFF) {
-                       if (conn->encrypt_level == SMB_ENCRYPTION_REQUIRED) {
-                               DBG_ERR("Service [%s] requires encryption, but "
-                                       "it is disabled globally!\n",
-                                       lp_const_servicename(snum));
-                               status = NT_STATUS_ACCESS_DENIED;
-                               goto err_root_exit;
-                       }
-                       conn->encrypt_level = SMB_ENCRYPTION_OFF;
+
+       if ((conn->encrypt_level > SMB_ENCRYPTION_OFF) &&
+           (lp_server_smb_encrypt(-1) == SMB_ENCRYPTION_OFF)) {
+
+               if (conn->encrypt_level == SMB_ENCRYPTION_REQUIRED) {
+                       DBG_ERR("Service [%s] requires encryption, but "
+                               "it is disabled globally!\n",
+                               lp_const_servicename(snum));
+                       status = NT_STATUS_ACCESS_DENIED;
+                       goto err_root_exit;
                }
+               conn->encrypt_level = SMB_ENCRYPTION_OFF;
        }
 
        conn->veto_list = NULL;