summaryrefslogtreecommitdiff
path: root/source4/torture/rap
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2011-03-18 01:23:53 +0100
committerGünther Deschner <gd@samba.org>2011-03-18 02:11:38 +0100
commitde5cec48a4660eb6b4dd4138e3aff11a4ed57cdc (patch)
treeb4e83d877638af78fa284d187bd3b37d5d37caae /source4/torture/rap
parent26ddcd3da1aa7903a08accea4e9d1ffaac1cae0a (diff)
downloadsamba-de5cec48a4660eb6b4dd4138e3aff11a4ed57cdc.tar.gz
samba-de5cec48a4660eb6b4dd4138e3aff11a4ed57cdc.tar.bz2
samba-de5cec48a4660eb6b4dd4138e3aff11a4ed57cdc.zip
s4-smbtorture: add netsessiongetinfo() test.
Guenther Autobuild-User: Günther Deschner <gd@samba.org> Autobuild-Date: Fri Mar 18 02:11:38 CET 2011 on sn-devel-104
Diffstat (limited to 'source4/torture/rap')
-rw-r--r--source4/torture/rap/rap.c60
1 files changed, 60 insertions, 0 deletions
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);