summaryrefslogtreecommitdiff
path: root/source4/torture/rpc/lsa.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-10-20 23:47:40 +0200
committerGünther Deschner <gd@samba.org>2009-10-20 23:57:58 +0200
commita4d54875768bbe6bcd019a788081d182ce9d4a80 (patch)
tree15dca50e7475c673b194dc3188840d4b25fe1a08 /source4/torture/rpc/lsa.c
parente349e2c54117c528b9d194f356399c57e2a04b56 (diff)
downloadsamba-a4d54875768bbe6bcd019a788081d182ce9d4a80.tar.gz
samba-a4d54875768bbe6bcd019a788081d182ce9d4a80.tar.bz2
samba-a4d54875768bbe6bcd019a788081d182ce9d4a80.zip
s4-smbtorture: fix RPC-LSA-LSALOOKUP test against w2k3 and w2k8.
Make sure to split out lsa_LookupName NULL name test so that we can better track results from bogus names and NULL names. Guenther
Diffstat (limited to 'source4/torture/rpc/lsa.c')
-rw-r--r--source4/torture/rpc/lsa.c66
1 files changed, 50 insertions, 16 deletions
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index e4a6a8422c..9cee4e2f0c 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -232,31 +232,19 @@ static bool test_LookupNames_bogus(struct dcerpc_pipe *p,
struct lsa_LookupNames r;
struct lsa_TransSidArray sids;
struct lsa_RefDomainList *domains = NULL;
- struct lsa_String *names;
+ struct lsa_String names[1];
uint32_t count = 0;
NTSTATUS status;
- int i;
-
- struct lsa_TranslatedName name[2];
- struct lsa_TransNameArray tnames;
-
- tnames.names = name;
- tnames.count = 2;
- name[0].name.string = "NT AUTHORITY\\BOGUS";
- name[1].name.string = NULL;
- torture_comment(tctx, "\nTesting LookupNames with bogus names\n");
+ torture_comment(tctx, "\nTesting LookupNames with bogus name\n");
sids.count = 0;
sids.sids = NULL;
- names = talloc_array(tctx, struct lsa_String, tnames.count);
- for (i=0;i<tnames.count;i++) {
- init_lsa_String(&names[i], tnames.names[i].name.string);
- }
+ init_lsa_String(&names[0], "NT AUTHORITY\\BOGUS");
r.in.handle = handle;
- r.in.num_names = tnames.count;
+ r.in.num_names = 1;
r.in.names = names;
r.in.sids = &sids;
r.in.level = 1;
@@ -276,6 +264,48 @@ static bool test_LookupNames_bogus(struct dcerpc_pipe *p,
return true;
}
+static bool test_LookupNames_NULL(struct dcerpc_pipe *p,
+ struct torture_context *tctx,
+ struct policy_handle *handle)
+{
+ struct lsa_LookupNames r;
+ struct lsa_TransSidArray sids;
+ struct lsa_RefDomainList *domains = NULL;
+ struct lsa_String names[1];
+ uint32_t count = 0;
+
+ torture_comment(tctx, "\nTesting LookupNames with NULL name\n");
+
+ sids.count = 0;
+ sids.sids = NULL;
+
+ names[0].string = NULL;
+
+ r.in.handle = handle;
+ r.in.num_names = 1;
+ r.in.names = names;
+ r.in.sids = &sids;
+ r.in.level = 1;
+ r.in.count = &count;
+ r.out.count = &count;
+ r.out.sids = &sids;
+ r.out.domains = &domains;
+
+ /* nt4 returns NT_STATUS_NONE_MAPPED with sid_type
+ * SID_NAME_UNKNOWN, rid 0, and sid_index -1;
+ *
+ * w2k3/w2k8 return NT_STATUS_OK with sid_type
+ * SID_NAME_DOMAIN, rid -1 and sid_index 0 and BUILTIN domain
+ */
+
+ torture_assert_ntstatus_ok(tctx, dcerpc_lsa_LookupNames(p, tctx, &r),
+ "LookupNames with NULL name failed");
+
+ torture_comment(tctx, "\n");
+
+ return true;
+}
+
static bool test_LookupNames_wellknown(struct dcerpc_pipe *p,
struct torture_context *tctx,
struct policy_handle *handle)
@@ -2768,6 +2798,10 @@ static bool testcase_LookupNames(struct torture_context *tctx,
ret = false;
}
+ if (!test_LookupNames_NULL(p, tctx, handle)) {
+ ret = false;
+ }
+
if (!test_LookupNames_bogus(p, tctx, handle)) {
ret = false;
}