summaryrefslogtreecommitdiffstats
path: root/source4/libcli/raw
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-08-31 03:16:52 +0000
committerAndrew Tridgell <tridge@samba.org>2003-08-31 03:16:52 +0000
commit11c5869a450d5f78a9395889ec03f77732cc8be5 (patch)
treed3fd5854dd61dc36f3d83064fdf04dc34c81234e /source4/libcli/raw
parenta8a5ac2bd218d5bc3985ffbe118111c9b4649860 (diff)
downloadsamba-11c5869a450d5f78a9395889ec03f77732cc8be5.tar.gz
samba-11c5869a450d5f78a9395889ec03f77732cc8be5.tar.xz
samba-11c5869a450d5f78a9395889ec03f77732cc8be5.zip
I think I've finally got the ascii/unicode issues right in trans2 find
first Also expanded the rename test a little (This used to be commit 723af7f097a8c7f23dac23039e479811559ac3cb)
Diffstat (limited to 'source4/libcli/raw')
-rw-r--r--source4/libcli/raw/rawfile.c2
-rw-r--r--source4/libcli/raw/rawrequest.c23
-rw-r--r--source4/libcli/raw/rawsearch.c8
3 files changed, 22 insertions, 11 deletions
diff --git a/source4/libcli/raw/rawfile.c b/source4/libcli/raw/rawfile.c
index e9d3a8305d..0dc2a15c11 100644
--- a/source4/libcli/raw/rawfile.c
+++ b/source4/libcli/raw/rawfile.c
@@ -48,7 +48,7 @@ struct cli_request *smb_raw_rename_send(struct cli_tree *tree,
SETUP_REQUEST(SMBntrename, 4, 0);
SSVAL(req->out.vwv, VWV(0), parms->ntrename.in.attrib);
SSVAL(req->out.vwv, VWV(1), parms->ntrename.in.flags);
- SIVAL(req->out.vwv, VWV(2), parms->ntrename.in.unknown);
+ SIVAL(req->out.vwv, VWV(2), parms->ntrename.in.cluster_size);
cli_req_append_ascii4(req, parms->ntrename.in.old_name, STR_TERMINATE);
cli_req_append_ascii4(req, parms->ntrename.in.new_name, STR_TERMINATE);
break;
diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c
index fa3b3ab627..139f031178 100644
--- a/source4/libcli/raw/rawrequest.c
+++ b/source4/libcli/raw/rawrequest.c
@@ -963,8 +963,9 @@ size_t cli_blob_pull_string(struct cli_session *session,
uint16 len_offset, uint16 str_offset,
unsigned flags)
{
+ int extra;
dest->s = NULL;
-
+
if (len_offset > blob->length-4) {
return 0;
}
@@ -973,19 +974,29 @@ size_t cli_blob_pull_string(struct cli_session *session,
} else {
dest->private_length = IVAL(blob->data, len_offset);
}
+ extra = 0;
dest->s = NULL;
if (!(flags & STR_ASCII) &&
((flags & STR_UNICODE) ||
(session->transport->negotiate.capabilities & CAP_UNICODE))) {
+ int align = 0;
if ((str_offset&1) && !(flags & STR_NOALIGN)) {
- str_offset++;
+ align = 1;
+ }
+ if (flags & STR_LEN_NOTERM) {
+ extra = 2;
}
- return cli_blob_pull_ucs2(mem_ctx, blob, &dest->s,
- blob->data+str_offset, dest->private_length, flags);
+ return align + extra + cli_blob_pull_ucs2(mem_ctx, blob, &dest->s,
+ blob->data+str_offset+align,
+ dest->private_length, flags);
+ }
+
+ if (flags & STR_LEN_NOTERM) {
+ extra = 1;
}
- return cli_blob_pull_ascii(mem_ctx, blob, &dest->s,
- blob->data+str_offset, dest->private_length, flags);
+ return extra + cli_blob_pull_ascii(mem_ctx, blob, &dest->s,
+ blob->data+str_offset, dest->private_length, flags);
}
/*
diff --git a/source4/libcli/raw/rawsearch.c b/source4/libcli/raw/rawsearch.c
index bdc39bb68c..222bf53623 100644
--- a/source4/libcli/raw/rawsearch.c
+++ b/source4/libcli/raw/rawsearch.c
@@ -263,8 +263,8 @@ static int parse_trans2_search(struct cli_tree *tree,
data->standard.attrib = SVAL(blob->data, 20);
len = cli_blob_pull_string(tree->session, mem_ctx, blob,
&data->standard.name,
- 22, 23, STR_LEN8BIT);
- return (len + 23 + 3) & ~3;
+ 22, 23, STR_LEN8BIT | STR_TERMINATE | STR_LEN_NOTERM);
+ return len + 23;
case RAW_SEARCH_EA_SIZE:
if (flags & FLAG_TRANS2_FIND_REQUIRE_RESUME) {
@@ -283,8 +283,8 @@ static int parse_trans2_search(struct cli_tree *tree,
data->ea_size.ea_size = IVAL(blob->data, 22);
len = cli_blob_pull_string(tree->session, mem_ctx, blob,
&data->ea_size.name,
- 26, 27, STR_LEN8BIT | STR_NOALIGN);
- return len + 27;
+ 26, 27, STR_LEN8BIT | STR_TERMINATE | STR_NOALIGN);
+ return len + 27 + 1;
case RAW_SEARCH_DIRECTORY_INFO:
if (blob->length < 65) return -1;