diff options
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/clilist.c | 6 | ||||
-rw-r--r-- | source3/libsmb/clistr.c | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c index 0033f05942..9080a9c221 100644 --- a/source3/libsmb/clilist.c +++ b/source3/libsmb/clilist.c @@ -333,7 +333,7 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute, interpret a short filename structure The length of the structure is returned ****************************************************************************/ -static int interpret_short_filename(char *p,file_info *finfo) +static int interpret_short_filename(struct cli_state *cli, char *p,file_info *finfo) { extern file_info def_finfo; @@ -345,7 +345,7 @@ static int interpret_short_filename(char *p,file_info *finfo) finfo->ctime = make_unix_date(p+22); finfo->mtime = finfo->atime = finfo->ctime; finfo->size = IVAL(p,26); - pstrcpy(finfo->name,p+30); + clistr_pull(cli, finfo->name, p+30, sizeof(finfo->name), 12, STR_CONVERT|STR_ASCII); if (strcmp(finfo->name, "..") && strcmp(finfo->name, ".")) fstrcpy(finfo->short_name,finfo->name); @@ -461,7 +461,7 @@ int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute, for (p=dirlist,i=0;i<num_received;i++) { file_info finfo; - p += interpret_short_filename(p,&finfo); + p += interpret_short_filename(cli, p,&finfo); fn(&finfo, Mask, state); } diff --git a/source3/libsmb/clistr.c b/source3/libsmb/clistr.c index feed10fa4e..93361053e0 100644 --- a/source3/libsmb/clistr.c +++ b/source3/libsmb/clistr.c @@ -95,12 +95,13 @@ int clistr_pull(struct cli_state *cli, char *dest, const void *src, int dest_len dest_len = sizeof(pstring); } - if (clistr_align(cli->inbuf, src)) { + if (!(flags & STR_ASCII) && clistr_align(cli->inbuf, src)) { src++; if (src_len > 0) src_len--; } - if (!(flags & STR_UNICODE) && !(SVAL(cli->inbuf, smb_flg2) & FLAGS2_UNICODE_STRINGS)) { + if ((flags & STR_ASCII) || + (!(flags & STR_UNICODE) && !(SVAL(cli->inbuf, smb_flg2) & FLAGS2_UNICODE_STRINGS))) { /* the server doesn't want unicode */ if (flags & STR_TERMINATE) { safe_strcpy(dest, src, dest_len); |