The Samba-Bugzilla – Attachment 10884 Details for
Bug 11079
libsmbclient not checking the cached connection alive status before re-using it from connection cache
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch for master.
0001-s3-lib-libsmbclient-If-reusing-a-server-struct-check.patch (text/plain), 1.80 KB, created by
Jeremy Allison
on 2015-03-18 21:22:22 UTC
(
hide
)
Description:
Proposed patch for master.
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2015-03-18 21:22:22 UTC
Size:
1.80 KB
patch
obsolete
>From bfca13f667824943b36dc45ea909b38f49cdc09e Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Wed, 18 Mar 2015 14:15:16 -0700 >Subject: [PATCH] s3: lib: libsmbclient: If reusing a server struct, check > every cli->timout miliseconds if it's still valid before use. > >Uses an cli_echo() call to do so. > >Based on code from <shargagan@novell.com> > >Bug 11079 - libsmbclient not checking the cached connection alive status before re-using it from connection cache > >https://bugzilla.samba.org/show_bug.cgi?id=11079 > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/include/libsmb_internal.h | 1 + > source3/libsmb/libsmb_server.c | 16 ++++++++++++++++ > 2 files changed, 17 insertions(+) > >diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h >index ce73181..65fad99 100644 >--- a/source3/include/libsmb_internal.h >+++ b/source3/include/libsmb_internal.h >@@ -81,6 +81,7 @@ struct _SMBCSRV { > bool no_pathinfo3; > bool no_nt_session; > struct policy_handle pol; >+ time_t last_echo_time; > > SMBCSRV *next, *prev; > }; >diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c >index 8f68a40..d05570d 100644 >--- a/source3/libsmb/libsmb_server.c >+++ b/source3/libsmb/libsmb_server.c >@@ -45,10 +45,26 @@ int > SMBC_check_server(SMBCCTX * context, > SMBCSRV * server) > { >+ time_t now; >+ > if (!cli_state_is_connected(server->cli)) { > return 1; > } > >+ now = time(NULL); >+ >+ if (server->last_echo_time == (time_t)0 || >+ now > server->last_echo_time + >+ (server->cli->timeout/1000)) { >+ unsigned char data[16] = {0}; >+ NTSTATUS status = cli_echo(server->cli, >+ 1, >+ data_blob_const(data, sizeof(data))); >+ if (!NT_STATUS_IS_OK(status)) { >+ return 1; >+ } >+ server->last_echo_time = now; >+ } > return 0; > } > >-- >2.2.0.rc0.207.ga3a616c >
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
Actions:
View
Attachments on
bug 11079
:
10676
|
10690
|
10884
|
10886
|
10888
|
10889
|
10898