diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-02-16 15:58:56 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:48:25 -0500 |
commit | 03e0d675cf7c8397513fe377142f96420ab6cbb2 (patch) | |
tree | 24f21fb3224495850d4da90bb1b13a7f05bbc5af | |
parent | ac8669cf5c5cb46b9c684b4b675a5c92a51b0979 (diff) | |
download | samba-03e0d675cf7c8397513fe377142f96420ab6cbb2.tar.gz samba-03e0d675cf7c8397513fe377142f96420ab6cbb2.tar.bz2 samba-03e0d675cf7c8397513fe377142f96420ab6cbb2.zip |
r21391: add supporting for
uint16 size;
[relative,subcontext(0),subcontext_size(size),flag(STR_NOTERM|NDR_REMAINING)] string *string;
as
uint16 size;
[relative,charset(UTF16)] uint8 *string[size];
isn't supported by pidl yet...
metze
(This used to be commit 9fcfa658430f04658c692eb26db9280fda6e4e25)
-rw-r--r-- | source4/librpc/ndr/ndr_string.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/source4/librpc/ndr/ndr_string.c b/source4/librpc/ndr/ndr_string.c index 8d27b2cba9..6c4332bd01 100644 --- a/source4/librpc/ndr/ndr_string.c +++ b/source4/librpc/ndr/ndr_string.c @@ -273,6 +273,32 @@ _PUBLIC_ NTSTATUS ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const cha *s = as; break; + case LIBNDR_FLAG_STR_NOTERM: + if (!(ndr->flags & LIBNDR_FLAG_REMAINING)) { + break; + } + + len1 = ndr->data_size - ndr->offset; + + NDR_PULL_NEED_BYTES(ndr, len1); + if (len1 == 0) { + as = talloc_strdup(ndr->current_mem_ctx, ""); + } else { + ret = convert_string_talloc(ndr->current_mem_ctx, + chset, CH_UNIX, + ndr->data+ndr->offset, + len1, + (void **)&as); + if (ret == -1) { + return ndr_pull_error(ndr, NDR_ERR_CHARCNV, + "Bad character conversion"); + } + } + NDR_CHECK(ndr_pull_advance(ndr, len1)); + + *s = as; + break; + default: return ndr_pull_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x\n", ndr->flags & LIBNDR_STRING_FLAGS); @@ -383,6 +409,11 @@ _PUBLIC_ NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const cha } default: + if (ndr->flags & LIBNDR_FLAG_REMAINING) { + NDR_CHECK(ndr_push_bytes(ndr, dest, d_len)); + break; + } + return ndr_push_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x\n", ndr->flags & LIBNDR_STRING_FLAGS); } |