diff options
author | Günther Deschner <gd@samba.org> | 2011-03-18 01:23:53 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2011-03-18 02:11:38 +0100 |
commit | de5cec48a4660eb6b4dd4138e3aff11a4ed57cdc (patch) | |
tree | b4e83d877638af78fa284d187bd3b37d5d37caae | |
parent | 26ddcd3da1aa7903a08accea4e9d1ffaac1cae0a (diff) | |
download | samba-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
-rw-r--r-- | source3/selftest/knownfail | 1 | ||||
-rw-r--r-- | source4/selftest/knownfail | 1 | ||||
-rw-r--r-- | source4/torture/rap/rap.c | 60 |
3 files changed, 62 insertions, 0 deletions
diff --git a/source3/selftest/knownfail b/source3/selftest/knownfail index ad8065a2ca..95f01f64dc 100644 --- a/source3/selftest/knownfail +++ b/source3/selftest/knownfail @@ -11,3 +11,4 @@ samba3.smbtorture_s3.*OPLOCK4 # fails sometimes on sn-devel samba3.posix_s3.nbt.dgram.*netlogon2 samba3.*rap.sam.*.useradd # Not provided by Samba 3 samba3.*rap.sam.*.userdelete # Not provided by Samba 3 +samba3.*rap.basic.*.netsessiongetinfo # Not provided by Samba 3 diff --git a/source4/selftest/knownfail b/source4/selftest/knownfail index a9cc4446c4..cdd7a2d306 100644 --- a/source4/selftest/knownfail +++ b/source4/selftest/knownfail @@ -40,6 +40,7 @@ samba4.base.charset.*.Testing partial surrogate .*net.api.delshare.* # DelShare isn't implemented yet samba4.rap.*netservergetinfo samba4.rap.*netsessionenum +samba4.rap.*netsessiongetinfo samba4.smb2.persistent.handles1 samba4.winbind.struct.*.show_sequence # Not yet working in winbind samba4.winbind.struct.*.getpwent # Not yet working in winbind 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); |