From f8c27d1e4a53e8a8324a28187b33db56992dcfb7 Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Fri, 5 Jun 2015 08:26:43 -0700 Subject: [PATCH] nsswitch: Extend idmap_rfc2307 testcase for reverse lookup Also test the codepaths to map UID and GID back to SID and names. Use different user and group to avoid returning results cached from the previous lookups. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11313 Signed-off-by: Christof Schmitt Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Fri Jun 5 01:24:32 CEST 2015 on sn-devel-104 (cherry picked from commit c1c07b462058f863e706127203e6f30dba89a2a9) --- nsswitch/tests/test_idmap_rfc2307.sh | 72 +++++++++++++++++++++++++++++++----- source3/selftest/tests.py | 2 +- 2 files changed, 64 insertions(+), 10 deletions(-) diff --git a/nsswitch/tests/test_idmap_rfc2307.sh b/nsswitch/tests/test_idmap_rfc2307.sh index b9efd346c8a..fc4c383c424 100755 --- a/nsswitch/tests/test_idmap_rfc2307.sh +++ b/nsswitch/tests/test_idmap_rfc2307.sh @@ -1,21 +1,24 @@ #!/bin/sh # Test id mapping through idmap_rfc2307 module if [ $# -lt 9 ]; then - echo Usage: $0 DOMAIN USERNAME UID GROUPNAME GID LDAPPREFIX DC_SERVER DC_USERNAME DC_PASSWORD + echo Usage: $0 DOMAIN USERNAME UID USERNAME2 UID2 GROUPNAME GID GROUPNAME2 GID2 LDAPPREFIX DC_SERVER DC_USERNAME DC_PASSWORD exit 1 fi DOMAIN="$1" USERNAME="$2" USERUID="$3" -GROUPNAME="$4" -GROUPGID="$5" -LDAPPREFIX="$6" -DC_SERVER="$7" -DC_USERNAME="$8" -DC_PASSWORD="$9" - -echo called with: $1 $2 $3 $4 $5 $6 $7 $8 $9 +USERNAME2="$4" +USERUID2="$5" +GROUPNAME="$6" +GROUPGID="$7" +GROUPNAME2="$8" +GROUPGID2="$9" +shift 9 +LDAPPREFIX="$1" +DC_SERVER="$2" +DC_USERNAME="$3" +DC_PASSWORD="$4" wbinfo="$VALGRIND $BINDIR/wbinfo" ldbadd="$BINDIR/ldbadd" @@ -26,7 +29,9 @@ failed=0 # Delete LDAP records $VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "cn=$USERNAME,$LDAPPREFIX" +$VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "cn=$USERNAME2,$LDAPPREFIX" $VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "cn=$GROUPNAME,$LDAPPREFIX" +$VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "cn=$GROUPNAME2,$LDAPPREFIX" $VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "$LDAPPREFIX" # Add id mapping information to LDAP @@ -53,6 +58,20 @@ EOF testit "add ldap user mapping record" $VALGRIND $ldbadd -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD $PREFIX/tmpldb cat > $PREFIX/tmpldb < $PREFIX/tmpldb < $PREFIX/tmpldb <