diff options
author | Andrew Tridgell <tridge@samba.org> | 2001-03-21 05:54:09 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2001-03-21 05:54:09 +0000 |
commit | 85a18b2c0cbccf8fa774ac5fb56e3c569ba4834c (patch) | |
tree | bf512eff80a4b01ec888974d606e616aa95223fe /source3/utils | |
parent | de2fdda9206d550ba1b1fb89b9033fd76a4fff61 (diff) | |
download | samba-85a18b2c0cbccf8fa774ac5fb56e3c569ba4834c.tar.gz samba-85a18b2c0cbccf8fa774ac5fb56e3c569ba4834c.tar.bz2 samba-85a18b2c0cbccf8fa774ac5fb56e3c569ba4834c.zip |
latest attempt at lanman1 wildcard matching
(This used to be commit 32361fc53e11a71f133a1727c6234a2bf01a5ccf)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/masktest.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/source3/utils/masktest.c b/source3/utils/masktest.c index 4dd8f3ef06..8ee590d077 100644 --- a/source3/utils/masktest.c +++ b/source3/utils/masktest.c @@ -45,8 +45,7 @@ int ms_fnmatch_lanman_core(char *pattern, char *string) while ((c = *p++)) { switch (c) { case '.': - if (!strchr(p,'.') && !*n && ms_fnmatch_lanman_core(p, n)==0) - goto match; + /* if (! *n && ! *p) goto match; */ if (*n != '.') goto nomatch; n++; break; @@ -113,9 +112,15 @@ next: int ms_fnmatch_lanman(char *pattern, char *string) { if (!strpbrk(pattern, "?*<>\"")) { + if (strcmp(string,"..") == 0) string = "."; return strcmp(pattern, string); } + if (strcmp(string,"..") == 0 || strcmp(string,".") == 0) { + return ms_fnmatch_lanman_core(pattern, "..") && + ms_fnmatch_lanman_core(pattern, "."); + } + return ms_fnmatch_lanman_core(pattern, string); } @@ -124,13 +129,14 @@ static BOOL reg_match_one(char *pattern, char *file) /* oh what a weird world this is */ if (old_list && strcmp(pattern, "*.*") == 0) return True; - if (strcmp(file,"..") == 0) file = "."; if (strcmp(pattern,".") == 0) return False; if (max_protocol <= PROTOCOL_LANMAN2) { return ms_fnmatch_lanman(pattern, file)==0; } + if (strcmp(file,"..") == 0) file = "."; + return ms_fnmatch(pattern, file)==0; } @@ -276,6 +282,16 @@ static void get_real_name(struct cli_state *cli, pstrcpy(long_name, finfo->name); strlower(long_name); } + + if (*short_name == 0) { + fstrcpy(short_name, long_name); + } + +#if 0 + if (!strchr(short_name,'.')) { + fstrcat(short_name,"."); + } +#endif } static void testpair(struct cli_state *cli, char *mask, char *file) @@ -311,7 +327,7 @@ static void testpair(struct cli_state *cli, char *mask, char *file) if (showall || strcmp(res1, res2)) { DEBUG(0,("%s %s %d mask=[%s] file=[%s] rfile=[%s/%s]\n", res1, res2, count, mask, file, long_name, short_name)); - // exit(1); + /* exit(1); */ } cli_unlink(cli, file); |