[PATCH] Fix bug 11079 - libsmbclient not checking the cached connection alive status before re-using it from connection cache

Jeremy Allison jra at samba.org
Thu Mar 19 12:33:23 MDT 2015

If a server disconnects a libsmbclient using app due to
idle timeout (gnome VFS for example), we fail the first
call after reselecting the SMBCSRV object from the cache.

We then correctly reconnect, but this doesn't fix the
previous NT_STATUS_CONNECTION_RESET we've already passed
back up the stack).

This patches fixes the problem by ensuring that if we're
re-using a SMBCSRV object we haven't used for cli->timeout
miliseconds (which is normally 20 seconds, much shorter
than a typical server idle timeout length) we test the
connection with an SMB1 or SMB2 echo request before allowing
it to be re-used. If the echo fails, we then correctly
reconnect before retrying the caller-initiated operation.

Tested (along with the previous patch for bug 11173,
on which this depends) by the GNOME VFS maintainer.

Please review and push !

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-s3-lib-libsmbclient-If-reusing-a-server-struct-check.patch
Type: text/x-diff
Size: 1848 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150319/5c547684/attachment.patch>

More information about the samba-technical mailing list