The Samba-Bugzilla – Attachment 14095 Details for
Bug 13340
reset on zero vc option resets the wrong client
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
patch.txt (text/plain), 2.49 KB, created by
Volker Lendecke
on 2018-03-30 02:57:29 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Volker Lendecke
Created:
2018-03-30 02:57:29 UTC
Size:
2.49 KB
patch
obsolete
>From a5b041721b270560c6a983013be9955abde6e52e Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Mon, 26 Mar 2018 04:36:25 -0500 >Subject: [PATCH] smbd: Fix "reset on zero vc" > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=13340 >Signed-off-by: Volker Lendecke <vl@samba.org> >--- > source3/smbd/sesssetup.c | 31 ++++++++++++++++++++++--------- > 1 file changed, 22 insertions(+), 9 deletions(-) > >diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c >index 56318a01deb..4174c9868f3 100644 >--- a/source3/smbd/sesssetup.c >+++ b/source3/smbd/sesssetup.c >@@ -482,6 +482,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req) > > struct shutdown_state { > const char *ip; >+ size_t ip_len; > struct messaging_context *msg_ctx; > }; > >@@ -492,6 +493,8 @@ static int shutdown_other_smbds(struct smbXsrv_session_global0 *session, > struct server_id self_pid = messaging_server_id(state->msg_ctx); > struct server_id pid = session->channels[0].server_id; > const char *addr = session->channels[0].remote_address; >+ const char *port_colon; >+ size_t addr_len; > struct server_id_buf tmp; > > DEBUG(10, ("shutdown_other_smbds: %s, %s\n", >@@ -507,14 +510,17 @@ static int shutdown_other_smbds(struct smbXsrv_session_global0 *session, > return 0; > } > >- /* >- * here we use strstr() because 'addr' >- * (session->channels[0].remote_address) >- * contains a string like: >- * 'ipv4:127.0.0.1:48163' >- */ >- if (strstr(addr, state->ip) == NULL) { >- DEBUG(10, ("%s does not match %s\n", state->ip, addr)); >+ port_colon = strrchr(addr, ':'); >+ if (port_colon == NULL) { >+ DBG_DEBUG("addr %s in contains no port\n", addr); >+ return 0; >+ } >+ addr_len = port_colon - addr; >+ >+ if ((addr_len != state->ip_len) || >+ (strncmp(addr, state->ip, state->ip_len) != 0)) { >+ DEBUG(10, ("%s (%zu) does not match %s (%zu)\n", >+ state->ip, state->ip_len, addr, addr_len)); > return 0; > } > >@@ -534,14 +540,21 @@ static void setup_new_vc_session(struct smbd_server_connection *sconn) > > if (lp_reset_on_zero_vc()) { > char *addr; >+ const char *port_colon; > struct shutdown_state state; > >- addr = tsocket_address_inet_addr_string( >+ addr = tsocket_address_string( > sconn->remote_address, talloc_tos()); > if (addr == NULL) { > return; > } > state.ip = addr; >+ >+ port_colon = strrchr(addr, ':'); >+ if (port_colon == NULL) { >+ return; >+ } >+ state.ip_len = port_colon - addr; > state.msg_ctx = sconn->msg_ctx; > smbXsrv_session_global_traverse(shutdown_other_smbds, &state); > TALLOC_FREE(addr); >-- >2.16.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
metze
:
review+
Actions:
View
Attachments on
bug 13340
:
14057
|
14083
| 14095