directory recursion problem

John P Janosik jpjanosi at us.ibm.com
Thu Apr 10 16:47:56 GMT 2003





Robin -

We were having the same problem along with a problem running binaries via a
UNC instead of a mapped drive if the binaries were more than two levels
down a tree when the first level was a DFS referral.  I made the following
patch to Samba to fix the second problem, but we never saw the directory
recursion problem again after this.  Shirish Kalele said he would take a
look at applying the patch or something similar, but I never heard back and
never saw the patch get applied.  Here is a link to my post about the
problem:
http://lists.samba.org/pipermail/samba-technical/2002-August/038903.html.

[rchfs2:root samba-2.2.5]# diff -urN
source/msdfs/msdfs.c.origsource/msdfs/msdfs.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: Pathconsumed:
%d\n", *consumedcntp));
                        }
                        return True;
-               }
+              }
+              p = strrchr(reqpath, '/');
        }
        return False;


Date: Thu, 10 Apr 2003 09:52:22 +0100
From: Robin.SOPER at tfeeuk.co.uk
To: samba-technical at samba.org
Subject: directory recursion problem
Message-ID: <OF902C93F9.3D996294-ON80256D04.0030B9D0 at uk.ad.ep.corp.local>
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Precedence: list
Message: 29

Hi,

Hopefully you can help me with this one.  I am using Samba 2.2.6 on two
Solaris servers . The PC users all see all the shares as being on one
system and it implements MSDFS to redirect any shares that are physically
located on another system to the samba server on that system.  We have
been using this config successfully for a good while now, but recently
it's been getting more and more use and we are experiencing an
intermittent problem - sometimes when the users look in a directory
(windows explorer) they see a directory within it with the same, when they
open that they see a directory within it with the same name etc etc. i.e.
a kind of recursive directory thing. Meanwhile other users will be using
the samba shares with no problem. Restarting the PC seems to fix the
problem - which maybe seems to suggest it's client related?   However I am
uncertain whether the problem lies with the WindowsNT4 clients (having a
problem with DFS maybe) or with the samba server .

Can you advise/help?

Thanks in advance


Robin Soper
TotalFinaElf Exploration UK PLC
Crawpeel Road,  Altens,
Aberdeen
AB12 3FG

Tel (01224) 297290


John Janosik



More information about the samba-technical mailing list