Fixed bugs in my YOST replacement code. Doing a trim_string
authorSamba Release Account <samba-bugs@samba.org>
Thu, 13 Feb 1997 20:36:58 +0000 (20:36 +0000)
committerSamba Release Account <samba-bugs@samba.org>
Thu, 13 Feb 1997 20:36:58 +0000 (20:36 +0000)
in unix_clean_name caused directory names to go from ./ to "".
This is now checked for, unix_clean name returns ./ in these
cases.
jra@cygnus.com

source/lib/util.c

index 44184f8d46862efc29eb1f0b2efc3accca592c92..a43de46c511cceefa96ae2a5075046e497dbfedf 100644 (file)
@@ -1185,7 +1185,11 @@ void unix_clean_name(char *s)
   string_sub(s, "//","/");
 
   /* Remove leading ./ characters */
-  trim_string(s, "./", NULL);
+  if(strncmp(s, "./", 2) == 0) {
+    trim_string(s, "./", NULL);
+    if(*s == 0)
+      strcpy(s,"./");
+  }
 
   while ((p = strstr(s,"/../")) != NULL)
     {
@@ -1381,6 +1385,10 @@ BOOL reduce_name(char *s,char *dir,BOOL widelinks)
          DEBUG(3,("Illegal file name? (%s)\n",s));
          return(False);
        }
+
+      if (strlen(s) == 0)
+        strcpy(s,"./");
+
       return(True);
     }