summaryrefslogtreecommitdiff
path: root/source4/libcli/ndr/ndr_basic.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-04 09:48:33 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-04 09:48:33 +0000
commit485f930088b524d704bed668d4ef118ca2f31bbe (patch)
tree8d99494f3e128c539169967276dc9f5dd9115997 /source4/libcli/ndr/ndr_basic.c
parent46046aa69be01d4868395b9b52b8bcd22c3859e5 (diff)
downloadsamba-485f930088b524d704bed668d4ef118ca2f31bbe.tar.gz
samba-485f930088b524d704bed668d4ef118ca2f31bbe.tar.bz2
samba-485f930088b524d704bed668d4ef118ca2f31bbe.zip
lsa_OpenPolicy2 now works
(This used to be commit 9cf479873f3501776091c9d01551adadcf525794)
Diffstat (limited to 'source4/libcli/ndr/ndr_basic.c')
-rw-r--r--source4/libcli/ndr/ndr_basic.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/source4/libcli/ndr/ndr_basic.c b/source4/libcli/ndr/ndr_basic.c
index 8cbf375403..21326c2a62 100644
--- a/source4/libcli/ndr/ndr_basic.c
+++ b/source4/libcli/ndr/ndr_basic.c
@@ -177,6 +177,7 @@ NTSTATUS ndr_push_bytes(struct ndr_push *ndr, const char *data, uint32 n)
*/
NTSTATUS ndr_push_length4_start(struct ndr_push *ndr, struct ndr_push_save *save)
{
+ NDR_PUSH_ALIGN(ndr, 4);
save->offset = ndr->offset;
return ndr_push_u32(ndr, 0);
}
@@ -203,21 +204,16 @@ NTSTATUS ndr_push_ptr(struct ndr_push *ndr, const void *p)
*/
NTSTATUS ndr_push_unistr(struct ndr_push *ndr, const char *s)
{
- smb_ucs2_t *ws;
+ char *ws;
ssize_t len;
- int i;
- len = push_ucs2_talloc(ndr->mem_ctx, &ws, s);
+ len = push_ucs2_talloc(ndr->mem_ctx, (smb_ucs2_t **)&ws, s);
if (len == -1) {
return NT_STATUS_INVALID_PARAMETER;
}
- NDR_CHECK(ndr_push_u32(ndr, len));
+ NDR_CHECK(ndr_push_u32(ndr, len/2));
NDR_CHECK(ndr_push_u32(ndr, 0));
- NDR_CHECK(ndr_push_u32(ndr, len-2));
- NDR_PUSH_NEED_BYTES(ndr, len);
- for (i=0;i<len;i+=2) {
- SSVAL(ndr->data, ndr->offset + i, ws[i]);
- }
- ndr->offset += i;
+ NDR_CHECK(ndr_push_u32(ndr, len/2));
+ NDR_CHECK(ndr_push_bytes(ndr, ws, len));
return NT_STATUS_OK;
}