diff options
author | Andrew Tridgell <tridge@samba.org> | 2001-02-26 05:13:19 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2001-02-26 05:13:19 +0000 |
commit | 571a04613b739bbfcea8a55d5ec55569b7a7b319 (patch) | |
tree | d2631a04f199c83c62e2011fdeaa72fe4fe8c103 | |
parent | d33b294b9aa6059bd0831a264b427108bd2d5db2 (diff) | |
download | samba-571a04613b739bbfcea8a55d5ec55569b7a7b319.tar.gz samba-571a04613b739bbfcea8a55d5ec55569b7a7b319.tar.bz2 samba-571a04613b739bbfcea8a55d5ec55569b7a7b319.zip |
made some progress in masktest
it now handles the server renaming files on create
(This used to be commit 85ce14f36da4f5a3fb3029634279bb473873bbd5)
-rw-r--r-- | source3/utils/masktest.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/source3/utils/masktest.c b/source3/utils/masktest.c index 864962d79a..9a4d7156b4 100644 --- a/source3/utils/masktest.c +++ b/source3/utils/masktest.c @@ -134,17 +134,16 @@ static BOOL reg_match_one(char *pattern, char *file) return ms_fnmatch(pattern, file)==0; } -static char *reg_test(char *pattern, char *file, char *short_name) +static char *reg_test(char *pattern, char *long_name, char *short_name) { static fstring ret; fstrcpy(ret, "---"); pattern = 1+strrchr(pattern,'\\'); - // file = 1+strrchr(file,'\\'); if (reg_match_one(pattern, ".")) ret[0] = '+'; if (reg_match_one(pattern, "..")) ret[1] = '+'; - if (reg_match_one(pattern, file) || + if (reg_match_one(pattern, long_name) || (*short_name && reg_match_one(pattern, short_name))) ret[2] = '+'; return ret; } @@ -261,10 +260,14 @@ void listfn(file_info *f, const char *s, void *state) finfo = f; } -static void get_short_name(struct cli_state *cli, - char *name, pstring long_name, fstring short_name) +static void get_real_name(struct cli_state *cli, + pstring long_name, fstring short_name) { - cli_list(cli, "\\masktest\\*.*", aHIDDEN | aDIR, listfn, NULL); + if (max_protocol <= PROTOCOL_LANMAN1) { + cli_list_new(cli, "\\masktest\\*.*", aHIDDEN | aDIR, listfn, NULL); + } else { + cli_list_new(cli, "\\masktest\\*", aHIDDEN | aDIR, listfn, NULL); + } if (finfo) { fstrcpy(short_name, finfo->short_name); strlower(short_name); @@ -296,20 +299,16 @@ static void testpair(struct cli_state *cli, char *mask, char *file) resultp = res1; fstrcpy(short_name, ""); finfo = NULL; - if (old_list) { - cli_list_old(cli, mask, aHIDDEN | aDIR, listfn, NULL); - } else { - get_short_name(cli, file, long_name, short_name); - finfo = NULL; - fstrcpy(res1, "---"); - cli_list(cli, mask, aHIDDEN | aDIR, listfn, NULL); - } + get_real_name(cli, long_name, short_name); + finfo = NULL; + fstrcpy(res1, "---"); + cli_list(cli, mask, aHIDDEN | aDIR, listfn, NULL); res2 = reg_test(mask, long_name, short_name); if (showall || strcmp(res1, res2)) { - DEBUG(0,("%s %s %d mask=[%s] file=[%s] mfile=[%s]\n", - res1, res2, count, mask, file, short_name)); + DEBUG(0,("%s %s %d mask=[%s] file=[%s] rfile=[%s/%s]\n", + res1, res2, count, mask, file, long_name, short_name)); } cli_unlink(cli, file); |