From de5cec48a4660eb6b4dd4138e3aff11a4ed57cdc Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 18 Mar 2011 01:23:53 +0100 Subject: s4-smbtorture: add netsessiongetinfo() test. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guenther Autobuild-User: Günther Deschner Autobuild-Date: Fri Mar 18 02:11:38 CET 2011 on sn-devel-104 --- source4/torture/rap/rap.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'source4/torture') diff --git a/source4/torture/rap/rap.c b/source4/torture/rap/rap.c index c31979f0b2..5c1c5e196c 100644 --- a/source4/torture/rap/rap.c +++ b/source4/torture/rap/rap.c @@ -149,6 +149,64 @@ static bool test_netsessionenum(struct torture_context *tctx, return true; } +static bool test_netsessiongetinfo_bysession(struct torture_context *tctx, + struct smbcli_state *cli, + const char *session) +{ + struct rap_NetSessionGetInfo r; + int i; + uint16_t levels[] = { 2 }; + + if (session && session[0] == '\\' && session[1] == '\\') { + r.in.SessionName = session; + } else { + r.in.SessionName = talloc_asprintf(tctx, "\\\\%s", session); + } + r.in.bufsize = 0xffff; + + for (i=0; i < ARRAY_SIZE(levels); i++) { + + r.in.level = levels[i]; + + torture_assert_ntstatus_ok(tctx, + smbcli_rap_netsessiongetinfo(cli->tree, tctx, &r), + "rap_netsessiongetinfo failed"); + torture_assert_werr_ok(tctx, W_ERROR(r.out.status), + "rap_netsessiongetinfo failed"); + } + + return true; +} + +static bool test_netsessiongetinfo(struct torture_context *tctx, + struct smbcli_state *cli) +{ + struct rap_NetSessionEnum r; + int i,n; + uint16_t levels[] = { 2 }; + + for (i=0; i < ARRAY_SIZE(levels); i++) { + + r.in.level = levels[i]; + r.in.bufsize = 8192; + + torture_assert_ntstatus_ok(tctx, + smbcli_rap_netsessionenum(cli->tree, tctx, &r), + "smbcli_rap_netsessionenum failed"); + torture_assert_werr_ok(tctx, W_ERROR(r.out.status), + "smbcli_rap_netsessionenum failed"); + + for (n=0; n < r.out.count; n++) { + torture_assert(tctx, + test_netsessiongetinfo_bysession(tctx, cli, r.out.info[n].info2.ComputerName), + "failed to query sessioninfo"); + } + } + + return true; +} + + bool torture_rap_scan(struct torture_context *torture, struct smbcli_state *cli) { int callno; @@ -186,6 +244,8 @@ NTSTATUS torture_rap_init(void) test_netservergetinfo); torture_suite_add_1smb_test(suite_basic, "netsessionenum", test_netsessionenum); + torture_suite_add_1smb_test(suite_basic, "netsessiongetinfo", + test_netsessiongetinfo); torture_suite_add_1smb_test(suite, "scan", torture_rap_scan); -- cgit