Add initial work on eventlog - doesn't quite work yet.
authorTim Potter <tpot@samba.org>
Thu, 20 Nov 2003 21:52:40 +0000 (21:52 +0000)
committerTim Potter <tpot@samba.org>
Thu, 20 Nov 2003 21:52:40 +0000 (21:52 +0000)
(This used to be commit 99fff7b1e24ee7231fa41ca9cb85382637f2b2b0)

source4/Makefile.in
source4/librpc/idl/eventlog.idl [new file with mode: 0644]
source4/librpc/ndr/libndr.h
source4/torture/rpc/eventlog.c [new file with mode: 0644]
source4/torture/torture.c

index 2601511517b187864fd4dc0810494a1f00f12057..a6cc8eff266fe616f60afc2c1c1ff3886e334f8f 100644 (file)
@@ -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 (file)
index 0000000..574868a
--- /dev/null
@@ -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
+       );
+}
index 93687d87965f1cbd1747bb0e08c8209266757e5d..b599d01023a9eb1a18ca53e0b2e760a4fb343573 100644 (file)
@@ -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 (file)
index 0000000..8f357e7
--- /dev/null
@@ -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;
+}
index cfb128914979ee282055b3bd9c3cbf753922c06e..54299e031d0f83395e6cb489f4fb82b876497eaf 100644 (file)
@@ -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}};