From 20730626af0b1aee6149fb7c537d185899ad0cef Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 20 Nov 2003 21:52:40 +0000 Subject: Add initial work on eventlog - doesn't quite work yet. (This used to be commit 99fff7b1e24ee7231fa41ca9cb85382637f2b2b0) --- source4/Makefile.in | 15 +++---- source4/librpc/idl/eventlog.idl | 32 ++++++++++++++ source4/librpc/ndr/libndr.h | 1 + source4/torture/rpc/eventlog.c | 93 +++++++++++++++++++++++++++++++++++++++++ source4/torture/torture.c | 1 + 5 files changed, 135 insertions(+), 7 deletions(-) create mode 100644 source4/librpc/idl/eventlog.idl create mode 100644 source4/torture/rpc/eventlog.c diff --git a/source4/Makefile.in b/source4/Makefile.in index 2601511517..a6cc8eff26 100644 --- a/source4/Makefile.in +++ b/source4/Makefile.in @@ -194,18 +194,19 @@ LIBCLIUTIL_OBJ = libcli/util/asn1.o \ libcli/util/pwd_cache.o libcli/util/clierror.o libcli/util/cliutil.o LIBRAW_NDR_OBJ = librpc/ndr/ndr.o librpc/ndr/ndr_basic.o librpc/ndr/ndr_sec.o \ - librpc/ndr/ndr_spoolss_buf.o \ - librpc/gen_ndr/ndr_echo.o librpc/gen_ndr/ndr_misc.o \ - librpc/gen_ndr/ndr_lsa.o librpc/gen_ndr/ndr_dfs.o \ - librpc/gen_ndr/ndr_samr.o librpc/gen_ndr/ndr_spoolss.o \ + librpc/ndr/ndr_spoolss_buf.o \ + librpc/gen_ndr/ndr_echo.o librpc/gen_ndr/ndr_misc.o \ + librpc/gen_ndr/ndr_lsa.o librpc/gen_ndr/ndr_dfs.o \ + librpc/gen_ndr/ndr_samr.o librpc/gen_ndr/ndr_spoolss.o \ librpc/gen_ndr/ndr_wkssvc.o librpc/gen_ndr/ndr_srvsvc.o \ - librpc/gen_ndr/ndr_atsvc.o + librpc/gen_ndr/ndr_atsvc.o librpc/gen_ndr/ndr_eventlog.o LIBRAW_RPC_OBJ = librpc/rpc/dcerpc.o librpc/rpc/dcerpc_smb.o \ librpc/gen_rpc/rpc_echo.o librpc/gen_rpc/rpc_lsa.o \ librpc/gen_rpc/rpc_dfs.o librpc/gen_rpc/rpc_spoolss.o \ librpc/gen_rpc/rpc_samr.o librpc/gen_rpc/rpc_wkssvc.o \ - librpc/gen_rpc/rpc_srvsvc.o librpc/gen_rpc/rpc_atsvc.o + librpc/gen_rpc/rpc_srvsvc.o librpc/gen_rpc/rpc_atsvc.o \ + librpc/gen_rpc/rpc_eventlog.o LIBRAW_OBJ = libcli/raw/rawfile.o libcli/raw/smb_signing.o \ libcli/raw/clisocket.o libcli/raw/clitransport.o \ @@ -442,7 +443,7 @@ SMBTORTURE_RAW_OBJ = torture/raw/qfsinfo.o torture/raw/qfileinfo.o torture/raw/s SMBTORTURE_RPC_OBJ = torture/rpc/lsa.o torture/rpc/echo.o torture/rpc/dfs.o \ torture/rpc/spoolss.o torture/rpc/samr.o torture/rpc/wkssvc.o \ - torture/rpc/srvsvc.o torture/rpc/atsvc.o + torture/rpc/srvsvc.o torture/rpc/atsvc.o torture/rpc/eventlog.o SMBTORTURE_OBJ1 = torture/torture.o torture/torture_util.o torture/nbio.o torture/scanner.o \ torture/utable.o torture/denytest.o torture/mangle_test.o \ diff --git a/source4/librpc/idl/eventlog.idl b/source4/librpc/idl/eventlog.idl new file mode 100644 index 0000000000..574868ab94 --- /dev/null +++ b/source4/librpc/idl/eventlog.idl @@ -0,0 +1,32 @@ +/* + eventlog interface definition +*/ +[ uuid(82273fdc-e32a-17c3-3f78-827929dc23ea), + version(1.0), + pointer_default(unique) +] interface eventlog +{ + /******************/ + /* Function: 0x00 */ + NTSTATUS eventlog_OpenEventLog( + [in] unistr *servername, + [in] unistr *sourcename, + [out,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x01 */ + NTSTATUS eventlog_GetNumRecords( + ); + + /******************/ + /* Function: 0x02 */ + NTSTATUS eventlog_ReadEventLog( + ); + + /******************/ + /* Function: 0x03 */ + NTSTATUS eventlog_CloseEventLog( + [in,out,ref] policy_handle *handle + ); +} diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h index 93687d8796..b599d01023 100644 --- a/source4/librpc/ndr/libndr.h +++ b/source4/librpc/ndr/libndr.h @@ -200,3 +200,4 @@ typedef void (*ndr_print_union_fn_t)(struct ndr_print *, const char *, uint32, v #include "librpc/gen_ndr/ndr_wkssvc.h" #include "librpc/gen_ndr/ndr_srvsvc.h" #include "librpc/gen_ndr/ndr_atsvc.h" +#include "librpc/gen_ndr/ndr_eventlog.h" diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c new file mode 100644 index 0000000000..8f357e7987 --- /dev/null +++ b/source4/torture/rpc/eventlog.c @@ -0,0 +1,93 @@ +/* + Unix SMB/CIFS implementation. + test suite for eventlog rpc operations + + Copyright (C) Tim Potter 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" + +BOOL test_CloseEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct policy_handle *handle) +{ + NTSTATUS status; + struct eventlog_CloseEventLog r; + + r.in.handle = r.out.handle = handle; + + printf("Testing CloseEventLog\n"); + + status = dcerpc_eventlog_CloseEventLog(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("CloseEventLog failed - %s\n", nt_errstr(status)); + return False; + } + + return True; +} + +static BOOL test_OpenEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +{ + NTSTATUS status; + struct eventlog_OpenEventLog r; + struct policy_handle handle; + + printf("\ntesting OpenEventLog\n"); + + r.in.servername = dcerpc_server_name(p); + r.out.handle = &handle; + + status = dcerpc_eventlog_OpenEventLog(p, mem_ctx, &r); + + if (!NT_STATUS_IS_OK(status)) { + printf("OpenEventLog failed - %s\n", nt_errstr(status)); + return False; + } + + if (!test_CloseEventLog(p, mem_ctx, &handle)) + return False; + + return True; +} + +BOOL torture_rpc_eventlog(int dummy) +{ + NTSTATUS status; + struct dcerpc_pipe *p; + TALLOC_CTX *mem_ctx; + BOOL ret = True; + + mem_ctx = talloc_init("torture_rpc_atsvc"); + + status = torture_rpc_connection(&p, + DCERPC_ATSVC_NAME, + DCERPC_ATSVC_UUID, + DCERPC_ATSVC_VERSION); + if (!NT_STATUS_IS_OK(status)) { + return False; + } + + p->flags |= DCERPC_DEBUG_PRINT_BOTH; + + if (!test_OpenEventLog(p, mem_ctx)) { + return False; + } + + torture_rpc_close(p); + + return ret; +} diff --git a/source4/torture/torture.c b/source4/torture/torture.c index cfb1289149..54299e031d 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -3995,6 +3995,7 @@ static struct { {"RPC-WKSSVC", torture_rpc_wkssvc, 0}, {"RPC-SRVSVC", torture_rpc_srvsvc, 0}, {"RPC-ATSVC", torture_rpc_atsvc, 0}, + {"RPC-EVENTLOG", torture_rpc_eventlog, 0}, {NULL, NULL, 0}}; -- cgit