From: David Mulder Date: Thu, 28 Jun 2018 15:01:59 +0000 (-0600) Subject: python: Allow forced signing via smb.SMB() X-Git-Tag: ldb-1.5.0~315 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4c7348e44d10ca519dd1322fd40b12c69e17a8e6;p=thirdparty%2Fsamba.git python: Allow forced signing via smb.SMB() Signed-off-by: David Mulder Reviewed-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/source4/libcli/pysmb.c b/source4/libcli/pysmb.c index a53e30bcf91..45ff9a0a7c0 100644 --- a/source4/libcli/pysmb.c +++ b/source4/libcli/pysmb.c @@ -601,7 +601,7 @@ static PyObject *py_smb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs PyObject *py_creds = Py_None; PyObject *py_lp = Py_None; const char *kwnames[] = { "hostname", "service", "creds", "lp", - "ntlmv2_auth", "use_spnego", NULL }; + "ntlmv2_auth", "use_spnego", "sign", NULL }; const char *hostname = NULL; const char *service = NULL; PyObject *smb; @@ -612,11 +612,12 @@ static PyObject *py_smb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs struct smbcli_session_options session_options; uint8_t ntlmv2_auth = 0xFF; uint8_t use_spnego = 0xFF; + PyObject *sign = Py_False; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "zz|OObb", + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "zz|OObbO", discard_const_p(char *, kwnames), &hostname, &service, &py_creds, &py_lp, - &ntlmv2_auth, &use_spnego)) { + &ntlmv2_auth, &use_spnego, &sign)) { return NULL; } @@ -658,6 +659,9 @@ static PyObject *py_smb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs if (use_spnego != 0xFF) { options.use_spnego = use_spnego; } + if (PyObject_IsTrue(sign)) { + options.signing = SMB_SIGNING_REQUIRED; + } status = do_smb_connect(spdata, spdata, hostname, service, &options,