summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/smbd/filename.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index d1c512c251..f098950c44 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -283,7 +283,7 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component,
} else {
pstring rest;
- /* Stat failed - ensure we don't use it. */
+ /* Stat failed - ensure we don't use it. */
ZERO_STRUCT(st);
*rest = 0;
@@ -320,7 +320,7 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component,
/*
* Just the last part of the name doesn't exist.
- * We may need to strupper() or strlower() it in case
+ * We may need to strupper() or strlower() it in case
* this conversion is being used for file creation
* purposes. If the filename is of mixed case then
* don't normalise it.
@@ -343,11 +343,14 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component,
}
/*
- * Restore the rest of the string.
+ * Restore the rest of the string. If the string was mangled the size
+ * may have changed.
*/
if (end) {
- pstrcpy(start+strlen(start)+1,rest);
end = start + strlen(start);
+ pstrcat(start,"/");
+ pstrcat(start,rest);
+ *end = '\0';
}
} /* end else */
@@ -489,7 +492,7 @@ static BOOL scan_directory(char *path, char *name,connection_struct *conn,BOOL d
if (!name_map_mangle(name2,False,True,SNUM(conn)))
continue;
- if ((mangled && mangled_equal(name,name2)) || fname_equal(name, name2)) {
+ if ((mangled && mangled_equal(name,name2)) || fname_equal(name, dname)) {
/* we've found the file, change it's name and return */
if (docache)
DirCacheAdd(path,name,dname,SNUM(conn));