s3:client: Turn off smb signing for message op
authorAndreas Schneider <asn@samba.org>
Thu, 28 May 2020 16:11:31 +0000 (18:11 +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>
python/samba/gpclass.py
python/samba/netcmd/domain_backup.py
python/samba/netcmd/gpo.py
python/samba/tests/dcerpc/raw_testcase.py
source3/client/client.c
source3/libsmb/pylibsmb.c

index a807a44e84e750c81054a76e61185325ad9744b4..7f64e75d40bf2f23e1302e6adf4278c20279d8ec 100644 (file)
@@ -399,7 +399,7 @@ def check_refresh_gpo_list(dc_hostname, lp, creds, gpos):
     # Force signing for the connection
     saved_signing_state = creds.get_smb_signing()
     creds.set_smb_signing(SMB_SIGNING_REQUIRED)
-    conn = libsmb.Conn(dc_hostname, 'sysvol', lp=s3_lp, creds=creds, sign=True)
+    conn = libsmb.Conn(dc_hostname, 'sysvol', lp=s3_lp, creds=creds)
     # Reset signing state
     creds.set_smb_signing(saved_signing_state)
     cache_path = lp.cache_path('gpo_cache')
index a9e0ba5bc67f22c317b372456dd5746fd48108f9..2977b071ec38730d4cac8f7ffd21503017181ff1 100644 (file)
@@ -120,7 +120,7 @@ def smb_sysvol_conn(server, lp, creds):
     # Force signing for the connection
     saved_signing_state = creds.get_smb_signing()
     creds.set_smb_signing(SMB_SIGNING_REQUIRED)
-    conn = libsmb.Conn(server, "sysvol", lp=s3_lp, creds=creds, sign=True)
+    conn = libsmb.Conn(server, "sysvol", lp=s3_lp, creds=creds)
     # Reset signing state
     creds.set_smb_signing(saved_signing_state)
     return conn
index 0f2f6520fc37eba9ed5c73e8994715999fe1ba8f..bbaa0c178814ba10e116d1062dc9f305ac83ea13 100644 (file)
@@ -392,7 +392,7 @@ def smb_connection(dc_hostname, service, lp, creds):
         # the SMB bindings rely on having a s3 loadparm
         s3_lp = s3param.get_context()
         s3_lp.load(lp.configfile)
-        conn = libsmb.Conn(dc_hostname, service, lp=s3_lp, creds=creds, sign=True)
+        conn = libsmb.Conn(dc_hostname, service, lp=s3_lp, creds=creds)
     except Exception:
         raise CommandError("Error connecting to '%s' using SMB" % dc_hostname)
     # Reset signing state
index 95a7d6ff60ed3245574189d1efc7be8b641dfe83..f1c097ebe6d3bc1166c2b04cd3e917ade202c390 100644 (file)
@@ -45,7 +45,7 @@ class smb_pipe_socket(object):
         saved_signing_state = creds.get_smb_ipc_signing()
         creds.set_smb_ipc_signing(SMB_SIGNING_REQUIRED)
         self.smbconn = libsmb.Conn(target_hostname, 'IPC$', lp3,
-                                   creds=creds, ipc=True, sign=True)
+                                   creds=creds, ipc=True)
         creds.set_smb_ipc_signing(saved_signing_state)
         self.smbfid = self.smbconn.create(pipename,
                                           DesiredAccess=0x12019f,
index f65293849d09185ea9bcf00e3fa531043a79f160..30287ffd253ddc00f6324f0c60419a567df33cd7 100644 (file)
@@ -6228,7 +6228,10 @@ static int do_message_op(struct user_auth_info *a_info)
 
        status = cli_connect_nb(desthost, have_ip ? &dest_ss : NULL,
                                port ? port : NBT_SMB_PORT, name_type,
-                               lp_netbios_name(), SMB_SIGNING_DEFAULT, 0, &cli);
+                               lp_netbios_name(),
+                               SMB_SIGNING_OFF,
+                               0,
+                               &cli);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("Connection to %s failed. Error %s\n", desthost, nt_errstr(status));
                return 1;
index 3579a0408301c1a38fe02b74b99e041898df9f5e..f8a4d56cf53a545226181cf21dd23d6b3df5f531 100644 (file)
@@ -440,9 +440,7 @@ static int py_cli_state_init(struct py_cli_state *self, PyObject *args,
        PyObject *py_lp = Py_None;
        PyObject *py_multi_threaded = Py_False;
        bool multi_threaded = false;
-       PyObject *py_sign = Py_False;
-       bool sign = false;
-       int signing_state = SMB_SIGNING_DEFAULT;
+       enum smb_signing_setting signing_state = SMB_SIGNING_DEFAULT;
        PyObject *py_force_smb1 = Py_False;
        bool force_smb1 = false;
        PyObject *py_ipc = Py_False;
@@ -453,7 +451,7 @@ static int py_cli_state_init(struct py_cli_state *self, PyObject *args,
 
        static const char *kwlist[] = {
                "host", "share", "lp", "creds",
-               "multi_threaded", "sign", "force_smb1",
+               "multi_threaded", "force_smb1",
                "ipc",
                NULL
        };
@@ -465,11 +463,10 @@ static int py_cli_state_init(struct py_cli_state *self, PyObject *args,
        }
 
        ret = ParseTupleAndKeywords(
-               args, kwds, "ssO|O!OOOO", kwlist,
+               args, kwds, "ssO|O!OOO", kwlist,
                &host, &share, &py_lp,
                py_type_Credentials, &creds,
                &py_multi_threaded,
-               &py_sign,
                &py_force_smb1,
                &py_ipc);
 
@@ -480,13 +477,8 @@ static int py_cli_state_init(struct py_cli_state *self, PyObject *args,
        }
 
        multi_threaded = PyObject_IsTrue(py_multi_threaded);
-       sign = PyObject_IsTrue(py_sign);
        force_smb1 = PyObject_IsTrue(py_force_smb1);
 
-       if (sign) {
-               signing_state = SMB_SIGNING_REQUIRED;
-       }
-
        if (force_smb1) {
                /*
                 * As most of the cli_*_send() function
@@ -532,6 +524,12 @@ static int py_cli_state_init(struct py_cli_state *self, PyObject *args,
                cli_creds = PyCredentials_AsCliCredentials(creds);
        }
 
+       if (use_ipc) {
+               signing_state = cli_credentials_get_smb_ipc_signing(cli_creds);
+       } else {
+               signing_state = cli_credentials_get_smb_signing(cli_creds);
+       }
+
        req = cli_full_connection_creds_send(
                NULL, self->ev, "myname", host, NULL, 0, share, "?????",
                cli_creds, flags, signing_state);