diff options
author | Tim Potter <tpot@samba.org> | 2004-02-08 00:51:07 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2004-02-08 00:51:07 +0000 |
commit | 4639eb5a58f8c0906afdc8e8f8f67f82e9547f75 (patch) | |
tree | 2115d25166961cea7d49836d53a05e98c796ff8a /source4/libcli/clilist.c | |
parent | f0c9a54b30cfa627b4ddcbc24fe943b21472df34 (diff) | |
download | samba-4639eb5a58f8c0906afdc8e8f8f67f82e9547f75.tar.gz samba-4639eb5a58f8c0906afdc8e8f8f67f82e9547f75.tar.bz2 samba-4639eb5a58f8c0906afdc8e8f8f67f82e9547f75.zip |
Convert libcli routines to use cli_tree instead of cli_state. Port
smbtorture to use the new interface.
Part 2 will be to eliminate cli_state from smbtorture as this is now
the only place where it is used.
(This used to be commit db1cc96af62ea42837d60592877fc3f93cef143b)
Diffstat (limited to 'source4/libcli/clilist.c')
-rw-r--r-- | source4/libcli/clilist.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 425a6002cc..ee0357579c 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -81,8 +81,9 @@ static BOOL cli_list_new_callback(void *private, union smb_search_data *file) return True; } -int cli_list_new(struct cli_state *cli, const char *Mask, uint16 attribute, - void (*fn)(file_info *, const char *, void *), void *caller_state) +int cli_list_new(struct cli_tree *tree, const char *Mask, uint16 attribute, + void (*fn)(file_info *, const char *, void *), + void *caller_state) { union smb_search_first first_parms; union smb_search_next next_parms; @@ -104,7 +105,7 @@ int cli_list_new(struct cli_state *cli, const char *Mask, uint16 attribute, mask = talloc_strdup(state.mem_ctx, Mask); - if (cli->transport->negotiate.capabilities & CAP_NT_SMBS) { + if (tree->session->transport->negotiate.capabilities & CAP_NT_SMBS) { level = RAW_SEARCH_BOTH_DIRECTORY_INFO; } else { level = RAW_SEARCH_STANDARD; @@ -122,7 +123,7 @@ int cli_list_new(struct cli_state *cli, const char *Mask, uint16 attribute, first_parms.t2ffirst.in.flags = FLAG_TRANS2_FIND_CLOSE_IF_END; first_parms.t2ffirst.in.storage_type = 0; - status = smb_raw_search_first(cli->tree, + status = smb_raw_search_first(tree, state.mem_ctx, &first_parms, (void*)&state, cli_list_new_callback); if (!NT_STATUS_IS_OK(status)) { @@ -148,7 +149,7 @@ int cli_list_new(struct cli_state *cli, const char *Mask, uint16 attribute, next_parms.t2fnext.in.resume_key = 0; next_parms.t2fnext.in.flags = FLAG_TRANS2_FIND_CONTINUE | FLAG_TRANS2_FIND_CLOSE_IF_END; - status = smb_raw_search_next(cli->tree, + status = smb_raw_search_next(tree, state.mem_ctx, &next_parms, (void*)&state, @@ -223,8 +224,9 @@ static BOOL cli_list_old_callback(void *private, union smb_search_data *file) return True; } -int cli_list_old(struct cli_state *cli, const char *Mask, uint16 attribute, - void (*fn)(file_info *, const char *, void *), void *caller_state) +int cli_list_old(struct cli_tree *tree, const char *Mask, uint16 attribute, + void (*fn)(file_info *, const char *, void *), + void *caller_state) { union smb_search_first first_parms; union smb_search_next next_parms; @@ -254,10 +256,11 @@ int cli_list_old(struct cli_state *cli, const char *Mask, uint16 attribute, first_parms.search_first.in.search_attrib = attribute; first_parms.search_first.in.pattern = mask; - status = smb_raw_search_first(cli->tree, state.mem_ctx, - &first_parms, - (void*)&state, - cli_list_old_callback); + status = smb_raw_search_first(tree, state.mem_ctx, + &first_parms, + (void*)&state, + cli_list_old_callback); + if (!NT_STATUS_IS_OK(status)) { talloc_destroy(state.mem_ctx); return -1; @@ -274,10 +277,10 @@ int cli_list_old(struct cli_state *cli, const char *Mask, uint16 attribute, next_parms.search_next.in.search_attrib = attribute; next_parms.search_next.in.search_id = state.status; - status = smb_raw_search_next(cli->tree, state.mem_ctx, - &next_parms, - (void*)&state, - cli_list_old_callback); + status = smb_raw_search_next(tree, state.mem_ctx, + &next_parms, + (void*)&state, + cli_list_old_callback); if (!NT_STATUS_IS_OK(status)) { talloc_destroy(state.mem_ctx); @@ -304,10 +307,10 @@ int cli_list_old(struct cli_state *cli, const char *Mask, uint16 attribute, This auto-switches between old and new style. ****************************************************************************/ -int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute, +int cli_list(struct cli_tree *tree, const char *Mask,uint16 attribute, void (*fn)(file_info *, const char *, void *), void *state) { - if (cli->transport->negotiate.protocol <= PROTOCOL_LANMAN1) - return cli_list_old(cli, Mask, attribute, fn, state); - return cli_list_new(cli, Mask, attribute, fn, state); + if (tree->session->transport->negotiate.protocol <= PROTOCOL_LANMAN1) + return cli_list_old(tree, Mask, attribute, fn, state); + return cli_list_new(tree, Mask, attribute, fn, state); } |