On Tue, 30 Nov 2010 14:37:47 -0500
Jeff Layton <[email protected]> wrote:

> On Tue, 30 Nov 2010 18:56:49 +0100 (CET)
> Robbert Kouprie <[email protected]> wrote:
> 
> > On Tue, 30 Nov 2010, Shirish Pargaonkar wrote:
> > 
> > > Wondering why the very same cifs client does not encounter this error 
> > > against
> > > a Windows 2008 server but does against a Windows 2003 server!
> > > Perhaps a Windows client also runs into this error against a Windows 2003 
> > > server
> > > but does handle/resolve it.
> > 
> > Well from the kernel logs, it looks like the kernel does try to handle 
> > it, but fails when trying to resolve a servername that still has part of 
> > the share name attached to it.
> > 
> > Look:
> > 
> >   fs/cifs/cifssmb.c: Decoding GetDFSRefer response BCC: 261  Offset 56
> >   fs/cifs/cifssmb.c: num_referrals: 2 dfs flags: 0x3 ...
> >   cifs.upcall: key description: dns_resolver;0;0;3f000000;FOXDFT13\C
> >   cifs.upcall: unable to resolve hostname: FOXDFT13\C [Name or service not 
> > known]
> >   kernel: [94358.873289] CIFS VFS: dns_resolve_server_name_to_ip: unable to 
> > resolve: FOXDFT13\C
> >   CIFS VFS: cifs_compose_mount_options: Failed to resolve server part of 
> > \\FOXDFT13\Company to IP: -126
> > 
> > The full server + share name is "FOXDFT13\Company". It should just resolve 
> > the server name "FOXDFT13", and not leave the "\C" attached to it.
> > 
> 
> I can reproduce this too. Looks like a recent regression, but I don't
> see what broke it right offhand. 
> 

I think I found it. Does this patch fix it for you?

--------------------------[snip]----------------------------

[PATCH] cifs: fix parsing of hostname in dfs referrals

The DFS referral parsing code does a memchr() call to find the '\\'
delimiter that separates the hostname in the referral UNC from the
sharename. It then uses that value to set the length of the hostname via
pointer subtraction.  Instead of subtracting the start of the hostname
however, it subtracts the start of the UNC, which causes the code to
pass in a hostname length that is 2 bytes too long.

Regression introduced in commit 1a4240f4.

Reported-by: Robbert Kouprie <[email protected]>
Signed-off-by: Jeff Layton <[email protected]>
Cc: Wang Lei <[email protected]>
Cc: David Howells <[email protected]>
Cc: [email protected]
---
 fs/cifs/dns_resolve.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/cifs/dns_resolve.c b/fs/cifs/dns_resolve.c
index 0eb8702..548f062 100644
--- a/fs/cifs/dns_resolve.c
+++ b/fs/cifs/dns_resolve.c
@@ -66,7 +66,7 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr)
        /* Search for server name delimiter */
        sep = memchr(hostname, '\\', len);
        if (sep)
-               len = sep - unc;
+               len = sep - hostname;
        else
                cFYI(1, "%s: probably server name is whole unc: %s",
                     __func__, unc);
-- 
1.7.3.2



-- 
Jeff Layton <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to