libsmb: reuse connections derived from DFS referrals
authorDavid Disseldorp <ddiss@samba.org>
Fri, 16 Jan 2015 15:21:22 +0000 (16:21 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 19 Jan 2015 05:48:05 +0000 (06:48 +0100)
commit7b7d4f740fe5017107d3100041cc8c7982f0eac7
tree0d2c043ecea966fb3b633181f5606be35c41ebc6
parent45829800eb3f3a8aeccfe7c1114dcf9df60371d5
libsmb: reuse connections derived from DFS referrals

[MS-DFSC] 3.2.1.1 and 3.2.1.2 states that DFS targets with the same site
location or relative cost are placed in random order in a DFS referral
response.

libsmbclient currently resolves DFS referrals on every API call, always
using the first entry in the referral response. With random ordering,
libsmbclient may open a new server connection, rather than reuse an
existing (cached) connection established in a previous DFS referred API
call.

This change sees libsmbclient check the connection cache for any of the
DFS referral response entries before creating a new connection.

This change is based on a patch by Har Gagan Sahai
<SHarGagan@novell.com>.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10123

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/libsmb/clidfs.c