diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-10-11 15:26:03 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:20:57 -0500 |
commit | 554972d1d2ede7598eff3450f17c3de0d85fe2e8 (patch) | |
tree | f20d2a2b2c97d15330211a009410781c13d239e5 | |
parent | 2bdaccaa9c794f901ddd10b57b67b8aa21ef5285 (diff) | |
download | samba-554972d1d2ede7598eff3450f17c3de0d85fe2e8.tar.gz samba-554972d1d2ede7598eff3450f17c3de0d85fe2e8.tar.bz2 samba-554972d1d2ede7598eff3450f17c3de0d85fe2e8.zip |
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)
-rw-r--r-- | source4/torture/rpc/rpc.c | 1 | ||||
-rw-r--r-- | source4/torture/rpc/samba3rpc.c | 73 |
2 files changed, 74 insertions, 0 deletions
diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c index 879fa7aa8e..24776d556d 100644 --- a/source4/torture/rpc/rpc.c +++ b/source4/torture/rpc/rpc.c @@ -136,6 +136,7 @@ NTSTATUS torture_rpc_init(void) torture_samba3_rpc_getusername); register_torture_op("RPC-SAMBA3-LSA", torture_samba3_rpc_lsa); register_torture_op("RPC-SAMBA3-SPOOLSS", torture_samba3_rpc_spoolss); + register_torture_op("RPC-SAMBA3-WKSSVC", torture_samba3_rpc_wkssvc); 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 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; +} |