summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-05-11 16:40:26 +0200
committerGünther Deschner <gd@samba.org>2009-05-11 16:44:39 +0200
commit7347373e7cb814d683c603ed958583ff70552a2b (patch)
tree241cb49a051ce72c87323f58a06ecf677e1e181a
parentd51bb8e4e6556db64907bfdd4f42a04e2dfddea8 (diff)
downloadsamba-7347373e7cb814d683c603ed958583ff70552a2b.tar.gz
samba-7347373e7cb814d683c603ed958583ff70552a2b.tar.bz2
samba-7347373e7cb814d683c603ed958583ff70552a2b.zip
s4-smbtorture: add optional very simple reply checks to lsa lookup name tests.
Guenther
-rw-r--r--source4/torture/rpc/lsa.c41
1 files changed, 34 insertions, 7 deletions
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index e10bc77911..04a8854031 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -319,7 +319,8 @@ static bool test_LookupNames_wellknown(struct dcerpc_pipe *p,
static bool test_LookupNames2(struct dcerpc_pipe *p,
struct torture_context *tctx,
struct policy_handle *handle,
- struct lsa_TransNameArray2 *tnames)
+ struct lsa_TransNameArray2 *tnames,
+ bool check_result)
{
struct lsa_LookupNames2 r;
struct lsa_TransSidArray2 sids;
@@ -357,6 +358,14 @@ static bool test_LookupNames2(struct dcerpc_pipe *p,
return false;
}
+ if (check_result) {
+ torture_assert_int_equal(tctx, count, sids.count,
+ "unexpected number of results returned");
+ if (sids.count > 0) {
+ torture_assert(tctx, sids.sids, "invalid sid buffer");
+ }
+ }
+
printf("\n");
return true;
@@ -366,7 +375,8 @@ static bool test_LookupNames2(struct dcerpc_pipe *p,
static bool test_LookupNames3(struct dcerpc_pipe *p,
struct torture_context *tctx,
struct policy_handle *handle,
- struct lsa_TransNameArray2 *tnames)
+ struct lsa_TransNameArray2 *tnames,
+ bool check_result)
{
struct lsa_LookupNames3 r;
struct lsa_TransSidArray3 sids;
@@ -404,6 +414,14 @@ static bool test_LookupNames3(struct dcerpc_pipe *p,
return false;
}
+ if (check_result) {
+ torture_assert_int_equal(tctx, count, sids.count,
+ "unexpected number of results returned");
+ if (sids.count > 0) {
+ torture_assert(tctx, sids.sids, "invalid sid buffer");
+ }
+ }
+
printf("\n");
return true;
@@ -411,7 +429,8 @@ static bool test_LookupNames3(struct dcerpc_pipe *p,
static bool test_LookupNames4(struct dcerpc_pipe *p,
struct torture_context *tctx,
- struct lsa_TransNameArray2 *tnames)
+ struct lsa_TransNameArray2 *tnames,
+ bool check_result)
{
struct lsa_LookupNames4 r;
struct lsa_TransSidArray3 sids;
@@ -448,6 +467,14 @@ static bool test_LookupNames4(struct dcerpc_pipe *p,
return false;
}
+ if (check_result) {
+ torture_assert_int_equal(tctx, count, sids.count,
+ "unexpected number of results returned");
+ if (sids.count > 0) {
+ torture_assert(tctx, sids.sids, "invalid sid buffer");
+ }
+ }
+
printf("\n");
return true;
@@ -530,11 +557,11 @@ static bool test_LookupSids2(struct dcerpc_pipe *p,
printf("\n");
- if (!test_LookupNames2(p, tctx, handle, &names)) {
+ if (!test_LookupNames2(p, tctx, handle, &names, false)) {
return false;
}
- if (!test_LookupNames3(p, tctx, handle, &names)) {
+ if (!test_LookupNames3(p, tctx, handle, &names, false)) {
return false;
}
@@ -580,7 +607,7 @@ static bool test_LookupSids3(struct dcerpc_pipe *p,
printf("\n");
- if (!test_LookupNames4(p, tctx, &names)) {
+ if (!test_LookupNames4(p, tctx, &names, false)) {
return false;
}
@@ -668,7 +695,7 @@ bool test_many_LookupSids(struct dcerpc_pipe *p,
nt_errstr(status));
return false;
}
- if (!test_LookupNames4(p, tctx, &names)) {
+ if (!test_LookupNames4(p, tctx, &names, false)) {
return false;
}
}