The Samba-Bugzilla – Attachment 10898 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]
git-am cherry-pick from master for 4.2.next, 4.1.next.
0002-s3-lib-libsmbclient-If-reusing-a-server-struct-check.patch (text/plain), 2.05 KB, created by
Jeremy Allison
on 2015-03-20 16:46:50 UTC
(
hide
)
Description:
git-am cherry-pick from master for 4.2.next, 4.1.next.
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2015-03-20 16:46:50 UTC
Size:
2.05 KB
patch
obsolete
>From 67993ab448495fe32d041378062995bf50be8922 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Wed, 18 Mar 2015 14:15:16 -0700 >Subject: [PATCH 2/2] 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> >Reviewed-by: David Disseldorp <ddiss@samba.org> > >Autobuild-User(master): David Disseldorp <ddiss@samba.org> >Autobuild-Date(master): Fri Mar 20 13:48:26 CET 2015 on sn-devel-104 > >(cherry picked from commit 4f4151ea050a5f34e42d73a4bf9448c673a35787) >--- > 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 d89b9ec..5410099 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_mono(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
Flags:
ddiss
:
review+
Actions:
View
Attachments on
bug 11079
:
10676
|
10690
|
10884
|
10886
|
10888
|
10889
| 10898