[PATCH - 1/1] libsmb: Sending smb echo or keepalive request on the cached connection before re-using
Stefan (metze) Metzmacher
metze at samba.org
Mon Feb 2 16:42:24 MST 2015
Hi Har Gagan,
thanks for the patch, but I fear it's not the correct approach.
See below.
> The ( https://bugzilla.samba.org/show_bug.cgi?id=11079.The ) issue is with libsmbclient, which is using the cached connection part of SMBC context without checking for its alive status. We noticed this issue while using libsmbclient against 2008R2 (SMB2).
>
>
> [MS-SMB2] 3.3.2.3 Session Expiration Timer -
> This timer controls the periodic scheduling of searching for sessions that have passed their expiration time. The server SHOULD<172> schedule this timer such that sessions are expired in a timely manner. This timer is also used for scavenging connections on which the NEGOTIATE and SESSION_SETUP have not been performed within a specified time.
>
> This timer is typically 45 secs. Because of 45 secs of session expiration timer, if the SMBC context is reused after 45 secs anytime, the cached connection is picked without checking for its connection status. In that case the SMB call done on that connection fails with NT_STATUS_CONNECTION_RESET error.
Sessions don't expire after 45 seconds, typically 8 or 10 hours.
We need to do a reauthentication before the session expires
or when we get NT_STATUS_NETWORK_SESSION_EXPIRED.
Sending echos before each single request doesn't help.
> This patch is attempting to address the issue. After doing this change, the SMBC_check_server() will returns '1', when the connection is closed during time expiration processing on the server. When that happens, SMBC_find_server() which had called SMBC_check_server(), will return 'NULL' for the 'srv' to the SMBC_server_internal(). In that case the function will attempt to re-create the connection, so that the client is not impacted.
If the connection gets disconnected, we need to replay operations on
after a reconnect.
metze
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150203/ee56307b/attachment.pgp>
More information about the samba-technical
mailing list