summaryrefslogtreecommitdiff
path: root/source4/libcli/ndr
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
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')
-rw-r--r--source4/libcli/ndr/ndr_basic.c16
-rw-r--r--source4/libcli/ndr/ndr_lsa.c25
-rw-r--r--source4/libcli/ndr/ndr_lsa.h12
3 files changed, 43 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;
}
diff --git a/source4/libcli/ndr/ndr_lsa.c b/source4/libcli/ndr/ndr_lsa.c
index 6649bd04c2..5955432915 100644
--- a/source4/libcli/ndr/ndr_lsa.c
+++ b/source4/libcli/ndr/ndr_lsa.c
@@ -83,3 +83,28 @@ NTSTATUS ndr_pull_lsa_OpenPolicy(struct ndr_pull *ndr,
NDR_CHECK(ndr_pull_status(ndr, &r->out.status));
return NT_STATUS_OK;
}
+
+/*
+ push a openpolicy2
+*/
+NTSTATUS ndr_push_lsa_OpenPolicy2(struct ndr_push *ndr,
+ struct lsa_OpenPolicy2 *r)
+{
+ NDR_CHECK(ndr_push_ptr(ndr, r->in.system_name));
+ NDR_CHECK(ndr_push_unistr(ndr, r->in.system_name));
+ NDR_CHECK(ndr_push_lsa_ObjectAttribute(ndr, r->in.attr));
+ NDR_CHECK(ndr_push_u32(ndr, r->in.desired_access));
+ return NT_STATUS_OK;
+}
+
+
+/*
+ parse a openpolicy2
+*/
+NTSTATUS ndr_pull_lsa_OpenPolicy2(struct ndr_pull *ndr,
+ struct lsa_OpenPolicy2 *r)
+{
+ NDR_CHECK(ndr_pull_policy_handle(ndr, &r->out.handle));
+ NDR_CHECK(ndr_pull_status(ndr, &r->out.status));
+ return NT_STATUS_OK;
+}
diff --git a/source4/libcli/ndr/ndr_lsa.h b/source4/libcli/ndr/ndr_lsa.h
index 4a0aff8323..cfdd98e24e 100644
--- a/source4/libcli/ndr/ndr_lsa.h
+++ b/source4/libcli/ndr/ndr_lsa.h
@@ -45,3 +45,15 @@ struct lsa_OpenPolicy {
NTSTATUS status;
} out;
};
+
+struct lsa_OpenPolicy2 {
+ struct {
+ const char *system_name;
+ struct lsa_ObjectAttribute *attr;
+ uint32 desired_access;
+ } in;
+ struct {
+ struct policy_handle handle;
+ NTSTATUS status;
+ } out;
+};