diff options
author | Jeremy Allison <jra@samba.org> | 1998-12-23 22:12:33 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1998-12-23 22:12:33 +0000 |
commit | 7564b2b6e7913258d0af4cc933823f786da60aac (patch) | |
tree | ae3e8f4f56a01aa7a3a7c974a3c1a3fcf60a6a72 | |
parent | 25318f8404f0261d895a48db82e7d9baa8604b03 (diff) | |
download | samba-7564b2b6e7913258d0af4cc933823f786da60aac.tar.gz samba-7564b2b6e7913258d0af4cc933823f786da60aac.tar.xz samba-7564b2b6e7913258d0af4cc933823f786da60aac.zip |
Fixed issues with client wildcards. It turns out that NT matches
wildcards against both long and short filenames in a trans2 wildcard
match. This fix gets us closer to NT compatibility (still not entirely
there yet.... one more issue I know about to fix....).
Jeremy.
-rw-r--r-- | source/lib/util.c | 25 | ||||
-rw-r--r-- | source/smbd/trans2.c | 36 |
2 files changed, 41 insertions, 20 deletions
diff --git a/source/lib/util.c b/source/lib/util.c index 3bf0a42c52a..d760e61fd00 100644 --- a/source/lib/util.c +++ b/source/lib/util.c @@ -1317,6 +1317,21 @@ BOOL mask_match(char *str, char *regexp, int case_sig,BOOL trans2) pstrcpy(t_pattern,regexp); pstrcpy(t_filename,str); + if(trans2) { + + /* a special case for 16 bit apps */ + if (strequal(t_pattern,"????????.???")) + pstrcpy(t_pattern,"*"); + +#if 0 + /* + * Handle broken clients that send us old 8.3 format. + */ + string_sub(t_pattern,"????????","*"); + string_sub(t_pattern,".???",".*"); +#endif + } + #if 0 /* * Not sure if this is a good idea. JRA. @@ -1413,19 +1428,21 @@ BOOL mask_match(char *str, char *regexp, int case_sig,BOOL trans2) */ if (strequal (t_filename, ".")) { /* - * Patterns: *.* *. ?. ? are valid - * + * Patterns: *.* *. ?. ? ????????.??? are valid. + * */ if(strequal(t_pattern, "*.*") || strequal(t_pattern, "*.") || - strequal(t_pattern, "?.") || strequal(t_pattern, "?")) + strequal(t_pattern, "????????.???") || + strequal(t_pattern, "?.") || strequal(t_pattern, "?")) matched = True; } else if (strequal (t_filename, "..")) { /* - * Patterns: *.* *. ?. ? *.? are valid + * Patterns: *.* *. ?. ? *.? ????????.??? are valid. * */ if(strequal(t_pattern, "*.*") || strequal(t_pattern, "*.") || strequal(t_pattern, "?.") || strequal(t_pattern, "?") || + strequal(t_pattern, "????????.???") || strequal(t_pattern, "*.?") || strequal(t_pattern, "?.*")) matched = True; } else { diff --git a/source/smbd/trans2.c b/source/smbd/trans2.c index 9e4000a1930..8afc9a29bcd 100644 --- a/source/smbd/trans2.c +++ b/source/smbd/trans2.c @@ -340,6 +340,8 @@ static int get_lanman2_dir_entry(connection_struct *conn, while (!found) { + BOOL got_match; + /* Needed if we run out of space */ prev_dirpos = TellDir(conn->dirptr); dname = ReadDirName(conn->dirptr); @@ -361,7 +363,24 @@ static int get_lanman2_dir_entry(connection_struct *conn, pstrcpy(fname,dname); - if(mask_match(fname, mask, case_sensitive, True)) + got_match = mask_match(fname, mask, case_sensitive, True); + + if(!got_match && !is_8_3(fname, False)) { + + /* + * It turns out that NT matches wildcards against + * both long *and* short names. This may explain some + * of the wildcard wierdness from old DOS clients + * that some people have been seeing.... JRA. + */ + + pstring newname; + pstrcpy( newname, fname); + name_map_mangle( newname, True, SNUM(conn)); + got_match = mask_match(newname, mask, case_sensitive, False); + } + + if(got_match) { BOOL isdots = (strequal(fname,"..") || strequal(fname,".")); if (dont_descend && !isdots) @@ -712,21 +731,6 @@ static int call_trans2findfirst(connection_struct *conn, /* Convert the formatted mask. */ mask_convert(mask); -#if 0 /* JRA */ - /* - * Now we have a working mask_match in util.c, I believe - * we no longer need these hacks (in fact they break - * things). JRA. - */ - - /* a special case for 16 bit apps */ - if (strequal(mask,"????????.???")) pstrcpy(mask,"*"); - - /* handle broken clients that send us old 8.3 format */ - string_sub(mask,"????????","*"); - string_sub(mask,".???",".*"); -#endif /* JRA */ - /* Save the wildcard match and attribs we are using on this directory - needed as lanman2 assumes these are being saved between calls */ |