Fix nasty bug pointed out by samba-technical poster. If name is mangled
authorJeremy Allison <jra@samba.org>
Fri, 9 May 2003 01:06:43 +0000 (01:06 +0000)
committerJeremy Allison <jra@samba.org>
Fri, 9 May 2003 01:06:43 +0000 (01:06 +0000)
then we weren't always correctly detecting that it had a valid stat struct
and so might now return a 'file existed'. Finally realized this when installing
the W2K resource kit as a test case.
Jeremy.

source/smbd/filename.c

index ad707a2b9dd7e5275b1a8dd67fe4b1e3789fb629..9dd1523c73d8c464413587b6e3fff539f0deabb0 100644 (file)
@@ -248,6 +248,16 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen
                                return(False);
                        }
 
+                       if (!end) {
+                               /*
+                                * We just scanned for, and found the end of the path.
+                                * We must return the valid stat struct.
+                                * JRA.
+                                */
+
+                               *pst = st;
+                       }
+
                } else {
                        pstring rest;
 
@@ -373,7 +383,8 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen
 
        /*
         * If we ended up resolving the entire path then return a valid
-        * stat struct if we got one.
+        * stat struct if we got one. Note this doesn't catch mangled paths,
+        * but the check in the for loop above will do that. JRA.
         */
 
        if (VALID_STAT(st) && (strlen(orig_path) == strlen(name)))