From ef2e26c91b80556af033d3335e55f5dfa6fff31d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 13 Aug 2003 01:53:07 +0000 Subject: first public release of samba4 code (This used to be commit b0510b5428b3461aeb9bbe3cc95f62fc73e2b97f) --- source4/libcli/clilist.c | 313 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 313 insertions(+) create mode 100644 source4/libcli/clilist.c (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c new file mode 100644 index 0000000000..620e4382f4 --- /dev/null +++ b/source4/libcli/clilist.c @@ -0,0 +1,313 @@ +/* + Unix SMB/CIFS implementation. + client directory list routines + Copyright (C) Andrew Tridgell 1994-2003 + Copyright (C) James Myers 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" + +struct search_private { + file_info *dirlist; + TALLOC_CTX *mem_ctx; + int dirlist_len; + int ff_searchcount; /* total received in 1 server trip */ + int total_received; /* total received all together */ + int info_level; + DATA_BLOB status; /* used for old-style search */ +}; + + +/**************************************************************************** + Interpret a long filename structure. +****************************************************************************/ +static BOOL interpret_long_filename(int level, + union smb_search_data *info, + file_info *finfo) +{ + file_info finfo2; + + if (!finfo) finfo = &finfo2; + ZERO_STRUCTP(finfo); + + finfo->size = info->both_directory_info.size; + finfo->ctime = nt_time_to_unix(&info->both_directory_info.create_time); + finfo->atime = nt_time_to_unix(&info->both_directory_info.access_time); + finfo->mtime = nt_time_to_unix(&info->both_directory_info.write_time); + finfo->mode = info->both_directory_info.attrib; /* 32 bit->16 bit attrib */ + if (info->both_directory_info.short_name.s) { + strncpy(finfo->short_name, info->both_directory_info.short_name.s, + sizeof(finfo->short_name)-1); + } + finfo->name = info->both_directory_info.name.s; + return True; +} + +/* callback function used for trans2 search */ +static BOOL cli_list_new_callback(void *private, union smb_search_data *file) +{ + struct search_private *state = (struct search_private*) private; + file_info *tdl; + + /* add file info to the dirlist pool */ + tdl = talloc_realloc(state->mem_ctx, state->dirlist, + state->dirlist_len + sizeof(struct file_info)); + + if (!tdl) { + return False; + } + state->dirlist = tdl; + state->dirlist_len += sizeof(struct file_info); + + interpret_long_filename(state->info_level, file, &state->dirlist[state->total_received]); + + state->total_received++; + state->ff_searchcount++; + + 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) +{ + union smb_search_first first_parms; + union smb_search_next next_parms; + struct search_private state; /* for callbacks */ + int received = 0; + BOOL first = True; + int num_received = 0; + int max_matches = 512; + char *mask; + int ff_eos = 0, i, ff_searchcount; + int ff_dir_handle=0; + int level; + + /* initialize state for search */ + state.dirlist = NULL; + state.mem_ctx = talloc_init("cli_list_new"); + state.dirlist_len = 0; + state.total_received = 0; + + mask = talloc_strdup(state.mem_ctx, Mask); + + if (cli->transport->negotiate.capabilities & CAP_NT_SMBS) { + level = RAW_SEARCH_BOTH_DIRECTORY_INFO; + } else { + level = RAW_SEARCH_STANDARD; + } + + while (1) { + state.ff_searchcount = 0; + if (first) { + NTSTATUS status; + + first_parms.t2ffirst.level = level; + first_parms.t2ffirst.in.max_count = max_matches; + first_parms.t2ffirst.in.search_attrib = attribute; + first_parms.t2ffirst.in.pattern = mask; + 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, + state.mem_ctx, &first_parms, + (void*)&state, cli_list_new_callback); + if (!NT_STATUS_IS_OK(status)) { + talloc_destroy(state.mem_ctx); + return -1; + } + + ff_dir_handle = first_parms.t2ffirst.out.handle; + ff_searchcount = first_parms.t2ffirst.out.count; + ff_eos = first_parms.t2ffirst.out.end_of_search; + + received = first_parms.t2ffirst.out.count; + if (received <= 0) break; + if (ff_eos) break; + first = False; + } else { + NTSTATUS status; + + next_parms.t2fnext.level = level; + next_parms.t2fnext.in.max_count = max_matches; + next_parms.t2fnext.in.last_name = mask; + next_parms.t2fnext.in.handle = ff_dir_handle; + 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, + state.mem_ctx, + &next_parms, + (void*)&state, + cli_list_new_callback); + + if (!NT_STATUS_IS_OK(status)) { + return -1; + } + ff_searchcount = next_parms.t2fnext.out.count; + ff_eos = next_parms.t2fnext.out.end_of_search; + received = next_parms.t2fnext.out.count; + if (received <= 0) break; + if (ff_eos) break; + } + + num_received += received; + } + + for (i=0;ictime = info->search.write_time; + finfo->atime = info->search.write_time; + finfo->mtime = info->search.write_time; + finfo->size = info->search.size; + finfo->mode = info->search.attrib; + finfo->name = info->search.name; + return True; +} + +/* callback function used for smb_search */ +static BOOL cli_list_old_callback(void *private, union smb_search_data *file) +{ + struct search_private *state = (struct search_private*) private; + file_info *tdl; + + /* add file info to the dirlist pool */ + tdl = talloc_realloc(state->mem_ctx, state->dirlist, + state->dirlist_len + sizeof(struct file_info)); + + if (!tdl) { + return False; + } + state->dirlist = tdl; + state->dirlist_len += sizeof(struct file_info); + + interpret_short_filename(state->info_level, file, &state->dirlist[state->total_received]); + + state->total_received++; + state->ff_searchcount++; + state->status = file->search.search_id; /* return resume info */ + + 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) +{ + union smb_search_first first_parms; + union smb_search_next next_parms; + struct search_private state; /* for callbacks */ + const int num_asked = 500; + int received = 0; + BOOL first = True; + int num_received = 0; + char *mask; + int i; + + /* initialize state for search */ + state.dirlist = NULL; + state.mem_ctx = talloc_init("cli_list_old"); + state.dirlist_len = 0; + state.total_received = 0; + + mask = talloc_strdup(state.mem_ctx, Mask); + + while (1) { + state.ff_searchcount = 0; + if (first) { + NTSTATUS status; + + first_parms.search_first.level = RAW_SEARCH_SEARCH; + first_parms.search_first.in.max_count = num_asked; + 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); + if (!NT_STATUS_IS_OK(status)) { + talloc_destroy(state.mem_ctx); + return -1; + } + + received = first_parms.search_first.out.count; + if (received <= 0) break; + first = False; + } else { + NTSTATUS status; + + next_parms.search_next.level = RAW_SEARCH_SEARCH; + next_parms.search_next.in.max_count = num_asked; + 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); + + if (!NT_STATUS_IS_OK(status)) { + talloc_destroy(state.mem_ctx); + return -1; + } + received = next_parms.search_next.out.count; + if (received <= 0) break; + } + + num_received += received; + } + + for (i=0;itransport->negotiate.protocol <= PROTOCOL_LANMAN1) + return cli_list_old(cli, Mask, attribute, fn, state); + return cli_list_new(cli, Mask, attribute, fn, state); +} -- cgit From 8e4ab747b02207671203d40cd2a78692da78faef Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Aug 2003 18:33:43 +0000 Subject: more fixes from the IRIX compiler (thanks herb!) (This used to be commit 4cf3839b727c77a727abb558bd9473119a092913) --- source4/libcli/clilist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 620e4382f4..425a6002cc 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -94,7 +94,7 @@ int cli_list_new(struct cli_state *cli, const char *Mask, uint16 attribute, char *mask; int ff_eos = 0, i, ff_searchcount; int ff_dir_handle=0; - int level; + enum search_level level; /* initialize state for search */ state.dirlist = NULL; -- cgit From 4639eb5a58f8c0906afdc8e8f8f67f82e9547f75 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sun, 8 Feb 2004 00:51:07 +0000 Subject: 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) --- source4/libcli/clilist.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'source4/libcli/clilist.c') 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); } -- cgit From 579c13da43d5b40ac6d6c1436399fbc1d8dfd054 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 25 May 2004 13:57:39 +0000 Subject: r873: converted samba4 to use real 64 bit integers instead of structures. This was suggested by metze recently. I checked on the build farm and all the machines we have support 64 bit ints, and support the LL suffix for 64 bit constants. I suspect some won't support strtoll() and related functions, so we will probably need replacements for those. (This used to be commit 9a9244a1c66654c12abe4379661cba83a73c4c21) --- source4/libcli/clilist.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index ee0357579c..ca4b6acdc7 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -45,9 +45,9 @@ static BOOL interpret_long_filename(int level, ZERO_STRUCTP(finfo); finfo->size = info->both_directory_info.size; - finfo->ctime = nt_time_to_unix(&info->both_directory_info.create_time); - finfo->atime = nt_time_to_unix(&info->both_directory_info.access_time); - finfo->mtime = nt_time_to_unix(&info->both_directory_info.write_time); + finfo->ctime = nt_time_to_unix(info->both_directory_info.create_time); + finfo->atime = nt_time_to_unix(info->both_directory_info.access_time); + finfo->mtime = nt_time_to_unix(info->both_directory_info.write_time); finfo->mode = info->both_directory_info.attrib; /* 32 bit->16 bit attrib */ if (info->both_directory_info.short_name.s) { strncpy(finfo->short_name, info->both_directory_info.short_name.s, -- cgit From f88bf54c7f6d1c2ef833047eb8327953c304b5ff Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 25 May 2004 17:24:24 +0000 Subject: r889: convert samba4 to use [u]int16_t instead of [u]int16 metze (This used to be commit af6f1f8a01bebbecd99bc8c066519e89966e65e3) --- source4/libcli/clilist.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index ca4b6acdc7..09d536a710 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -81,7 +81,7 @@ static BOOL cli_list_new_callback(void *private, union smb_search_data *file) return True; } -int cli_list_new(struct cli_tree *tree, const char *Mask, uint16 attribute, +int cli_list_new(struct cli_tree *tree, const char *Mask, uint16_t attribute, void (*fn)(file_info *, const char *, void *), void *caller_state) { @@ -224,7 +224,7 @@ static BOOL cli_list_old_callback(void *private, union smb_search_data *file) return True; } -int cli_list_old(struct cli_tree *tree, const char *Mask, uint16 attribute, +int cli_list_old(struct cli_tree *tree, const char *Mask, uint16_t attribute, void (*fn)(file_info *, const char *, void *), void *caller_state) { @@ -307,7 +307,7 @@ int cli_list_old(struct cli_tree *tree, const char *Mask, uint16 attribute, This auto-switches between old and new style. ****************************************************************************/ -int cli_list(struct cli_tree *tree, const char *Mask,uint16 attribute, +int cli_list(struct cli_tree *tree, const char *Mask,uint16_t attribute, void (*fn)(file_info *, const char *, void *), void *state) { if (tree->session->transport->negotiate.protocol <= PROTOCOL_LANMAN1) -- cgit From d093b7e7771c3f143546889c95f97dd0be16998f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 19 Jul 2004 10:35:05 +0000 Subject: r1547: rename 'enum _level' -> 'enum smb__level' e.g. we now have 'union smb_mkdir' and 'enum smb_mkdir_level' in sync we may should also rename 'RAW_MKDIR_*' -> 'SMB_MKDIR_*' metze (This used to be commit 0bb50dcf1ccb9797000fcbea4d8a73f2d2a3db77) --- source4/libcli/clilist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 09d536a710..f5ff4bd699 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -95,7 +95,7 @@ int cli_list_new(struct cli_tree *tree, const char *Mask, uint16_t attribute, char *mask; int ff_eos = 0, i, ff_searchcount; int ff_dir_handle=0; - enum search_level level; + enum smb_search_level level; /* initialize state for search */ state.dirlist = NULL; -- cgit From ae81794cf8de793bd18aae98777a6dc648ef3432 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 2 Aug 2004 07:40:55 +0000 Subject: r1619: - add support for older systems to cli_list*() - make cli_list_new() use the last_name continue method rather than the trans2 findnext continue flag, as the continue flag is broken on win2003 (win2003 sometimes misses up to 1/3 of all files in a directory) (This used to be commit daa9648b3f6919b1615a5737b96310c3a41a0192) --- source4/libcli/clilist.c | 57 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 19 deletions(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index f5ff4bd699..7dac7399a7 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -27,7 +27,8 @@ struct search_private { int dirlist_len; int ff_searchcount; /* total received in 1 server trip */ int total_received; /* total received all together */ - int info_level; + enum smb_search_level info_level; + const char *last_name; /* used to continue trans2 search */ DATA_BLOB status; /* used for old-style search */ }; @@ -35,7 +36,7 @@ struct search_private { /**************************************************************************** Interpret a long filename structure. ****************************************************************************/ -static BOOL interpret_long_filename(int level, +static BOOL interpret_long_filename(enum smb_search_level level, union smb_search_data *info, file_info *finfo) { @@ -43,17 +44,35 @@ static BOOL interpret_long_filename(int level, if (!finfo) finfo = &finfo2; ZERO_STRUCTP(finfo); - - finfo->size = info->both_directory_info.size; - finfo->ctime = nt_time_to_unix(info->both_directory_info.create_time); - finfo->atime = nt_time_to_unix(info->both_directory_info.access_time); - finfo->mtime = nt_time_to_unix(info->both_directory_info.write_time); - finfo->mode = info->both_directory_info.attrib; /* 32 bit->16 bit attrib */ - if (info->both_directory_info.short_name.s) { - strncpy(finfo->short_name, info->both_directory_info.short_name.s, - sizeof(finfo->short_name)-1); + + switch (level) { + case RAW_SEARCH_STANDARD: + finfo->size = info->standard.size; + finfo->ctime = info->standard.create_time; + finfo->atime = info->standard.access_time; + finfo->mtime = info->standard.write_time; + finfo->mode = info->standard.attrib; + finfo->name = info->standard.name.s; + break; + + case RAW_SEARCH_BOTH_DIRECTORY_INFO: + finfo->size = info->both_directory_info.size; + finfo->ctime = nt_time_to_unix(info->both_directory_info.create_time); + finfo->atime = nt_time_to_unix(info->both_directory_info.access_time); + finfo->mtime = nt_time_to_unix(info->both_directory_info.write_time); + finfo->mode = info->both_directory_info.attrib; /* 32 bit->16 bit attrib */ + if (info->both_directory_info.short_name.s) { + strncpy(finfo->short_name, info->both_directory_info.short_name.s, + sizeof(finfo->short_name)-1); + } + finfo->name = info->both_directory_info.name.s; + break; + + default: + DEBUG(0,("Unhandled level %d in interpret_long_filename\n", (int)level)); + return False; } - finfo->name = info->both_directory_info.name.s; + return True; } @@ -75,6 +94,7 @@ static BOOL cli_list_new_callback(void *private, union smb_search_data *file) interpret_long_filename(state->info_level, file, &state->dirlist[state->total_received]); + state->last_name = state->dirlist[state->total_received].name; state->total_received++; state->ff_searchcount++; @@ -95,7 +115,6 @@ int cli_list_new(struct cli_tree *tree, const char *Mask, uint16_t attribute, char *mask; int ff_eos = 0, i, ff_searchcount; int ff_dir_handle=0; - enum smb_search_level level; /* initialize state for search */ state.dirlist = NULL; @@ -106,9 +125,9 @@ int cli_list_new(struct cli_tree *tree, const char *Mask, uint16_t attribute, mask = talloc_strdup(state.mem_ctx, Mask); if (tree->session->transport->negotiate.capabilities & CAP_NT_SMBS) { - level = RAW_SEARCH_BOTH_DIRECTORY_INFO; + state.info_level = RAW_SEARCH_BOTH_DIRECTORY_INFO; } else { - level = RAW_SEARCH_STANDARD; + state.info_level = RAW_SEARCH_STANDARD; } while (1) { @@ -116,7 +135,7 @@ int cli_list_new(struct cli_tree *tree, const char *Mask, uint16_t attribute, if (first) { NTSTATUS status; - first_parms.t2ffirst.level = level; + first_parms.t2ffirst.level = state.info_level; first_parms.t2ffirst.in.max_count = max_matches; first_parms.t2ffirst.in.search_attrib = attribute; first_parms.t2ffirst.in.pattern = mask; @@ -142,12 +161,12 @@ int cli_list_new(struct cli_tree *tree, const char *Mask, uint16_t attribute, } else { NTSTATUS status; - next_parms.t2fnext.level = level; + next_parms.t2fnext.level = state.info_level; next_parms.t2fnext.in.max_count = max_matches; - next_parms.t2fnext.in.last_name = mask; + next_parms.t2fnext.in.last_name = state.last_name; next_parms.t2fnext.in.handle = ff_dir_handle; next_parms.t2fnext.in.resume_key = 0; - next_parms.t2fnext.in.flags = FLAG_TRANS2_FIND_CONTINUE | FLAG_TRANS2_FIND_CLOSE_IF_END; + next_parms.t2fnext.in.flags = FLAG_TRANS2_FIND_CLOSE_IF_END; status = smb_raw_search_next(tree, state.mem_ctx, -- cgit From c5fbb6f23c2d399c7510bc552cdb1a27b1ef66a8 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 4 Aug 2004 13:23:35 +0000 Subject: r1654: rename cli_ -> smbcli_ rename CLI_ -> SMBCLI_ metze (This used to be commit 8441750fd9427dd6fe477f27e603821b4026f038) --- source4/libcli/clilist.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 7dac7399a7..e2c267cc96 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -77,7 +77,7 @@ static BOOL interpret_long_filename(enum smb_search_level level, } /* callback function used for trans2 search */ -static BOOL cli_list_new_callback(void *private, union smb_search_data *file) +static BOOL smbcli_list_new_callback(void *private, union smb_search_data *file) { struct search_private *state = (struct search_private*) private; file_info *tdl; @@ -101,7 +101,7 @@ static BOOL cli_list_new_callback(void *private, union smb_search_data *file) return True; } -int cli_list_new(struct cli_tree *tree, const char *Mask, uint16_t attribute, +int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribute, void (*fn)(file_info *, const char *, void *), void *caller_state) { @@ -118,7 +118,7 @@ int cli_list_new(struct cli_tree *tree, const char *Mask, uint16_t attribute, /* initialize state for search */ state.dirlist = NULL; - state.mem_ctx = talloc_init("cli_list_new"); + state.mem_ctx = talloc_init("smbcli_list_new"); state.dirlist_len = 0; state.total_received = 0; @@ -144,7 +144,7 @@ int cli_list_new(struct cli_tree *tree, const char *Mask, uint16_t attribute, status = smb_raw_search_first(tree, state.mem_ctx, &first_parms, - (void*)&state, cli_list_new_callback); + (void*)&state, smbcli_list_new_callback); if (!NT_STATUS_IS_OK(status)) { talloc_destroy(state.mem_ctx); return -1; @@ -172,7 +172,7 @@ int cli_list_new(struct cli_tree *tree, const char *Mask, uint16_t attribute, state.mem_ctx, &next_parms, (void*)&state, - cli_list_new_callback); + smbcli_list_new_callback); if (!NT_STATUS_IS_OK(status)) { return -1; @@ -219,7 +219,7 @@ static BOOL interpret_short_filename(int level, } /* callback function used for smb_search */ -static BOOL cli_list_old_callback(void *private, union smb_search_data *file) +static BOOL smbcli_list_old_callback(void *private, union smb_search_data *file) { struct search_private *state = (struct search_private*) private; file_info *tdl; @@ -243,7 +243,7 @@ static BOOL cli_list_old_callback(void *private, union smb_search_data *file) return True; } -int cli_list_old(struct cli_tree *tree, const char *Mask, uint16_t attribute, +int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribute, void (*fn)(file_info *, const char *, void *), void *caller_state) { @@ -259,7 +259,7 @@ int cli_list_old(struct cli_tree *tree, const char *Mask, uint16_t attribute, /* initialize state for search */ state.dirlist = NULL; - state.mem_ctx = talloc_init("cli_list_old"); + state.mem_ctx = talloc_init("smbcli_list_old"); state.dirlist_len = 0; state.total_received = 0; @@ -278,7 +278,7 @@ int cli_list_old(struct cli_tree *tree, const char *Mask, uint16_t attribute, status = smb_raw_search_first(tree, state.mem_ctx, &first_parms, (void*)&state, - cli_list_old_callback); + smbcli_list_old_callback); if (!NT_STATUS_IS_OK(status)) { talloc_destroy(state.mem_ctx); @@ -299,7 +299,7 @@ int cli_list_old(struct cli_tree *tree, const char *Mask, uint16_t attribute, status = smb_raw_search_next(tree, state.mem_ctx, &next_parms, (void*)&state, - cli_list_old_callback); + smbcli_list_old_callback); if (!NT_STATUS_IS_OK(status)) { talloc_destroy(state.mem_ctx); @@ -326,10 +326,10 @@ int cli_list_old(struct cli_tree *tree, const char *Mask, uint16_t attribute, This auto-switches between old and new style. ****************************************************************************/ -int cli_list(struct cli_tree *tree, const char *Mask,uint16_t attribute, +int smbcli_list(struct smbcli_tree *tree, const char *Mask,uint16_t attribute, void (*fn)(file_info *, const char *, void *), void *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); + return smbcli_list_old(tree, Mask, attribute, fn, state); + return smbcli_list_new(tree, Mask, attribute, fn, state); } -- cgit From b83ba93eaeb2dcb0bf11615591d886fda84e4162 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 21 Aug 2004 01:54:46 +0000 Subject: r1983: a completely new implementation of talloc This version does the following: 1) talloc_free(), talloc_realloc() and talloc_steal() lose their (redundent) first arguments 2) you can use _any_ talloc pointer as a talloc context to allocate more memory. This allows you to create complex data structures where the top level structure is the logical parent of the next level down, and those are the parents of the level below that. Then destroy either the lot with a single talloc_free() or destroy any sub-part with a talloc_free() of that part 3) you can name any pointer. Use talloc_named() which is just like talloc() but takes the printf style name argument as well as the parent context and the size. The whole thing ends up being a very simple piece of code, although some of the pointer walking gets hairy. So far, I'm just using the new talloc() like the old one. The next step is to actually take advantage of the new interface properly. Expect some new commits soon that simplify some common coding styles in samba4 by using the new talloc(). (This used to be commit e35bb094c52e550b3105dd1638d8d90de71d854f) --- source4/libcli/clilist.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index e2c267cc96..0e2cdabc0a 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -83,8 +83,8 @@ static BOOL smbcli_list_new_callback(void *private, union smb_search_data *file) file_info *tdl; /* add file info to the dirlist pool */ - tdl = talloc_realloc(state->mem_ctx, state->dirlist, - state->dirlist_len + sizeof(struct file_info)); + tdl = talloc_realloc(state->dirlist, + state->dirlist_len + sizeof(struct file_info)); if (!tdl) { return False; @@ -225,8 +225,8 @@ static BOOL smbcli_list_old_callback(void *private, union smb_search_data *file) file_info *tdl; /* add file info to the dirlist pool */ - tdl = talloc_realloc(state->mem_ctx, state->dirlist, - state->dirlist_len + sizeof(struct file_info)); + tdl = talloc_realloc(state->dirlist, + state->dirlist_len + sizeof(struct file_info)); if (!tdl) { return False; -- cgit From 23ba434b017d61f397befe9808fa3214c3964355 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 21 Sep 2004 08:46:47 +0000 Subject: r2469: complete overhaul of the old-style RAW_SEARCH_ calls (the OS/2 and original core level calls). The old code was completely wrong in many respects. also fixed the EA_SIZE level in the server extended the RAW-SEARCH test suite to test the new code properly (This used to be commit 71480271ad84b57fcdde264a54bb2408cf783255) --- source4/libcli/clilist.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 0e2cdabc0a..91a989d361 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -29,7 +29,7 @@ struct search_private { int total_received; /* total received all together */ enum smb_search_level info_level; const char *last_name; /* used to continue trans2 search */ - DATA_BLOB status; /* used for old-style search */ + struct smb_search_id id; /* used for old-style search */ }; @@ -238,7 +238,7 @@ static BOOL smbcli_list_old_callback(void *private, union smb_search_data *file) state->total_received++; state->ff_searchcount++; - state->status = file->search.search_id; /* return resume info */ + state->id = file->search.id; /* return resume info */ return True; } @@ -294,7 +294,7 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu next_parms.search_next.level = RAW_SEARCH_SEARCH; next_parms.search_next.in.max_count = num_asked; next_parms.search_next.in.search_attrib = attribute; - next_parms.search_next.in.search_id = state.status; + next_parms.search_next.in.id = state.id; status = smb_raw_search_next(tree, state.mem_ctx, &next_parms, -- cgit From e6e4e3e0a3f2222efeca7bee535fe26162c974c8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 22 Sep 2004 05:13:32 +0000 Subject: r2495: cope properly with STATUS_NO_MORE_FILES in old search client code (This used to be commit 878729b7d97869a3d6dacea115ed4af2fd18e93c) --- source4/libcli/clilist.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 91a989d361..67a2e980ca 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -300,7 +300,10 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu &next_parms, (void*)&state, smbcli_list_old_callback); - + + if (NT_STATUS_EQUAL(status, STATUS_NO_MORE_FILES)) { + break; + } if (!NT_STATUS_IS_OK(status)) { talloc_destroy(state.mem_ctx); return -1; -- cgit From 9010d3859eca98d6a28ccf4f461b66a5778be4d5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 26 Sep 2004 11:45:14 +0000 Subject: r2661: fixed a client side memory leak in the clilist code. This sort of bug happens quite easily with the new talloc_realloc() interface. talloc_realloc() now looks like this: void *talloc_realloc(void *ptr, size_t size); and if ptr is not NULL then everything is fine. If ptr is NULL then talloc_realloc() presumes you want to allocate in the NULL context, which is probably not what is wanted. For now the solution is to initialise ptr like this: ptr = talloc(mem_ctx, 0); so when the realloc happens it has a context to get hold of. I might change the interface of talloc_realloc() later to prevent this problem in a more robust manner (This used to be commit bd813dfb1b08b586dc71f9cec4eb65b35ea808fe) --- source4/libcli/clilist.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 67a2e980ca..529d4f81a3 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -117,11 +117,11 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu int ff_dir_handle=0; /* initialize state for search */ - state.dirlist = NULL; state.mem_ctx = talloc_init("smbcli_list_new"); state.dirlist_len = 0; state.total_received = 0; + state.dirlist = talloc(state.mem_ctx, 0); mask = talloc_strdup(state.mem_ctx, Mask); if (tree->session->transport->negotiate.capabilities & CAP_NT_SMBS) { @@ -258,11 +258,11 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu int i; /* initialize state for search */ - state.dirlist = NULL; state.mem_ctx = talloc_init("smbcli_list_old"); state.dirlist_len = 0; state.total_received = 0; - + + state.dirlist = talloc(state.mem_ctx, 0); mask = talloc_strdup(state.mem_ctx, Mask); while (1) { -- cgit From 5b44130afad1bb1764d986de3ef0e8e04b0e7357 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 27 Sep 2004 01:36:19 +0000 Subject: r2671: we're getting too many errors caused by the talloc_realloc() API not taking a context (so when you pass a NULL pointer you end up with memory in a top level context). Fixed it by changing the API to take a context. The context is only used if the pointer you are reallocing is NULL. (This used to be commit 8dc23821c9f54b2f13049b5e608a0cafb81aa540) --- source4/libcli/clilist.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 529d4f81a3..2659e81419 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -83,7 +83,8 @@ static BOOL smbcli_list_new_callback(void *private, union smb_search_data *file) file_info *tdl; /* add file info to the dirlist pool */ - tdl = talloc_realloc(state->dirlist, + tdl = talloc_realloc(state, + state->dirlist, state->dirlist_len + sizeof(struct file_info)); if (!tdl) { @@ -225,7 +226,8 @@ static BOOL smbcli_list_old_callback(void *private, union smb_search_data *file) file_info *tdl; /* add file info to the dirlist pool */ - tdl = talloc_realloc(state->dirlist, + tdl = talloc_realloc(state, + state->dirlist, state->dirlist_len + sizeof(struct file_info)); if (!tdl) { -- cgit From d1a568363049c82f4314f7a1c5453a92bee84343 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 2 Oct 2004 12:30:02 +0000 Subject: r2787: force masktest to use RAW_SEARCH_BOTH_DIRECTORY_INFO so it can obtain the short name (This used to be commit ad5a5ea08d5be812e0ef662948477add2433bc6f) --- source4/libcli/clilist.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 2659e81419..84d96d62f4 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -103,8 +103,9 @@ static BOOL smbcli_list_new_callback(void *private, union smb_search_data *file) } int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribute, - void (*fn)(file_info *, const char *, void *), - void *caller_state) + enum smb_search_level level, + void (*fn)(file_info *, const char *, void *), + void *caller_state) { union smb_search_first first_parms; union smb_search_next next_parms; @@ -125,11 +126,14 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu state.dirlist = talloc(state.mem_ctx, 0); mask = talloc_strdup(state.mem_ctx, Mask); - if (tree->session->transport->negotiate.capabilities & CAP_NT_SMBS) { - state.info_level = RAW_SEARCH_BOTH_DIRECTORY_INFO; - } else { - state.info_level = RAW_SEARCH_STANDARD; + if (level == RAW_SEARCH_GENERIC) { + if (tree->session->transport->negotiate.capabilities & CAP_NT_SMBS) { + level = RAW_SEARCH_BOTH_DIRECTORY_INFO; + } else { + level = RAW_SEARCH_STANDARD; + } } + state.info_level = level; while (1) { state.ff_searchcount = 0; @@ -336,5 +340,5 @@ int smbcli_list(struct smbcli_tree *tree, const char *Mask,uint16_t attribute, { if (tree->session->transport->negotiate.protocol <= PROTOCOL_LANMAN1) return smbcli_list_old(tree, Mask, attribute, fn, state); - return smbcli_list_new(tree, Mask, attribute, fn, state); + return smbcli_list_new(tree, Mask, attribute, RAW_SEARCH_GENERIC, fn, state); } -- cgit From 9f1210a243654fd6d94acdef83f468a33c1b3b3f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 1 Nov 2004 01:03:22 +0000 Subject: r3419: moved the libcli/raw structures into libcli/raw/libcliraw.h and made them private (This used to be commit 386ac565c452ede1d74e06acb401ca9db99d3ff3) --- source4/libcli/clilist.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 84d96d62f4..dde2a7befa 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "libcli/raw/libcliraw.h" struct search_private { file_info *dirlist; -- cgit From a99b6219a810a1cd10bd62a6716780602808f0cd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 2 Nov 2004 12:15:17 +0000 Subject: r3481: split out client.h and events.h (This used to be commit c6f486574470a311e0d336c026103f131451e21e) --- source4/libcli/clilist.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index dde2a7befa..e8b97f324d 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -20,10 +20,11 @@ */ #include "includes.h" +#include "client.h" #include "libcli/raw/libcliraw.h" struct search_private { - file_info *dirlist; + struct file_info *dirlist; TALLOC_CTX *mem_ctx; int dirlist_len; int ff_searchcount; /* total received in 1 server trip */ @@ -39,9 +40,9 @@ struct search_private { ****************************************************************************/ static BOOL interpret_long_filename(enum smb_search_level level, union smb_search_data *info, - file_info *finfo) + struct file_info *finfo) { - file_info finfo2; + struct file_info finfo2; if (!finfo) finfo = &finfo2; ZERO_STRUCTP(finfo); @@ -81,7 +82,7 @@ static BOOL interpret_long_filename(enum smb_search_level level, static BOOL smbcli_list_new_callback(void *private, union smb_search_data *file) { struct search_private *state = (struct search_private*) private; - file_info *tdl; + struct file_info *tdl; /* add file info to the dirlist pool */ tdl = talloc_realloc(state, @@ -105,7 +106,7 @@ static BOOL smbcli_list_new_callback(void *private, union smb_search_data *file) int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribute, enum smb_search_level level, - void (*fn)(file_info *, const char *, void *), + void (*fn)(struct file_info *, const char *, void *), void *caller_state) { union smb_search_first first_parms; @@ -208,9 +209,9 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu ****************************************************************************/ static BOOL interpret_short_filename(int level, union smb_search_data *info, - file_info *finfo) + struct file_info *finfo) { - file_info finfo2; + struct file_info finfo2; if (!finfo) finfo = &finfo2; ZERO_STRUCTP(finfo); @@ -228,7 +229,7 @@ static BOOL interpret_short_filename(int level, static BOOL smbcli_list_old_callback(void *private, union smb_search_data *file) { struct search_private *state = (struct search_private*) private; - file_info *tdl; + struct file_info *tdl; /* add file info to the dirlist pool */ tdl = talloc_realloc(state, @@ -251,7 +252,7 @@ static BOOL smbcli_list_old_callback(void *private, union smb_search_data *file) } int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribute, - void (*fn)(file_info *, const char *, void *), + void (*fn)(struct file_info *, const char *, void *), void *caller_state) { union smb_search_first first_parms; @@ -337,7 +338,7 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu ****************************************************************************/ int smbcli_list(struct smbcli_tree *tree, const char *Mask,uint16_t attribute, - void (*fn)(file_info *, const char *, void *), void *state) + void (*fn)(struct file_info *, const char *, void *), void *state) { if (tree->session->transport->negotiate.protocol <= PROTOCOL_LANMAN1) return smbcli_list_old(tree, Mask, attribute, fn, state); -- cgit From 607e3022381ab089bfcc0b153461b6b3ac76f175 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 30 Nov 2004 05:37:57 +0000 Subject: r4013: got rid of a bunch of unused or unmaintained code - removed the clitar code. It is unmaintained, and a horribly badly done hack - removed client.h as it contained mostly unused definitions - removed the unused clidfs.c code (This used to be commit 31a7bddbb3815b4d625e993dbce4805dae1c18f8) --- source4/libcli/clilist.c | 49 +++++++++++++++++++++--------------------------- 1 file changed, 21 insertions(+), 28 deletions(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index e8b97f324d..8b05b98e0e 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -20,11 +20,11 @@ */ #include "includes.h" -#include "client.h" +#include "clilist.h" #include "libcli/raw/libcliraw.h" struct search_private { - struct file_info *dirlist; + struct clilist_file_info *dirlist; TALLOC_CTX *mem_ctx; int dirlist_len; int ff_searchcount; /* total received in 1 server trip */ @@ -40,9 +40,9 @@ struct search_private { ****************************************************************************/ static BOOL interpret_long_filename(enum smb_search_level level, union smb_search_data *info, - struct file_info *finfo) + struct clilist_file_info *finfo) { - struct file_info finfo2; + struct clilist_file_info finfo2; if (!finfo) finfo = &finfo2; ZERO_STRUCTP(finfo); @@ -50,23 +50,17 @@ static BOOL interpret_long_filename(enum smb_search_level level, switch (level) { case RAW_SEARCH_STANDARD: finfo->size = info->standard.size; - finfo->ctime = info->standard.create_time; - finfo->atime = info->standard.access_time; finfo->mtime = info->standard.write_time; - finfo->mode = info->standard.attrib; + finfo->attrib = info->standard.attrib; finfo->name = info->standard.name.s; + finfo->short_name = info->standard.name.s; break; case RAW_SEARCH_BOTH_DIRECTORY_INFO: finfo->size = info->both_directory_info.size; - finfo->ctime = nt_time_to_unix(info->both_directory_info.create_time); - finfo->atime = nt_time_to_unix(info->both_directory_info.access_time); finfo->mtime = nt_time_to_unix(info->both_directory_info.write_time); - finfo->mode = info->both_directory_info.attrib; /* 32 bit->16 bit attrib */ - if (info->both_directory_info.short_name.s) { - strncpy(finfo->short_name, info->both_directory_info.short_name.s, - sizeof(finfo->short_name)-1); - } + finfo->attrib = info->both_directory_info.attrib; + finfo->short_name = info->both_directory_info.short_name.s; finfo->name = info->both_directory_info.name.s; break; @@ -82,18 +76,18 @@ static BOOL interpret_long_filename(enum smb_search_level level, static BOOL smbcli_list_new_callback(void *private, union smb_search_data *file) { struct search_private *state = (struct search_private*) private; - struct file_info *tdl; + struct clilist_file_info *tdl; /* add file info to the dirlist pool */ tdl = talloc_realloc(state, state->dirlist, - state->dirlist_len + sizeof(struct file_info)); + state->dirlist_len + sizeof(struct clilist_file_info)); if (!tdl) { return False; } state->dirlist = tdl; - state->dirlist_len += sizeof(struct file_info); + state->dirlist_len += sizeof(struct clilist_file_info); interpret_long_filename(state->info_level, file, &state->dirlist[state->total_received]); @@ -106,7 +100,7 @@ static BOOL smbcli_list_new_callback(void *private, union smb_search_data *file) int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribute, enum smb_search_level level, - void (*fn)(struct file_info *, const char *, void *), + void (*fn)(struct clilist_file_info *, const char *, void *), void *caller_state) { union smb_search_first first_parms; @@ -209,19 +203,18 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu ****************************************************************************/ static BOOL interpret_short_filename(int level, union smb_search_data *info, - struct file_info *finfo) + struct clilist_file_info *finfo) { - struct file_info finfo2; + struct clilist_file_info finfo2; if (!finfo) finfo = &finfo2; ZERO_STRUCTP(finfo); - finfo->ctime = info->search.write_time; - finfo->atime = info->search.write_time; finfo->mtime = info->search.write_time; finfo->size = info->search.size; - finfo->mode = info->search.attrib; + finfo->attrib = info->search.attrib; finfo->name = info->search.name; + finfo->short_name = info->search.name; return True; } @@ -229,18 +222,18 @@ static BOOL interpret_short_filename(int level, static BOOL smbcli_list_old_callback(void *private, union smb_search_data *file) { struct search_private *state = (struct search_private*) private; - struct file_info *tdl; + struct clilist_file_info *tdl; /* add file info to the dirlist pool */ tdl = talloc_realloc(state, state->dirlist, - state->dirlist_len + sizeof(struct file_info)); + state->dirlist_len + sizeof(struct clilist_file_info)); if (!tdl) { return False; } state->dirlist = tdl; - state->dirlist_len += sizeof(struct file_info); + state->dirlist_len += sizeof(struct clilist_file_info); interpret_short_filename(state->info_level, file, &state->dirlist[state->total_received]); @@ -252,7 +245,7 @@ static BOOL smbcli_list_old_callback(void *private, union smb_search_data *file) } int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribute, - void (*fn)(struct file_info *, const char *, void *), + void (*fn)(struct clilist_file_info *, const char *, void *), void *caller_state) { union smb_search_first first_parms; @@ -338,7 +331,7 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu ****************************************************************************/ int smbcli_list(struct smbcli_tree *tree, const char *Mask,uint16_t attribute, - void (*fn)(struct file_info *, const char *, void *), void *state) + void (*fn)(struct clilist_file_info *, const char *, void *), void *state) { if (tree->session->transport->negotiate.protocol <= PROTOCOL_LANMAN1) return smbcli_list_old(tree, Mask, attribute, fn, state); -- cgit From cc55aef7c116d03ba2817625b0ba9edb378525e3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 6 Jan 2005 02:32:43 +0000 Subject: r4547: - added talloc_new(ctx) macro that is a neater form of the common talloc(ctx, 0) call. - cleaned up some talloc usage in various files I'd like to get to the point that we have no calls to talloc(), at which point we will rename talloc_p() to talloc(), to encourage everyone to use the typesafe functions. (This used to be commit e6c81d7c9f8a6938947d3c1c8a971a0d6d50b67a) --- source4/libcli/clilist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 8b05b98e0e..ec103dbfa4 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -119,7 +119,7 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu state.dirlist_len = 0; state.total_received = 0; - state.dirlist = talloc(state.mem_ctx, 0); + state.dirlist = talloc_new(state.mem_ctx); mask = talloc_strdup(state.mem_ctx, Mask); if (level == RAW_SEARCH_GENERIC) { @@ -263,7 +263,7 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu state.dirlist_len = 0; state.total_received = 0; - state.dirlist = talloc(state.mem_ctx, 0); + state.dirlist = talloc_new(state.mem_ctx); mask = talloc_strdup(state.mem_ctx, Mask); while (1) { -- cgit From 11ce2cfd70df264c5c91b4daaa9a01c5abc673b0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 7 Jan 2005 04:39:16 +0000 Subject: r4591: - converted the other _p talloc functions to not need _p - added #if TALLOC_DEPRECATED around the _p functions - fixes the code that broke from the above while doing this I fixed quite a number of places that were incorrectly using the non type-safe talloc functions to use the type safe ones. Some were even doing multiplies for array allocation, which is potentially unsafe. (This used to be commit 6e7754abd0c225527fb38363996a6e241b87b37e) --- source4/libcli/clilist.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index ec103dbfa4..77fd760837 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -81,13 +81,13 @@ static BOOL smbcli_list_new_callback(void *private, union smb_search_data *file) /* add file info to the dirlist pool */ tdl = talloc_realloc(state, state->dirlist, - state->dirlist_len + sizeof(struct clilist_file_info)); - + struct clilist_file_info, + state->dirlist_len + 1); if (!tdl) { return False; } state->dirlist = tdl; - state->dirlist_len += sizeof(struct clilist_file_info); + state->dirlist_len++; interpret_long_filename(state->info_level, file, &state->dirlist[state->total_received]); @@ -227,13 +227,14 @@ static BOOL smbcli_list_old_callback(void *private, union smb_search_data *file) /* add file info to the dirlist pool */ tdl = talloc_realloc(state, state->dirlist, - state->dirlist_len + sizeof(struct clilist_file_info)); + struct clilist_file_info, + state->dirlist_len + 1); if (!tdl) { return False; } state->dirlist = tdl; - state->dirlist_len += sizeof(struct clilist_file_info); + state->dirlist_len++; interpret_short_filename(state->info_level, file, &state->dirlist[state->total_received]); -- cgit From 759da3b915e2006d4c87b5ace47f399accd9ce91 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 27 Jan 2005 07:08:20 +0000 Subject: r5037: got rid of all of the TALLOC_DEPRECATED stuff. My apologies for the large commit. I thought this was worthwhile to get done for consistency. (This used to be commit ec32b22ed5ec224f6324f5e069d15e92e38e15c0) --- source4/libcli/clilist.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 77fd760837..0d69a386eb 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -147,7 +147,7 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu state.mem_ctx, &first_parms, (void*)&state, smbcli_list_new_callback); if (!NT_STATUS_IS_OK(status)) { - talloc_destroy(state.mem_ctx); + talloc_free(state.mem_ctx); return -1; } @@ -192,7 +192,7 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu fn(&state.dirlist[i], Mask, caller_state); } - talloc_destroy(state.mem_ctx); + talloc_free(state.mem_ctx); return state.total_received; } @@ -283,7 +283,7 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu smbcli_list_old_callback); if (!NT_STATUS_IS_OK(status)) { - talloc_destroy(state.mem_ctx); + talloc_free(state.mem_ctx); return -1; } @@ -307,7 +307,7 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu break; } if (!NT_STATUS_IS_OK(status)) { - talloc_destroy(state.mem_ctx); + talloc_free(state.mem_ctx); return -1; } received = next_parms.search_next.out.count; @@ -321,7 +321,7 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu fn(&state.dirlist[i], Mask, caller_state); } - talloc_destroy(state.mem_ctx); + talloc_free(state.mem_ctx); return state.total_received; } -- cgit From 78c50015bb8bd5a1d831a6e7ec796b3367c73145 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 3 Jan 2006 15:40:05 +0000 Subject: r12694: Move some headers to the directory of the subsystem they belong to. (This used to be commit c722f665c90103f3ed57621c460e32ad33e7a8a3) --- source4/libcli/clilist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 0d69a386eb..f18ec84db9 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -20,7 +20,7 @@ */ #include "includes.h" -#include "clilist.h" +#include "libcli/libcli.h" #include "libcli/raw/libcliraw.h" struct search_private { -- cgit From af0a9eb52955cfae570bfdc01821f56385c860cf Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 6 Jul 2006 08:00:24 +0000 Subject: r16834: split the level's of smb_search_first/smb_search_next and the levels of smb_search_data metze (This used to be commit 78c201db8a47a71908698c4dda2add4cf85694d9) --- source4/libcli/clilist.c | 57 +++++++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 22 deletions(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index f18ec84db9..16986e9428 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -29,7 +29,7 @@ struct search_private { int dirlist_len; int ff_searchcount; /* total received in 1 server trip */ int total_received; /* total received all together */ - enum smb_search_level info_level; + enum smb_search_data_level data_level; const char *last_name; /* used to continue trans2 search */ struct smb_search_id id; /* used for old-style search */ }; @@ -38,7 +38,7 @@ struct search_private { /**************************************************************************** Interpret a long filename structure. ****************************************************************************/ -static BOOL interpret_long_filename(enum smb_search_level level, +static BOOL interpret_long_filename(enum smb_search_data_level level, union smb_search_data *info, struct clilist_file_info *finfo) { @@ -48,7 +48,7 @@ static BOOL interpret_long_filename(enum smb_search_level level, ZERO_STRUCTP(finfo); switch (level) { - case RAW_SEARCH_STANDARD: + case RAW_SEARCH_DATA_STANDARD: finfo->size = info->standard.size; finfo->mtime = info->standard.write_time; finfo->attrib = info->standard.attrib; @@ -56,7 +56,7 @@ static BOOL interpret_long_filename(enum smb_search_level level, finfo->short_name = info->standard.name.s; break; - case RAW_SEARCH_BOTH_DIRECTORY_INFO: + case RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO: finfo->size = info->both_directory_info.size; finfo->mtime = nt_time_to_unix(info->both_directory_info.write_time); finfo->attrib = info->both_directory_info.attrib; @@ -89,7 +89,7 @@ static BOOL smbcli_list_new_callback(void *private, union smb_search_data *file) state->dirlist = tdl; state->dirlist_len++; - interpret_long_filename(state->info_level, file, &state->dirlist[state->total_received]); + interpret_long_filename(state->data_level, file, &state->dirlist[state->total_received]); state->last_name = state->dirlist[state->total_received].name; state->total_received++; @@ -99,7 +99,7 @@ static BOOL smbcli_list_new_callback(void *private, union smb_search_data *file) } int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribute, - enum smb_search_level level, + enum smb_search_data_level level, void (*fn)(struct clilist_file_info *, const char *, void *), void *caller_state) { @@ -122,21 +122,22 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu state.dirlist = talloc_new(state.mem_ctx); mask = talloc_strdup(state.mem_ctx, Mask); - if (level == RAW_SEARCH_GENERIC) { + if (level == RAW_SEARCH_DATA_GENERIC) { if (tree->session->transport->negotiate.capabilities & CAP_NT_SMBS) { - level = RAW_SEARCH_BOTH_DIRECTORY_INFO; + level = RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO; } else { - level = RAW_SEARCH_STANDARD; + level = RAW_SEARCH_DATA_STANDARD; } } - state.info_level = level; + state.data_level = level; while (1) { state.ff_searchcount = 0; if (first) { NTSTATUS status; - first_parms.t2ffirst.level = state.info_level; + first_parms.t2ffirst.level = RAW_SEARCH_TRANS2; + first_parms.t2ffirst.data_level = state.data_level; first_parms.t2ffirst.in.max_count = max_matches; first_parms.t2ffirst.in.search_attrib = attribute; first_parms.t2ffirst.in.pattern = mask; @@ -162,7 +163,8 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu } else { NTSTATUS status; - next_parms.t2fnext.level = state.info_level; + next_parms.t2fnext.level = RAW_SEARCH_TRANS2; + next_parms.t2fnext.data_level = state.data_level; next_parms.t2fnext.in.max_count = max_matches; next_parms.t2fnext.in.last_name = state.last_name; next_parms.t2fnext.in.handle = ff_dir_handle; @@ -201,20 +203,29 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu Interpret a short filename structure. The length of the structure is returned. ****************************************************************************/ -static BOOL interpret_short_filename(int level, - union smb_search_data *info, - struct clilist_file_info *finfo) +static BOOL interpret_short_filename(enum smb_search_data_level level, + union smb_search_data *info, + struct clilist_file_info *finfo) { struct clilist_file_info finfo2; if (!finfo) finfo = &finfo2; ZERO_STRUCTP(finfo); + + switch (level) { + case RAW_SEARCH_DATA_SEARCH: + finfo->mtime = info->search.write_time; + finfo->size = info->search.size; + finfo->attrib = info->search.attrib; + finfo->name = info->search.name; + finfo->short_name = info->search.name; + break; + + default: + DEBUG(0,("Unhandled level %d in interpret_short_filename\n", (int)level)); + return False; + } - finfo->mtime = info->search.write_time; - finfo->size = info->search.size; - finfo->attrib = info->search.attrib; - finfo->name = info->search.name; - finfo->short_name = info->search.name; return True; } @@ -236,7 +247,7 @@ static BOOL smbcli_list_old_callback(void *private, union smb_search_data *file) state->dirlist = tdl; state->dirlist_len++; - interpret_short_filename(state->info_level, file, &state->dirlist[state->total_received]); + interpret_short_filename(state->data_level, file, &state->dirlist[state->total_received]); state->total_received++; state->ff_searchcount++; @@ -273,6 +284,7 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu NTSTATUS status; first_parms.search_first.level = RAW_SEARCH_SEARCH; + first_parms.search_first.data_level = RAW_SEARCH_DATA_SEARCH; first_parms.search_first.in.max_count = num_asked; first_parms.search_first.in.search_attrib = attribute; first_parms.search_first.in.pattern = mask; @@ -294,6 +306,7 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu NTSTATUS status; next_parms.search_next.level = RAW_SEARCH_SEARCH; + next_parms.search_next.data_level = RAW_SEARCH_DATA_SEARCH; next_parms.search_next.in.max_count = num_asked; next_parms.search_next.in.search_attrib = attribute; next_parms.search_next.in.id = state.id; @@ -336,5 +349,5 @@ int smbcli_list(struct smbcli_tree *tree, const char *Mask,uint16_t attribute, { if (tree->session->transport->negotiate.protocol <= PROTOCOL_LANMAN1) return smbcli_list_old(tree, Mask, attribute, fn, state); - return smbcli_list_new(tree, Mask, attribute, RAW_SEARCH_GENERIC, fn, state); + return smbcli_list_new(tree, Mask, attribute, RAW_SEARCH_DATA_GENERIC, fn, state); } -- cgit From 6d35c078114d911784bf7c18fc700ea81cea6f6f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 27 Jul 2006 16:44:59 +0000 Subject: r17278: fix un uninitialized value found by valgrind metze (This used to be commit fe463bc568e8ac78ca161bcba3e867d33bb828b3) --- source4/libcli/clilist.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 16986e9428..9b4a1a158f 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -274,6 +274,7 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu state.mem_ctx = talloc_init("smbcli_list_old"); state.dirlist_len = 0; state.total_received = 0; + state.data_level = RAW_SEARCH_DATA_SEARCH; state.dirlist = talloc_new(state.mem_ctx); mask = talloc_strdup(state.mem_ctx, Mask); -- cgit From a475bfdcca0bc84a3a823a3061bbd53d9bad2842 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 1 May 2007 02:08:11 +0000 Subject: r22620: fix compiler warnings metze (This used to be commit b7adc88e743308742545f3ee6710f8c0bfa197d8) --- source4/libcli/clilist.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 9b4a1a158f..341b934aae 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -39,7 +39,7 @@ struct search_private { Interpret a long filename structure. ****************************************************************************/ static BOOL interpret_long_filename(enum smb_search_data_level level, - union smb_search_data *info, + const union smb_search_data *info, struct clilist_file_info *finfo) { struct clilist_file_info finfo2; @@ -73,7 +73,7 @@ static BOOL interpret_long_filename(enum smb_search_data_level level, } /* callback function used for trans2 search */ -static BOOL smbcli_list_new_callback(void *private, union smb_search_data *file) +static BOOL smbcli_list_new_callback(void *private, const union smb_search_data *file) { struct search_private *state = (struct search_private*) private; struct clilist_file_info *tdl; @@ -204,7 +204,7 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu The length of the structure is returned. ****************************************************************************/ static BOOL interpret_short_filename(enum smb_search_data_level level, - union smb_search_data *info, + const union smb_search_data *info, struct clilist_file_info *finfo) { struct clilist_file_info finfo2; @@ -230,7 +230,7 @@ static BOOL interpret_short_filename(enum smb_search_data_level level, } /* callback function used for smb_search */ -static BOOL smbcli_list_old_callback(void *private, union smb_search_data *file) +static BOOL smbcli_list_old_callback(void *private, const union smb_search_data *file) { struct search_private *state = (struct search_private*) private; struct clilist_file_info *tdl; -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/libcli/clilist.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 341b934aae..ba85ec397a 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -15,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From dccf3f99e45137b6cd18c1de1c79808ad67130d1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 13:27:14 +0000 Subject: r25027: Fix more warnings. (This used to be commit 5085c53fcfade614e83d21fc2c1a5bc43bb2a729) --- source4/libcli/clilist.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index ba85ec397a..14fd3ee4f7 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -118,7 +118,8 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu state.dirlist_len = 0; state.total_received = 0; - state.dirlist = talloc_new(state.mem_ctx); + state.dirlist = talloc_array(state.mem_ctx, + struct clilist_file_info, 0); mask = talloc_strdup(state.mem_ctx, Mask); if (level == RAW_SEARCH_DATA_GENERIC) { @@ -275,7 +276,8 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu state.total_received = 0; state.data_level = RAW_SEARCH_DATA_SEARCH; - state.dirlist = talloc_new(state.mem_ctx); + state.dirlist = talloc_array(state.mem_ctx, struct clilist_file_info, + 0); mask = talloc_strdup(state.mem_ctx, Mask); while (1) { -- cgit From 2151cde58014ea2e822c13d2f8a369b45dc19ca8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 6 Oct 2007 22:28:14 +0000 Subject: r25554: Convert last instances of BOOL, True and False to the standard types. (This used to be commit 566aa14139510788548a874e9213d91317f83ca9) --- source4/libcli/clilist.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 14fd3ee4f7..07393a3491 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -37,7 +37,7 @@ struct search_private { /**************************************************************************** Interpret a long filename structure. ****************************************************************************/ -static BOOL interpret_long_filename(enum smb_search_data_level level, +static bool interpret_long_filename(enum smb_search_data_level level, const union smb_search_data *info, struct clilist_file_info *finfo) { @@ -65,14 +65,14 @@ static BOOL interpret_long_filename(enum smb_search_data_level level, default: DEBUG(0,("Unhandled level %d in interpret_long_filename\n", (int)level)); - return False; + return false; } - return True; + return true; } /* callback function used for trans2 search */ -static BOOL smbcli_list_new_callback(void *private, const union smb_search_data *file) +static bool smbcli_list_new_callback(void *private, const union smb_search_data *file) { struct search_private *state = (struct search_private*) private; struct clilist_file_info *tdl; @@ -83,7 +83,7 @@ static BOOL smbcli_list_new_callback(void *private, const union smb_search_data struct clilist_file_info, state->dirlist_len + 1); if (!tdl) { - return False; + return false; } state->dirlist = tdl; state->dirlist_len++; @@ -94,7 +94,7 @@ static BOOL smbcli_list_new_callback(void *private, const union smb_search_data state->total_received++; state->ff_searchcount++; - return True; + return true; } int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribute, @@ -106,7 +106,7 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu union smb_search_next next_parms; struct search_private state; /* for callbacks */ int received = 0; - BOOL first = True; + bool first = true; int num_received = 0; int max_matches = 512; char *mask; @@ -159,7 +159,7 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu received = first_parms.t2ffirst.out.count; if (received <= 0) break; if (ff_eos) break; - first = False; + first = false; } else { NTSTATUS status; @@ -203,7 +203,7 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu Interpret a short filename structure. The length of the structure is returned. ****************************************************************************/ -static BOOL interpret_short_filename(enum smb_search_data_level level, +static bool interpret_short_filename(enum smb_search_data_level level, const union smb_search_data *info, struct clilist_file_info *finfo) { @@ -223,14 +223,14 @@ static BOOL interpret_short_filename(enum smb_search_data_level level, default: DEBUG(0,("Unhandled level %d in interpret_short_filename\n", (int)level)); - return False; + return false; } - return True; + return true; } /* callback function used for smb_search */ -static BOOL smbcli_list_old_callback(void *private, const union smb_search_data *file) +static bool smbcli_list_old_callback(void *private, const union smb_search_data *file) { struct search_private *state = (struct search_private*) private; struct clilist_file_info *tdl; @@ -242,7 +242,7 @@ static BOOL smbcli_list_old_callback(void *private, const union smb_search_data state->dirlist_len + 1); if (!tdl) { - return False; + return false; } state->dirlist = tdl; state->dirlist_len++; @@ -253,7 +253,7 @@ static BOOL smbcli_list_old_callback(void *private, const union smb_search_data state->ff_searchcount++; state->id = file->search.id; /* return resume info */ - return True; + return true; } int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribute, @@ -265,7 +265,7 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu struct search_private state; /* for callbacks */ const int num_asked = 500; int received = 0; - BOOL first = True; + bool first = true; int num_received = 0; char *mask; int i; @@ -303,7 +303,7 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu received = first_parms.search_first.out.count; if (received <= 0) break; - first = False; + first = false; } else { NTSTATUS status; -- cgit From afe3e8172ddaa5e4aa811faceecda4f943d6e2ef Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Apr 2008 04:53:27 +0200 Subject: Install public header files again and include required prototypes. (This used to be commit 47ffbbf67435904754469544390b67d34c958343) --- source4/libcli/clilist.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libcli/clilist.c') diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 07393a3491..5d43606c61 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -21,6 +21,7 @@ #include "includes.h" #include "libcli/libcli.h" #include "libcli/raw/libcliraw.h" +#include "libcli/raw/raw_proto.h" struct search_private { struct clilist_file_info *dirlist; -- cgit