From c7d7022e7783c216bc4d1703564738e6872737d4 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 11 Jul 2006 20:54:05 +0000 Subject: r16956: Walk some of the samba3 srvsvc code (This used to be commit bd84fde777366899391d122e0aa5034ba0b80037) --- source4/torture/rpc/rpc.c | 1 + source4/torture/rpc/samba3rpc.c | 122 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 122 insertions(+), 1 deletion(-) diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c index a89ffc71d2..eaa2932587 100644 --- a/source4/torture/rpc/rpc.c +++ b/source4/torture/rpc/rpc.c @@ -129,6 +129,7 @@ NTSTATUS torture_rpc_init(void) register_torture_op("RPC-BINDSAMBA3", torture_bind_samba3); register_torture_op("RPC-NETLOGSAMBA3", torture_netlogon_samba3); register_torture_op("RPC-SAMBA3SESSIONKEY", torture_samba3_sessionkey); + register_torture_op("RPC-SAMBA3-SRVSVC", torture_samba3_rpc_srvsvc); register_torture_op("RPC-DRSUAPI", torture_rpc_drsuapi); register_torture_op("RPC-CRACKNAMES", torture_rpc_drsuapi_cracknames); register_torture_op("RPC-ROT", torture_rpc_rot); diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index 1e2d40fc42..a54e502e4f 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -28,6 +28,8 @@ #include "librpc/gen_ndr/ndr_samr_c.h" #include "librpc/gen_ndr/ndr_netlogon.h" #include "librpc/gen_ndr/ndr_netlogon_c.h" +#include "librpc/gen_ndr/ndr_srvsvc.h" +#include "librpc/gen_ndr/ndr_srvsvc_c.h" #include "lib/cmdline/popt_common.h" #include "librpc/rpc/dcerpc.h" #include "torture/rpc/rpc.h" @@ -1139,7 +1141,7 @@ BOOL torture_samba3_sessionkey(struct torture_context *torture) wks_name = get_myname(); } - mem_ctx = talloc_init("torture_bind_authcontext"); + mem_ctx = talloc_init("torture_samba3_sessionkey"); if (mem_ctx == NULL) { d_printf("talloc_init failed\n"); @@ -1211,3 +1213,121 @@ BOOL torture_samba3_sessionkey(struct torture_context *torture) return ret; } + +static BOOL test_NetShareGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + const char *sharename) +{ + NTSTATUS status; + struct srvsvc_NetShareGetInfo r; + uint32_t levels[] = { 0, 1, 2, 501, 502, 1004, 1005, 1006, 1007 }; + int i; + BOOL ret = True; + + r.in.server_unc = talloc_asprintf(mem_ctx, "\\\\%s", + dcerpc_server_name(p)); + r.in.share_name = sharename; + + for (i=0;icount = 0; + r.in.ctr.ctr0->array = NULL; + r.in.max_buffer = (uint32_t)-1; + r.in.resume_handle = NULL; + + for (i=0;icount > 0) { + *one_sharename = ctr->array[0].name; + } + } + } + + return ret; +} + +BOOL torture_samba3_rpc_srvsvc(struct torture_context *torture) +{ + NTSTATUS status; + struct dcerpc_pipe *p; + TALLOC_CTX *mem_ctx; + BOOL ret = True; + const char *sharename = NULL; + + if (!(mem_ctx = talloc_new(torture))) { + return False; + } + + status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_srvsvc); + if (!NT_STATUS_IS_OK(status)) { + printf("torture_rpc_connection failed: %s\n", + nt_errstr(status)); + ret = False; + goto done; + } + + ret &= test_NetShareEnum(p, mem_ctx, &sharename); + if (sharename == NULL) { + printf("did not get sharename\n"); + } else { + ret &= test_NetShareGetInfo(p, mem_ctx, sharename); + } + done: + talloc_free(mem_ctx); + return ret; +} -- cgit