Author: tpot Date: 2005-08-06 00:58:06 +0000 (Sat, 06 Aug 2005) New Revision: 9156
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9156 Log: Add IDL and test for FlushEventLog() but it always seems to return NT_STATUS_ACCESS_DENIED. Modified: branches/SAMBA_4_0/source/librpc/idl/eventlog.idl branches/SAMBA_4_0/source/torture/rpc/eventlog.c Changeset: Modified: branches/SAMBA_4_0/source/librpc/idl/eventlog.idl =================================================================== --- branches/SAMBA_4_0/source/librpc/idl/eventlog.idl 2005-08-06 00:47:17 UTC (rev 9155) +++ branches/SAMBA_4_0/source/librpc/idl/eventlog.idl 2005-08-06 00:58:06 UTC (rev 9156) @@ -172,5 +172,7 @@ /*****************/ /* Function 0x17 */ - NTSTATUS eventlog_FlushEventLog(); + NTSTATUS eventlog_FlushEventLog( + [in,ref] policy_handle *handle + ); } Modified: branches/SAMBA_4_0/source/torture/rpc/eventlog.c =================================================================== --- branches/SAMBA_4_0/source/torture/rpc/eventlog.c 2005-08-06 00:47:17 UTC (rev 9155) +++ branches/SAMBA_4_0/source/torture/rpc/eventlog.c 2005-08-06 00:58:06 UTC (rev 9156) @@ -31,7 +31,8 @@ name->size = name->length; } -static BOOL test_GetNumRecords(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) +static BOOL test_GetNumRecords(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct policy_handle *handle) { NTSTATUS status; struct eventlog_GetNumRecords r; @@ -52,7 +53,8 @@ return True; } -static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t offset) +static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct policy_handle *handle, uint32_t offset) { NTSTATUS status; struct eventlog_ReadEventLogW r; @@ -91,7 +93,7 @@ } static BOOL test_CloseEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, - struct policy_handle *handle) + struct policy_handle *handle) { NTSTATUS status; struct eventlog_CloseEventLog r; @@ -101,6 +103,7 @@ 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; @@ -109,6 +112,28 @@ return True; } +static BOOL test_FlushEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct policy_handle *handle) +{ + NTSTATUS status; + struct eventlog_FlushEventLog r; + + r.in.handle = handle; + + printf("Testing FlushEventLog\n"); + + status = dcerpc_eventlog_FlushEventLog(p, mem_ctx, &r); + + /* Huh? Does this RPC always return access denied? */ + + if (!NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) { + printf("FlushEventLog failed - %s\n", nt_errstr(status)); + return False; + } + + return True; +} + static BOOL test_ClearEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -121,6 +146,7 @@ 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; @@ -129,7 +155,8 @@ return True; } -static BOOL test_OpenEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) +static BOOL test_OpenEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct policy_handle *handle) { NTSTATUS status; struct eventlog_OpenEventLogW r; @@ -164,8 +191,8 @@ BOOL torture_rpc_eventlog(void) { - NTSTATUS status; - struct dcerpc_pipe *p; + NTSTATUS status; + struct dcerpc_pipe *p; struct policy_handle handle; TALLOC_CTX *mem_ctx; BOOL ret = True; @@ -177,6 +204,7 @@ DCERPC_EVENTLOG_NAME, DCERPC_EVENTLOG_UUID, DCERPC_EVENTLOG_VERSION); + if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); return False; @@ -188,15 +216,17 @@ } #if 0 - test_ClearEventLog(p, mem_ctx, &handle); /* Destructive test */ + ret &= test_ClearEventLog(p, mem_ctx, &handle); /* Destructive test */ #endif - test_GetNumRecords(p, mem_ctx, &handle); + ret &= test_GetNumRecords(p, mem_ctx, &handle); - test_ReadEventLog(p, mem_ctx, &handle, 0); + ret &= test_ReadEventLog(p, mem_ctx, &handle, 0); - test_CloseEventLog(p, mem_ctx, &handle); + ret &= test_FlushEventLog(p, mem_ctx, &handle); + ret &= test_CloseEventLog(p, mem_ctx, &handle); + talloc_free(mem_ctx); return ret;
