diff options
author | Tim Potter <tpot@samba.org> | 2004-04-03 01:25:40 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2004-04-03 01:25:40 +0000 |
commit | f1c3fa060efcecde404d0bfb55c359ef7fe36ed8 (patch) | |
tree | 7b4cd54be3ed694a835c6ada2fa55570413267af /source4/librpc | |
parent | 4c12490730de84d63bf654f97cbc17ffcb1d25f5 (diff) | |
download | samba-f1c3fa060efcecde404d0bfb55c359ef7fe36ed8.tar.gz samba-f1c3fa060efcecde404d0bfb55c359ef7fe36ed8.tar.bz2 samba-f1c3fa060efcecde404d0bfb55c359ef7fe36ed8.zip |
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)
Diffstat (limited to 'source4/librpc')
-rw-r--r-- | source4/librpc/config.m4 | 8 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_lsa.c | 79 |
2 files changed, 86 insertions, 1 deletions
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); +} + |