s3:net: Use cli_credentials_set_smb_encryption()
authorAndreas Schneider <asn@samba.org>
Wed, 10 Jun 2020 10:31:02 +0000 (12:31 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 19 Aug 2020 16:22:42 +0000 (16:22 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/utils/net_util.c

index b139fb2d0da42e2091cd1214ad308405535473a7..5829d8910754320b9278ab138e673ccf33c66870 100644 (file)
@@ -148,16 +148,6 @@ NTSTATUS connect_to_service(struct net_context *c,
                return nt_status;
        }
 
-       if (c->smb_encrypt) {
-               nt_status = cli_cm_force_encryption_creds(*cli_ctx,
-                                                         creds,
-                                                         service_name);
-               if (!NT_STATUS_IS_OK(nt_status)) {
-                       cli_shutdown(*cli_ctx);
-                       *cli_ctx = NULL;
-               }
-       }
-
        return nt_status;
 }
 
@@ -577,6 +567,12 @@ struct cli_credentials *net_context_creds(struct net_context *c,
                                             CRED_SPECIFIED);
        }
 
+       if (c->smb_encrypt) {
+               cli_credentials_set_smb_encryption(creds,
+                                                  SMB_ENCRYPTION_REQUIRED,
+                                                  CRED_SPECIFIED);
+       }
+
        return creds;
 }