summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-05-09 01:06:43 +0000
committerJeremy Allison <jra@samba.org>2003-05-09 01:06:43 +0000
commit5418b7b5f03539242c7b2a28be77ff90601429d6 (patch)
tree07024cc8bb332731740e2edd654dddd2245d9a04 /source3
parent4286b7812f9df2e2741c01197feb680f00e09033 (diff)
downloadsamba-5418b7b5f03539242c7b2a28be77ff90601429d6.tar.gz
samba-5418b7b5f03539242c7b2a28be77ff90601429d6.tar.bz2
samba-5418b7b5f03539242c7b2a28be77ff90601429d6.zip
Fix nasty bug pointed out by samba-technical poster. If name is mangled
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. (This used to be commit a0688316ce0a9bad0b24cbb495f6e0a112227b50)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/filename.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index ad707a2b9d..9dd1523c73 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -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)))