summaryrefslogtreecommitdiff
path: root/source4/torture/rpc
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2005-08-05 22:57:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:31:23 -0500
commitd87e1306c5cbfcbcd80d3f527aa4412aedfb9dcf (patch)
treed03704315fd01e52aa95055da82c8e8add698ac9 /source4/torture/rpc
parentb2b89d654df22412c1a566780dc66e8bf3dc4d10 (diff)
downloadsamba-d87e1306c5cbfcbcd80d3f527aa4412aedfb9dcf.tar.gz
samba-d87e1306c5cbfcbcd80d3f527aa4412aedfb9dcf.tar.bz2
samba-d87e1306c5cbfcbcd80d3f527aa4412aedfb9dcf.zip
r9145: Some work on eventlog since jerry is doing some in Samba3. (-:
- Convert to use lsa_String instead of eventlog_String. - Copy across some constants. - Implement idl and testcase for ClearEventLog() function (This used to be commit 352b21af3f0a84ee31d0eecaa76abf2134d044de)
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r--source4/torture/rpc/eventlog.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c
index 7d3a3bfea9..1929c4a068 100644
--- a/source4/torture/rpc/eventlog.c
+++ b/source4/torture/rpc/eventlog.c
@@ -22,12 +22,13 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_eventlog.h"
+#include "librpc/gen_ndr/ndr_lsa.h"
-static void init_eventlog_String(struct eventlog_String *name, const char *s)
+static void init_lsa_String(struct lsa_String *name, const char *s)
{
- name->name = s;
- name->name_len = 2*strlen_m(s);
- name->name_size = name->name_len;
+ name->string = s;
+ name->length = 2*strlen_m(s);
+ name->size = name->length;
}
static BOOL test_GetNumRecords(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle)
@@ -63,6 +64,8 @@ static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct
r.in.handle = handle;
r.in.number_of_bytes = 0x0;
+ r.out.data = talloc(mem_ctx, uint8_t);
+
status = dcerpc_eventlog_ReadEventLogW(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
@@ -112,6 +115,26 @@ static BOOL test_CloseEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return True;
}
+static BOOL test_ClearEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle)
+{
+ NTSTATUS status;
+ struct eventlog_ClearEventLogW r;
+
+ r.in.handle = handle;
+ r.in.unknown = NULL;
+
+ printf("Testing ClearEventLog\n");
+
+ status = dcerpc_eventlog_ClearEventLogW(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("ClearEventLog failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ return True;
+}
+
static BOOL test_OpenEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle)
{
NTSTATUS status;
@@ -124,8 +147,8 @@ static BOOL test_OpenEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct
unknown0.unknown1 = 0x0001;
r.in.unknown0 = &unknown0;
- init_eventlog_String(&r.in.source, "system");
- init_eventlog_String(&r.in.unknown1, NULL);
+ init_lsa_String(&r.in.logname, "system");
+ init_lsa_String(&r.in.servername, NULL);
r.in.unknown2 = 0x00000001;
r.in.unknown3 = 0x00000001;
r.out.handle = handle;
@@ -170,6 +193,10 @@ BOOL torture_rpc_eventlog(void)
return False;
}
+#if 0
+ test_ClearEventLog(p, mem_ctx, &handle); /* Destructive test */
+#endif
+
test_GetNumRecords(p, mem_ctx, &handle);
test_ReadEventLog(p, mem_ctx, &handle, 0);