]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4-smbtorture: add test_GetLogIntormation test.
authorGünther Deschner <gd@samba.org>
Tue, 20 Jan 2009 18:01:43 +0000 (19:01 +0100)
committerGünther Deschner <gd@samba.org>
Sat, 24 Jan 2009 02:33:23 +0000 (03:33 +0100)
Guenther

source4/torture/rpc/eventlog.c

index 5da205bcdeba9ae34945fd5da7d12968f0824f45..e1b6cd940f0ced62a8f01dec15b578657101d86c 100644 (file)
@@ -282,6 +282,53 @@ static bool test_ClearEventLog(struct torture_context *tctx,
        return true;
 }
 
+static bool test_GetLogInformation(struct torture_context *tctx,
+                                  struct dcerpc_pipe *p)
+{
+       NTSTATUS status;
+       struct eventlog_GetLogIntormation r;
+       struct eventlog_CloseEventLog cr;
+       struct policy_handle handle;
+       uint32_t bytes_needed = 0;
+
+       if (!get_policy_handle(tctx, p, &handle))
+               return false;
+
+       r.in.handle = &handle;
+       r.in.level = 1;
+       r.in.buf_size = 0;
+       r.out.buffer = NULL;
+       r.out.bytes_needed = &bytes_needed;
+
+       status = dcerpc_eventlog_GetLogIntormation(p, tctx, &r);
+
+       torture_assert_ntstatus_equal(tctx, status, NT_STATUS_INVALID_LEVEL,
+                                     "GetLogInformation failed");
+
+       r.in.level = 0;
+
+       status = dcerpc_eventlog_GetLogIntormation(p, tctx, &r);
+
+       torture_assert_ntstatus_equal(tctx, status, NT_STATUS_BUFFER_TOO_SMALL,
+                                     "GetLogInformation failed");
+
+       r.in.buf_size = bytes_needed;
+       r.out.buffer = talloc_array(tctx, uint8_t, bytes_needed);
+
+       status = dcerpc_eventlog_GetLogIntormation(p, tctx, &r);
+
+       torture_assert_ntstatus_ok(tctx, status, "GetLogInformation failed");
+
+       cr.in.handle = cr.out.handle = &handle;
+
+       torture_assert_ntstatus_ok(tctx,
+                       dcerpc_eventlog_CloseEventLog(p, tctx, &cr),
+                       "CloseEventLog failed");
+
+       return true;
+}
+
+
 static bool test_OpenEventLog(struct torture_context *tctx,
                              struct dcerpc_pipe *p)
 {
@@ -318,6 +365,7 @@ struct torture_suite *torture_rpc_eventlog(TALLOC_CTX *mem_ctx)
        torture_rpc_tcase_add_test(tcase, "ReadEventLog", test_ReadEventLog);
        torture_rpc_tcase_add_test(tcase, "ReportEventLog", test_ReportEventLog);
        torture_rpc_tcase_add_test(tcase, "FlushEventLog", test_FlushEventLog);
+       torture_rpc_tcase_add_test(tcase, "GetLogIntormation", test_GetLogInformation);
 
        return suite;
 }