diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/Makefile.in | 4 | ||||
-rw-r--r-- | source4/librpc/idl/lsa.idl | 2 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_basic.c | 2 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_lsa.c | 114 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_lsa.h | 27 | ||||
-rw-r--r-- | source4/librpc/rpc/rpc_lsa.c | 11 | ||||
-rwxr-xr-x | source4/script/build_idl.sh | 10 |
7 files changed, 46 insertions, 124 deletions
diff --git a/source4/Makefile.in b/source4/Makefile.in index ee26dc58da..2027e1040b 100644 --- a/source4/Makefile.in +++ b/source4/Makefile.in @@ -734,6 +734,10 @@ pch: $(CC) -I. -I$(srcdir) $(FLAGS) -c $(srcdir)/include/includes.h -o $(srcdir)/include/includes.h.gch +idl: + script/build_idl.sh + + # These dependencies are only approximately correct: we want to make # sure Samba's paths are updated if ./configure is re-run. Really it # would be nice if "make prefix=/opt/samba all" also rebuilt things, diff --git a/source4/librpc/idl/lsa.idl b/source4/librpc/idl/lsa.idl index 6b72d19d85..e043582f1d 100644 --- a/source4/librpc/idl/lsa.idl +++ b/source4/librpc/idl/lsa.idl @@ -28,7 +28,7 @@ [in] uint16 *system_name, [in,ref] lsa_ObjectAttribute *attr, [in] uint32 desired_access, - [out] policy_handle *handle + [out,ref] policy_handle *handle ); NTSTATUS lsa_OpenPolicy2 ( diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c index 0597bcab00..21bd36963c 100644 --- a/source4/librpc/ndr/ndr_basic.c +++ b/source4/librpc/ndr/ndr_basic.c @@ -83,7 +83,7 @@ NTSTATUS ndr_pull_uint32(struct ndr_pull *ndr, uint32 *v) /* pull a NTSTATUS */ -NTSTATUS ndr_pull_status(struct ndr_pull *ndr, NTSTATUS *status) +NTSTATUS ndr_pull_NTSTATUS(struct ndr_pull *ndr, NTSTATUS *status) { uint32 v; NDR_CHECK(ndr_pull_uint32(ndr, &v)); diff --git a/source4/librpc/ndr/ndr_lsa.c b/source4/librpc/ndr/ndr_lsa.c index ff395f5699..533e895006 100644 --- a/source4/librpc/ndr/ndr_lsa.c +++ b/source4/librpc/ndr/ndr_lsa.c @@ -1,30 +1,7 @@ -/* - Unix SMB/CIFS implementation. - - routines for marshalling/unmarshalling lsa pipe - - Copyright (C) Andrew Tridgell 2003 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - +/* parser auto-generated by pidl */ #include "includes.h" -/* parser auto-generated by pidl */ - static NTSTATUS ndr_push_lsa_QosInfo(struct ndr_push *ndr, int ndr_flags, struct lsa_QosInfo *r) { struct ndr_push_save _save1, _save2, _save3; @@ -169,6 +146,14 @@ NTSTATUS ndr_push_lsa_OpenPolicy(struct ndr_push *ndr, struct lsa_OpenPolicy *r) return NT_STATUS_OK; } +NTSTATUS ndr_pull_lsa_OpenPolicy(struct ndr_pull *ndr, struct lsa_OpenPolicy *r) +{ + NDR_CHECK(ndr_pull_policy_handle(ndr, r->out.handle)); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result)); + + return NT_STATUS_OK; +} + NTSTATUS ndr_push_lsa_OpenPolicy2(struct ndr_push *ndr, struct lsa_OpenPolicy2 *r) { NDR_CHECK(ndr_push_ptr(ndr, r->in.system_name)); @@ -181,6 +166,14 @@ NTSTATUS ndr_push_lsa_OpenPolicy2(struct ndr_push *ndr, struct lsa_OpenPolicy2 * return NT_STATUS_OK; } +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_NTSTATUS(ndr, &r->out.result)); + + return NT_STATUS_OK; +} + static NTSTATUS ndr_push_lsa_SidPtr(struct ndr_push *ndr, int ndr_flags, struct lsa_SidPtr *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -250,81 +243,18 @@ done: NTSTATUS ndr_push_lsa_EnumSids(struct ndr_push *ndr, struct lsa_EnumSids *r) { NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle)); - NDR_CHECK(ndr_push_uint32(ndr, r->in.resume_handle)); + NDR_CHECK(ndr_push_uint32(ndr, *r->in.resume_handle)); NDR_CHECK(ndr_push_uint32(ndr, r->in.num_entries)); return NT_STATUS_OK; } -/* - parse a openpolicy -*/ -NTSTATUS ndr_pull_lsa_OpenPolicy(struct ndr_pull *ndr, - struct lsa_OpenPolicy *r) -{ - NDR_ALLOC(ndr, r->out.handle); - NDR_CHECK(ndr_pull_policy_handle(ndr, r->out.handle)); - NDR_CHECK(ndr_pull_status(ndr, &r->out.result)); - return NT_STATUS_OK; -} - -/* - parse a openpolicy2 -*/ -NTSTATUS ndr_pull_lsa_OpenPolicy2(struct ndr_pull *ndr, - struct lsa_OpenPolicy2 *r) -{ - NDR_ALLOC(ndr, r->out.handle); - NDR_CHECK(ndr_pull_policy_handle(ndr, r->out.handle)); - NDR_CHECK(ndr_pull_status(ndr, &r->out.result)); - return NT_STATUS_OK; -} - -#if 0 -/* - pull a lsa_SidArray -*/ -static NTSTATUS ndr_pull_lsa_SidArray(struct ndr_pull *ndr, - struct lsa_SidArray *r) +NTSTATUS ndr_pull_lsa_EnumSids(struct ndr_pull *ndr, struct lsa_EnumSids *r) { - uint32 ptr; - - NDR_CHECK(ndr_pull_uint32(ndr, &r->num_sids)); - NDR_CHECK(ndr_pull_uint32(ndr, &ptr)); - if (ptr) { - uint32 asize, i; - - NDR_CHECK(ndr_pull_uint32(ndr, &asize)); - NDR_ALLOC_N(ndr, r->sids, asize); - for (i=0;i<asize;i++) { - NDR_CHECK(ndr_pull_uint32(ndr, &ptr)); - if (ptr) { - NDR_ALLOC(ndr, r->sids[i]); - } else { - r->sids[i] = NULL; - } - } - - for (i=0;i<asize;i++) { - if (r->sids[i]) { - NDR_CHECK(ndr_pull_dom_sid2(ndr, r->sids[i])); - } - } - } - return NT_STATUS_OK; -} -#endif - -/* - pull a EnumSids -*/ -NTSTATUS ndr_pull_lsa_EnumSids(struct ndr_pull *ndr, - struct lsa_EnumSids *r) -{ - NDR_CHECK(ndr_pull_uint32(ndr, &r->out.resume_handle)); - NDR_ALLOC(ndr, r->out.sids); + NDR_CHECK(ndr_pull_uint32(ndr, r->out.resume_handle)); NDR_CHECK(ndr_pull_lsa_SidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sids)); - NDR_CHECK(ndr_pull_status(ndr, &r->out.result)); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result)); + return NT_STATUS_OK; } diff --git a/source4/librpc/ndr/ndr_lsa.h b/source4/librpc/ndr/ndr_lsa.h index ab9b0ea164..c19a884536 100644 --- a/source4/librpc/ndr/ndr_lsa.h +++ b/source4/librpc/ndr/ndr_lsa.h @@ -1,25 +1,3 @@ -/* - Unix SMB/CIFS implementation. - - definitions for marshalling/unmarshalling the lsa pipe - - Copyright (C) Andrew Tridgell 2003 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - /* header auto-generated by pidl */ struct lsa_QosInfo { @@ -76,16 +54,15 @@ struct lsa_SidArray { struct lsa_EnumSids { struct { struct policy_handle *handle; - uint32 resume_handle; + uint32 *resume_handle; uint32 num_entries; } in; struct { - uint32 resume_handle; + uint32 *resume_handle; struct lsa_SidArray *sids; NTSTATUS result; } out; }; - diff --git a/source4/librpc/rpc/rpc_lsa.c b/source4/librpc/rpc/rpc_lsa.c index 8a627aa562..f11519a3c3 100644 --- a/source4/librpc/rpc/rpc_lsa.c +++ b/source4/librpc/rpc/rpc_lsa.c @@ -51,6 +51,7 @@ NTSTATUS dcerpc_lsa_OpenPolicy(struct dcerpc_pipe *p, r.in.system_name = &s; r.in.attr = attr; r.in.desired_access = access_mask; + r.out.handle = handle; /* make the call */ status = dcerpc_ndr_request(p, LSA_OPENPOLICY, mem_ctx, @@ -62,7 +63,6 @@ NTSTATUS dcerpc_lsa_OpenPolicy(struct dcerpc_pipe *p, } /* and extract the .out parameters */ - *handle = *r.out.handle; status = r.out.result; done: @@ -93,6 +93,7 @@ NTSTATUS dcerpc_lsa_OpenPolicy2(struct dcerpc_pipe *p, r.in.system_name = server; r.in.attr = attr; r.in.desired_access = access_mask; + r.out.handle = handle; /* make the call */ status = dcerpc_ndr_request(p, LSA_OPENPOLICY2, mem_ctx, @@ -104,7 +105,6 @@ NTSTATUS dcerpc_lsa_OpenPolicy2(struct dcerpc_pipe *p, } /* and extract the .out parameters */ - *handle = *r.out.handle; status = r.out.result; done: @@ -127,9 +127,12 @@ NTSTATUS dcerpc_lsa_EnumSids(struct dcerpc_pipe *p, /* fill the .in side of the call */ r.in.handle = handle; - r.in.resume_handle = *resume_handle; + r.in.resume_handle = resume_handle; r.in.num_entries = num_entries; + r.out.resume_handle = resume_handle; + r.out.sids = sids; + /* make the call */ status = dcerpc_ndr_request(p, LSA_ENUM_ACCOUNTS, mem_ctx, (ndr_push_fn_t) ndr_push_lsa_EnumSids, @@ -140,8 +143,6 @@ NTSTATUS dcerpc_lsa_EnumSids(struct dcerpc_pipe *p, } /* and extract the .out parameters */ - *resume_handle = r.out.resume_handle; - *sids = *r.out.sids; status = r.out.result; done: diff --git a/source4/script/build_idl.sh b/source4/script/build_idl.sh new file mode 100755 index 0000000000..a456f479fd --- /dev/null +++ b/source4/script/build_idl.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +for f in librpc/idl/*.idl; do + echo Processing $f + base=`basename $f .idl` + ndr=librpc/ndr/ndr_$base + $HOME/pidl/pidl.pl --output $ndr --parse --header --parser $f || exit 1 +done + +exit 0 |