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>
creds.set_password(os.getenv("PASSWORD"))
c = libsmb_samba_internal.Conn(os.getenv("SERVER_IP"), "tmp",
creds.set_password(os.getenv("PASSWORD"))
c = libsmb_samba_internal.Conn(os.getenv("SERVER_IP"), "tmp",
- creds, multi_threaded=True)
+ creds, multi_threaded=True,
+ force_smb1=True)
PyObject *py_sign = Py_False;
bool sign = false;
int signing_state = SMB_SIGNING_DEFAULT;
PyObject *py_sign = Py_False;
bool sign = false;
int signing_state = SMB_SIGNING_DEFAULT;
+ PyObject *py_force_smb1 = Py_False;
+ bool force_smb1 = false;
struct tevent_req *req;
bool ret;
struct tevent_req *req;
bool ret;
- /*
- * For now we only support SMB1,
- * as most of the cli_*_send() function
- * don't support SMB2, it's only plugged
- * into the sync wrapper functions currently.
- */
- int flags = CLI_FULL_CONNECTION_FORCE_SMB1;
static const char *kwlist[] = {
"host", "share", "credentials",
static const char *kwlist[] = {
"host", "share", "credentials",
- "multi_threaded", "sign", NULL
+ "multi_threaded", "sign", "force_smb1",
+ NULL
};
PyTypeObject *py_type_Credentials = get_pytype(
};
PyTypeObject *py_type_Credentials = get_pytype(
}
ret = ParseTupleAndKeywords(
}
ret = ParseTupleAndKeywords(
- args, kwds, "ss|O!OO", kwlist,
+ args, kwds, "ss|O!OOO", kwlist,
&host, &share,
py_type_Credentials, &creds,
&py_multi_threaded,
&host, &share,
py_type_Credentials, &creds,
&py_multi_threaded,
+ &py_sign,
+ &py_force_smb1);
Py_DECREF(py_type_Credentials);
Py_DECREF(py_type_Credentials);
multi_threaded = PyObject_IsTrue(py_multi_threaded);
sign = PyObject_IsTrue(py_sign);
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 (sign) {
signing_state = SMB_SIGNING_REQUIRED;
}
+ if (force_smb1) {
+ /*
+ * As most of the cli_*_send() function
+ * don't support SMB2 (it's only plugged
+ * into the sync wrapper functions currently)
+ * we have a way to force SMB1.
+ */
+ flags = CLI_FULL_CONNECTION_FORCE_SMB1;
+ }
+
if (multi_threaded) {
#ifdef HAVE_PTHREAD
ret = py_cli_state_setup_mt_ev(self);
if (multi_threaded) {
#ifdef HAVE_PTHREAD
ret = py_cli_state_setup_mt_ev(self);
"No PTHREAD support available");
return -1;
#endif
"No PTHREAD support available");
return -1;
#endif
+ if (!force_smb1) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "multi_threaded is only possible on "
+ "SMB1 connections");
+ return -1;
+ }
} else {
ret = py_cli_state_setup_ev(self);
if (!ret) {
} else {
ret = py_cli_state_setup_ev(self);
if (!ret) {