From 20730626af0b1aee6149fb7c537d185899ad0cef Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 20 Nov 2003 21:52:40 +0000 Subject: Add initial work on eventlog - doesn't quite work yet. (This used to be commit 99fff7b1e24ee7231fa41ca9cb85382637f2b2b0) --- source4/torture/rpc/eventlog.c | 93 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 source4/torture/rpc/eventlog.c (limited to 'source4/torture/rpc/eventlog.c') 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; +} -- cgit From a20352959e0474e10dc533f7ecb876cf7a4c8723 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 21 Nov 2003 03:07:02 +0000 Subject: More work on eventlog - still doesn't work. (-: (This used to be commit 9109cb832a3807b3eee9e52c8c533e2bf0c8007a) --- source4/torture/rpc/eventlog.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 8f357e7987..14b091a0c3 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -21,6 +21,13 @@ #include "includes.h" +static void init_eventlog_String(struct eventlog_String *name, const char *s) +{ + name->name = s; + name->name_len = 2*strlen_m(s); + name->name_size = name->name_len; +} + BOOL test_CloseEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -44,12 +51,19 @@ static BOOL test_OpenEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { NTSTATUS status; struct eventlog_OpenEventLog r; + struct eventlog_OpenUnknown0 unknown0; struct policy_handle handle; printf("\ntesting OpenEventLog\n"); - r.in.servername = dcerpc_server_name(p); - r.out.handle = &handle; + unknown0.unknown0 = 0x005c; + unknown0.unknown1 = 0x0001; + + r.in.unknown0 = &unknown0; + init_eventlog_String(&r.in.source, "system"); + init_eventlog_String(&r.in.unknown1, NULL); + r.in.unknown2 = 0x00000001; + r.in.unknown3 = 0x00000001; status = dcerpc_eventlog_OpenEventLog(p, mem_ctx, &r); @@ -74,9 +88,9 @@ BOOL torture_rpc_eventlog(int dummy) mem_ctx = talloc_init("torture_rpc_atsvc"); status = torture_rpc_connection(&p, - DCERPC_ATSVC_NAME, - DCERPC_ATSVC_UUID, - DCERPC_ATSVC_VERSION); + DCERPC_EVENTLOG_NAME, + DCERPC_EVENTLOG_UUID, + DCERPC_EVENTLOG_VERSION); if (!NT_STATUS_IS_OK(status)) { return False; } -- cgit From 86a604429ee13aa8c3f930ea74b1fada278ced45 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 22 Nov 2003 08:11:32 +0000 Subject: a fairly major upgrade to the dcerpc system * added a NDR validator. The way it works is that when the DCERPC_DEBUG_VALIDATE_* flags are set the dcerpc system will perform NDR buffer validation. On sending a request the packet is first marshalled, then unmarahslled, then marshalled again, and it is confirmed that the two marshalling results are idential. This ensures that our pull and push routines are absolutely in sync, so that we can be very confident that if a routine works in the client then the corresponding routine must work on the server side. A similar validation is performed on all replies. * a result of this change is that pidl is fussier about the [ref] tag. You can only use it on pointers (which is the only place it makes sense) * fixed a basic alignment bug in the push side of the NDR code * added server side pull/push support. Our dcerpc system is now fully ready to be used on the server side. * fixed the relative offset pointer list. It must be traversed in reverse order on push * added automatic value setting for the size parameter in outgoing SdBuf structures. * expanded the ndr debugging code to always give a message on any failure * fixed the subcontext push code * fixed some memory leaks in smbtorture RPC tests (This used to be commit 8ecf720206a2eef3f8ea7cbdb1f460664a5dba9a) --- source4/torture/rpc/eventlog.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 14b091a0c3..19f0644258 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -101,6 +101,8 @@ BOOL torture_rpc_eventlog(int dummy) return False; } + talloc_destroy(mem_ctx); + torture_rpc_close(p); return ret; -- cgit From d858a2ceee8f36162c99297cb917ea0deb0079de Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 17 Jan 2004 00:16:18 +0000 Subject: make sure we initialise r.out.handle in openeventlog (This used to be commit 6319166420ba7cd7bb3a69d88510d8e6216c7c89) --- source4/torture/rpc/eventlog.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 19f0644258..8ad1469919 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -64,6 +64,7 @@ static BOOL test_OpenEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) init_eventlog_String(&r.in.unknown1, NULL); r.in.unknown2 = 0x00000001; r.in.unknown3 = 0x00000001; + r.out.handle = &handle; status = dcerpc_eventlog_OpenEventLog(p, mem_ctx, &r); -- cgit From 0b4da9d7e069a5e32d9706ee12cde7fe7625270d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 3 Feb 2004 14:56:07 +0000 Subject: - add 'print' to the DCERPC binding strings e.g. ncacn_np:myserver:[samr,sign,print] will now enable the packet debugging and the debugging is not bound anymore to the debuglevel >= 2 in the torture tests - also the dcesrv_remote module now supports debugging of the packets use the 'dcerpc_remote:binding' smb.conf parameter. metze (This used to be commit 40abf3c584efed7f977ddd688ea064540e5a5b13) --- source4/torture/rpc/eventlog.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 8ad1469919..1a3eb986ec 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -95,8 +95,6 @@ BOOL torture_rpc_eventlog(int dummy) if (!NT_STATUS_IS_OK(status)) { return False; } - - p->flags |= DCERPC_DEBUG_PRINT_BOTH; if (!test_OpenEventLog(p, mem_ctx)) { return False; -- cgit From 2bc3b3bcec7900cda3841af95ab08e07c3d26c9d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 14 May 2004 18:59:00 +0000 Subject: r739: Implement GetNumRecords() call from eventlog pipe, including a torture test (This used to be commit 6a254e26f17c2b3175023764c02dc73615d585d6) --- source4/torture/rpc/eventlog.c | 88 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 80 insertions(+), 8 deletions(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 1a3eb986ec..85dfdcae31 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -3,6 +3,7 @@ test suite for eventlog rpc operations Copyright (C) Tim Potter 2003 + Copyright (C) Jelmer Vernooij 2004 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 @@ -28,6 +29,69 @@ static void init_eventlog_String(struct eventlog_String *name, const char *s) name->name_size = name->name_len; } +static BOOL test_GetNumRecords(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) +{ + NTSTATUS status; + struct eventlog_GetNumRecords r; + + printf("\ntesting GetNumRecords\n"); + + r.in.handle = handle; + + status = dcerpc_eventlog_GetNumRecords(p, mem_ctx, &r); + + if (!NT_STATUS_IS_OK(status)) { + printf("GetNumRecords failed - %s\n", nt_errstr(status)); + return False; + } + + printf("%d records\n", r.out.number); + + return True; +} + +static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32 offset) +{ + NTSTATUS status; + struct eventlog_ReadEventLog r; + + printf("\ntesting ReadEventLog\n"); + + r.in.flags = 0x0; + r.in.offset = offset; + r.in.handle = handle; + r.in.number_of_bytes = 0x0; + + status = dcerpc_eventlog_ReadEventLog(p, mem_ctx, &r); + + if (!NT_STATUS_IS_OK(status)) { + printf("ReadEventLog failed - %s\n", nt_errstr(status)); + return False; + } + + if (NT_STATUS_IS_OK(r.out.result)) { + /* No data */ + return True; + } + + if (!NT_STATUS_EQUAL(r.out.result, NT_STATUS_BUFFER_TOO_SMALL)) { + printf("ReadEventLog failed - %s\n", nt_errstr(r.out.result)); + return False; + } + + r.in.number_of_bytes = r.out.real_size; + + status = dcerpc_eventlog_ReadEventLog(p, mem_ctx, &r); + + if (!NT_STATUS_IS_OK(status)) { + printf("ReadEventLog failed - %s\n", nt_errstr(status)); + return False; + } + + + return True; +} + BOOL test_CloseEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -47,12 +111,11 @@ BOOL test_CloseEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return True; } -static BOOL test_OpenEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +static BOOL test_OpenEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct eventlog_OpenEventLog r; struct eventlog_OpenUnknown0 unknown0; - struct policy_handle handle; printf("\ntesting OpenEventLog\n"); @@ -64,7 +127,7 @@ static BOOL test_OpenEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) init_eventlog_String(&r.in.unknown1, NULL); r.in.unknown2 = 0x00000001; r.in.unknown3 = 0x00000001; - r.out.handle = &handle; + r.out.handle = handle; status = dcerpc_eventlog_OpenEventLog(p, mem_ctx, &r); @@ -73,16 +136,19 @@ static BOOL test_OpenEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) return False; } - if (!test_CloseEventLog(p, mem_ctx, &handle)) + if (!NT_STATUS_IS_OK(r.out.result)) { + printf("OpenEventLog failed - %s\n", nt_errstr(r.out.result)); return False; + } return True; } BOOL torture_rpc_eventlog(int dummy) { - NTSTATUS status; - struct dcerpc_pipe *p; + NTSTATUS status; + struct dcerpc_pipe *p; + struct policy_handle handle; TALLOC_CTX *mem_ctx; BOOL ret = True; @@ -96,13 +162,19 @@ BOOL torture_rpc_eventlog(int dummy) return False; } - if (!test_OpenEventLog(p, mem_ctx)) { + if (!test_OpenEventLog(p, mem_ctx, &handle)) { return False; } + test_GetNumRecords(p, mem_ctx, &handle); + + test_ReadEventLog(p, mem_ctx, &handle, 0); + + test_CloseEventLog(p, mem_ctx, &handle); + talloc_destroy(mem_ctx); - torture_rpc_close(p); + torture_rpc_close(p); return ret; } -- cgit From f9d8f8843dc0ab8c9d59abde7222e0f118b86b5d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 25 May 2004 16:24:13 +0000 Subject: r884: convert samba4 to use [u]int32_t instead of [u]int32 metze (This used to be commit 0e5517d937a2eb7cf707991d1c7498c1ab456095) --- source4/torture/rpc/eventlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 85dfdcae31..31b7d1f5b3 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -50,7 +50,7 @@ static BOOL test_GetNumRecords(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struc return True; } -static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32 offset) +static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t offset) { NTSTATUS status; struct eventlog_ReadEventLog r; -- cgit From b7779be06aa6fd16d24545c10c1a57ef04360617 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 13 Aug 2004 01:31:11 +0000 Subject: r1799: List more uuids. From http://www.hsc.fr/ressources/articles/win_net_srv (This used to be commit 8d36dbed8c5bdc82176083b2c6f8d989ae903ba5) --- source4/torture/rpc/eventlog.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 31b7d1f5b3..343c81e385 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -53,7 +53,7 @@ static BOOL test_GetNumRecords(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struc static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t offset) { NTSTATUS status; - struct eventlog_ReadEventLog r; + struct eventlog_ReadEventLogW r; printf("\ntesting ReadEventLog\n"); @@ -62,7 +62,7 @@ static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct r.in.handle = handle; r.in.number_of_bytes = 0x0; - status = dcerpc_eventlog_ReadEventLog(p, mem_ctx, &r); + status = dcerpc_eventlog_ReadEventLogW(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("ReadEventLog failed - %s\n", nt_errstr(status)); @@ -81,7 +81,7 @@ static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct r.in.number_of_bytes = r.out.real_size; - status = dcerpc_eventlog_ReadEventLog(p, mem_ctx, &r); + status = dcerpc_eventlog_ReadEventLogW(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("ReadEventLog failed - %s\n", nt_errstr(status)); @@ -114,7 +114,7 @@ BOOL test_CloseEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, static BOOL test_OpenEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; - struct eventlog_OpenEventLog r; + struct eventlog_OpenEventLogW r; struct eventlog_OpenUnknown0 unknown0; printf("\ntesting OpenEventLog\n"); @@ -129,7 +129,7 @@ static BOOL test_OpenEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct r.in.unknown3 = 0x00000001; r.out.handle = handle; - status = dcerpc_eventlog_OpenEventLog(p, mem_ctx, &r); + status = dcerpc_eventlog_OpenEventLogW(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("OpenEventLog failed - %s\n", nt_errstr(status)); -- cgit From ba6d5fcb97b9831dddf7dfe09fb02fbb23d864b4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 28 Oct 2004 13:40:50 +0000 Subject: r3324: made the smbtorture code completely warning free (This used to be commit 7067bb9b52223cafa28470f264f0b60646a07a01) --- source4/torture/rpc/eventlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 343c81e385..dfa9fc7a51 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -144,7 +144,7 @@ static BOOL test_OpenEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct return True; } -BOOL torture_rpc_eventlog(int dummy) +BOOL torture_rpc_eventlog(void) { NTSTATUS status; struct dcerpc_pipe *p; -- cgit From 90067934cd3195df80f8b1e614629d51fffcb38b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 1 Nov 2004 10:30:34 +0000 Subject: r3428: switched to using minimal includes for the auto-generated RPC code. The thing that finally convinced me that minimal includes was worth pursuing for rpc was a compiler (tcc) that failed to build Samba due to reaching internal limits of the size of include files. Also the fact that includes.h.gch was 16MB, which really seems excessive. This patch brings it back to 12M, which is still too large, but better. Note that this patch speeds up compile times for both the pch and non-pch case. This change also includes the addition iof a "depends()" option in our IDL files, allowing you to specify that one IDL file depends on another. This capability was needed for the auto-includes generation. (This used to be commit b8f5fa8ac8e8725f3d321004f0aedf4246fc6b49) --- source4/torture/rpc/eventlog.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index dfa9fc7a51..a98b3e9e79 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "librpc/gen_ndr/ndr_eventlog.h" static void init_eventlog_String(struct eventlog_String *name, const char *s) { -- cgit From 6d3c74a67b935f348777feb3fac7653a9c4277a8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 3 Nov 2004 20:32:28 +0000 Subject: r3513: Add (the infrastructure for) DCOM support. Contents: - Support for sending over the object UUID in DCERPC calls - Simple torture test for the DCOM "Simple" object - Generate extra argument for "object" interfaces in pidl - Some stubs for common DCOM functions (This used to be commit c052f2e1edd816206d8974af3140cec7ef97a70c) --- source4/torture/rpc/eventlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index a98b3e9e79..91e012cdec 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -93,7 +93,7 @@ static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct return True; } -BOOL test_CloseEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static BOOL test_CloseEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; -- cgit From 759da3b915e2006d4c87b5ace47f399accd9ce91 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 27 Jan 2005 07:08:20 +0000 Subject: r5037: got rid of all of the TALLOC_DEPRECATED stuff. My apologies for the large commit. I thought this was worthwhile to get done for consistency. (This used to be commit ec32b22ed5ec224f6324f5e069d15e92e38e15c0) --- source4/torture/rpc/eventlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 91e012cdec..7e320200f0 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -173,7 +173,7 @@ BOOL torture_rpc_eventlog(void) test_CloseEventLog(p, mem_ctx, &handle); - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); torture_rpc_close(p); -- cgit From 645711c602313940dcf80ec786557920ecfbf884 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 22 Mar 2005 08:00:45 +0000 Subject: r5941: Commit this patch much earlier than I would normally prefer, but metze needs a working tree... The main volume of this patch was what I started working on today: - Cleans up memory handling around DCE/RPC pipes, to have a parent talloc context. - Uses sepereate inner loops for some of the DCE/RPC tests The other and more important part of this patch fixes issues surrounding the new credentials framwork: This makes the struct cli_credentials always a talloc() structure, rather than on the stack. Parts of the cli_credentials code already assumed this. There were other issues, particularly in the DCERPC over SMB handling, as well as little things that had to be tidied up before test_w2k3.sh would start to pass. Andrew Bartlett (This used to be commit 0453f9d05d2e336fba1f85dbf2718d01fa2bf778) --- source4/torture/rpc/eventlog.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 7e320200f0..7d3a3bfea9 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -155,15 +155,18 @@ BOOL torture_rpc_eventlog(void) mem_ctx = talloc_init("torture_rpc_atsvc"); - status = torture_rpc_connection(&p, + status = torture_rpc_connection(mem_ctx, + &p, DCERPC_EVENTLOG_NAME, DCERPC_EVENTLOG_UUID, DCERPC_EVENTLOG_VERSION); if (!NT_STATUS_IS_OK(status)) { + talloc_free(mem_ctx); return False; } if (!test_OpenEventLog(p, mem_ctx, &handle)) { + talloc_free(mem_ctx); return False; } @@ -175,7 +178,5 @@ BOOL torture_rpc_eventlog(void) talloc_free(mem_ctx); - torture_rpc_close(p); - return ret; } -- cgit From d87e1306c5cbfcbcd80d3f527aa4412aedfb9dcf Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 5 Aug 2005 22:57:47 +0000 Subject: 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) --- source4/torture/rpc/eventlog.c | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'source4/torture/rpc/eventlog.c') 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); -- cgit From 865319a0ec76ce9281ce141487bd926d5480830f Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sat, 6 Aug 2005 00:47:17 +0000 Subject: r9155: Fix ReadEventLog() test so it now works. (This used to be commit b76d35e7e2207f4da294a7cd1b5636b954162be2) --- source4/torture/rpc/eventlog.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 1929c4a068..69ed683bc4 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -2,7 +2,7 @@ Unix SMB/CIFS implementation. test suite for eventlog rpc operations - Copyright (C) Tim Potter 2003 + Copyright (C) Tim Potter 2003,2005 Copyright (C) Jelmer Vernooij 2004 This program is free software; you can redistribute it and/or modify @@ -59,20 +59,13 @@ static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct printf("\ntesting ReadEventLog\n"); - r.in.flags = 0x0; - r.in.offset = offset; r.in.handle = handle; - r.in.number_of_bytes = 0x0; - - r.out.data = talloc(mem_ctx, uint8_t); + r.in.flags = EVENTLOG_BACKWARDS_READ|EVENTLOG_SEQUENTIAL_READ; + r.in.offset = 0; + r.in.number_of_bytes = 0; status = dcerpc_eventlog_ReadEventLogW(p, mem_ctx, &r); - if (!NT_STATUS_IS_OK(status)) { - printf("ReadEventLog failed - %s\n", nt_errstr(status)); - return False; - } - if (NT_STATUS_IS_OK(r.out.result)) { /* No data */ return True; @@ -84,6 +77,7 @@ static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct } r.in.number_of_bytes = r.out.real_size; + r.out.data = talloc_size(mem_ctx, r.in.number_of_bytes); status = dcerpc_eventlog_ReadEventLogW(p, mem_ctx, &r); -- cgit From f18657aa59749fe85bfe1cc4fc2a49db2685eea6 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sat, 6 Aug 2005 00:58:06 +0000 Subject: r9156: Add IDL and test for FlushEventLog() but it always seems to return NT_STATUS_ACCESS_DENIED. (This used to be commit f18d1f539e4fd434dfc519e45f4c356c5cd4d73a) --- source4/torture/rpc/eventlog.c | 50 +++++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 10 deletions(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 69ed683bc4..5ce0652729 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -31,7 +31,8 @@ static void init_lsa_String(struct lsa_String *name, const char *s) 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 @@ static BOOL test_GetNumRecords(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struc 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_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct } 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 @@ static BOOL test_CloseEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 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 @@ static BOOL test_CloseEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 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 @@ static BOOL test_ClearEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 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 @@ static BOOL test_ClearEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 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 @@ static BOOL test_OpenEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct 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 @@ BOOL torture_rpc_eventlog(void) DCERPC_EVENTLOG_NAME, DCERPC_EVENTLOG_UUID, DCERPC_EVENTLOG_VERSION); + if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); return False; @@ -188,14 +216,16 @@ BOOL torture_rpc_eventlog(void) } #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); + + ret &= test_ReadEventLog(p, mem_ctx, &handle, 0); - test_ReadEventLog(p, mem_ctx, &handle, 0); + ret &= test_FlushEventLog(p, mem_ctx, &handle); - test_CloseEventLog(p, mem_ctx, &handle); + ret &= test_CloseEventLog(p, mem_ctx, &handle); talloc_free(mem_ctx); -- cgit From 2fa50ab671ba4a7e552e001f0dfde3a7cc330f8e Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 9 Aug 2005 03:09:47 +0000 Subject: r9222: Rename smb_tree_connect() to smb_raw_tcon() to match other raw function names. (This used to be commit 26b191b3c9529b2dae5d004819dab46657064408) --- source4/torture/rpc/eventlog.c | 46 +++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 21 deletions(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 5ce0652729..eebf485e5c 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -54,41 +54,45 @@ static BOOL test_GetNumRecords(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, - struct policy_handle *handle, uint32_t offset) + struct policy_handle *handle) { NTSTATUS status; struct eventlog_ReadEventLogW r; printf("\ntesting ReadEventLog\n"); + r.in.offset = 0; r.in.handle = handle; r.in.flags = EVENTLOG_BACKWARDS_READ|EVENTLOG_SEQUENTIAL_READ; - r.in.offset = 0; - r.in.number_of_bytes = 0; - status = dcerpc_eventlog_ReadEventLogW(p, mem_ctx, &r); + while (1) { + r.in.number_of_bytes = 0; + r.out.data = NULL; - if (NT_STATUS_IS_OK(r.out.result)) { - /* No data */ - return True; - } + status = dcerpc_eventlog_ReadEventLogW(p, mem_ctx, &r); - if (!NT_STATUS_EQUAL(r.out.result, NT_STATUS_BUFFER_TOO_SMALL)) { - printf("ReadEventLog failed - %s\n", nt_errstr(r.out.result)); - return False; - } + if (NT_STATUS_EQUAL(r.out.result, NT_STATUS_END_OF_FILE)) { + break; + } - r.in.number_of_bytes = r.out.real_size; - r.out.data = talloc_size(mem_ctx, r.in.number_of_bytes); + if (!NT_STATUS_EQUAL(r.out.result, NT_STATUS_BUFFER_TOO_SMALL)) { + printf("ReadEventLog failed - %s\n", nt_errstr(r.out.result)); + return False; + } + + r.in.number_of_bytes = r.out.real_size; + r.out.data = talloc_size(mem_ctx, r.in.number_of_bytes); - status = dcerpc_eventlog_ReadEventLogW(p, mem_ctx, &r); + status = dcerpc_eventlog_ReadEventLogW(p, mem_ctx, &r); - if (!NT_STATUS_IS_OK(status)) { - printf("ReadEventLog failed - %s\n", nt_errstr(status)); - return False; + if (!NT_STATUS_IS_OK(status)) { + printf("ReadEventLog failed - %s\n", nt_errstr(status)); + return False; + } + + r.in.offset++; } - return True; } @@ -168,7 +172,7 @@ static BOOL test_OpenEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, unknown0.unknown1 = 0x0001; r.in.unknown0 = &unknown0; - init_lsa_String(&r.in.logname, "system"); + init_lsa_String(&r.in.logname, "dns server"); init_lsa_String(&r.in.servername, NULL); r.in.unknown2 = 0x00000001; r.in.unknown3 = 0x00000001; @@ -221,7 +225,7 @@ BOOL torture_rpc_eventlog(void) ret &= test_GetNumRecords(p, mem_ctx, &handle); - ret &= test_ReadEventLog(p, mem_ctx, &handle, 0); + ret &= test_ReadEventLog(p, mem_ctx, &handle); ret &= test_FlushEventLog(p, mem_ctx, &handle); -- cgit From c08578c0cb739ca9433edb015e995eda82fdf8d4 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 11 Aug 2005 04:04:16 +0000 Subject: r9238: Some test code to do user-unmarshalling of eventlog_Record data. (This used to be commit d0225f10797eaeeb6d10cf753578703e144ee8dd) --- source4/torture/rpc/eventlog.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index eebf485e5c..576565e247 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -66,6 +66,12 @@ static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.in.flags = EVENTLOG_BACKWARDS_READ|EVENTLOG_SEQUENTIAL_READ; while (1) { + DATA_BLOB blob; + struct eventlog_Record rec; + struct ndr_pull *ndr; + + /* Read first for number of bytes in record */ + r.in.number_of_bytes = 0; r.out.data = NULL; @@ -80,6 +86,8 @@ static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return False; } + /* Now read the actual record */ + r.in.number_of_bytes = r.out.real_size; r.out.data = talloc_size(mem_ctx, r.in.number_of_bytes); @@ -90,6 +98,24 @@ static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return False; } + /* Decode a user-marshalled record */ + + blob.length = r.out.sent_size; + blob.data = talloc_steal(mem_ctx, r.out.data); + + ndr = ndr_pull_init_blob(&blob, mem_ctx); + + status = ndr_pull_eventlog_Record( + ndr, NDR_SCALARS|NDR_BUFFERS, &rec); + + NDR_PRINT_DEBUG(eventlog_Record, &rec); + + if (!NT_STATUS_IS_OK(status)) { + printf("ReadEventLog failed parsing event log record " + "- %s\n", nt_errstr(status)); + return False; + } + r.in.offset++; } -- cgit From acd6a086b341096fcbea1775ce748587fcc8020a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 27 Dec 2005 14:28:01 +0000 Subject: r12510: Change the DCE/RPC interfaces to take a pointer to a dcerpc_interface_table struct rather then a tuple of interface name, UUID and version. This removes the requirement for having a global list of DCE/RPC interfaces, except for these parts of the code that use that list explicitly (ndrdump and the scanner torture test). This should also allow us to remove the hack that put the authservice parameter in the dcerpc_binding struct as it can now be read directly from dcerpc_interface_table. I will now modify some of these functions to take a dcerpc_syntax_id structure rather then a full dcerpc_interface_table. (This used to be commit 8aae0f168e54c01d0866ad6e0da141dbd828574f) --- source4/torture/rpc/eventlog.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 576565e247..56647cfc3e 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -229,11 +229,7 @@ BOOL torture_rpc_eventlog(void) mem_ctx = talloc_init("torture_rpc_atsvc"); - status = torture_rpc_connection(mem_ctx, - &p, - DCERPC_EVENTLOG_NAME, - DCERPC_EVENTLOG_UUID, - DCERPC_EVENTLOG_VERSION); + status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_eventlog); if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); -- cgit From 25bb00fbcd409572e1c19c05fdc42c883936780b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 3 Jan 2006 13:41:17 +0000 Subject: r12693: Move core data structures out of smb.h into core.h torture prototypes in seperate header (This used to be commit 73610639b23ca3743077193fa0b1de7c7f65944d) --- source4/torture/rpc/eventlog.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 56647cfc3e..64c2b0b4ad 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "torture/torture.h" #include "librpc/gen_ndr/ndr_eventlog.h" #include "librpc/gen_ndr/ndr_lsa.h" -- cgit From eefe30b7d8e17ed744318417954669bacf2b3ac0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 14 Mar 2006 15:02:05 +0000 Subject: r14379: Build torture/rpc/ as a seperate smbtorture module. Move helper functions for rpc out of torture/torture.c (This used to be commit 1d2d970f3b8aef3f36c2befb94b5dd72c0086639) --- source4/torture/rpc/eventlog.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 64c2b0b4ad..8de099d215 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -24,6 +24,7 @@ #include "torture/torture.h" #include "librpc/gen_ndr/ndr_eventlog.h" #include "librpc/gen_ndr/ndr_lsa.h" +#include "torture/rpc/rpc.h" static void init_lsa_String(struct lsa_String *name, const char *s) { -- cgit From 1060f6b3f621cb70b075a879f129e57f10fdbf8a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 14 Mar 2006 23:35:30 +0000 Subject: r14402: Generate seperate headers for RPC client functions. (This used to be commit 7054ebf0249930843a2baf4d023ae8f62cedb109) --- source4/torture/rpc/eventlog.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 8de099d215..1372dd6b73 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -23,6 +23,7 @@ #include "includes.h" #include "torture/torture.h" #include "librpc/gen_ndr/ndr_eventlog.h" +#include "librpc/gen_ndr/ndr_eventlog_c.h" #include "librpc/gen_ndr/ndr_lsa.h" #include "torture/rpc/rpc.h" -- cgit From 909b111f587705a45f63540b39968f1af58a9b5d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 25 Mar 2006 16:01:28 +0000 Subject: r14720: Add torture_context argument to all torture tests (This used to be commit 3c7a5ce29108dd82210dc3e1f00414f545949e1d) --- source4/torture/rpc/eventlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 1372dd6b73..381b34a49c 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -222,7 +222,7 @@ static BOOL test_OpenEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return True; } -BOOL torture_rpc_eventlog(void) +BOOL torture_rpc_eventlog(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; -- cgit From 8773e743c518578584d07d35ffdafdd598af88b0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 16 Oct 2006 13:06:41 +0000 Subject: r19339: Merge my 4.0-unittest branch. This adds an API for more fine-grained output in the testsuite rather than just True or False for a set of tests. The aim is to use this for: * known failure lists (run all tests and detect tests that started working or started failing). This would allow us to get rid of the RPC-SAMBA3-* tests * nicer torture output * simplification of the testsuite system * compatibility with other unit testing systems * easier usage of smbtorture (being able to run one test and automatically set up the environment for that) This is still a work-in-progress; expect more updates over the next couple of days. (This used to be commit 0eb6097305776325c75081356309115f445a7218) --- source4/torture/rpc/eventlog.c | 255 ++++++++++++++++++++--------------------- 1 file changed, 123 insertions(+), 132 deletions(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 381b34a49c..3ecc1a422b 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -34,38 +34,72 @@ static void init_lsa_String(struct lsa_String *name, const char *s) name->size = name->length; } -static BOOL test_GetNumRecords(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, - struct policy_handle *handle) +static bool get_policy_handle(struct torture_context *tctx, + struct dcerpc_pipe *p, + struct policy_handle *handle) +{ + struct eventlog_OpenEventLogW r; + struct eventlog_OpenUnknown0 unknown0; + + unknown0.unknown0 = 0x005c; + unknown0.unknown1 = 0x0001; + + r.in.unknown0 = &unknown0; + init_lsa_String(&r.in.logname, "dns server"); + init_lsa_String(&r.in.servername, NULL); + r.in.unknown2 = 0x00000001; + r.in.unknown3 = 0x00000001; + r.out.handle = handle; + + torture_assert_ntstatus_ok(tctx, + dcerpc_eventlog_OpenEventLogW(p, tctx, &r), + "OpenEventLog failed"); + + torture_assert_ntstatus_ok(tctx, r.out.result, "OpenEventLog failed"); + + return true; +} + + + +static bool test_GetNumRecords(struct torture_context *tctx, struct dcerpc_pipe *p) { - NTSTATUS status; struct eventlog_GetNumRecords r; + struct eventlog_CloseEventLog cr; + struct policy_handle handle; - printf("\ntesting GetNumRecords\n"); + if (!get_policy_handle(tctx, p, &handle)) + return false; - r.in.handle = handle; + r.in.handle = &handle; - status = dcerpc_eventlog_GetNumRecords(p, mem_ctx, &r); + torture_assert_ntstatus_ok(tctx, + dcerpc_eventlog_GetNumRecords(p, tctx, &r), + "GetNumRecords failed"); - if (!NT_STATUS_IS_OK(status)) { - printf("GetNumRecords failed - %s\n", nt_errstr(status)); - return False; - } + torture_comment(tctx, talloc_asprintf(tctx, "%d records\n", r.out.number)); - printf("%d records\n", r.out.number); + cr.in.handle = cr.out.handle = &handle; - return True; + torture_assert_ntstatus_ok(tctx, + dcerpc_eventlog_CloseEventLog(p, tctx, &cr), + "CloseEventLog failed"); + return true; } -static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, - struct policy_handle *handle) +static bool test_ReadEventLog(struct torture_context *tctx, + struct dcerpc_pipe *p) { NTSTATUS status; struct eventlog_ReadEventLogW r; + struct eventlog_CloseEventLog cr; + struct policy_handle handle; - printf("\ntesting ReadEventLog\n"); + if (!get_policy_handle(tctx, p, &handle)) + return false; r.in.offset = 0; - r.in.handle = handle; + r.in.handle = &handle; r.in.flags = EVENTLOG_BACKWARDS_READ|EVENTLOG_SEQUENTIAL_READ; while (1) { @@ -78,185 +112,142 @@ static BOOL test_ReadEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.in.number_of_bytes = 0; r.out.data = NULL; - status = dcerpc_eventlog_ReadEventLogW(p, mem_ctx, &r); + status = dcerpc_eventlog_ReadEventLogW(p, tctx, &r); if (NT_STATUS_EQUAL(r.out.result, NT_STATUS_END_OF_FILE)) { break; } - if (!NT_STATUS_EQUAL(r.out.result, NT_STATUS_BUFFER_TOO_SMALL)) { - printf("ReadEventLog failed - %s\n", nt_errstr(r.out.result)); - return False; - } + torture_assert_ntstatus_ok(tctx, status, "ReadEventLog failed"); + + torture_assert_ntstatus_equal(tctx, r.out.result, NT_STATUS_BUFFER_TOO_SMALL, + "ReadEventLog failed"); /* Now read the actual record */ r.in.number_of_bytes = r.out.real_size; - r.out.data = talloc_size(mem_ctx, r.in.number_of_bytes); + r.out.data = talloc_size(tctx, r.in.number_of_bytes); - status = dcerpc_eventlog_ReadEventLogW(p, mem_ctx, &r); + status = dcerpc_eventlog_ReadEventLogW(p, tctx, &r); - if (!NT_STATUS_IS_OK(status)) { - printf("ReadEventLog failed - %s\n", nt_errstr(status)); - return False; - } + torture_assert_ntstatus_ok(tctx, status, "ReadEventLog failed"); /* Decode a user-marshalled record */ blob.length = r.out.sent_size; - blob.data = talloc_steal(mem_ctx, r.out.data); + blob.data = talloc_steal(tctx, r.out.data); - ndr = ndr_pull_init_blob(&blob, mem_ctx); + ndr = ndr_pull_init_blob(&blob, tctx); status = ndr_pull_eventlog_Record( ndr, NDR_SCALARS|NDR_BUFFERS, &rec); NDR_PRINT_DEBUG(eventlog_Record, &rec); - if (!NT_STATUS_IS_OK(status)) { - printf("ReadEventLog failed parsing event log record " - "- %s\n", nt_errstr(status)); - return False; - } + torture_assert_ntstatus_ok(tctx, status, + "ReadEventLog failed parsing event log record"); r.in.offset++; } - return True; -} - -static BOOL test_CloseEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, - struct policy_handle *handle) -{ - NTSTATUS status; - struct eventlog_CloseEventLog r; + cr.in.handle = cr.out.handle = &handle; - 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; - } + torture_assert_ntstatus_ok(tctx, + dcerpc_eventlog_CloseEventLog(p, tctx, &cr), + "CloseEventLog failed"); - return True; + return true; } -static BOOL test_FlushEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, - struct policy_handle *handle) +static bool test_FlushEventLog(struct torture_context *tctx, + struct dcerpc_pipe *p) { - NTSTATUS status; struct eventlog_FlushEventLog r; + struct eventlog_CloseEventLog cr; + struct policy_handle handle; - r.in.handle = handle; - - printf("Testing FlushEventLog\n"); + if (!get_policy_handle(tctx, p, &handle)) + return false; - status = dcerpc_eventlog_FlushEventLog(p, mem_ctx, &r); + r.in.handle = &handle; /* Huh? Does this RPC always return access denied? */ + torture_assert_ntstatus_equal(tctx, + dcerpc_eventlog_FlushEventLog(p, tctx, &r), + NT_STATUS_ACCESS_DENIED, + "FlushEventLog failed"); - if (!NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) { - printf("FlushEventLog failed - %s\n", nt_errstr(status)); - return False; - } + cr.in.handle = cr.out.handle = &handle; + + torture_assert_ntstatus_ok(tctx, + dcerpc_eventlog_CloseEventLog(p, tctx, &cr), + "CloseEventLog failed"); - return True; + return true; } -static BOOL test_ClearEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, - struct policy_handle *handle) +static bool test_ClearEventLog(struct dcerpc_pipe *p, TALLOC_CTX *tctx) { - NTSTATUS status; struct eventlog_ClearEventLogW r; + struct eventlog_CloseEventLog cr; + struct policy_handle handle; - r.in.handle = handle; + if (!get_policy_handle(tctx, p, &handle)) + return false; + + r.in.handle = &handle; r.in.unknown = NULL; - printf("Testing ClearEventLog\n"); + torture_assert_ntstatus_ok(tctx, + dcerpc_eventlog_ClearEventLogW(p, tctx, &r), + "ClearEventLog failed"); - status = dcerpc_eventlog_ClearEventLogW(p, mem_ctx, &r); + cr.in.handle = cr.out.handle = &handle; - if (!NT_STATUS_IS_OK(status)) { - printf("ClearEventLog failed - %s\n", nt_errstr(status)); - return False; - } + torture_assert_ntstatus_ok(tctx, + dcerpc_eventlog_CloseEventLog(p, tctx, &cr), + "CloseEventLog failed"); - return True; + return true; } -static BOOL test_OpenEventLog(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, - struct policy_handle *handle) +static bool test_OpenEventLog(struct torture_context *tctx, + struct dcerpc_pipe *p) { - NTSTATUS status; - struct eventlog_OpenEventLogW r; - struct eventlog_OpenUnknown0 unknown0; - - printf("\ntesting OpenEventLog\n"); - - unknown0.unknown0 = 0x005c; - unknown0.unknown1 = 0x0001; - - r.in.unknown0 = &unknown0; - init_lsa_String(&r.in.logname, "dns server"); - init_lsa_String(&r.in.servername, NULL); - r.in.unknown2 = 0x00000001; - r.in.unknown3 = 0x00000001; - r.out.handle = handle; + struct policy_handle handle; + struct eventlog_CloseEventLog cr; - status = dcerpc_eventlog_OpenEventLogW(p, mem_ctx, &r); + if (!get_policy_handle(tctx, p, &handle)) + return false; - if (!NT_STATUS_IS_OK(status)) { - printf("OpenEventLog failed - %s\n", nt_errstr(status)); - return False; - } + cr.in.handle = cr.out.handle = &handle; - if (!NT_STATUS_IS_OK(r.out.result)) { - printf("OpenEventLog failed - %s\n", nt_errstr(r.out.result)); - return False; - } + torture_assert_ntstatus_ok(tctx, + dcerpc_eventlog_CloseEventLog(p, tctx, &cr), + "CloseEventLog failed"); - return True; + return true; } -BOOL torture_rpc_eventlog(struct torture_context *torture) +struct torture_suite *torture_rpc_eventlog(void) { - NTSTATUS status; - struct dcerpc_pipe *p; - struct policy_handle handle; - TALLOC_CTX *mem_ctx; - BOOL ret = True; - - mem_ctx = talloc_init("torture_rpc_atsvc"); + struct torture_suite *suite; + struct torture_tcase *tcase; - status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_eventlog); + suite = torture_suite_create(talloc_autofree_context(), "EVENTLOG"); + tcase = torture_suite_add_rpc_iface_tcase(suite, "eventlog", + &dcerpc_table_eventlog); - if (!NT_STATUS_IS_OK(status)) { - talloc_free(mem_ctx); - return False; - } - - if (!test_OpenEventLog(p, mem_ctx, &handle)) { - talloc_free(mem_ctx); - return False; - } + torture_rpc_tcase_add_test(tcase, "OpenEventLog", test_OpenEventLog); #if 0 - ret &= test_ClearEventLog(p, mem_ctx, &handle); /* Destructive test */ + /* Destructive test */ + torture_rpc_tcase_add_test(tcase, "ClearEventLog", test_ClearEventLog); #endif - ret &= test_GetNumRecords(p, mem_ctx, &handle); - - ret &= test_ReadEventLog(p, mem_ctx, &handle); - - ret &= test_FlushEventLog(p, mem_ctx, &handle); - - ret &= test_CloseEventLog(p, mem_ctx, &handle); - - talloc_free(mem_ctx); + torture_rpc_tcase_add_test(tcase, "GetNumRecords", test_GetNumRecords); + torture_rpc_tcase_add_test(tcase, "ReadEventLog", test_ReadEventLog); + torture_rpc_tcase_add_test(tcase, "FlushEventLog", test_FlushEventLog); - return ret; + return suite; } -- cgit From 68ebe2572406aaf7f61cd0b51fd02b5c11502a80 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 23 Nov 2006 00:34:31 +0000 Subject: r19850: Fix IDL warnings. (This used to be commit 92b8bde561277a6b83048ce003cc29ff1b380255) --- source4/torture/rpc/eventlog.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 3ecc1a422b..01a07a680d 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -77,7 +77,7 @@ static bool test_GetNumRecords(struct torture_context *tctx, struct dcerpc_pipe dcerpc_eventlog_GetNumRecords(p, tctx, &r), "GetNumRecords failed"); - torture_comment(tctx, talloc_asprintf(tctx, "%d records\n", r.out.number)); + torture_comment(tctx, talloc_asprintf(tctx, "%d records\n", *r.out.number)); cr.in.handle = cr.out.handle = &handle; @@ -125,7 +125,7 @@ static bool test_ReadEventLog(struct torture_context *tctx, /* Now read the actual record */ - r.in.number_of_bytes = r.out.real_size; + r.in.number_of_bytes = *r.out.real_size; r.out.data = talloc_size(tctx, r.in.number_of_bytes); status = dcerpc_eventlog_ReadEventLogW(p, tctx, &r); @@ -134,7 +134,7 @@ static bool test_ReadEventLog(struct torture_context *tctx, /* Decode a user-marshalled record */ - blob.length = r.out.sent_size; + blob.length = *r.out.sent_size; blob.data = talloc_steal(tctx, r.out.data); ndr = ndr_pull_init_blob(&blob, tctx); -- cgit From 537e7738928d7ac1c3fe983e87e266d0db5f621e Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 12 Apr 2007 11:24:51 +0000 Subject: r22192: fix compiler warnings ClearEventLog test is compiled in but disabled now metze (This used to be commit 19fb09970a7bb1c52e616ae9402ea843139a5414) --- source4/torture/rpc/eventlog.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 01a07a680d..ae0283ea99 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -77,7 +77,7 @@ static bool test_GetNumRecords(struct torture_context *tctx, struct dcerpc_pipe dcerpc_eventlog_GetNumRecords(p, tctx, &r), "GetNumRecords failed"); - torture_comment(tctx, talloc_asprintf(tctx, "%d records\n", *r.out.number)); + torture_comment(tctx, "%d records\n", *r.out.number); cr.in.handle = cr.out.handle = &handle; @@ -186,12 +186,17 @@ static bool test_FlushEventLog(struct torture_context *tctx, return true; } -static bool test_ClearEventLog(struct dcerpc_pipe *p, TALLOC_CTX *tctx) +static bool test_ClearEventLog(struct torture_context *tctx, + struct dcerpc_pipe *p) { struct eventlog_ClearEventLogW r; struct eventlog_CloseEventLog cr; struct policy_handle handle; + if (!torture_setting_bool(tctx, "dangerous", false)) { + torture_skip(tctx, "ClearEventLog test disabled - enable dangerous tests to use"); + } + if (!get_policy_handle(tctx, p, &handle)) return false; @@ -236,15 +241,10 @@ struct torture_suite *torture_rpc_eventlog(void) suite = torture_suite_create(talloc_autofree_context(), "EVENTLOG"); tcase = torture_suite_add_rpc_iface_tcase(suite, "eventlog", - &dcerpc_table_eventlog); + &dcerpc_table_eventlog); torture_rpc_tcase_add_test(tcase, "OpenEventLog", test_OpenEventLog); - -#if 0 - /* Destructive test */ torture_rpc_tcase_add_test(tcase, "ClearEventLog", test_ClearEventLog); -#endif - torture_rpc_tcase_add_test(tcase, "GetNumRecords", test_GetNumRecords); torture_rpc_tcase_add_test(tcase, "ReadEventLog", test_ReadEventLog); torture_rpc_tcase_add_test(tcase, "FlushEventLog", test_FlushEventLog); -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/torture/rpc/eventlog.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index ae0283ea99..7961ec56ce 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -7,7 +7,7 @@ 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 + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,8 +16,7 @@ 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. + along with this program. If not, see . */ #include "includes.h" -- cgit From f14bd1a90ab47a418c0ec2492990a417a0bb3bf6 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 19 Aug 2007 21:23:03 +0000 Subject: r24557: rename 'dcerpc_table_' -> 'ndr_table_' metze (This used to be commit 84651aee81aaabbebf52ffc3fbcbabb2eec6eed5) --- source4/torture/rpc/eventlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 7961ec56ce..0c4ee14f85 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -240,7 +240,7 @@ struct torture_suite *torture_rpc_eventlog(void) suite = torture_suite_create(talloc_autofree_context(), "EVENTLOG"); tcase = torture_suite_add_rpc_iface_tcase(suite, "eventlog", - &dcerpc_table_eventlog); + &ndr_table_eventlog); torture_rpc_tcase_add_test(tcase, "OpenEventLog", test_OpenEventLog); torture_rpc_tcase_add_test(tcase, "ClearEventLog", test_ClearEventLog); -- cgit From 18302e7030e568d23f13717cb006193490e4213d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 28 Aug 2007 16:24:18 +0000 Subject: r24751: Run more tests, remove empty testsuites, more small improvements. (This used to be commit 2a5a0819eea86ba322434306e062d13893b5722e) --- source4/torture/rpc/eventlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 0c4ee14f85..1c72625f73 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -236,7 +236,7 @@ static bool test_OpenEventLog(struct torture_context *tctx, struct torture_suite *torture_rpc_eventlog(void) { struct torture_suite *suite; - struct torture_tcase *tcase; + struct torture_rpc_tcase *tcase; suite = torture_suite_create(talloc_autofree_context(), "EVENTLOG"); tcase = torture_suite_add_rpc_iface_tcase(suite, "eventlog", -- cgit From d05d5da1e8cfd64f2c5b1c0ee1b2c71bb65ae441 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 31 Aug 2007 15:43:03 +0000 Subject: r24846: Use metadata about dangerous tests. (This used to be commit f914b828ff486d41e123e6dafa1c8fd76b34b44b) --- source4/torture/rpc/eventlog.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 1c72625f73..99208eb7ea 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -192,10 +192,6 @@ static bool test_ClearEventLog(struct torture_context *tctx, struct eventlog_CloseEventLog cr; struct policy_handle handle; - if (!torture_setting_bool(tctx, "dangerous", false)) { - torture_skip(tctx, "ClearEventLog test disabled - enable dangerous tests to use"); - } - if (!get_policy_handle(tctx, p, &handle)) return false; @@ -237,13 +233,16 @@ struct torture_suite *torture_rpc_eventlog(void) { struct torture_suite *suite; struct torture_rpc_tcase *tcase; + struct torture_test *test; suite = torture_suite_create(talloc_autofree_context(), "EVENTLOG"); tcase = torture_suite_add_rpc_iface_tcase(suite, "eventlog", &ndr_table_eventlog); torture_rpc_tcase_add_test(tcase, "OpenEventLog", test_OpenEventLog); - torture_rpc_tcase_add_test(tcase, "ClearEventLog", test_ClearEventLog); + test = torture_rpc_tcase_add_test(tcase, "ClearEventLog", + test_ClearEventLog); + test->dangerous = true; torture_rpc_tcase_add_test(tcase, "GetNumRecords", test_GetNumRecords); torture_rpc_tcase_add_test(tcase, "ReadEventLog", test_ReadEventLog); torture_rpc_tcase_add_test(tcase, "FlushEventLog", test_FlushEventLog); -- cgit From 7fd416bd3e0d9cf602f441c9d4a1750544cba8e5 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 31 Aug 2007 22:34:52 +0000 Subject: r24855: Convert RPC-DRSUAPI, RPC-SCHANNEL to use the torture API. (This used to be commit dadcc4708e1813c0b657f1d357c2ae202ea4ec5a) --- source4/torture/rpc/eventlog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 99208eb7ea..539923a2e0 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -229,13 +229,13 @@ static bool test_OpenEventLog(struct torture_context *tctx, return true; } -struct torture_suite *torture_rpc_eventlog(void) +struct torture_suite *torture_rpc_eventlog(TALLOC_CTX *mem_ctx) { struct torture_suite *suite; struct torture_rpc_tcase *tcase; struct torture_test *test; - suite = torture_suite_create(talloc_autofree_context(), "EVENTLOG"); + suite = torture_suite_create(mem_ctx, "EVENTLOG"); tcase = torture_suite_add_rpc_iface_tcase(suite, "eventlog", &ndr_table_eventlog); -- cgit From 98b57d5eb61094a9c88e2f7d90d3e21b7e74e9d8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 16:46:30 +0000 Subject: r25035: Fix some more warnings, use service pointer rather than service number in more places. (This used to be commit df9cebcb97e20564359097148665bd519f31bc6f) --- source4/torture/rpc/eventlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 539923a2e0..c1d863454c 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -125,7 +125,7 @@ static bool test_ReadEventLog(struct torture_context *tctx, /* Now read the actual record */ r.in.number_of_bytes = *r.out.real_size; - r.out.data = talloc_size(tctx, r.in.number_of_bytes); + r.out.data = talloc_array(tctx, uint8_t, r.in.number_of_bytes); status = dcerpc_eventlog_ReadEventLogW(p, tctx, &r); -- cgit From 529763a9aa192a6785ba878aceeb1683c2510913 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 9 Nov 2007 19:24:51 +0100 Subject: r25920: ndr: change NTSTAUS into enum ndr_err_code (samba4 callers) lib/messaging/ lib/registry/ lib/ldb-samba/ librpc/rpc/ auth/auth_winbind.c auth/gensec/ auth/kerberos/ dsdb/repl/ dsdb/samdb/ dsdb/schema/ torture/ cluster/ctdb/ kdc/ ntvfs/ipc/ torture/rap/ ntvfs/ utils/getntacl.c ntptr/ smb_server/ libcli/wrepl/ wrepl_server/ libcli/cldap/ libcli/dgram/ libcli/ldap/ libcli/raw/ libcli/nbt/ libnet/ winbind/ rpc_server/ metze (This used to be commit 6223c7fddc972687eb577e04fc1c8e0604c35435) --- source4/torture/rpc/eventlog.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index c1d863454c..64b012fba6 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -105,6 +105,7 @@ static bool test_ReadEventLog(struct torture_context *tctx, DATA_BLOB blob; struct eventlog_Record rec; struct ndr_pull *ndr; + enum ndr_err_code ndr_err; /* Read first for number of bytes in record */ @@ -138,8 +139,9 @@ static bool test_ReadEventLog(struct torture_context *tctx, ndr = ndr_pull_init_blob(&blob, tctx); - status = ndr_pull_eventlog_Record( + ndr_err = ndr_pull_eventlog_Record( ndr, NDR_SCALARS|NDR_BUFFERS, &rec); + status = ndr_map_error2ntstatus(ndr_err); NDR_PRINT_DEBUG(eventlog_Record, &rec); -- cgit From d1e716cf4331bf09cfe15a6634bc5887aff81d20 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 13 Dec 2007 22:46:27 +0100 Subject: r26432: Require ndr_pull users to specify iconv_convenience. (This used to be commit 28b1d36551b75241c1cf9fca5d74f45a6dc884ab) --- source4/torture/rpc/eventlog.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 64b012fba6..047146edaf 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -25,6 +25,7 @@ #include "librpc/gen_ndr/ndr_eventlog_c.h" #include "librpc/gen_ndr/ndr_lsa.h" #include "torture/rpc/rpc.h" +#include "param/param.h" static void init_lsa_String(struct lsa_String *name, const char *s) { @@ -137,7 +138,7 @@ static bool test_ReadEventLog(struct torture_context *tctx, blob.length = *r.out.sent_size; blob.data = talloc_steal(tctx, r.out.data); - ndr = ndr_pull_init_blob(&blob, tctx); + ndr = ndr_pull_init_blob(&blob, tctx, lp_iconv_convenience(tctx->lp_ctx)); ndr_err = ndr_pull_eventlog_Record( ndr, NDR_SCALARS|NDR_BUFFERS, &rec); -- cgit From a9d30b0d61a6a3363dc659c3e07ce1615c5e85df Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 13 Feb 2008 14:52:53 +0100 Subject: torture/eventlog: fix crash bugs! This bug was introduced in 92b8bde561277a6b83048ce003cc29ff1b380255 and this shows that we need to be very, very careful in changing idl elements from scalars to [ref] pointers! metze (This used to be commit 3ec4bce0b64764e364aedea2800eed296805c51e) --- source4/torture/rpc/eventlog.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 047146edaf..4701fdfe4d 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -67,11 +67,14 @@ static bool test_GetNumRecords(struct torture_context *tctx, struct dcerpc_pipe struct eventlog_GetNumRecords r; struct eventlog_CloseEventLog cr; struct policy_handle handle; + uint32_t number = 0; if (!get_policy_handle(tctx, p, &handle)) return false; + ZERO_STRUCT(r); r.in.handle = &handle; + r.out.number = &number; torture_assert_ntstatus_ok(tctx, dcerpc_eventlog_GetNumRecords(p, tctx, &r), @@ -98,6 +101,7 @@ static bool test_ReadEventLog(struct torture_context *tctx, if (!get_policy_handle(tctx, p, &handle)) return false; + ZERO_STRUCT(r); r.in.offset = 0; r.in.handle = &handle; r.in.flags = EVENTLOG_BACKWARDS_READ|EVENTLOG_SEQUENTIAL_READ; @@ -107,11 +111,15 @@ static bool test_ReadEventLog(struct torture_context *tctx, struct eventlog_Record rec; struct ndr_pull *ndr; enum ndr_err_code ndr_err; + uint32_t sent_size = 0; + uint32_t real_size = 0; /* Read first for number of bytes in record */ r.in.number_of_bytes = 0; r.out.data = NULL; + r.out.sent_size = &sent_size; + r.out.real_size = &real_size; status = dcerpc_eventlog_ReadEventLogW(p, tctx, &r); -- cgit From 60e205c34c4a28060f47ba1aa7c7592d33d302bc Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 13 Feb 2008 16:20:23 +0100 Subject: torture/eventlog: the NTSTATUS of dcerpc_ functions is the same as r.out.result metze (This used to be commit 0c5539e5fedd4123f61d50ee29acdc5a5f0faf76) --- source4/torture/rpc/eventlog.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source4/torture/rpc/eventlog.c') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 4701fdfe4d..feeeb9330b 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -127,8 +127,6 @@ static bool test_ReadEventLog(struct torture_context *tctx, break; } - torture_assert_ntstatus_ok(tctx, status, "ReadEventLog failed"); - torture_assert_ntstatus_equal(tctx, r.out.result, NT_STATUS_BUFFER_TOO_SMALL, "ReadEventLog failed"); -- cgit