From: Stefan Metzmacher Date: Tue, 4 Dec 2018 09:42:55 +0000 (+0100) Subject: s3:pylibsmb: remember that a connection uses SMB1 X-Git-Tag: tdb-1.3.17~340 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fdc62b03ca5eac3f98f0e1f2db45a7df0b29095e;p=thirdparty%2Fsamba.git s3:pylibsmb: remember that a connection uses SMB1 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 Reviewed-by: Tim Beale Reviewed-by: Andrew Bartlett --- diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c index ed3c041d4ff..e4552a2d68a 100644 --- a/source3/libsmb/pylibsmb.c +++ b/source3/libsmb/pylibsmb.c @@ -21,6 +21,7 @@ #include #include "includes.h" #include "python/py3compat.h" +#include "libcli/smb/smbXcli_base.h" #include "libsmb/libsmb.h" #include "libcli/security/security.h" #include "system/select.h" @@ -80,6 +81,7 @@ struct py_cli_oplock_break { struct py_cli_state { PyObject_HEAD struct cli_state *cli; + bool is_smb1; struct tevent_context *ev; int (*req_wait_fn)(struct tevent_context *ev, struct tevent_req *req); @@ -403,6 +405,7 @@ static PyObject *py_cli_state_new(PyTypeObject *type, PyObject *args, return NULL; } self->cli = NULL; + self->is_smb1 = false; self->ev = NULL; self->thread_state = NULL; self->oplock_waiter = NULL; @@ -519,6 +522,10 @@ static int py_cli_state_init(struct py_cli_state *self, PyObject *args, return -1; } + if (smbXcli_conn_protocol(self->cli->conn) < PROTOCOL_SMB2_02) { + self->is_smb1 = true; + } + self->oplock_waiter = cli_smb_oplock_break_waiter_send( self->ev, self->ev, self->cli); if (self->oplock_waiter == NULL) {