selftest: Add gid-to-sid lookup to idmap_ad test
authorChristof Schmitt <cs@samba.org>
Mon, 22 Apr 2019 23:15:20 +0000 (16:15 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 24 Apr 2019 01:02:17 +0000 (01:02 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13903

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
nsswitch/tests/test_idmap_ad.sh

index 7450ae0..3e36498 100755 (executable)
@@ -49,6 +49,13 @@ add: gidNumber
 gidNumber: 2000001
 EOF
 
+cat <<EOF | $ldbmodify -H ldap://$DC_SERVER -U "$DOMAIN\Administrator%$DC_PASSWORD"
+dn: CN=Domain Admins,CN=Users,$BASE_DN
+changetype: modify
+add: gidNumber
+gidNumber: 2000002
+EOF
+
 #
 # Test 1: Test uid of Administrator, should be 2000000
 #
@@ -79,6 +86,16 @@ test "$out" = "$DOMAIN/administrator:*:2000000:2000001::/home/$DOMAIN/administra
 ret=$?
 testit "Test get userinfo for Administrator works" test $ret -eq 0 || failed=$(expr $failed + 1)
 
+#
+# Test 4: Test lookup from gid to sid
+#
+
+out="$($wbinfo -G 2000002)"
+echo "wbinfo returned: \"$out\", expecting \"$DOMAIN_SID-512\""
+test "$out" = "$DOMAIN_SID-512"
+ret=$?
+testit "Test gid lookup of Domain Admins" test $ret -eq 0 || failed=$(expr $failed + 1)
+
 #
 # Remove POSIX ids from AD
 #
@@ -96,4 +113,11 @@ delete: gidNumber
 gidNumber: 2000001
 EOF
 
+cat <<EOF | $ldbmodify -H ldap://$DC_SERVER -U "$DOMAIN\Administrator%$DC_PASSWORD"
+dn: CN=Domain Admins,CN=Users,$BASE_DN
+changetype: modify
+delete: gidNumber
+gidNumber: 2000002
+EOF
+
 exit $failed