Problem with msdfs with Samba 2.2.5 and 3.0 alpha19

Shirish Kalele kalele at veritas.com
Wed Aug 21 14:31:10 GMT 2002


Hi John,

Yes, the msdfs code only tries the entire path and the path one level up
when asked for a dfs referral. There didn't seem to be a case where the
redirector ever jumped straight to a path without resolving each component
first (which would result in a correct referral). But it looks like it
does.. I'll try and reproduce this here, take a look at the patch and apply
it or a variant to 2_2 and HEAD.

Thanks,
Shirish

----- Original Message -----
From: "John P Janosik" <jpjanosi at us.ibm.com>
To: <samba-technical at lists.samba.org>
Sent: Wednesday, August 21, 2002 8:34 AM
Subject: Problem with msdfs with Samba 2.2.5 and 3.0 alpha19


> Hello,
>
> I think we have found a problem with Samba's msdfs support.  When we try
to
> directly access a directory for the first time via a msdfs link from a
> Windows XP or 2000 client the Samba server does not return the referral if
> the link is more than two levels back in the path.  Here is an example:
>
> Win2000 server with a Dfs root \\rchn20dc\home, link technet  points to a
> Samba server:
> C:\>dir \\rchn20dc\home\technet\tn0208\technet
>  Volume in drive \\rchn20dc\home has no label.
>  Volume Serial Number is 5406-067F
>
>  Directory of \\rchn20dc\home\technet\tn0208\technet
>
> 08/06/2002  02:37 PM    <DIR>          .
> .
> .
> 07/31/2002  07:00 PM        11,291,797 TN0208.TOC
>                5 File(s)    643,464,418 bytes
>                2 Dir(s)  233,144,582,144 bytes free
>
>
> Samba 2.2.5 or 3.0 alpha19 msdfs root with same link:
> C:\>dir \\rchfs\pub\technet\tn0208\technet
>  Volume in drive \\rchfs\pub is pub
>  Volume Serial Number is 0514-0112
>
>  Directory of \\rchfs\pub\technet\tn0208
>
> 08/06/2002  02:34 PM    <DIR>          .
> .
> .
> 08/06/2002  02:37 PM    <DIR>          TECHNET
>               20 File(s)      6,407,854 bytes
>                4 Dir(s)  233,144,582,144 bytes free
>
> After looking at the ethereal traces to a Samba 2.2.5, Samba 3.0 alpha19,
> and Win2k server I see that Win2k returns the referral for \\rcn20dc\pub
> when sent a get_dfs_referral for \rchn20dc\home\technet\tn0208\technet.
> The Samba servers do not.  The XP client then sends a second
> get_dfs_referral to the Samba server, this time leaving off the last
> directory in the path and then displays the directory one level back from
> what was asked for.  I have tried the same test from a Windows 2000 client
> and the dir command to the Samba server just fails, it does not send the
> second get_dfs_referral.
>
> I made the following change to work around the problem.   Can anyone tell
> me if this is OK:
> [rchfs2:root samba-2.2.5]# diff -urN source/msdfs/msdfs.c.orig
> source/msdfs/msdf
> s.c
> --- source/msdfs/msdfs.c.orig   Tue Jun 18 20:13:44 2002
> +++ source/msdfs/msdfs.c        Wed Aug 21 10:20:20 2002
> @@ -215,7 +215,7 @@
>                       BOOL* self_referralp, int* consumedcntp)
>  {
>         fstring localpath;
> -
> +      int levels;
>         char *p;
>         fstring reqpath;
>
> @@ -253,7 +253,7 @@
>         /* also redirect if the parent directory is a dfs link */
>         fstrcpy(reqpath, dp->reqpath);
>         p = strrchr(reqpath, '/');
> -       if (p) {
> +      for(levels=1; p; levels++) {
>                 *p = '\0';
>                 fstrcpy(localpath, conn->connectpath);
>                 fstrcat(localpath, "/");
> @@ -267,19 +267,23 @@
>                            the path consumed
>                         */
>                         if (consumedcntp) {
> -                               char *q;
> -                               pstring buf;
> +                              char *q;
> +                              pstring buf;
> +                              int j;
>                                 safe_strcpy(buf, dfspath, sizeof(buf));
>                                 trim_string(buf, NULL, "\\");
> -                               q = strrchr(buf, '\\');
> -                               if (q)
> -                                       *q = '\0';
> +                                for(j=0; j<levels; j++) {
> +                                       q = strrchr(buf, '\\');
> +                                       if (q)
> +                                               *q = '\0';
> +                                }
>                                 *consumedcntp = strlen(buf);
>                                 DEBUG(10, ("resolve_dfs_path: Path
> consumed: %d\
> n", *consumedcntp));
>                         }
>
>                         return True;
> -               }
> +              }
> +              p = strrchr(reqpath, '/');
>         }
>
>         return False;
>
> Thanks,
>
> John Janosik
> jpjanosi at us.ibm.com
>




More information about the samba-technical mailing list