summaryrefslogtreecommitdiff
path: root/nsswitch/libwbclient
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-04-04 22:52:53 +0200
committerVolker Lendecke <vl@samba.org>2010-04-19 14:27:17 +0200
commit250bea02b586219275efc87d65fbae32b867ba86 (patch)
tree67632ce1782a6d672a5c17d47b1ef95f212a5b08 /nsswitch/libwbclient
parent0a966980f445a9fd9c39ca35dcaaec55c33ac749 (diff)
downloadsamba-250bea02b586219275efc87d65fbae32b867ba86.tar.gz
samba-250bea02b586219275efc87d65fbae32b867ba86.tar.bz2
samba-250bea02b586219275efc87d65fbae32b867ba86.zip
libwbclient: Test wbcLookupRids
Diffstat (limited to 'nsswitch/libwbclient')
-rw-r--r--nsswitch/libwbclient/tests/wbclient.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/nsswitch/libwbclient/tests/wbclient.c b/nsswitch/libwbclient/tests/wbclient.c
index 261163c4fc..511405010d 100644
--- a/nsswitch/libwbclient/tests/wbclient.c
+++ b/nsswitch/libwbclient/tests/wbclient.c
@@ -463,6 +463,33 @@ static bool test_wbc_resolve_winsbyip(struct torture_context *tctx)
return true;
}
+static bool test_wbc_lookup_rids(struct torture_context *tctx)
+{
+ struct wbcDomainSid builtin;
+ uint32_t rids[2] = { 544, 545 };
+ const char *domain_name, **names;
+ enum wbcSidType *types;
+ wbcErr ret;
+
+ wbcStringToSid("S-1-5-32", &builtin);
+
+ ret = wbcLookupRids(&builtin, 2, rids, &domain_name, &names,
+ &types);
+ torture_assert_wbc_ok(tctx, ret, "wbcLookupRids failed");
+
+ torture_assert_str_equal(
+ tctx, names[0], "Administrators",
+ "S-1-5-32-544 not mapped to 'Administrators'");
+ torture_assert_str_equal(
+ tctx, names[1], "Users", "S-1-5-32-545 not mapped to 'Users'");
+
+ wbcFreeMemory((char *)domain_name);
+ wbcFreeMemory(names);
+ wbcFreeMemory(types);
+
+ return true;
+}
+
struct torture_suite *torture_wbclient(void)
{
struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "WBCLIENT");
@@ -484,6 +511,8 @@ struct torture_suite *torture_wbclient(void)
torture_suite_add_simple_test(suite, "wbcLookupDomainControllerEx", test_wbc_lookupdcex);
torture_suite_add_simple_test(suite, "wbcResolveWinsByName", test_wbc_resolve_winsbyname);
torture_suite_add_simple_test(suite, "wbcResolveWinsByIP", test_wbc_resolve_winsbyip);
+ torture_suite_add_simple_test(suite, "wbcLookupRids",
+ test_wbc_lookup_rids);
return suite;
}