diff options
author | Tim Potter <tpot@samba.org> | 2003-11-20 21:52:40 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2003-11-20 21:52:40 +0000 |
commit | 20730626af0b1aee6149fb7c537d185899ad0cef (patch) | |
tree | 057c4f571e60a2473861f7984d2dec30baea0898 /source4/torture/rpc | |
parent | ddd2f9ced058a24ef63c4033cb54c8517269bbfd (diff) | |
download | samba-20730626af0b1aee6149fb7c537d185899ad0cef.tar.gz samba-20730626af0b1aee6149fb7c537d185899ad0cef.tar.bz2 samba-20730626af0b1aee6149fb7c537d185899ad0cef.zip |
Add initial work on eventlog - doesn't quite work yet.
(This used to be commit 99fff7b1e24ee7231fa41ca9cb85382637f2b2b0)
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r-- | source4/torture/rpc/eventlog.c | 93 |
1 files changed, 93 insertions, 0 deletions
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; +} |