mirror of
https://github.com/samba-team/samba.git
synced 2025-01-27 14:04:05 +03:00
s3:pylibsmb: add sign=True to require signing
BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892 BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Tim Beale <timbeale@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
1bccbfcff7
commit
247a71b63a
@ -422,6 +422,9 @@ static int py_cli_state_init(struct py_cli_state *self, PyObject *args,
|
|||||||
struct cli_credentials *cli_creds;
|
struct cli_credentials *cli_creds;
|
||||||
PyObject *py_multi_threaded = Py_False;
|
PyObject *py_multi_threaded = Py_False;
|
||||||
bool multi_threaded = false;
|
bool multi_threaded = false;
|
||||||
|
PyObject *py_sign = Py_False;
|
||||||
|
bool sign = false;
|
||||||
|
int signing_state = SMB_SIGNING_DEFAULT;
|
||||||
struct tevent_req *req;
|
struct tevent_req *req;
|
||||||
bool ret;
|
bool ret;
|
||||||
/*
|
/*
|
||||||
@ -433,7 +436,8 @@ static int py_cli_state_init(struct py_cli_state *self, PyObject *args,
|
|||||||
int flags = CLI_FULL_CONNECTION_FORCE_SMB1;
|
int flags = CLI_FULL_CONNECTION_FORCE_SMB1;
|
||||||
|
|
||||||
static const char *kwlist[] = {
|
static const char *kwlist[] = {
|
||||||
"host", "share", "credentials", "multi_threaded", NULL
|
"host", "share", "credentials",
|
||||||
|
"multi_threaded", "sign", NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
PyTypeObject *py_type_Credentials = get_pytype(
|
PyTypeObject *py_type_Credentials = get_pytype(
|
||||||
@ -443,10 +447,11 @@ static int py_cli_state_init(struct py_cli_state *self, PyObject *args,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = ParseTupleAndKeywords(
|
ret = ParseTupleAndKeywords(
|
||||||
args, kwds, "ss|O!O", kwlist,
|
args, kwds, "ss|O!OO", kwlist,
|
||||||
&host, &share,
|
&host, &share,
|
||||||
py_type_Credentials, &creds,
|
py_type_Credentials, &creds,
|
||||||
&py_multi_threaded);
|
&py_multi_threaded,
|
||||||
|
&py_sign);
|
||||||
|
|
||||||
Py_DECREF(py_type_Credentials);
|
Py_DECREF(py_type_Credentials);
|
||||||
|
|
||||||
@ -455,6 +460,11 @@ static int py_cli_state_init(struct py_cli_state *self, PyObject *args,
|
|||||||
}
|
}
|
||||||
|
|
||||||
multi_threaded = PyObject_IsTrue(py_multi_threaded);
|
multi_threaded = PyObject_IsTrue(py_multi_threaded);
|
||||||
|
sign = PyObject_IsTrue(py_sign);
|
||||||
|
|
||||||
|
if (sign) {
|
||||||
|
signing_state = SMB_SIGNING_REQUIRED;
|
||||||
|
}
|
||||||
|
|
||||||
if (multi_threaded) {
|
if (multi_threaded) {
|
||||||
#ifdef HAVE_PTHREAD
|
#ifdef HAVE_PTHREAD
|
||||||
@ -482,7 +492,7 @@ static int py_cli_state_init(struct py_cli_state *self, PyObject *args,
|
|||||||
|
|
||||||
req = cli_full_connection_creds_send(
|
req = cli_full_connection_creds_send(
|
||||||
NULL, self->ev, "myname", host, NULL, 0, share, "?????",
|
NULL, self->ev, "myname", host, NULL, 0, share, "?????",
|
||||||
cli_creds, flags, SMB_SIGNING_DEFAULT);
|
cli_creds, flags, signing_state);
|
||||||
if (!py_tevent_req_wait_exc(self, req)) {
|
if (!py_tevent_req_wait_exc(self, req)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user