summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2020-07-06 17:27:05 +0200
committerJeremy Allison <jra@samba.org>2021-03-06 03:30:06 +0000
commitb145434f24f35a3d43d49980ef10bf59aae9243d (patch)
treeab7065298ad06fc3d778611119dc5599f757730a /librpc
parentf1f5c36581a942bcccd63ede4b023fdb1a1d3ed4 (diff)
downloadsamba-b145434f24f35a3d43d49980ef10bf59aae9243d.tar.gz
smbXsrv_client: move the connection passing to smb2srv_client_mc_negprot_send/recv
We need a full request/response pair in order to avoid races in the multichannel connection passing. smb2srv_client_mc_negprot_send/recv locks the db record for the given client_guid. If there's no entry found, we add ourself and return NT_STATUS_OK. If there's an existing process for that client guid we start messaging_filtered_read_send() dbwrap_watched_watch_send() before calling smb2srv_client_connection_pass(). Then we release the lock and wait for either MSG_SMBXSRV_CONNECTION_PASSED to arrive or retry if dbwrap_watched_watch_recv signaled a change in the database. If we got MSG_SMBXSRV_CONNECTION_PASSED we'll return NT_STATUS_MESSAGE_RETRIEVED in order to signal that the other process will take care of the connection and we terminate the current process. All that is done completely async, which means that the IDLE_CLOSED_TIMEOUT (60 seconds) may trigger deadtime_fn(), which will send itself a MSG_SHUTDOWN. So the process that accepted the tcp connection exists if there was no MSG_SMBXSRV_CONNECTION_PASSED within 60 seconds. However the fd may still exists in the kernel (and the new connection may still be handed to the other process. If that process somehow exists before there's no way to prevent a connection termination for the client. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14433 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sat Mar 6 03:30:06 UTC 2021 on sn-devel-184
Diffstat (limited to 'librpc')
-rw-r--r--librpc/idl/messaging.idl1
1 files changed, 1 insertions, 0 deletions
diff --git a/librpc/idl/messaging.idl b/librpc/idl/messaging.idl
index 8160c76149c..06a72520f8b 100644
--- a/librpc/idl/messaging.idl
+++ b/librpc/idl/messaging.idl
@@ -136,6 +136,7 @@ interface messaging
/* smbXsrv messages */
MSG_SMBXSRV_SESSION_CLOSE = 0x0600,
MSG_SMBXSRV_CONNECTION_PASS = 0x0601,
+ MSG_SMBXSRV_CONNECTION_PASSED = 0x0602,
/* source4 and NTVFS smb server messages */
MSG_BRL_RETRY = 0x0700,