diff options
author | Jeremy Allison <jra@samba.org> | 2004-03-05 01:37:25 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2004-03-05 01:37:25 +0000 |
commit | 09325be439d7c976aadd2db2c2905f97b5af9ba6 (patch) | |
tree | 541abbf2412dd64943cb2e596d93603b26c9a3f1 /source3/smbd/vfs.c | |
parent | 26c41cb6d71f229a8dd2c7439c85de99f5f1e050 (diff) | |
download | samba-09325be439d7c976aadd2db2c2905f97b5af9ba6.tar.gz samba-09325be439d7c976aadd2db2c2905f97b5af9ba6.tar.bz2 samba-09325be439d7c976aadd2db2c2905f97b5af9ba6.zip |
all_string_sub() is broken as it doesn't handle mb chars correctly (and
so breaks when substitution '/' and '\'). It's used by unix_clean_name(),
which is used by reduce_name, which is used by check_name() (phew!).
Now that we know all filenames passed to check_name() are in a "good"
format (no double slashes, all '\\' chars translated to '/' etc.) due
to the new check_path_syntax() we can avoid calling reduce_name unless
widelinks are denied. After this check-in I can fix all_string_sub() to
handle mb chars correctly as it won't be in the direct path in the
main path handling code.
Jeremy.
(This used to be commit bce0678331aa4746181389e0f91f11fb2a6dadcb)
Diffstat (limited to 'source3/smbd/vfs.c')
-rw-r--r-- | source3/smbd/vfs.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 2f981c743f..284e24e7b1 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -845,10 +845,9 @@ static BOOL readlink_check(connection_struct *conn, const char *dir, char *name) Reduce a file name, removing .. elements and checking that it is below dir in the heirachy. This uses vfs_GetWd() and so must be run on the system that has the referenced file system. - Widelinks are allowed if widelinks is true. ********************************************************************/ -BOOL reduce_name(connection_struct *conn, pstring s, const char *dir,BOOL widelinks) +BOOL reduce_name(connection_struct *conn, pstring s, const char *dir) { #ifndef REDUCE_PATHS return True; @@ -862,20 +861,6 @@ BOOL reduce_name(connection_struct *conn, pstring s, const char *dir,BOOL wideli *dir2 = *wd = *base_name = *newname = 0; - if (widelinks) { - unix_clean_name(s); - /* can't have a leading .. */ - if (strncmp(s,"..",2) == 0 && (s[2]==0 || s[2]=='/')) { - DEBUG(3,("Illegal file name? (%s)\n",s)); - return(False); - } - - if (strlen(s) == 0) - pstrcpy(s,"./"); - - return(True); - } - DEBUG(3,("reduce_name [%s] [%s]\n",s,dir)); /* remove any double slashes */ |