diff options
Diffstat (limited to 'source/libsmb/clilist.c')
-rw-r--r-- | source/libsmb/clilist.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/source/libsmb/clilist.c b/source/libsmb/clilist.c index 3eacc25380a..647bf54be61 100644 --- a/source/libsmb/clilist.c +++ b/source/libsmb/clilist.c @@ -1,5 +1,6 @@ /* - Unix SMB/CIFS implementation. + Unix SMB/Netbios implementation. + Version 3.0 client directory list routines Copyright (C) Andrew Tridgell 1994-1998 @@ -22,13 +23,13 @@ #include "includes.h" + /**************************************************************************** - Interpret a long filename structure - this is mostly guesses at the moment. - The length of the structure is returned - The structure of a long filename depends on the info level. 260 is used - by NT and 2 is used by OS/2 +interpret a long filename structure - this is mostly guesses at the moment +The length of the structure is returned +The structure of a long filename depends on the info level. 260 is used +by NT and 2 is used by OS/2 ****************************************************************************/ - static int interpret_long_filename(struct cli_state *cli, int level,char *p,file_info *finfo) { @@ -41,7 +42,8 @@ static int interpret_long_filename(struct cli_state *cli, memcpy(finfo,&def_finfo,sizeof(*finfo)); - switch (level) { + switch (level) + { case 1: /* OS/2 understands this */ /* these dates are converted to GMT by make_unix_date */ @@ -53,14 +55,11 @@ static int interpret_long_filename(struct cli_state *cli, len = CVAL(p, 26); p += 27; p += clistr_align_in(cli, p, 0); - /* the len+2 below looks strange but it is - important to cope with the differences - between win2000 and win9x for this call - (tridge) */ p += clistr_pull(cli, finfo->name, p, - sizeof(finfo->name), - len+2, - STR_TERMINATE); + sizeof(finfo->name), + len, + STR_TERMINATE); + p += 1; /* Skip the trailing \0 too */ return PTR_DIFF(p, base); case 2: /* this is what OS/2 uses mostly */ @@ -125,16 +124,16 @@ static int interpret_long_filename(struct cli_state *cli, namelen, 0); return SVAL(base, 0); } - } + } DEBUG(1,("Unknown long filename format %d\n",level)); return(SVAL(p,0)); } -/**************************************************************************** - Do a directory listing, calling fn on each file found. -****************************************************************************/ +/**************************************************************************** + do a directory listing, calling fn on each file found + ****************************************************************************/ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute, void (*fn)(file_info *, const char *, void *), void *state) { @@ -179,7 +178,7 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute, SIVAL(param,8,0); p = param+12; p += clistr_push(cli, param+12, mask, -1, - STR_TERMINATE); + STR_TERMINATE|STR_CONVERT); } else { setup = TRANSACT2_FINDNEXT; SSVAL(param,0,ff_dir_handle); @@ -189,7 +188,7 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute, SSVAL(param,10,8+4+2); /* continue + resume required + close on end */ p = param+12; p += clistr_push(cli, param+12, mask, -1, - STR_TERMINATE); + STR_TERMINATE|STR_CONVERT); } param_len = PTR_DIFF(p, param); @@ -306,11 +305,12 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute, return(total_received); } + + /**************************************************************************** - Interpret a short filename structure. - The length of the structure is returned. +interpret a short filename structure +The length of the structure is returned ****************************************************************************/ - static int interpret_short_filename(struct cli_state *cli, char *p,file_info *finfo) { extern file_info def_finfo; @@ -332,11 +332,10 @@ static int interpret_short_filename(struct cli_state *cli, char *p,file_info *fi /**************************************************************************** - Do a directory listing, calling fn on each file found. - this uses the old SMBsearch interface. It is needed for testing Samba, - but should otherwise not be used. -****************************************************************************/ - + do a directory listing, calling fn on each file found + this uses the old SMBsearch interface. It is needed for testing Samba, + but should otherwise not be used + ****************************************************************************/ int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute, void (*fn)(file_info *, const char *, void *), void *state) { @@ -371,7 +370,7 @@ int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute, p = smb_buf(cli->outbuf); *p++ = 4; - p += clistr_push(cli, p, first?mask:"", -1, STR_TERMINATE); + p += clistr_push(cli, p, first?mask:"", -1, STR_TERMINATE|STR_CONVERT); *p++ = 5; if (first) { SSVAL(p,0,0); @@ -452,15 +451,16 @@ int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute, return(num_received); } -/**************************************************************************** - Do a directory listing, calling fn on each file found. - This auto-switches between old and new style. -****************************************************************************/ +/**************************************************************************** + 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) + if (cli->protocol <= PROTOCOL_LANMAN1) { return cli_list_old(cli, Mask, attribute, fn, state); + } return cli_list_new(cli, Mask, attribute, fn, state); } |