From f1c3fa060efcecde404d0bfb55c359ef7fe36ed8 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sat, 3 Apr 2004 01:25:40 +0000 Subject: This is the start of a C API to the DCERPC client routines. Currently the only way to access this is to cut&paste from torture/rpc/*.c (This used to be commit 3355fec421f82034f433a4b59aa5ad589b070577) --- source4/Makefile.in | 1 + source4/librpc/config.m4 | 8 ++++- source4/librpc/rpc/dcerpc_lsa.c | 79 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 source4/librpc/rpc/dcerpc_lsa.c (limited to 'source4') diff --git a/source4/Makefile.in b/source4/Makefile.in index f095007c99..31e752165d 100644 --- a/source4/Makefile.in +++ b/source4/Makefile.in @@ -106,6 +106,7 @@ LIBCLI_OBJS = @LIBCLI_OBJS@ LIBNDR_RAW_OBJS = @LIBNDR_RAW_OBJS@ LIBRPC_RAW_OBJS = @LIBRPC_RAW_OBJS@ LIBRPC_OBJS = @LIBRPC_OBJS@ +LIBRPC_CLIENT_OBJS = @LIBRPC_CLIENT_OBJS@ LIBSMB_OBJS = @LIBSMB_OBJS@ LIBSMB_LIBS = @LIBSMB_LIBS@ diff --git a/source4/librpc/config.m4 b/source4/librpc/config.m4 index 3674cf98c7..a4e5fa27fa 100644 --- a/source4/librpc/config.m4 +++ b/source4/librpc/config.m4 @@ -25,6 +25,12 @@ SMB_SUBSYSTEM(LIBRPC_RAW,[], librpc/rpc/dcerpc_smb.o librpc/rpc/dcerpc_tcp.o], librpc/rpc/librpc_raw_public_proto.h) +SMB_SUBSYSTEM(LIBRPC_CLIENT,[], + [librpc/rpc/dcerpc_lsa.o], + librpc/rpc/librpc/client/public_proto.h) + SMB_SUBSYSTEM(LIBRPC,[], - [\$(LIBNDR_RAW_OBJS) \$(LIBRPC_RAW_OBJS)], + [\$(LIBNDR_RAW_OBJS) \$(LIBRPC_RAW_OBJS) \ + \$(LIBRPC_CLIENT_OBJS)], librpc/librpc_public_proto.h) + diff --git a/source4/librpc/rpc/dcerpc_lsa.c b/source4/librpc/rpc/dcerpc_lsa.c new file mode 100644 index 0000000000..482853c0ab --- /dev/null +++ b/source4/librpc/rpc/dcerpc_lsa.c @@ -0,0 +1,79 @@ +/* + Unix SMB/CIFS implementation. + raw dcerpc operations + + Copyright (C) Tim Potter 2004 + + 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 lsa_OpenPolicy(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct policy_handle *handle) +{ + struct lsa_ObjectAttribute attr; + struct lsa_QosInfo qos; + struct lsa_OpenPolicy r; + NTSTATUS status; + uint16 system_name = '\\'; + + qos.len = 0; + qos.impersonation_level = 2; + qos.context_mode = 1; + qos.effective_only = 0; + + attr.len = 0; + attr.root_dir = NULL; + attr.object_name = NULL; + attr.attributes = 0; + attr.sec_desc = NULL; + attr.sec_qos = &qos; + + r.in.system_name = &system_name; + r.in.attr = &attr; + r.in.desired_access = SEC_RIGHTS_MAXIMUM_ALLOWED; + r.out.handle = handle; + + return dcerpc_lsa_OpenPolicy(p, mem_ctx, &r); +} + +NTSTATUS lsa_OpenPolicy2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct policy_handle *handle) +{ + struct lsa_ObjectAttribute attr; + struct lsa_QosInfo qos; + struct lsa_OpenPolicy2 r; + + qos.len = 0; + qos.impersonation_level = 2; + qos.context_mode = 1; + qos.effective_only = 0; + + attr.len = 0; + attr.root_dir = NULL; + attr.object_name = NULL; + attr.attributes = 0; + attr.sec_desc = NULL; + attr.sec_qos = &qos; + + r.in.system_name = "\\"; + r.in.attr = &attr; + r.in.desired_access = SEC_RIGHTS_MAXIMUM_ALLOWED; + r.out.handle = handle; + + return dcerpc_lsa_OpenPolicy2(p, mem_ctx, &r); +} + -- cgit