diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-11-08 11:21:57 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-11-08 11:21:57 +0000 |
commit | 7d212460a5c00b4039440c2db0dde56e7d519d66 (patch) | |
tree | 7c14238930104c5edc8711f480b3ba0095d8d687 /source4/librpc/ndr/ndr_basic.c | |
parent | 4e4a63d5185d1567c115e7cbf15022b0fbcbc870 (diff) | |
download | samba-7d212460a5c00b4039440c2db0dde56e7d519d66.tar.gz samba-7d212460a5c00b4039440c2db0dde56e7d519d66.tar.bz2 samba-7d212460a5c00b4039440c2db0dde56e7d519d66.zip |
- corrected some lsa idl
- updated lsa parse code from pidl
(This used to be commit 3983b2aee77b0e093847bfc02e02b83ab281f5dd)
Diffstat (limited to 'source4/librpc/ndr/ndr_basic.c')
-rw-r--r-- | source4/librpc/ndr/ndr_basic.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c index 3bd75e7c0d..0597bcab00 100644 --- a/source4/librpc/ndr/ndr_basic.c +++ b/source4/librpc/ndr/ndr_basic.c @@ -243,6 +243,32 @@ NTSTATUS ndr_push_unistr(struct ndr_push *ndr, const char *s) } /* + pull a comformant, variable ucs2 string from the wire into a C string +*/ +NTSTATUS ndr_pull_unistr(struct ndr_pull *ndr, const char **s) +{ + char *ws, *as=NULL; + uint32 len1, ofs, len2; + + NDR_CHECK(ndr_pull_uint32(ndr, &len1)); + NDR_CHECK(ndr_pull_uint32(ndr, &ofs)); + NDR_CHECK(ndr_pull_uint32(ndr, &len2)); + if (len2 > len1) { + return NT_STATUS_INVALID_PARAMETER; + } + NDR_ALLOC_N(ndr, ws, (len1+1)*2); + NDR_CHECK(ndr_pull_bytes(ndr, ws, len1*2)); + SSVAL(ws, len1*2, 0); + SSVAL(ws, len2*2, 0); + pull_ucs2_talloc(ndr->mem_ctx, &as, (const smb_ucs2_t *)ws); + if (!as) { + return NT_STATUS_INVALID_PARAMETER; + } + *s = as; + return NT_STATUS_OK; +} + +/* push a 4 byte offset pointer, remembering where we are so we can later fill in the correct value */ |