diff options
author | Jeremy Allison <jra@samba.org> | 2001-12-18 01:26:54 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-12-18 01:26:54 +0000 |
commit | 0558e2c4024d419dfb7b77a2eec100f7916831d6 (patch) | |
tree | a1d8c3bcbe8af6d78ea0d73754802cdeb7692325 | |
parent | e6111117325f286028c08b51ad4f598eeba55c89 (diff) | |
download | samba-0558e2c4024d419dfb7b77a2eec100f7916831d6.tar.gz samba-0558e2c4024d419dfb7b77a2eec100f7916831d6.tar.bz2 samba-0558e2c4024d419dfb7b77a2eec100f7916831d6.zip |
Fixed the bug with descending into mangled directories.
The problem is that name_map_mangle can *change* the length of a patchname.
Ensure that all the character pointer messing about can cope with changing
sizes of components. This code is too ugly to live.....
This also needs *lots* of testing.
Jeremy.
(This used to be commit 9f2b6a07429da5dec59e562fa5489b8079978677)
-rw-r--r-- | source3/smbd/filename.c | 13 |
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)); |