diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-08-31 03:16:52 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-08-31 03:16:52 +0000 |
commit | 11c5869a450d5f78a9395889ec03f77732cc8be5 (patch) | |
tree | d3fd5854dd61dc36f3d83064fdf04dc34c81234e /source4/libcli/raw/rawrequest.c | |
parent | a8a5ac2bd218d5bc3985ffbe118111c9b4649860 (diff) | |
download | samba-11c5869a450d5f78a9395889ec03f77732cc8be5.tar.gz samba-11c5869a450d5f78a9395889ec03f77732cc8be5.tar.bz2 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/rawrequest.c')
-rw-r--r-- | source4/libcli/raw/rawrequest.c | 23 |
1 files changed, 17 insertions, 6 deletions
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); } /* |