The .get_oplock_break is dependent on the pthread code, which is only
used when creating a SMB connection with multi_threaded=True.
Add an explicit error to the .get_oplock_break() if someone tries to use
it in non-multithreaded mode.
Initializing self->oplock_waiter in non-multithreaded mode is similarly
redundant if the API can never be used.
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
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: Tim Beale <timbeale@catalyst.net.nz>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
self->is_smb1 = true;
}
+ /*
+ * Oplocks require a multi threaded connection
+ */
+ if (self->thread_state == NULL) {
+ return 0;
+ }
+
self->oplock_waiter = cli_smb_oplock_break_waiter_send(
self->ev, self->ev, self->cli);
if (self->oplock_waiter == NULL) {
return NULL;
}
+ if (self->thread_state == NULL) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "get_oplock_break() only possible on "
+ "a multi_threaded connection");
+ return NULL;
+ }
+
if (self->oplock_cond != NULL) {
errno = EBUSY;
PyErr_SetFromErrno(PyExc_RuntimeError);