From 554972d1d2ede7598eff3450f17c3de0d85fe2e8 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 11 Oct 2006 15:26:03 +0000 Subject: r19247: Ok, figured out that wkssvc wksgetinfo also gives the server name. I thought I had tested that w2k3 copies the input server name to output. Volker (This used to be commit b7e54501f773a11892ab5ef3202ee4d57723725e) --- source4/torture/rpc/samba3rpc.c | 73 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) (limited to 'source4/torture/rpc/samba3rpc.c') diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index 24799d2a16..56a4adfe57 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -36,6 +36,8 @@ #include "librpc/gen_ndr/ndr_srvsvc_c.h" #include "librpc/gen_ndr/ndr_spoolss.h" #include "librpc/gen_ndr/ndr_spoolss_c.h" +#include "librpc/gen_ndr/ndr_wkssvc.h" +#include "librpc/gen_ndr/ndr_wkssvc_c.h" #include "lib/cmdline/popt_common.h" #include "librpc/rpc/dcerpc.h" #include "torture/rpc/rpc.h" @@ -2560,3 +2562,74 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) return ret; } + +BOOL torture_samba3_rpc_wkssvc(struct torture_context *torture) +{ + TALLOC_CTX *mem_ctx; + struct smbcli_state *cli; + struct dcerpc_pipe *p; + NTSTATUS status; + char *servername; + + if (!(mem_ctx = talloc_new(torture))) { + return False; + } + + if (!(torture_open_connection_share( + mem_ctx, &cli, lp_parm_string(-1, "torture", "host"), + "IPC$", NULL))) { + d_printf("IPC$ connection failed\n"); + talloc_free(mem_ctx); + return False; + } + + status = get_servername(mem_ctx, cli->tree, &servername); + if (!NT_STATUS_IS_OK(status)) { + d_fprintf(stderr, "(%s) get_servername returned %s\n", + __location__, nt_errstr(status)); + talloc_free(mem_ctx); + return False; + } + + status = pipe_bind_smb(mem_ctx, cli->tree, "\\wkssvc", + &dcerpc_table_wkssvc, &p); + if (!NT_STATUS_IS_OK(status)) { + d_printf("(%s) pipe_bind_smb failed: %s\n", __location__, + nt_errstr(status)); + talloc_free(mem_ctx); + return False; + } + + { + struct wkssvc_NetWkstaInfo100 wks100; + union wkssvc_NetWkstaInfo info; + struct wkssvc_NetWkstaGetInfo r; + + r.in.server_name = "\\foo"; + r.in.level = 100; + info.info100 = &wks100; + r.out.info = &info; + + status = dcerpc_wkssvc_NetWkstaGetInfo(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) { + d_printf("(%s) dcerpc_wkssvc_NetWksGetInfo failed: " + "%s, %s\n", __location__, nt_errstr(status), + win_errstr(r.out.result)); + talloc_free(mem_ctx); + return False; + } + + if (strcmp(servername, + r.out.info->info100->server_name) != 0) { + d_printf("(%s) servername inconsistency: RAP=%s, " + "dcerpc_wkssvc_NetWksGetInfo=%s", + __location__, servername, + r.out.info->info100->server_name); + talloc_free(mem_ctx); + return False; + } + } + + talloc_free(mem_ctx); + return True; +} -- cgit