2 # Test id mapping through idmap_rfc2307 module
4 echo Usage
: $0 DOMAIN USERNAME UID GROUPNAME GID LDAPPREFIX DC_SERVER DC_USERNAME DC_PASSWORD
18 echo called with
: $1 $2 $3 $4 $5 $6 $7 $8 $9
20 wbinfo
="$VALGRIND $BINDIR/wbinfo"
23 if [ -x "$BINDIR/ldbadd" ]; then
24 ldbadd
="$BINDIR/ldbadd"
28 if [ -x "$BINDIR/ldbdel" ]; then
29 ldbdel
="$BINDIR/ldbdel"
34 .
`dirname $0`/..
/..
/testprogs
/blackbox
/subunit.sh
37 $VALGRIND $ldbdel -H ldap
://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "cn=$USERNAME,$LDAPPREFIX"
38 $VALGRIND $ldbdel -H ldap
://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "cn=$GROUPNAME,$LDAPPREFIX"
39 $VALGRIND $ldbdel -H ldap
://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "$LDAPPREFIX"
41 # Add id mapping information to LDAP
43 cat > $PREFIX/tmpldb
<<EOF
45 objectclass: organizationalUnit
48 testit
"add ldap prefix" $VALGRIND $ldbadd -H ldap
://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD $PREFIX/tmpldb
50 cat > $PREFIX/tmpldb
<<EOF
51 dn: cn=$USERNAME,$LDAPPREFIX
52 objectClass: organizationalPerson
53 objectClass: posixAccount
59 homeDirectory: /home/admin
62 testit
"add ldap user mapping record" $VALGRIND $ldbadd -H ldap
://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD $PREFIX/tmpldb
64 cat > $PREFIX/tmpldb
<<EOF
65 dn: cn=$GROUPNAME,$LDAPPREFIX
66 objectClass: posixGroup
67 objectClass: groupOfNames
70 member: cn=$USERNAME,$LDAPPREFIX
73 testit
"add ldap group mapping record" $VALGRIND $ldbadd -H ldap
://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD $PREFIX/tmpldb
75 rm -f $PREFIX/tmpldbmodify
77 testit
"wbinfo --name-to-sid" $wbinfo --name-to-sid "$DOMAIN\\$USERNAME" || failed
=$
(expr $failed + 1)
78 user_sid
=$
($wbinfo -n "$DOMAIN\\$USERNAME" | cut
-d " " -f1)
79 echo "$DOMAIN\\$USERNAME resolved to $user_sid"
81 testit
"wbinfo --sid-to-uid=$user_sid" $wbinfo --sid-to-uid=$user_sid || failed
=$
(expr $failed + 1)
82 user_uid
=$
($wbinfo --sid-to-uid=$user_sid | cut
-d " " -f1)
83 echo "$DOMAIN\\$USERNAME resolved to $user_uid"
85 testit
"test $user_uid -eq $USERUID" test $user_uid -eq $USERUID || failed
=$
(expr $failed + 1)
87 # Not sure how to get group names with spaces to resolve through testit
88 #testit "wbinfo --name-to-sid" $wbinfo --name-to-sid="$DOMAIN\\$GROUPNAME" || failed=$(expr $failed + 1)
89 group_sid
=$
($wbinfo --name-to-sid="$DOMAIN\\$GROUPNAME" | cut
-d " " -f1)
90 echo "$DOMAIN\\$GROUPNAME resolved to $group_sid"
92 testit
"wbinfo --sid-to-gid=$group_sid" $wbinfo --sid-to-gid=$group_sid || failed
=$
(expr $failed + 1)
93 group_gid
=$
($wbinfo --sid-to-gid=$group_sid | cut
-d " " -f1)
94 echo "$DOMAIN\\$GROUPNAME resolved to $group_gid"
96 testit
"test $group_gid -eq $GROUPGID" test $group_gid -eq $GROUPGID || failed
=$
(expr $failed + 1)
99 $VALGRIND $ldbdel -H ldap
://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "cn=$USERNAME,$LDAPPREFIX"
100 $VALGRIND $ldbdel -H ldap
://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "cn=$GROUPNAME,$LDAPPREFIX"
101 $VALGRIND $ldbdel -H ldap
://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "$LDAPPREFIX"