diff options
author | Volker Lendecke <vl@samba.org> | 2010-08-10 07:44:15 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2010-08-18 15:14:02 +0200 |
commit | d7c8fb21bb0a29bb7227d4b242aba2f1524f6c48 (patch) | |
tree | c305bcfb7a4de6bc565d6629ce8c33fe37b9bb1a /source3/torture | |
parent | 77761d9adcf34a9d1cd4567422c98efac101b3f6 (diff) | |
download | samba-d7c8fb21bb0a29bb7227d4b242aba2f1524f6c48.tar.gz samba-d7c8fb21bb0a29bb7227d4b242aba2f1524f6c48.tar.bz2 samba-d7c8fb21bb0a29bb7227d4b242aba2f1524f6c48.zip |
s3: async cli_list
Diffstat (limited to 'source3/torture')
-rw-r--r-- | source3/torture/masktest.c | 47 | ||||
-rw-r--r-- | source3/torture/torture.c | 9 |
2 files changed, 36 insertions, 20 deletions
diff --git a/source3/torture/masktest.c b/source3/torture/masktest.c index 41c472a951..51de6d9505 100644 --- a/source3/torture/masktest.c +++ b/source3/torture/masktest.c @@ -263,11 +263,16 @@ static struct cli_state *connect_one(char *share) } static char *resultp; -static struct file_info *f_info; + +struct rn_state { + char **pp_long_name; + char *short_name; +}; static void listfn(const char *mnt, struct file_info *f, const char *s, - void *state) + void *private_data) { + struct rn_state *state = (struct rn_state *)private_data; if (strcmp(f->name,".") == 0) { resultp[0] = '+'; } else if (strcmp(f->name,"..") == 0) { @@ -275,28 +280,38 @@ static void listfn(const char *mnt, struct file_info *f, const char *s, } else { resultp[2] = '+'; } - f_info = f; + + if ((state == NULL) || ISDOT(f->name) || ISDOTDOT(f->name)) { + return; + } + + fstrcpy(state->short_name, f->short_name); + strlower_m(state->short_name); + *state->pp_long_name = SMB_STRDUP(f->name); + if (!*state->pp_long_name) { + return; + } + strlower_m(*state->pp_long_name); } static void get_real_name(struct cli_state *cli, char **pp_long_name, fstring short_name) { + struct rn_state state; + + state.pp_long_name = pp_long_name; + state.short_name = short_name; + *pp_long_name = NULL; /* nasty hack to force level 260 listings - tridge */ - cli->capabilities |= CAP_NT_SMBS; if (max_protocol <= PROTOCOL_LANMAN1) { - cli_list_new(cli, "\\masktest\\*.*", aHIDDEN | aDIR, listfn, NULL); + cli_list_trans(cli, "\\masktest\\*.*", aHIDDEN | aDIR, + SMB_FIND_FILE_BOTH_DIRECTORY_INFO, listfn, + &state); } else { - cli_list_new(cli, "\\masktest\\*", aHIDDEN | aDIR, listfn, NULL); - } - if (f_info) { - fstrcpy(short_name, f_info->short_name); - strlower_m(short_name); - *pp_long_name = SMB_STRDUP(f_info->name); - if (!*pp_long_name) { - return; - } - strlower_m(*pp_long_name); + cli_list_trans(cli, "\\masktest\\*", aHIDDEN | aDIR, + SMB_FIND_FILE_BOTH_DIRECTORY_INFO, + listfn, &state); } if (*short_name == 0) { @@ -331,12 +346,10 @@ static void testpair(struct cli_state *cli, const char *mask, const char *file) resultp = res1; fstrcpy(short_name, ""); - f_info = NULL; get_real_name(cli, &long_name, short_name); if (!long_name) { return; } - f_info = NULL; fstrcpy(res1, "---"); cli_list(cli, mask, aHIDDEN | aDIR, listfn, NULL); diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 01a085d89a..0e3ee18a37 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -5183,7 +5183,8 @@ static bool run_dirtest1(int dummy) } /* Now ensure that doing an old list sees both files and directories. */ - num_seen = cli_list_old(cli, "\\LISTDIR\\*", aDIR, list_fn, NULL); + num_seen = 0; + cli_list_old(cli, "\\LISTDIR\\*", aDIR, list_fn, &num_seen); printf("num_seen = %d\n", num_seen ); /* We should see 100 files + 1000 directories + . and .. */ if (num_seen != 2002) @@ -5192,12 +5193,14 @@ static bool run_dirtest1(int dummy) /* Ensure if we have the "must have" bits we only see the * relevent entries. */ - num_seen = cli_list_old(cli, "\\LISTDIR\\*", (aDIR<<8)|aDIR, list_fn, NULL); + num_seen = 0; + cli_list_old(cli, "\\LISTDIR\\*", (aDIR<<8)|aDIR, list_fn, &num_seen); printf("num_seen = %d\n", num_seen ); if (num_seen != 1002) correct = False; - num_seen = cli_list_old(cli, "\\LISTDIR\\*", (aARCH<<8)|aDIR, list_fn, NULL); + num_seen = 0; + cli_list_old(cli, "\\LISTDIR\\*", (aARCH<<8)|aDIR, list_fn, &num_seen); printf("num_seen = %d\n", num_seen ); if (num_seen != 1000) correct = False; |