diff options
Diffstat (limited to 'source4/libcli')
-rw-r--r-- | source4/libcli/raw/rawfile.c | 2 | ||||
-rw-r--r-- | source4/libcli/raw/rawrequest.c | 23 | ||||
-rw-r--r-- | source4/libcli/raw/rawsearch.c | 8 |
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; |