diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/Makefile.in | 10 | ||||
-rw-r--r-- | source4/include/includes.h | 4 | ||||
-rw-r--r-- | source4/libcli/ndr/ndr_lsa.c | 155 | ||||
-rw-r--r-- | source4/librpc/idl/lsa.idl | 48 | ||||
-rw-r--r-- | source4/librpc/ndr/libndr.h (renamed from source4/libcli/ndr/libndr.h) | 8 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr.c (renamed from source4/libcli/ndr/ndr.c) | 0 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_basic.c (renamed from source4/libcli/ndr/ndr_basic.c) | 53 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_echo.c (renamed from source4/libcli/ndr/ndr_echo.c) | 18 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_echo.h (renamed from source4/libcli/ndr/ndr_echo.h) | 0 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_lsa.c | 167 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_lsa.h (renamed from source4/libcli/ndr/ndr_lsa.h) | 28 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_misc.c (renamed from source4/libcli/ndr/ndr_misc.c) | 0 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_misc.h (renamed from source4/libcli/ndr/ndr_misc.h) | 0 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_sec.c (renamed from source4/libcli/ndr/ndr_sec.c) | 66 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_sec.h (renamed from source4/libcli/ndr/ndr_sec.h) | 0 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.c (renamed from source4/libcli/rpc/dcerpc.c) | 0 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.h (renamed from source4/libcli/rpc/dcerpc.h) | 0 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_smb.c (renamed from source4/libcli/raw/rawdcerpc.c) | 0 | ||||
-rw-r--r-- | source4/librpc/rpc/rpc_echo.c (renamed from source4/libcli/rpc/rpc_echo.c) | 0 | ||||
-rw-r--r-- | source4/librpc/rpc/rpc_lsa.c (renamed from source4/libcli/rpc/rpc_lsa.c) | 19 |
20 files changed, 332 insertions, 244 deletions
diff --git a/source4/Makefile.in b/source4/Makefile.in index 1055c0ac6c..ee26dc58da 100644 --- a/source4/Makefile.in +++ b/source4/Makefile.in @@ -193,10 +193,11 @@ LIBCLIUTIL_OBJ = libcli/util/asn1.o \ libcli/util/doserr.o libcli/util/errormap.o \ libcli/util/pwd_cache.o libcli/util/clierror.o libcli/util/cliutil.o -LIBRAW_NDR_OBJ = libcli/ndr/ndr.o libcli/ndr/ndr_basic.o libcli/ndr/ndr_sec.o \ - libcli/ndr/ndr_echo.o libcli/ndr/ndr_misc.o libcli/ndr/ndr_lsa.o +LIBRAW_NDR_OBJ = librpc/ndr/ndr.o librpc/ndr/ndr_basic.o librpc/ndr/ndr_sec.o \ + librpc/ndr/ndr_echo.o librpc/ndr/ndr_misc.o librpc/ndr/ndr_lsa.o -LIBRAW_RPC_OBJ = libcli/rpc/dcerpc.o libcli/rpc/rpc_echo.o libcli/rpc/rpc_lsa.o +LIBRAW_RPC_OBJ = librpc/rpc/dcerpc.o librpc/rpc/rpc_echo.o librpc/rpc/rpc_lsa.o \ + librpc/rpc/dcerpc_smb.o LIBRAW_OBJ = libcli/raw/rawfile.o libcli/raw/smb_signing.o \ libcli/raw/clisocket.o libcli/raw/clitransport.o \ @@ -207,7 +208,7 @@ LIBRAW_OBJ = libcli/raw/rawfile.o libcli/raw/smb_signing.o \ libcli/raw/rawtrans.o libcli/raw/clioplock.o \ libcli/raw/rawnegotiate.o libcli/raw/rawfsinfo.o \ libcli/raw/rawfileinfo.o libcli/raw/rawnotify.o \ - libcli/raw/rawioctl.o libcli/raw/rawacl.o libcli/raw/rawdcerpc.o \ + libcli/raw/rawioctl.o libcli/raw/rawacl.o \ $(LIBRAW_NDR_OBJ) $(LIBRAW_RPC_OBJ) $(LIBSAMBA_OBJ) $(LIBCLIUTIL_OBJ) \ $(RPC_PARSE_OBJ1) $(LIBNTLMSSP_OBJ) $(LIBNMB_OBJ) $(KRBCLIENT_OBJ) @@ -729,6 +730,7 @@ MAKEDIR = || exec false; \ # 'make pch' is extremely useful for fast compiles if you have gcc-3.4 pch: + rm -f $(srcdir)/include/includes.h.gch $(CC) -I. -I$(srcdir) $(FLAGS) -c $(srcdir)/include/includes.h -o $(srcdir)/include/includes.h.gch diff --git a/source4/include/includes.h b/source4/include/includes.h index fb8719b2b6..e6a25a9b24 100644 --- a/source4/include/includes.h +++ b/source4/include/includes.h @@ -776,8 +776,8 @@ extern int errno; #include "mutex.h" -#include "libcli/ndr/libndr.h" -#include "libcli/rpc/dcerpc.h" +#include "librpc/ndr/libndr.h" +#include "librpc/rpc/dcerpc.h" /* * Type for wide character dirent structure. diff --git a/source4/libcli/ndr/ndr_lsa.c b/source4/libcli/ndr/ndr_lsa.c deleted file mode 100644 index dfe978f9d4..0000000000 --- a/source4/libcli/ndr/ndr_lsa.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - 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. -*/ - - -#include "includes.h" - -NTSTATUS ndr_push_lsa_QosInfo(struct ndr_push *ndr, - struct lsa_QosInfo *r) -{ - struct ndr_push_save length; - - NDR_CHECK(ndr_push_length4_start(ndr, &length)); - NDR_CHECK(ndr_push_u16(ndr, r->impersonation_level)); - NDR_CHECK(ndr_push_u8(ndr, r->context_mode)); - NDR_CHECK(ndr_push_u8(ndr, r->effective_only)); - NDR_CHECK(ndr_push_length4_end(ndr, &length)); - - return NT_STATUS_OK; -} - -NTSTATUS ndr_push_lsa_ObjectAttribute(struct ndr_push *ndr, - struct lsa_ObjectAttribute *r) -{ - struct ndr_push_save length; - - NDR_CHECK(ndr_push_length4_start(ndr, &length)); - NDR_CHECK(ndr_push_ptr(ndr, r->root_dir)); - NDR_CHECK(ndr_push_ptr(ndr, r->object_name)); - NDR_CHECK(ndr_push_u32(ndr, r->attributes)); - NDR_CHECK(ndr_push_ptr(ndr, r->sec_desc)); - NDR_CHECK(ndr_push_ptr(ndr, r->sec_qos)); - - if (r->root_dir) NDR_CHECK(ndr_push_u8(ndr, r->root_dir[0])); - if (r->object_name) NDR_CHECK(ndr_push_unistr(ndr, r->object_name)); - if (r->sec_desc) NDR_CHECK(ndr_push_security_descriptor(ndr, r->sec_desc)); - if (r->sec_qos) NDR_CHECK(ndr_push_lsa_QosInfo(ndr, r->sec_qos)); - - NDR_CHECK(ndr_push_length4_end(ndr, &length)); - - return NT_STATUS_OK; -} - -/* - push a openpolicy -*/ -NTSTATUS ndr_push_lsa_OpenPolicy(struct ndr_push *ndr, - struct lsa_OpenPolicy *r) -{ - NDR_CHECK(ndr_push_ptr(ndr, r->in.system_name)); - NDR_CHECK(ndr_push_u16(ndr, r->in.system_name[0])); - 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 openpolicy -*/ -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_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; -} - - -/* - push a EnumSids -*/ -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_u32(ndr, r->in.start_at)); - NDR_CHECK(ndr_push_u32(ndr, r->in.num_entries)); - return NT_STATUS_OK; -} - -/* - pull a EnumSids -*/ -NTSTATUS ndr_pull_lsa_EnumSids(struct ndr_pull *ndr, - struct lsa_EnumSids *r) -{ - uint32 nptrs, asize, i, ptr; - - NDR_CHECK(ndr_pull_u32(ndr, &r->out.num_entries)); - NDR_CHECK(ndr_pull_u32(ndr, &nptrs)); - NDR_CHECK(ndr_pull_u32(ndr, &ptr)); - if (!ptr) goto done; - - NDR_CHECK(ndr_pull_u32(ndr, &asize)); - NDR_ALLOC_N(ndr, r->out.sids, nptrs); - for (i=0;i<nptrs;i++) { - NDR_CHECK(ndr_pull_u32(ndr, &ptr)); - if (ptr) { - NDR_ALLOC(ndr, r->out.sids[i]); - } else { - r->out.sids[i] = NULL; - } - } - for (i=0;i<nptrs;i++) { - if (r->out.sids[i]) NDR_CHECK(ndr_pull_dom_sid2(ndr, r->out.sids[i])); - } - -done: - NDR_CHECK(ndr_pull_status(ndr, &r->out.status)); - return NT_STATUS_OK; -} diff --git a/source4/librpc/idl/lsa.idl b/source4/librpc/idl/lsa.idl new file mode 100644 index 0000000000..566b78f34d --- /dev/null +++ b/source4/librpc/idl/lsa.idl @@ -0,0 +1,48 @@ +/* + lsa interface definition +*/ + +[ uuid(12345778-1234-abcd-ef00-0123456789ab), + version(0.0), + pointer_default(unique) +] interface lsarpc +{ + + typedef struct { + [struct_len] uint32 _len; + uint16 impersonation_level; + uint8 context_mode; + uint8 effective_only; + } lsa_QosInfo; + + typedef struct { + [struct_len] uint32 _len; + uint8 *root_dir; + unistr *object_name; + uint32 attributes; + security_descriptor *sec_desc; + lsa_QosInfo *sec_qos; + } lsa_ObjectAttribute; + + NTSTATUS lsa_OpenPolicy ( + [in] uint16 *system_name, + [in] [ref] lsa_ObjectAttribute *attr, + [in] uint32 desired_access, + [out] policy_handle *handle + ); + + NTSTATUS lsa_OpenPolicy2 ( + [in] unistr *system_name, + [in] [ref] lsa_ObjectAttribute *attr, + [in] uint32 desired_access, + [out] [ref] policy_handle *handle + ); + + NTSTATUS lsa_EnumSids( + [in] [ref] policy_handle *handle, + [in] uint32 start_at, + [in] [out] [ref] uint32 *num_entries, + [out] dom_sid **sids + ); + +} diff --git a/source4/libcli/ndr/libndr.h b/source4/librpc/ndr/libndr.h index 7bd92b4cd1..0d28783a6d 100644 --- a/source4/libcli/ndr/libndr.h +++ b/source4/librpc/ndr/libndr.h @@ -89,7 +89,7 @@ typedef NTSTATUS (*ndr_push_fn_t)(struct ndr_push *, void *); typedef NTSTATUS (*ndr_pull_fn_t)(struct ndr_pull *, void *); /* now pull in the individual parsers */ -#include "libcli/ndr/ndr_sec.h" -#include "libcli/ndr/ndr_misc.h" -#include "libcli/ndr/ndr_echo.h" -#include "libcli/ndr/ndr_lsa.h" +#include "librpc/ndr/ndr_sec.h" +#include "librpc/ndr/ndr_misc.h" +#include "librpc/ndr/ndr_echo.h" +#include "librpc/ndr/ndr_lsa.h" diff --git a/source4/libcli/ndr/ndr.c b/source4/librpc/ndr/ndr.c index 4e5f199835..4e5f199835 100644 --- a/source4/libcli/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c diff --git a/source4/libcli/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c index 394d1e2eb1..3bd75e7c0d 100644 --- a/source4/libcli/ndr/ndr_basic.c +++ b/source4/librpc/ndr/ndr_basic.c @@ -36,9 +36,9 @@ } while(0) /* - parse a u8 + parse a uint8 */ -NTSTATUS ndr_pull_u8(struct ndr_pull *ndr, uint8 *v) +NTSTATUS ndr_pull_uint8(struct ndr_pull *ndr, uint8 *v) { NDR_PULL_NEED_BYTES(ndr, 1); *v = CVAL(ndr->data, ndr->offset); @@ -48,9 +48,9 @@ NTSTATUS ndr_pull_u8(struct ndr_pull *ndr, uint8 *v) /* - parse a u16 + parse a uint16 */ -NTSTATUS ndr_pull_u16(struct ndr_pull *ndr, uint16 *v) +NTSTATUS ndr_pull_uint16(struct ndr_pull *ndr, uint16 *v) { NDR_PULL_ALIGN(ndr, 2); NDR_PULL_NEED_BYTES(ndr, 2); @@ -65,9 +65,9 @@ NTSTATUS ndr_pull_u16(struct ndr_pull *ndr, uint16 *v) /* - parse a u32 + parse a uint32 */ -NTSTATUS ndr_pull_u32(struct ndr_pull *ndr, uint32 *v) +NTSTATUS ndr_pull_uint32(struct ndr_pull *ndr, uint32 *v) { NDR_PULL_ALIGN(ndr, 4); NDR_PULL_NEED_BYTES(ndr, 4); @@ -86,7 +86,7 @@ NTSTATUS ndr_pull_u32(struct ndr_pull *ndr, uint32 *v) NTSTATUS ndr_pull_status(struct ndr_pull *ndr, NTSTATUS *status) { uint32 v; - NDR_CHECK(ndr_pull_u32(ndr, &v)); + NDR_CHECK(ndr_pull_uint32(ndr, &v)); *status = NT_STATUS(v); return NT_STATUS_OK; } @@ -121,13 +121,13 @@ NTSTATUS ndr_pull_guid(struct ndr_pull *ndr, GUID *guid) #define NDR_PUSH_ALIGN(ndr, n) do { \ uint32 _pad = (ndr->offset & (n-1)); \ - while (_pad--) NDR_CHECK(ndr_push_u8(ndr, 0)); \ + while (_pad--) NDR_CHECK(ndr_push_uint8(ndr, 0)); \ } while(0) /* - push a u8 + push a uint8 */ -NTSTATUS ndr_push_u8(struct ndr_push *ndr, uint8 v) +NTSTATUS ndr_push_uint8(struct ndr_push *ndr, uint8 v) { NDR_PUSH_NEED_BYTES(ndr, 1); SCVAL(ndr->data, ndr->offset, v); @@ -136,9 +136,9 @@ NTSTATUS ndr_push_u8(struct ndr_push *ndr, uint8 v) } /* - push a u16 + push a uint16 */ -NTSTATUS ndr_push_u16(struct ndr_push *ndr, uint16 v) +NTSTATUS ndr_push_uint16(struct ndr_push *ndr, uint16 v) { NDR_PUSH_ALIGN(ndr, 2); NDR_PUSH_NEED_BYTES(ndr, 2); @@ -148,9 +148,9 @@ NTSTATUS ndr_push_u16(struct ndr_push *ndr, uint16 v) } /* - push a u32 + push a uint32 */ -NTSTATUS ndr_push_u32(struct ndr_push *ndr, uint32 v) +NTSTATUS ndr_push_uint32(struct ndr_push *ndr, uint32 v) { NDR_PUSH_ALIGN(ndr, 4); NDR_PUSH_NEED_BYTES(ndr, 4); @@ -160,6 +160,15 @@ NTSTATUS ndr_push_u32(struct ndr_push *ndr, uint32 v) } /* + align to a uint32 +*/ +NTSTATUS ndr_push_align_uint32(struct ndr_push *ndr) +{ + NDR_PUSH_ALIGN(ndr, 4); + return NT_STATUS_OK; +} + +/* push some bytes */ NTSTATUS ndr_push_bytes(struct ndr_push *ndr, const char *data, uint32 n) @@ -194,7 +203,7 @@ NTSTATUS ndr_push_length4_start(struct ndr_push *ndr, struct ndr_push_save *save { NDR_PUSH_ALIGN(ndr, 4); ndr_push_save(ndr, save); - return ndr_push_u32(ndr, 0); + return ndr_push_uint32(ndr, 0); } NTSTATUS ndr_push_length4_end(struct ndr_push *ndr, struct ndr_push_save *save) @@ -202,7 +211,7 @@ NTSTATUS ndr_push_length4_end(struct ndr_push *ndr, struct ndr_push_save *save) struct ndr_push_save save2; ndr_push_save(ndr, &save2); ndr_push_restore(ndr, save); - NDR_CHECK(ndr_push_u32(ndr, save2.offset - ndr->offset)); + NDR_CHECK(ndr_push_uint32(ndr, save2.offset - ndr->offset)); ndr_push_restore(ndr, &save2); return NT_STATUS_OK; } @@ -212,7 +221,7 @@ NTSTATUS ndr_push_length4_end(struct ndr_push *ndr, struct ndr_push_save *save) */ NTSTATUS ndr_push_ptr(struct ndr_push *ndr, const void *p) { - return ndr_push_u32(ndr, p?1:0); + return ndr_push_uint32(ndr, p?1:0); } /* @@ -226,9 +235,9 @@ NTSTATUS ndr_push_unistr(struct ndr_push *ndr, const char *s) if (len == -1) { return NT_STATUS_INVALID_PARAMETER; } - NDR_CHECK(ndr_push_u32(ndr, len/2)); - NDR_CHECK(ndr_push_u32(ndr, 0)); - NDR_CHECK(ndr_push_u32(ndr, len/2)); + NDR_CHECK(ndr_push_uint32(ndr, len/2)); + NDR_CHECK(ndr_push_uint32(ndr, 0)); + NDR_CHECK(ndr_push_uint32(ndr, len/2)); NDR_CHECK(ndr_push_bytes(ndr, ws, len)); return NT_STATUS_OK; } @@ -241,7 +250,7 @@ NTSTATUS ndr_push_offset(struct ndr_push *ndr, struct ndr_push_save *ofs) { NDR_PUSH_ALIGN(ndr, 4); ndr_push_save(ndr, ofs); - return ndr_push_u32(ndr, 0); + return ndr_push_uint32(ndr, 0); } /* @@ -255,7 +264,7 @@ NTSTATUS ndr_push_offset_ptr(struct ndr_push *ndr, struct ndr_push_save save2; ndr_push_save(ndr, &save2); ndr_push_restore(ndr, ofs); - NDR_CHECK(ndr_push_u32(ndr, save2.offset - save->offset)); + NDR_CHECK(ndr_push_uint32(ndr, save2.offset - save->offset)); ndr_push_restore(ndr, &save2); return NT_STATUS_OK; } diff --git a/source4/libcli/ndr/ndr_echo.c b/source4/librpc/ndr/ndr_echo.c index c60569676c..e2bb062d2e 100644 --- a/source4/libcli/ndr/ndr_echo.c +++ b/source4/librpc/ndr/ndr_echo.c @@ -30,7 +30,7 @@ NTSTATUS ndr_pull_rpcecho_addone(struct ndr_pull *ndr, struct rpcecho_addone *r) { - NDR_CHECK(ndr_pull_u32(ndr, &r->out.data)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->out.data)); return NT_STATUS_OK; } @@ -41,7 +41,7 @@ NTSTATUS ndr_pull_rpcecho_addone(struct ndr_pull *ndr, NTSTATUS ndr_push_rpcecho_addone(struct ndr_push *ndr, struct rpcecho_addone *r) { - NDR_CHECK(ndr_push_u32(ndr, r->in.data)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.data)); return NT_STATUS_OK; } @@ -52,7 +52,7 @@ NTSTATUS ndr_push_rpcecho_addone(struct ndr_push *ndr, NTSTATUS ndr_pull_rpcecho_echodata(struct ndr_pull *ndr, struct rpcecho_echodata *r) { - NDR_CHECK(ndr_pull_u32(ndr, &r->out.len)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->out.len)); NDR_ALLOC_N(ndr, r->out.data, r->out.len); NDR_CHECK(ndr_pull_bytes(ndr, r->out.data, r->out.len)); return NT_STATUS_OK; @@ -64,8 +64,8 @@ NTSTATUS ndr_pull_rpcecho_echodata(struct ndr_pull *ndr, NTSTATUS ndr_push_rpcecho_echodata(struct ndr_push *ndr, struct rpcecho_echodata *r) { - NDR_CHECK(ndr_push_u32(ndr, r->in.len)); - NDR_CHECK(ndr_push_u32(ndr, r->in.len)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.len)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.len)); NDR_CHECK(ndr_push_bytes(ndr, r->in.data, r->in.len)); return NT_STATUS_OK; } @@ -85,8 +85,8 @@ NTSTATUS ndr_pull_rpcecho_sinkdata(struct ndr_pull *ndr, NTSTATUS ndr_push_rpcecho_sinkdata(struct ndr_push *ndr, struct rpcecho_sinkdata *r) { - NDR_CHECK(ndr_push_u32(ndr, r->in.len)); - NDR_CHECK(ndr_push_u32(ndr, r->in.len)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.len)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.len)); NDR_CHECK(ndr_push_bytes(ndr, r->in.data, r->in.len)); return NT_STATUS_OK; } @@ -97,7 +97,7 @@ NTSTATUS ndr_push_rpcecho_sinkdata(struct ndr_push *ndr, NTSTATUS ndr_pull_rpcecho_sourcedata(struct ndr_pull *ndr, struct rpcecho_sourcedata *r) { - NDR_CHECK(ndr_pull_u32(ndr, &r->out.len)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->out.len)); NDR_ALLOC_N(ndr, r->out.data, r->out.len); NDR_CHECK(ndr_pull_bytes(ndr, r->out.data, r->out.len)); return NT_STATUS_OK; @@ -109,6 +109,6 @@ NTSTATUS ndr_pull_rpcecho_sourcedata(struct ndr_pull *ndr, NTSTATUS ndr_push_rpcecho_sourcedata(struct ndr_push *ndr, struct rpcecho_sourcedata *r) { - NDR_CHECK(ndr_push_u32(ndr, r->in.len)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.len)); return NT_STATUS_OK; } diff --git a/source4/libcli/ndr/ndr_echo.h b/source4/librpc/ndr/ndr_echo.h index aecf68c4c0..aecf68c4c0 100644 --- a/source4/libcli/ndr/ndr_echo.h +++ b/source4/librpc/ndr/ndr_echo.h diff --git a/source4/librpc/ndr/ndr_lsa.c b/source4/librpc/ndr/ndr_lsa.c new file mode 100644 index 0000000000..bde450687e --- /dev/null +++ b/source4/librpc/ndr/ndr_lsa.c @@ -0,0 +1,167 @@ +/* + 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. +*/ + + +#include "includes.h" + +/* + 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; +} + + +/* + pull a EnumSids +*/ +NTSTATUS ndr_pull_lsa_EnumSids(struct ndr_pull *ndr, + struct lsa_EnumSids *r) +{ + uint32 nptrs, asize, i, ptr; + + NDR_CHECK(ndr_pull_uint32(ndr, &r->out.num_entries)); + NDR_CHECK(ndr_pull_uint32(ndr, &nptrs)); + NDR_CHECK(ndr_pull_uint32(ndr, &ptr)); + if (!ptr) goto done; + + NDR_CHECK(ndr_pull_uint32(ndr, &asize)); + NDR_ALLOC_N(ndr, r->out.sids, nptrs); + for (i=0;i<nptrs;i++) { + NDR_CHECK(ndr_pull_uint32(ndr, &ptr)); + if (ptr) { + NDR_ALLOC(ndr, r->out.sids[i]); + } else { + r->out.sids[i] = NULL; + } + } + for (i=0;i<nptrs;i++) { + if (r->out.sids[i]) NDR_CHECK(ndr_pull_dom_sid2(ndr, r->out.sids[i])); + } + +done: + NDR_CHECK(ndr_pull_status(ndr, &r->out.result)); + return NT_STATUS_OK; +} + + +/* parser auto-generated by pidl */ + +static NTSTATUS ndr_push_lsa_QosInfo(struct ndr_push *ndr, struct lsa_QosInfo *r) +{ + struct ndr_push_save len_save1, len_save2, len_save3; + ndr_push_save(ndr, &len_save1); + NDR_CHECK(ndr_push_align_uint32(ndr)); + ndr_push_save(ndr, &len_save2); + NDR_CHECK(ndr_push_uint32(ndr, 0)); + NDR_CHECK(ndr_push_uint16(ndr, r->impersonation_level)); + NDR_CHECK(ndr_push_uint8(ndr, r->context_mode)); + NDR_CHECK(ndr_push_uint8(ndr, r->effective_only)); + ndr_push_save(ndr, &len_save3); + ndr_push_restore(ndr, &len_save2); + NDR_CHECK(ndr_push_uint32(ndr, len_save3.offset - len_save1.offset)); + ndr_push_restore(ndr, &len_save3); + return NT_STATUS_OK; +} + +static NTSTATUS ndr_push_lsa_ObjectAttribute(struct ndr_push *ndr, struct lsa_ObjectAttribute *r) +{ + struct ndr_push_save len_save1, len_save2, len_save3; + ndr_push_save(ndr, &len_save1); + NDR_CHECK(ndr_push_align_uint32(ndr)); + ndr_push_save(ndr, &len_save2); + NDR_CHECK(ndr_push_uint32(ndr, 0)); + NDR_CHECK(ndr_push_ptr(ndr, r->root_dir)); + NDR_CHECK(ndr_push_ptr(ndr, r->object_name)); + NDR_CHECK(ndr_push_uint32(ndr, r->attributes)); + NDR_CHECK(ndr_push_ptr(ndr, r->sec_desc)); + NDR_CHECK(ndr_push_ptr(ndr, r->sec_qos)); + if (r->root_dir) { + NDR_CHECK(ndr_push_uint8(ndr, *r->root_dir)); + } + if (r->object_name) { + NDR_CHECK(ndr_push_unistr(ndr, r->object_name)); + } + if (r->sec_desc) { + NDR_CHECK(ndr_push_security_descriptor(ndr, r->sec_desc)); + } + if (r->sec_qos) { + NDR_CHECK(ndr_push_lsa_QosInfo(ndr, r->sec_qos)); + } + ndr_push_save(ndr, &len_save3); + ndr_push_restore(ndr, &len_save2); + NDR_CHECK(ndr_push_uint32(ndr, len_save3.offset - len_save1.offset)); + ndr_push_restore(ndr, &len_save3); + return NT_STATUS_OK; +} + +NTSTATUS ndr_push_lsa_OpenPolicy(struct ndr_push *ndr, struct lsa_OpenPolicy *r) +{ + NDR_CHECK(ndr_push_ptr(ndr, r->in.system_name)); + if (r->in.system_name) { + NDR_CHECK(ndr_push_uint16(ndr, *r->in.system_name)); + } + NDR_CHECK(ndr_push_lsa_ObjectAttribute(ndr, r->in.attr)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.desired_access)); + + 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)); + if (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_uint32(ndr, r->in.desired_access)); + + return NT_STATUS_OK; +} + +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.start_at)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.num_entries)); + + return NT_STATUS_OK; +} + + diff --git a/source4/libcli/ndr/ndr_lsa.h b/source4/librpc/ndr/ndr_lsa.h index 0cc43b5f86..402227a8bf 100644 --- a/source4/libcli/ndr/ndr_lsa.h +++ b/source4/librpc/ndr/ndr_lsa.h @@ -20,14 +20,16 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +/* header auto-generated by pidl */ + struct lsa_QosInfo { uint16 impersonation_level; - uint8 context_mode; - uint8 effective_only; + uint8 context_mode; + uint8 effective_only; }; struct lsa_ObjectAttribute { - const char *root_dir; + uint8 *root_dir; const char *object_name; uint32 attributes; struct security_descriptor *sec_desc; @@ -36,14 +38,16 @@ struct lsa_ObjectAttribute { struct lsa_OpenPolicy { struct { - const char *system_name; + uint16 *system_name; struct lsa_ObjectAttribute *attr; uint32 desired_access; } in; + struct { - struct policy_handle handle; - NTSTATUS status; + struct policy_handle *handle; + NTSTATUS result; } out; + }; struct lsa_OpenPolicy2 { @@ -52,10 +56,12 @@ struct lsa_OpenPolicy2 { struct lsa_ObjectAttribute *attr; uint32 desired_access; } in; + struct { - struct policy_handle handle; - NTSTATUS status; + struct policy_handle *handle; + NTSTATUS result; } out; + }; struct lsa_EnumSids { @@ -64,9 +70,13 @@ struct lsa_EnumSids { uint32 start_at; uint32 num_entries; } in; + struct { uint32 num_entries; struct dom_sid **sids; - NTSTATUS status; + NTSTATUS result; } out; + }; + + diff --git a/source4/libcli/ndr/ndr_misc.c b/source4/librpc/ndr/ndr_misc.c index cdd6652068..cdd6652068 100644 --- a/source4/libcli/ndr/ndr_misc.c +++ b/source4/librpc/ndr/ndr_misc.c diff --git a/source4/libcli/ndr/ndr_misc.h b/source4/librpc/ndr/ndr_misc.h index cc3576b3e8..cc3576b3e8 100644 --- a/source4/libcli/ndr/ndr_misc.h +++ b/source4/librpc/ndr/ndr_misc.h diff --git a/source4/libcli/ndr/ndr_sec.c b/source4/librpc/ndr/ndr_sec.c index 9ac5240b0f..31cf823e0d 100644 --- a/source4/libcli/ndr/ndr_sec.c +++ b/source4/librpc/ndr/ndr_sec.c @@ -34,16 +34,16 @@ NTSTATUS ndr_pull_security_ace(struct ndr_pull *ndr, struct security_ace *ace) ndr_pull_save(ndr, &save); - NDR_CHECK(ndr_pull_u8(ndr, &ace->type)); - NDR_CHECK(ndr_pull_u8(ndr, &ace->flags)); - NDR_CHECK(ndr_pull_u16(ndr, &size)); + NDR_CHECK(ndr_pull_uint8(ndr, &ace->type)); + NDR_CHECK(ndr_pull_uint8(ndr, &ace->flags)); + NDR_CHECK(ndr_pull_uint16(ndr, &size)); NDR_CHECK(ndr_pull_limit_size(ndr, size, 4)); - NDR_CHECK(ndr_pull_u32(ndr, &ace->access_mask)); + NDR_CHECK(ndr_pull_uint32(ndr, &ace->access_mask)); if (sec_ace_object(ace->type)) { NDR_ALLOC(ndr, ace->obj); - NDR_CHECK(ndr_pull_u32(ndr, &ace->obj->flags)); + NDR_CHECK(ndr_pull_uint32(ndr, &ace->obj->flags)); if (ace->obj->flags & SEC_ACE_OBJECT_PRESENT) { NDR_CHECK(ndr_pull_guid(ndr, &ace->obj->object_guid)); } @@ -72,10 +72,10 @@ NTSTATUS ndr_pull_security_acl(struct ndr_pull *ndr, struct security_acl *acl) ndr_pull_save(ndr, &save); - NDR_CHECK(ndr_pull_u16(ndr, &acl->revision)); - NDR_CHECK(ndr_pull_u16(ndr, &size)); + NDR_CHECK(ndr_pull_uint16(ndr, &acl->revision)); + NDR_CHECK(ndr_pull_uint16(ndr, &size)); NDR_CHECK(ndr_pull_limit_size(ndr, size, 4)); - NDR_CHECK(ndr_pull_u32(ndr, &acl->num_aces)); + NDR_CHECK(ndr_pull_uint32(ndr, &acl->num_aces)); NDR_ALLOC_N(ndr, acl->aces, acl->num_aces); @@ -97,7 +97,7 @@ NTSTATUS ndr_pull_security_acl_ofs(struct ndr_pull *ndr, struct security_acl **a uint32 ofs; struct ndr_pull_save save; - NDR_CHECK(ndr_pull_u32(ndr, &ofs)); + NDR_CHECK(ndr_pull_uint32(ndr, &ofs)); if (ofs == 0) { /* it is valid for an acl ptr to be NULL */ *acl = NULL; @@ -121,16 +121,16 @@ NTSTATUS ndr_pull_dom_sid(struct ndr_pull *ndr, struct dom_sid *sid) { int i; - NDR_CHECK(ndr_pull_u8(ndr, &sid->sid_rev_num)); - NDR_CHECK(ndr_pull_u8(ndr, &sid->num_auths)); + NDR_CHECK(ndr_pull_uint8(ndr, &sid->sid_rev_num)); + NDR_CHECK(ndr_pull_uint8(ndr, &sid->num_auths)); for (i=0;i<6;i++) { - NDR_CHECK(ndr_pull_u8(ndr, &sid->id_auth[i])); + NDR_CHECK(ndr_pull_uint8(ndr, &sid->id_auth[i])); } NDR_ALLOC_N(ndr, sid->sub_auths, sid->num_auths); for (i=0;i<sid->num_auths;i++) { - NDR_CHECK(ndr_pull_u32(ndr, &sid->sub_auths[i])); + NDR_CHECK(ndr_pull_uint32(ndr, &sid->sub_auths[i])); } return NT_STATUS_OK; @@ -142,7 +142,7 @@ NTSTATUS ndr_pull_dom_sid(struct ndr_pull *ndr, struct dom_sid *sid) NTSTATUS ndr_pull_dom_sid2(struct ndr_pull *ndr, struct dom_sid *sid) { uint32 num_auths; - NDR_CHECK(ndr_pull_u32(ndr, &num_auths)); + NDR_CHECK(ndr_pull_uint32(ndr, &num_auths)); return ndr_pull_dom_sid(ndr, sid); } @@ -154,7 +154,7 @@ NTSTATUS ndr_pull_dom_sid_ofs(struct ndr_pull *ndr, struct dom_sid **sid) uint32 ofs; struct ndr_pull_save save; - NDR_CHECK(ndr_pull_u32(ndr, &ofs)); + NDR_CHECK(ndr_pull_uint32(ndr, &ofs)); if (ofs == 0) { /* it is valid for a dom_sid ptr to be NULL */ *sid = NULL; @@ -178,8 +178,8 @@ NTSTATUS ndr_pull_security_descriptor(struct ndr_pull *ndr, { NDR_ALLOC(ndr, *sd); - NDR_CHECK(ndr_pull_u8(ndr, &(*sd)->revision)); - NDR_CHECK(ndr_pull_u16(ndr, &(*sd)->type)); + NDR_CHECK(ndr_pull_uint8(ndr, &(*sd)->revision)); + NDR_CHECK(ndr_pull_uint16(ndr, &(*sd)->type)); NDR_CHECK(ndr_pull_dom_sid_ofs(ndr, &(*sd)->owner_sid)); NDR_CHECK(ndr_pull_dom_sid_ofs(ndr, &(*sd)->group_sid)); NDR_CHECK(ndr_pull_security_acl_ofs(ndr, &(*sd)->sacl)); @@ -196,14 +196,14 @@ NTSTATUS ndr_push_security_ace(struct ndr_push *ndr, struct security_ace *ace) { struct ndr_push_save save1, save2; - NDR_CHECK(ndr_push_u8(ndr, ace->type)); - NDR_CHECK(ndr_push_u8(ndr, ace->flags)); + NDR_CHECK(ndr_push_uint8(ndr, ace->type)); + NDR_CHECK(ndr_push_uint8(ndr, ace->flags)); ndr_push_save(ndr, &save1); - NDR_CHECK(ndr_push_u16(ndr, 0)); - NDR_CHECK(ndr_push_u32(ndr, ace->access_mask)); + NDR_CHECK(ndr_push_uint16(ndr, 0)); + NDR_CHECK(ndr_push_uint32(ndr, ace->access_mask)); if (sec_ace_object(ace->type)) { - NDR_CHECK(ndr_push_u32(ndr, ace->obj->flags)); + NDR_CHECK(ndr_push_uint32(ndr, ace->obj->flags)); if (ace->obj->flags & SEC_ACE_OBJECT_PRESENT) { NDR_CHECK(ndr_push_guid(ndr, &ace->obj->object_guid)); } @@ -216,7 +216,7 @@ NTSTATUS ndr_push_security_ace(struct ndr_push *ndr, struct security_ace *ace) ndr_push_save(ndr, &save2); ndr_push_restore(ndr, &save1); - NDR_CHECK(ndr_push_u16(ndr, 2 + save2.offset - save1.offset)); + NDR_CHECK(ndr_push_uint16(ndr, 2 + save2.offset - save1.offset)); ndr_push_restore(ndr, &save2); return NT_STATUS_OK; @@ -231,16 +231,16 @@ NTSTATUS ndr_push_security_acl(struct ndr_push *ndr, struct security_acl *acl) int i; struct ndr_push_save save1, save2; - NDR_CHECK(ndr_push_u16(ndr, acl->revision)); + NDR_CHECK(ndr_push_uint16(ndr, acl->revision)); ndr_push_save(ndr, &save1); - NDR_CHECK(ndr_push_u16(ndr, 0)); - NDR_CHECK(ndr_push_u32(ndr, acl->num_aces)); + NDR_CHECK(ndr_push_uint16(ndr, 0)); + NDR_CHECK(ndr_push_uint32(ndr, acl->num_aces)); for (i=0;i<acl->num_aces;i++) { NDR_CHECK(ndr_push_security_ace(ndr, &acl->aces[i])); } ndr_push_save(ndr, &save2); ndr_push_restore(ndr, &save1); - NDR_CHECK(ndr_push_u16(ndr, 2 + save2.offset - save1.offset)); + NDR_CHECK(ndr_push_uint16(ndr, 2 + save2.offset - save1.offset)); ndr_push_restore(ndr, &save2); return NT_STATUS_OK; @@ -253,13 +253,13 @@ NTSTATUS ndr_push_dom_sid(struct ndr_push *ndr, struct dom_sid *sid) { int i; - NDR_CHECK(ndr_push_u8(ndr, sid->sid_rev_num)); - NDR_CHECK(ndr_push_u8(ndr, sid->num_auths)); + NDR_CHECK(ndr_push_uint8(ndr, sid->sid_rev_num)); + NDR_CHECK(ndr_push_uint8(ndr, sid->num_auths)); for (i=0;i<6;i++) { - NDR_CHECK(ndr_push_u8(ndr, sid->id_auth[i])); + NDR_CHECK(ndr_push_uint8(ndr, sid->id_auth[i])); } for (i=0;i<sid->num_auths;i++) { - NDR_CHECK(ndr_push_u32(ndr, sid->sub_auths[i])); + NDR_CHECK(ndr_push_uint32(ndr, sid->sub_auths[i])); } return NT_STATUS_OK; @@ -277,8 +277,8 @@ NTSTATUS ndr_push_security_descriptor(struct ndr_push *ndr, ndr_push_save(ndr, &save); - NDR_CHECK(ndr_push_u8(ndr, sd->revision)); - NDR_CHECK(ndr_push_u16(ndr, sd->type)); + NDR_CHECK(ndr_push_uint8(ndr, sd->revision)); + NDR_CHECK(ndr_push_uint16(ndr, sd->type)); NDR_CHECK(ndr_push_offset(ndr, &ofs1)); NDR_CHECK(ndr_push_offset(ndr, &ofs2)); diff --git a/source4/libcli/ndr/ndr_sec.h b/source4/librpc/ndr/ndr_sec.h index 0c9d542006..0c9d542006 100644 --- a/source4/libcli/ndr/ndr_sec.h +++ b/source4/librpc/ndr/ndr_sec.h diff --git a/source4/libcli/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index 9e6c05e7ae..9e6c05e7ae 100644 --- a/source4/libcli/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c diff --git a/source4/libcli/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h index 09ddc3625c..09ddc3625c 100644 --- a/source4/libcli/rpc/dcerpc.h +++ b/source4/librpc/rpc/dcerpc.h diff --git a/source4/libcli/raw/rawdcerpc.c b/source4/librpc/rpc/dcerpc_smb.c index 0541200015..0541200015 100644 --- a/source4/libcli/raw/rawdcerpc.c +++ b/source4/librpc/rpc/dcerpc_smb.c diff --git a/source4/libcli/rpc/rpc_echo.c b/source4/librpc/rpc/rpc_echo.c index d73f9bda9c..d73f9bda9c 100644 --- a/source4/libcli/rpc/rpc_echo.c +++ b/source4/librpc/rpc/rpc_echo.c diff --git a/source4/libcli/rpc/rpc_lsa.c b/source4/librpc/rpc/rpc_lsa.c index 65d6a81491..2aa3f78730 100644 --- a/source4/libcli/rpc/rpc_lsa.c +++ b/source4/librpc/rpc/rpc_lsa.c @@ -22,6 +22,11 @@ #include "includes.h" + +NTSTATUS ndr_push_lsa_OpenPolicy(struct ndr_push *ndr, struct lsa_OpenPolicy *r); +NTSTATUS ndr_push_lsa_OpenPolicy2(struct ndr_push *ndr, struct lsa_OpenPolicy2 *r); +NTSTATUS ndr_push_lsa_EnumSids(struct ndr_push *ndr, struct lsa_EnumSids *r); + /* OpenPolicy interface */ @@ -34,6 +39,7 @@ NTSTATUS dcerpc_lsa_OpenPolicy(struct dcerpc_pipe *p, struct lsa_OpenPolicy r; NTSTATUS status; TALLOC_CTX *mem_ctx; + uint16 s; mem_ctx = talloc_init("dcerpc_lsa_openpolicy"); if (!mem_ctx) { @@ -41,7 +47,8 @@ NTSTATUS dcerpc_lsa_OpenPolicy(struct dcerpc_pipe *p, } /* fill the .in side of the call */ - r.in.system_name = server; + s = server[0]; + r.in.system_name = &s; r.in.attr = attr; r.in.desired_access = access_mask; @@ -55,8 +62,8 @@ NTSTATUS dcerpc_lsa_OpenPolicy(struct dcerpc_pipe *p, } /* and extract the .out parameters */ - *handle = r.out.handle; - status = r.out.status; + *handle = *r.out.handle; + status = r.out.result; done: talloc_destroy(mem_ctx); @@ -97,8 +104,8 @@ NTSTATUS dcerpc_lsa_OpenPolicy2(struct dcerpc_pipe *p, } /* and extract the .out parameters */ - *handle = r.out.handle; - status = r.out.status; + *handle = *r.out.handle; + status = r.out.result; done: talloc_destroy(mem_ctx); @@ -135,7 +142,7 @@ NTSTATUS dcerpc_lsa_EnumSids(struct dcerpc_pipe *p, /* and extract the .out parameters */ *num_entries = r.out.num_entries; *sids = r.out.sids; - status = r.out.status; + status = r.out.result; done: return status; |