summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-02-26 05:10:44 +0000
committerAndrew Tridgell <tridge@samba.org>2001-02-26 05:10:44 +0000
commitf9405ab8f921753f1de9490f37b18ccfcd3ab370 (patch)
tree0c5d7f9573a787c2f0d0a8771afbbea24bd08986
parentf7602aaaa6d03fc50299def73293912a2ab1f997 (diff)
downloadsamba-f9405ab8f921753f1de9490f37b18ccfcd3ab370.tar.gz
samba-f9405ab8f921753f1de9490f37b18ccfcd3ab370.tar.bz2
samba-f9405ab8f921753f1de9490f37b18ccfcd3ab370.zip
add cli_list_new() for forced new protocol listing
(This used to be commit a5407366b77f2bec2c21e1f36dd007813d33f75e)
-rw-r--r--source3/libsmb/clilist.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c
index c30f69a36c..eccf3c553a 100644
--- a/source3/libsmb/clilist.c
+++ b/source3/libsmb/clilist.c
@@ -135,8 +135,8 @@ static int interpret_long_filename(struct cli_state *cli,
p += 2;
clistr_pull(cli, finfo->short_name, p,
sizeof(finfo->short_name),
- -1,
- CLISTR_TERMINATE | CLISTR_CONVERT);
+ 24,
+ CLISTR_CONVERT);
p += 24; /* short name? */
clistr_pull(cli, finfo->name, p,
sizeof(finfo->name),
@@ -155,8 +155,8 @@ static int interpret_long_filename(struct cli_state *cli,
/****************************************************************************
do a directory listing, calling fn on each file found
****************************************************************************/
-int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
- void (*fn)(file_info *, const char *, void *), void *state)
+int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute,
+ void (*fn)(file_info *, const char *, void *), void *state)
{
int max_matches = 512;
/* NT uses 260, OS/2 uses 2. Both accept 1. */
@@ -179,10 +179,6 @@ int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
uint16 setup;
pstring param;
- if (cli->protocol <= PROTOCOL_LANMAN1) {
- return cli_list_old(cli, Mask, attribute, fn, state);
- }
-
pstrcpy(mask,Mask);
while (ff_eos == 0) {
@@ -466,3 +462,17 @@ int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
if (dirlist) free(dirlist);
return(num_received);
}
+
+
+/****************************************************************************
+ do a directory listing, calling fn on each file found
+ this auto-switches between old and new style
+ ****************************************************************************/
+int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
+ void (*fn)(file_info *, const char *, void *), void *state)
+{
+ if (cli->protocol <= PROTOCOL_LANMAN1) {
+ return cli_list_old(cli, Mask, attribute, fn, state);
+ }
+ return cli_list_new(cli, Mask, attribute, fn, state);
+}