summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-03-16 03:25:13 +0000
committerAndrew Tridgell <tridge@samba.org>2001-03-16 03:25:13 +0000
commit871a4294043e2e74d906f63ad97a31e35abd0374 (patch)
tree453a0c1c2bb5cad6d38a001396508e8c57f48de8
parentc9b8da47a68c98d72d59d25d1e2d8f3069300f40 (diff)
downloadsamba-871a4294043e2e74d906f63ad97a31e35abd0374.tar.gz
samba-871a4294043e2e74d906f63ad97a31e35abd0374.tar.bz2
samba-871a4294043e2e74d906f63ad97a31e35abd0374.zip
added STR_ASCII support to clistr_pull()
(This used to be commit 797293811ef0a79eecc460c471135c89090f8c06)
-rw-r--r--source3/libsmb/clilist.c6
-rw-r--r--source3/libsmb/clistr.c5
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);