1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

nsswitch: Reformat shell scripts

shfmt -f nsswitch/ | xargs shfmt -w -p -i 0 -fn

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Andreas Schneider 2022-02-21 11:20:53 +01:00 committed by Andreas Schneider
parent 5b70f21d15
commit d42f08d16b
12 changed files with 310 additions and 307 deletions

View File

@ -21,30 +21,30 @@ ldbsearch="$VALGRIND $BINDIR/ldbsearch"
failed=0 failed=0
. `dirname $0`/../../testprogs/blackbox/subunit.sh . $(dirname $0)/../../testprogs/blackbox/subunit.sh
DOMAIN_SID=$($wbinfo -n "$DOMAIN/" | cut -f 1 -d " ") DOMAIN_SID=$($wbinfo -n "$DOMAIN/" | cut -f 1 -d " ")
if [ $? -ne 0 ] ; then if [ $? -ne 0 ]; then
echo "Could not find domain SID" | subunit_fail_test "test_idmap_ad" echo "Could not find domain SID" | subunit_fail_test "test_idmap_ad"
exit 1 exit 1
fi fi
TRUST_DOMAIN_SID=$($wbinfo -n "$TRUST_DOMAIN/" | cut -f 1 -d " ") TRUST_DOMAIN_SID=$($wbinfo -n "$TRUST_DOMAIN/" | cut -f 1 -d " ")
if [ $? -ne 0 ] ; then if [ $? -ne 0 ]; then
echo "Could not find trusted domain SID" | subunit_fail_test "test_idmap_ad" echo "Could not find trusted domain SID" | subunit_fail_test "test_idmap_ad"
exit 1 exit 1
fi fi
BASE_DN=$($ldbsearch -H ldap://$DC_SERVER -b "" --scope=base defaultNamingContext | awk '/^defaultNamingContext/ {print $2}') BASE_DN=$($ldbsearch -H ldap://$DC_SERVER -b "" --scope=base defaultNamingContext | awk '/^defaultNamingContext/ {print $2}')
if [ $? -ne 0 ] ; then if [ $? -ne 0 ]; then
echo "Could not find base DN" | subunit_fail_test "test_idmap_ad" echo "Could not find base DN" | subunit_fail_test "test_idmap_ad"
exit 1 exit 1
fi fi
TRUST_BASE_DN=$($ldbsearch -H ldap://$TRUST_SERVER -b "" --scope=base defaultNamingContext | awk '/^defaultNamingContext/ {print $2}') TRUST_BASE_DN=$($ldbsearch -H ldap://$TRUST_SERVER -b "" --scope=base defaultNamingContext | awk '/^defaultNamingContext/ {print $2}')
if [ $? -ne 0 ] ; then if [ $? -ne 0 ]; then
echo "Could not find trusted base DN" | subunit_fail_test "test_idmap_ad" echo "Could not find trusted base DN" | subunit_fail_test "test_idmap_ad"
exit 1 exit 1
fi fi
# #
@ -83,7 +83,7 @@ EOF
# Add POSIX ids to trusted domain # Add POSIX ids to trusted domain
# #
cat <<EOF | $ldbmodify -H ldap://$TRUST_SERVER \ cat <<EOF | $ldbmodify -H ldap://$TRUST_SERVER \
-U "$TRUST_DOMAIN\Administrator%$TRUST_PASSWORD" -U "$TRUST_DOMAIN\Administrator%$TRUST_PASSWORD"
dn: CN=Administrator,CN=Users,$TRUST_BASE_DN dn: CN=Administrator,CN=Users,$TRUST_BASE_DN
changetype: modify changetype: modify
add: uidNumber add: uidNumber
@ -91,7 +91,7 @@ uidNumber: 2500000
EOF EOF
cat <<EOF | $ldbmodify -H ldap://$TRUST_SERVER \ cat <<EOF | $ldbmodify -H ldap://$TRUST_SERVER \
-U "$TRUST_DOMAIN\Administrator%$TRUST_PASSWORD" -U "$TRUST_DOMAIN\Administrator%$TRUST_PASSWORD"
dn: CN=Domain Users,CN=Users,$TRUST_BASE_DN dn: CN=Domain Users,CN=Users,$TRUST_BASE_DN
changetype: modify changetype: modify
add: gidNumber add: gidNumber
@ -99,7 +99,7 @@ gidNumber: 2500001
EOF EOF
cat <<EOF | $ldbmodify -H ldap://$TRUST_SERVER \ cat <<EOF | $ldbmodify -H ldap://$TRUST_SERVER \
-U "$TRUST_DOMAIN\Administrator%$TRUST_PASSWORD" -U "$TRUST_DOMAIN\Administrator%$TRUST_PASSWORD"
dn: CN=Domain Admins,CN=Users,$TRUST_BASE_DN dn: CN=Domain Admins,CN=Users,$TRUST_BASE_DN
changetype: modify changetype: modify
add: gidNumber add: gidNumber
@ -222,7 +222,7 @@ EOF
# Remove POSIX ids from trusted domain # Remove POSIX ids from trusted domain
# #
cat <<EOF | $ldbmodify -H ldap://$TRUST_SERVER \ cat <<EOF | $ldbmodify -H ldap://$TRUST_SERVER \
-U "$TRUST_DOMAIN\Administrator%$TRUST_PASSWORD" -U "$TRUST_DOMAIN\Administrator%$TRUST_PASSWORD"
dn: CN=Administrator,CN=Users,$TRUST_BASE_DN dn: CN=Administrator,CN=Users,$TRUST_BASE_DN
changetype: modify changetype: modify
delete: uidNumber delete: uidNumber
@ -230,7 +230,7 @@ uidNumber: 2500000
EOF EOF
cat <<EOF | $ldbmodify -H ldap://$TRUST_SERVER \ cat <<EOF | $ldbmodify -H ldap://$TRUST_SERVER \
-U "$TRUST_DOMAIN\Administrator%$TRUST_PASSWORD" -U "$TRUST_DOMAIN\Administrator%$TRUST_PASSWORD"
dn: CN=Domain Users,CN=Users,$TRUST_BASE_DN dn: CN=Domain Users,CN=Users,$TRUST_BASE_DN
changetype: modify changetype: modify
delete: gidNumber delete: gidNumber
@ -238,7 +238,7 @@ gidNumber: 2500001
EOF EOF
cat <<EOF | $ldbmodify -H ldap://$TRUST_SERVER \ cat <<EOF | $ldbmodify -H ldap://$TRUST_SERVER \
-U "$TRUST_DOMAIN\Administrator%$TRUST_PASSWORD" -U "$TRUST_DOMAIN\Administrator%$TRUST_PASSWORD"
dn: CN=Domain Admins,CN=Users,$TRUST_BASE_DN dn: CN=Domain Admins,CN=Users,$TRUST_BASE_DN
changetype: modify changetype: modify
delete: gidNumber delete: gidNumber

View File

@ -11,7 +11,7 @@ wbinfo="$VALGRIND $BINDIR/wbinfo"
failed=0 failed=0
. `dirname $0`/../../testprogs/blackbox/subunit.sh . $(dirname $0)/../../testprogs/blackbox/subunit.sh
testit "wbinfo returns domain SID" $wbinfo -n "$DOMAIN/" || exit 1 testit "wbinfo returns domain SID" $wbinfo -n "$DOMAIN/" || exit 1
DOMAIN_SID=$($wbinfo -n "$DOMAIN/" | cut -f 1 -d " ") DOMAIN_SID=$($wbinfo -n "$DOMAIN/" | cut -f 1 -d " ")
@ -19,15 +19,15 @@ echo "Domain $DOMAIN has SID $DOMAIN_SID"
# Find an unused uid and SID # Find an unused uid and SID
RID=66666 RID=66666
while true ; do while true; do
id $RID id $RID
if [ $? -ne 0 ] ; then if [ $? -ne 0 ]; then
$wbinfo -s $DOMAIN_SID-$RID $wbinfo -s $DOMAIN_SID-$RID
if [ $? -ne 0 ] ; then if [ $? -ne 0 ]; then
break break
fi
fi fi
fi RID=$(expr $RID + 1)
RID=$(expr $RID + 1)
done done
echo "Using non-existing SID $DOMAIN_SID-$RID to check no id allocation is done by the backend" echo "Using non-existing SID $DOMAIN_SID-$RID to check no id allocation is done by the backend"

View File

@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
# Test id mapping through idmap_rfc2307 module # Test id mapping through idmap_rfc2307 module
if [ $# -lt 15 ]; then if [ $# -lt 15 ]; then
echo Usage: $0 DOMAIN USERNAME UID USERNAME2 UID2 \ echo Usage: $0 DOMAIN USERNAME UID USERNAME2 UID2 \
GROUPNAME GID GROUPNAME2 GID2 GID_START NUMGROUPS \ GROUPNAME GID GROUPNAME2 GID2 GID_START NUMGROUPS \
LDAPPREFIX DC_SERVER DC_USERNAME DC_PASSWORD LDAPPREFIX DC_SERVER DC_USERNAME DC_PASSWORD
exit 1 exit 1
fi fi
@ -44,7 +44,7 @@ fi
failed=0 failed=0
. `dirname $0`/../../testprogs/blackbox/subunit.sh . $(dirname $0)/../../testprogs/blackbox/subunit.sh
# Delete LDAP records # Delete LDAP records
$VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "$LDAPPREFIX" --controls="tree_delete:1" $VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "$LDAPPREFIX" --controls="tree_delete:1"
@ -52,13 +52,13 @@ $VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "$LDA
# Add id mapping information to LDAP # Add id mapping information to LDAP
testit "add ldap prefix" $VALGRIND $ldbadd -H ldap://$DC_SERVER \ testit "add ldap prefix" $VALGRIND $ldbadd -H ldap://$DC_SERVER \
-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD <<EOF -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD <<EOF
dn: $LDAPPREFIX dn: $LDAPPREFIX
objectclass: organizationalUnit objectclass: organizationalUnit
EOF EOF
testit "add ldap user mapping record" $VALGRIND $ldbadd -H ldap://$DC_SERVER \ testit "add ldap user mapping record" $VALGRIND $ldbadd -H ldap://$DC_SERVER \
-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD <<EOF -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD <<EOF
dn: cn=$USERNAME,$LDAPPREFIX dn: cn=$USERNAME,$LDAPPREFIX
objectClass: organizationalPerson objectClass: organizationalPerson
objectClass: posixAccount objectClass: posixAccount
@ -71,7 +71,7 @@ homeDirectory: /home/admin
EOF EOF
testit "add second ldap user mapping record" $VALGRIND $ldbadd \ testit "add second ldap user mapping record" $VALGRIND $ldbadd \
-H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD <<EOF -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD <<EOF
dn: cn=$USERNAME2,$LDAPPREFIX dn: cn=$USERNAME2,$LDAPPREFIX
objectClass: organizationalPerson objectClass: organizationalPerson
objectClass: posixAccount objectClass: posixAccount
@ -84,7 +84,7 @@ homeDirectory: /home/admin
EOF EOF
testit "add ldap group mapping record" $VALGRIND $ldbadd \ testit "add ldap group mapping record" $VALGRIND $ldbadd \
-H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD <<EOF -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD <<EOF
dn: cn=$GROUPNAME,$LDAPPREFIX dn: cn=$GROUPNAME,$LDAPPREFIX
objectClass: posixGroup objectClass: posixGroup
objectClass: groupOfNames objectClass: groupOfNames
@ -94,7 +94,7 @@ member: cn=$USERNAME,$LDAPPREFIX
EOF EOF
testit "add second ldap group mapping record" $VALGRIND $ldbadd \ testit "add second ldap group mapping record" $VALGRIND $ldbadd \
-H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD <<EOF -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD <<EOF
dn: cn=$GROUPNAME2,$LDAPPREFIX dn: cn=$GROUPNAME2,$LDAPPREFIX
objectClass: posixGroup objectClass: posixGroup
objectClass: groupOfNames objectClass: groupOfNames
@ -147,20 +147,20 @@ echo "SID $group_sid2 resolved to $group_name2"
testit "test $group_name2 = $DOMAIN/$GROUPNAME2" test "$(echo $group_name2 | tr A-Z a-z)" = "$(echo $DOMAIN/$GROUPNAME2 | tr A-Z a-z)" || failed=$(expr $failed + 1) testit "test $group_name2 = $DOMAIN/$GROUPNAME2" test "$(echo $group_name2 | tr A-Z a-z)" = "$(echo $DOMAIN/$GROUPNAME2 | tr A-Z a-z)" || failed=$(expr $failed + 1)
i=0 i=0
while [ ${i} -lt ${NUMGROUPS} ] ; do while [ ${i} -lt ${NUMGROUPS} ]; do
GRP=$(printf "test_rfc2307_group_%3.3d" "$i") GRP=$(printf "test_rfc2307_group_%3.3d" "$i")
GRP_GID=$(expr "$GID_START" + "$i") GRP_GID=$(expr "$GID_START" + "$i")
testit "Add group $GRP" $net rpc group add "$GRP" -S "$DC_SERVER" \ testit "Add group $GRP" $net rpc group add "$GRP" -S "$DC_SERVER" \
-U"${DOMAIN}\\${DC_USERNAME}"%"${DC_PASSWORD}" || -U"${DOMAIN}\\${DC_USERNAME}"%"${DC_PASSWORD}" ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
testit "Add groupmem $GRP $USERNAME" \ testit "Add groupmem $GRP $USERNAME" \
$net rpc group addmem "$GRP" "$USERNAME" \ $net rpc group addmem "$GRP" "$USERNAME" \
-S "$DC_SERVER" \ -S "$DC_SERVER" \
-U"${DOMAIN}\\${DC_USERNAME}"%"${DC_PASSWORD}" || -U"${DOMAIN}\\${DC_USERNAME}"%"${DC_PASSWORD}" ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
testit "Add group object for $GRP $GRP_GID" \ testit "Add group object for $GRP $GRP_GID" \
$VALGRIND $ldbadd \ $VALGRIND $ldbadd \
-H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD <<EOF -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD <<EOF
dn: cn=$GRP,$LDAPPREFIX dn: cn=$GRP,$LDAPPREFIX
objectClass: posixGroup objectClass: posixGroup
objectClass: groupOfNames objectClass: groupOfNames
@ -168,51 +168,51 @@ cn: $GRP
gidNumber: $GRP_GID gidNumber: $GRP_GID
member: cn=$USERNAME,$LDAPPREFIX member: cn=$USERNAME,$LDAPPREFIX
EOF EOF
i=$(expr "$i" + 1) i=$(expr "$i" + 1)
done done
# Test whether wbinfo --xids-to-sids finds everything # Test whether wbinfo --xids-to-sids finds everything
GIDS="" GIDS=""
i=0 i=0
while [ ${i} -lt ${NUMGROUPS} ] ; do while [ ${i} -lt ${NUMGROUPS} ]; do
GIDS="$GIDS g$(expr ${i} + ${GID_START})" GIDS="$GIDS g$(expr ${i} + ${GID_START})"
i=$(expr "$i" + 1) i=$(expr "$i" + 1)
done done
NUM_VALID_SIDS=$($wbinfo --unix-ids-to-sids="$GIDS" | grep -v ^"NOT MAPPED" | wc -l) NUM_VALID_SIDS=$($wbinfo --unix-ids-to-sids="$GIDS" | grep -v ^"NOT MAPPED" | wc -l)
testit "Count number of valid sids found" \ testit "Count number of valid sids found" \
test ${NUM_VALID_SIDS} = ${NUMGROUPS} || test ${NUM_VALID_SIDS} = ${NUMGROUPS} ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
# Prime the cache so we test idmap, not the harder problem of # Prime the cache so we test idmap, not the harder problem of
# consistent group memberships for users without a login. # consistent group memberships for users without a login.
testit "Authenticate the user to prime the netlogon cache" \ testit "Authenticate the user to prime the netlogon cache" \
$wbinfo -a $DOMAIN/$DC_USERNAME%$DC_PASSWORD || failed=$(expr $failed + 1) $wbinfo -a $DOMAIN/$DC_USERNAME%$DC_PASSWORD || failed=$(expr $failed + 1)
# Test whether wbinfo -r shows all groups # Test whether wbinfo -r shows all groups
EXPECTED_USERGROUPS="1000000/1000001/2000002/" EXPECTED_USERGROUPS="1000000/1000001/2000002/"
i=0 i=0
while [ ${i} -lt ${NUMGROUPS} ] ; do while [ ${i} -lt ${NUMGROUPS} ]; do
EXPECTED_USERGROUPS="$EXPECTED_USERGROUPS$(expr ${i} + ${GID_START})/" EXPECTED_USERGROUPS="$EXPECTED_USERGROUPS$(expr ${i} + ${GID_START})/"
i=$(expr "$i" + 1) i=$(expr "$i" + 1)
done done
USERGROUPS=$($wbinfo -r $DOMAIN/$USERNAME | sort -n | tr '\n' '/') USERGROUPS=$($wbinfo -r $DOMAIN/$USERNAME | sort -n | tr '\n' '/')
testit "Testing for expected group memberships" \ testit "Testing for expected group memberships" \
test "$USERGROUPS" = "$EXPECTED_USERGROUPS" || test "$USERGROUPS" = "$EXPECTED_USERGROUPS" ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
i=0 i=0
while [ ${i} -lt ${NUMGROUPS} ] ; do while [ ${i} -lt ${NUMGROUPS} ]; do
GRP=$(printf "test_rfc2307_group_%3.3d" ${i}) GRP=$(printf "test_rfc2307_group_%3.3d" ${i})
testit "Del group $GRP" $net rpc group delete "$GRP" -S "$DC_SERVER" \ testit "Del group $GRP" $net rpc group delete "$GRP" -S "$DC_SERVER" \
-U"${DOMAIN}\\${DC_USERNAME}"%"${DC_PASSWORD}" || -U"${DOMAIN}\\${DC_USERNAME}"%"${DC_PASSWORD}" ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
i=$(expr "$i" + 1) i=$(expr "$i" + 1)
done done
# Delete LDAP records # Delete LDAP records

View File

@ -14,31 +14,31 @@ RANGE_START="$2"
wbinfo="$VALGRIND $BINDIR/wbinfo" wbinfo="$VALGRIND $BINDIR/wbinfo"
failed=0 failed=0
. `dirname $0`/../../testprogs/blackbox/subunit.sh . $(dirname $0)/../../testprogs/blackbox/subunit.sh
DOMAIN_SID=$($wbinfo -n "$DOMAIN/" | cut -f 1 -d " ") DOMAIN_SID=$($wbinfo -n "$DOMAIN/" | cut -f 1 -d " ")
if [ $? -ne 0 ] ; then if [ $? -ne 0 ]; then
echo "Could not find domain SID" | subunit_fail_test "test_idmap_rid" echo "Could not find domain SID" | subunit_fail_test "test_idmap_rid"
exit 1 exit 1
fi fi
# Find an unused uid and SID # Find an unused uid and SID
RID=66666 RID=66666
MAX_RID=77777 MAX_RID=77777
while true ; do while true; do
id $RID id $RID
if [ $? -ne 0 ] ; then if [ $? -ne 0 ]; then
SID="$DOMAIN_SID-$RID" SID="$DOMAIN_SID-$RID"
$wbinfo -s $SID $wbinfo -s $SID
if [ $? -ne 0 ] ; then if [ $? -ne 0 ]; then
break break
fi
fi
RID=$(expr $RID + 1)
if [ $RID -eq $MAX_RID ]; then
echo "Could not find free SID" | subunit_fail_test "test_idmap_rid"
exit 1
fi fi
fi
RID=$(expr $RID + 1)
if [ $RID -eq $MAX_RID ] ; then
echo "Could not find free SID" | subunit_fail_test "test_idmap_rid"
exit 1
fi
done done
# #
@ -72,60 +72,60 @@ GROUP_SID=$($wbinfo --name-to-sid="$GROUP" | sed -e 's/ .*//')
uid=$($wbinfo --sid-to-uid=$GROUP_SID) uid=$($wbinfo --sid-to-uid=$GROUP_SID)
ret=$? ret=$?
testit "ID_TYPE_BOTH group map to uid succeeds" test $ret -eq 0 ||\ testit "ID_TYPE_BOTH group map to uid succeeds" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
testit "ID_TYPE_BOTH group map to uid has result" test -n $uid ||\ testit "ID_TYPE_BOTH group map to uid has result" test -n $uid ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
gid=$($wbinfo --sid-to-gid=$GROUP_SID) gid=$($wbinfo --sid-to-gid=$GROUP_SID)
ret=$? ret=$?
testit "ID_TYPE_BOTH group map to gid succeeds" test $ret -eq 0 ||\ testit "ID_TYPE_BOTH group map to gid succeeds" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
testit "ID_TYPE_BOTH group map to gid has result" test -n $gid ||\ testit "ID_TYPE_BOTH group map to gid has result" test -n $gid ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
testit "ID_TYPE_BOTH group uid equals gid" test $uid -eq $gid ||\ testit "ID_TYPE_BOTH group uid equals gid" test $uid -eq $gid ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
group_pw="$DOMAIN/domain users:*:$uid:$gid::/home/$DOMAIN/domain users:/bin/false" group_pw="$DOMAIN/domain users:*:$uid:$gid::/home/$DOMAIN/domain users:/bin/false"
out=$(getent passwd "$GROUP") out=$(getent passwd "$GROUP")
ret=$? ret=$?
testit "getpwnam for ID_TYPE_BOTH group succeeds" test $ret -eq 0 ||\ testit "getpwnam for ID_TYPE_BOTH group succeeds" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
test "$out" = "$group_pw" test "$out" = "$group_pw"
ret=$? ret=$?
testit "getpwnam for ID_TYPE_BOTH group output" test $ret -eq 0 ||\ testit "getpwnam for ID_TYPE_BOTH group output" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
out=$(getent passwd $uid) out=$(getent passwd $uid)
ret=$? ret=$?
testit "getpwuid for ID_TYPE_BOTH group succeeds" test $ret -eq 0 ||\ testit "getpwuid for ID_TYPE_BOTH group succeeds" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
test "$out" = "$group_pw" test "$out" = "$group_pw"
ret=$? ret=$?
testit "getpwuid for ID_TYPE_BOTH group output" test $ret -eq 0 ||\ testit "getpwuid for ID_TYPE_BOTH group output" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
group_gr="$DOMAIN/domain users:x:$gid:" group_gr="$DOMAIN/domain users:x:$gid:"
out=$(getent group "$GROUP") out=$(getent group "$GROUP")
ret=$? ret=$?
testit "getgrnam for ID_TYPE_BOTH group succeeds" test $ret -eq 0 ||\ testit "getgrnam for ID_TYPE_BOTH group succeeds" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
test "$out" = "$group_gr" test "$out" = "$group_gr"
ret=$? ret=$?
testit "getgrnam for ID_TYPE_BOTH group output" test $ret -eq 0 ||\ testit "getgrnam for ID_TYPE_BOTH group output" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
out=$(getent group "$gid") out=$(getent group "$gid")
ret=$? ret=$?
testit "getgrgid for ID_TYPE_BOTH group succeeds" test $ret -eq 0 ||\ testit "getgrgid for ID_TYPE_BOTH group succeeds" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
test "$out" = "$group_gr" test "$out" = "$group_gr"
ret=$? ret=$?
testit "getgrgid for ID_TYPE_BOTH group output" test $ret -eq 0 ||\ testit "getgrgid for ID_TYPE_BOTH group output" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
# #
@ -139,60 +139,60 @@ USER_SID=$($wbinfo --name-to-sid="$USER" | sed -e 's/ .*//')
uid=$($wbinfo --sid-to-uid=$USER_SID) uid=$($wbinfo --sid-to-uid=$USER_SID)
ret=$? ret=$?
testit "ID_TYPE_BOTH user map to uid succeeds" test $ret -eq 0 ||\ testit "ID_TYPE_BOTH user map to uid succeeds" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
testit "ID_TYPE_BOTH user map to uid has result" test -n $uid ||\ testit "ID_TYPE_BOTH user map to uid has result" test -n $uid ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
gid=$($wbinfo --sid-to-gid=$USER_SID) gid=$($wbinfo --sid-to-gid=$USER_SID)
ret=$? ret=$?
testit "ID_TYPE_BOTH user map to gid succeeds" test $ret -eq 0 ||\ testit "ID_TYPE_BOTH user map to gid succeeds" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
testit "ID_TYPE_BOTH user map to gid has result" test -n $gid ||\ testit "ID_TYPE_BOTH user map to gid has result" test -n $gid ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
testit "ID_TYPE_BOTH user uid equals gid" test $uid -eq $gid ||\ testit "ID_TYPE_BOTH user uid equals gid" test $uid -eq $gid ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
user_pw="$DOMAIN/administrator:*:$uid:$dom_users_gid::/home/$DOMAIN/administrator:/bin/false" user_pw="$DOMAIN/administrator:*:$uid:$dom_users_gid::/home/$DOMAIN/administrator:/bin/false"
out=$(getent passwd "$USER") out=$(getent passwd "$USER")
ret=$? ret=$?
testit "getpwnam for ID_TYPE_BOTH user succeeds" test $ret -eq 0 ||\ testit "getpwnam for ID_TYPE_BOTH user succeeds" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
test "$out" = "$user_pw" test "$out" = "$user_pw"
ret=$? ret=$?
testit "getpwnam for ID_TYPE_BOTH user output" test $ret -eq 0 ||\ testit "getpwnam for ID_TYPE_BOTH user output" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
out=$(getent passwd $uid) out=$(getent passwd $uid)
ret=$? ret=$?
testit "getpwuid for ID_TYPE_BOTH user succeeds" test $ret -eq 0 ||\ testit "getpwuid for ID_TYPE_BOTH user succeeds" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
test "$out" = "$user_pw" test "$out" = "$user_pw"
ret=$? ret=$?
testit "getpwuid for ID_TYPE_BOTH user output" test $ret -eq 0 ||\ testit "getpwuid for ID_TYPE_BOTH user output" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
user_gr="$DOMAIN/administrator:x:$gid:$DOMAIN/administrator" user_gr="$DOMAIN/administrator:x:$gid:$DOMAIN/administrator"
out=$(getent group "$USER") out=$(getent group "$USER")
ret=$? ret=$?
testit "getgrnam for ID_TYPE_BOTH user succeeds" test $ret -eq 0 ||\ testit "getgrnam for ID_TYPE_BOTH user succeeds" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
test "$out" = "$user_gr" test "$out" = "$user_gr"
ret=$? ret=$?
testit "getgrnam for ID_TYPE_BOTH user output" test $ret -eq 0 ||\ testit "getgrnam for ID_TYPE_BOTH user output" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
out=$(getent group "$gid") out=$(getent group "$gid")
ret=$? ret=$?
testit "getgrgid for ID_TYPE_BOTH user succeeds" test $ret -eq 0 ||\ testit "getgrgid for ID_TYPE_BOTH user succeeds" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
test "$out" = "$user_gr" test "$out" = "$user_gr"
ret=$? ret=$?
testit "getgrgid for ID_TYPE_BOTH user output" test $ret -eq 0 ||\ testit "getgrgid for ID_TYPE_BOTH user output" test $ret -eq 0 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
exit $failed exit $failed

View File

@ -1,10 +1,10 @@
#!/bin/sh #!/bin/sh
# Blackbox test for wbinfo and rfc2307 mappings # Blackbox test for wbinfo and rfc2307 mappings
if [ $# -lt 4 ]; then if [ $# -lt 4 ]; then
cat <<EOF cat <<EOF
Usage: test_rfc2307_mapping.sh DOMAIN USERNAME PASSWORD SERVER UID_RFC2307TEST GID_RFC2307TEST Usage: test_rfc2307_mapping.sh DOMAIN USERNAME PASSWORD SERVER UID_RFC2307TEST GID_RFC2307TEST
EOF EOF
exit 1; exit 1
fi fi
DOMAIN=$1 DOMAIN=$1
@ -26,41 +26,42 @@ else
ldbmodify="ldbmodify" ldbmodify="ldbmodify"
fi fi
. `dirname $0`/../../testprogs/blackbox/subunit.sh . $(dirname $0)/../../testprogs/blackbox/subunit.sh
testfail() { testfail()
{
name="$1" name="$1"
shift shift
cmdline="$*" cmdline="$*"
echo "test: $name" echo "test: $name"
$cmdline $cmdline
status=$? status=$?
if [ x$status = x0 ]; then if [ x$status = x0 ]; then
echo "failure: $name" echo "failure: $name"
else else
echo "success: $name" echo "success: $name"
fi fi
return $status return $status
} }
knownfail() { knownfail()
name="$1" {
shift name="$1"
cmdline="$*" shift
echo "test: $name" cmdline="$*"
$cmdline echo "test: $name"
status=$? $cmdline
if [ x$status = x0 ]; then status=$?
echo "failure: $name [unexpected success]" if [ x$status = x0 ]; then
status=1 echo "failure: $name [unexpected success]"
else status=1
echo "knownfail: $name" else
status=0 echo "knownfail: $name"
fi status=0
return $status fi
return $status
} }
# Create new testing account # Create new testing account
testit "user add" $PYTHON $samba_tool user create --given-name="rfc2307" --surname="Tester" --initial="UT" rfc2307_test_user testp@ssw0Rd $@ testit "user add" $PYTHON $samba_tool user create --given-name="rfc2307" --surname="Tester" --initial="UT" rfc2307_test_user testp@ssw0Rd $@
@ -70,112 +71,112 @@ testit "group add" $PYTHON $samba_tool group add $CONFIG --group-scope='Domain'
# Create new testing group # Create new testing group
# Convert name to SID # Convert name to SID
testit "wbinfo -n against $TARGET" $wbinfo -n "$DOMAIN/rfc2307_test_user" || failed=`expr $failed + 1` testit "wbinfo -n against $TARGET" $wbinfo -n "$DOMAIN/rfc2307_test_user" || failed=$(expr $failed + 1)
user_sid=`$wbinfo -n "$DOMAIN/rfc2307_test_user" | cut -d " " -f1` user_sid=$($wbinfo -n "$DOMAIN/rfc2307_test_user" | cut -d " " -f1)
echo "$DOMAIN/rfc2307_test_user resolved to $user_sid" echo "$DOMAIN/rfc2307_test_user resolved to $user_sid"
testit "wbinfo -s $user_sid against $TARGET" $wbinfo -s $user_sid || failed=`expr $failed + 1` testit "wbinfo -s $user_sid against $TARGET" $wbinfo -s $user_sid || failed=$(expr $failed + 1)
user_name=`$wbinfo -s $user_sid | cut -d " " -f1| tr a-z A-Z` user_name=$($wbinfo -s $user_sid | cut -d " " -f1 | tr a-z A-Z)
echo "$user_sid resolved to $user_name" echo "$user_sid resolved to $user_name"
tested_name=`echo $DOMAIN/rfc2307_test_user | tr a-z A-Z` tested_name=$(echo $DOMAIN/rfc2307_test_user | tr a-z A-Z)
# Now check that wbinfo works correctly (sid <=> name) # Now check that wbinfo works correctly (sid <=> name)
echo "test: wbinfo -s check for sane mapping" echo "test: wbinfo -s check for sane mapping"
if test x$user_name != x$tested_name; then if test x$user_name != x$tested_name; then
echo "$user_name does not match $tested_name" echo "$user_name does not match $tested_name"
echo "failure: wbinfo -s check for sane mapping" echo "failure: wbinfo -s check for sane mapping"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
else else
echo "success: wbinfo -s check for sane mapping" echo "success: wbinfo -s check for sane mapping"
fi fi
testit "wbinfo -n on the returned name against $TARGET" $wbinfo -n $user_name || failed=`expr $failed + 1` testit "wbinfo -n on the returned name against $TARGET" $wbinfo -n $user_name || failed=$(expr $failed + 1)
test_sid=`$wbinfo -n $tested_name | cut -d " " -f1` test_sid=$($wbinfo -n $tested_name | cut -d " " -f1)
echo "test: wbinfo -n check for sane mapping" echo "test: wbinfo -n check for sane mapping"
if test x$user_sid != x$test_sid; then if test x$user_sid != x$test_sid; then
echo "$user_sid does not match $test_sid" echo "$user_sid does not match $test_sid"
echo "failure: wbinfo -n check for sane mapping" echo "failure: wbinfo -n check for sane mapping"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
else else
echo "success: wbinfo -n check for sane mapping" echo "success: wbinfo -n check for sane mapping"
fi fi
testit "wbinfo -n against $TARGET" $wbinfo -n "$DOMAIN/rfc2307_test_group" || failed=`expr $failed + 1` testit "wbinfo -n against $TARGET" $wbinfo -n "$DOMAIN/rfc2307_test_group" || failed=$(expr $failed + 1)
group_sid=`$wbinfo -n "$DOMAIN/rfc2307_test_group" | cut -d " " -f1` group_sid=$($wbinfo -n "$DOMAIN/rfc2307_test_group" | cut -d " " -f1)
echo "$DOMAIN/rfc2307_test_group resolved to $group_sid" echo "$DOMAIN/rfc2307_test_group resolved to $group_sid"
# Then add a uidNumber to the group record using ldbmodify # Then add a uidNumber to the group record using ldbmodify
cat > $PREFIX/tmpldbmodify <<EOF cat >$PREFIX/tmpldbmodify <<EOF
dn: <SID=$user_sid> dn: <SID=$user_sid>
changetype: modify changetype: modify
add: uidNumber add: uidNumber
uidNumber: $UID_RFC2307TEST uidNumber: $UID_RFC2307TEST
EOF EOF
testit "modify gidNumber on group" $VALGRIND $ldbmodify -H ldap://$SERVER $PREFIX/tmpldbmodify -U$DOMAIN/$USERNAME%$PASSWORD $@ || failed=`expr $failed + 1` testit "modify gidNumber on group" $VALGRIND $ldbmodify -H ldap://$SERVER $PREFIX/tmpldbmodify -U$DOMAIN/$USERNAME%$PASSWORD $@ || failed=$(expr $failed + 1)
# Then add a gidNumber to the group record using ldbmodify # Then add a gidNumber to the group record using ldbmodify
cat > $PREFIX/tmpldbmodify <<EOF cat >$PREFIX/tmpldbmodify <<EOF
dn: <SID=$group_sid> dn: <SID=$group_sid>
changetype: modify changetype: modify
add: gidNumber add: gidNumber
gidNumber: $GID_RFC2307TEST gidNumber: $GID_RFC2307TEST
EOF EOF
testit "modify gidNumber on group" $VALGRIND $ldbmodify -H ldap://$SERVER $PREFIX/tmpldbmodify -U$DOMAIN/$USERNAME%$PASSWORD $@ || failed=`expr $failed + 1` testit "modify gidNumber on group" $VALGRIND $ldbmodify -H ldap://$SERVER $PREFIX/tmpldbmodify -U$DOMAIN/$USERNAME%$PASSWORD $@ || failed=$(expr $failed + 1)
rm -f $PREFIX/tmpldbmodify rm -f $PREFIX/tmpldbmodify
# Now check we get a correct SID for the UID # Now check we get a correct SID for the UID
testit "wbinfo -U against $TARGET" $wbinfo -U $UID_RFC2307TEST || failed=`expr $failed + 1` testit "wbinfo -U against $TARGET" $wbinfo -U $UID_RFC2307TEST || failed=$(expr $failed + 1)
echo "test: wbinfo -U check for sane mapping" echo "test: wbinfo -U check for sane mapping"
sid_for_user=`$wbinfo -U $UID_RFC2307TEST` sid_for_user=$($wbinfo -U $UID_RFC2307TEST)
if test x"$sid_for_user" != x"$user_sid"; then if test x"$sid_for_user" != x"$user_sid"; then
echo "uid $UID_RFC2307TEST mapped to $sid_for_user, not $user_sid" echo "uid $UID_RFC2307TEST mapped to $sid_for_user, not $user_sid"
echo "failure: wbinfo -U check for sane mapping" echo "failure: wbinfo -U check for sane mapping"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
else else
echo "success: wbinfo -U check for sane mapping" echo "success: wbinfo -U check for sane mapping"
fi fi
testit "wbinfo -G against $TARGET" $wbinfo -G $GID_RFC2307TEST || failed=`expr $failed + 1` testit "wbinfo -G against $TARGET" $wbinfo -G $GID_RFC2307TEST || failed=$(expr $failed + 1)
echo "test: wbinfo -G check for sane mapping" echo "test: wbinfo -G check for sane mapping"
sid_for_group=`$wbinfo -G $GID_RFC2307TEST` sid_for_group=$($wbinfo -G $GID_RFC2307TEST)
if test x$sid_for_group != "x$group_sid"; then if test x$sid_for_group != "x$group_sid"; then
echo "gid $GID_RFC2307TEST mapped to $sid_for_group, not $group_sid" echo "gid $GID_RFC2307TEST mapped to $sid_for_group, not $group_sid"
echo "failure: wbinfo -G check for sane mapping" echo "failure: wbinfo -G check for sane mapping"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
else else
echo "success: wbinfo -G check for sane mapping" echo "success: wbinfo -G check for sane mapping"
fi fi
# Now check we get the right UID from the SID # Now check we get the right UID from the SID
testit "wbinfo -S against $TARGET" $wbinfo -S "$user_sid" || failed=`expr $failed + 1` testit "wbinfo -S against $TARGET" $wbinfo -S "$user_sid" || failed=$(expr $failed + 1)
echo "test: wbinfo -S check for sane mapping" echo "test: wbinfo -S check for sane mapping"
uid_for_user_sid=`$wbinfo -S $user_sid` uid_for_user_sid=$($wbinfo -S $user_sid)
if test 0$uid_for_user_sid -ne $UID_RFC2307TEST; then if test 0$uid_for_user_sid -ne $UID_RFC2307TEST; then
echo "$user_sid mapped to $uid_for_sid, not $UID_RFC2307TEST" echo "$user_sid mapped to $uid_for_sid, not $UID_RFC2307TEST"
echo "failure: wbinfo -S check for sane mapping" echo "failure: wbinfo -S check for sane mapping"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
else else
echo "success: wbinfo -S check for sane mapping" echo "success: wbinfo -S check for sane mapping"
fi fi
# Now check we get the right GID from the SID # Now check we get the right GID from the SID
testit "wbinfo -Y" $wbinfo -Y "$group_sid" || failed=`expr $failed + 1` testit "wbinfo -Y" $wbinfo -Y "$group_sid" || failed=$(expr $failed + 1)
echo "test: wbinfo -Y check for sane mapping" echo "test: wbinfo -Y check for sane mapping"
gid_for_user_sid=`$wbinfo -Y $group_sid` gid_for_user_sid=$($wbinfo -Y $group_sid)
if test 0$gid_for_user_sid -ne $GID_RFC2307TEST; then if test 0$gid_for_user_sid -ne $GID_RFC2307TEST; then
echo "$group_sid mapped to $gid_for_sid, not $GID_RFC2307TEST" echo "$group_sid mapped to $gid_for_sid, not $GID_RFC2307TEST"
echo "failure: wbinfo -Y check for sane mapping" echo "failure: wbinfo -Y check for sane mapping"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
else else
echo "success: wbinfo -Y check for sane mapping" echo "success: wbinfo -Y check for sane mapping"
fi fi

View File

@ -2,8 +2,8 @@
# Test winbind ad backend behaviour when the kerberos ticket expires # Test winbind ad backend behaviour when the kerberos ticket expires
if [ $# -ne 1 ]; then if [ $# -ne 1 ]; then
echo Usage: $0 DOMAIN echo Usage: $0 DOMAIN
exit 1 exit 1
fi fi
DOMAIN="$1" DOMAIN="$1"
@ -13,12 +13,12 @@ net="$VALGRIND $BINDIR/net"
failed=0 failed=0
. `dirname $0`/../../testprogs/blackbox/subunit.sh . $(dirname $0)/../../testprogs/blackbox/subunit.sh
DOMAIN_SID=$($wbinfo -n "$DOMAIN/" | cut -f 1 -d " ") DOMAIN_SID=$($wbinfo -n "$DOMAIN/" | cut -f 1 -d " ")
if [ $? -ne 0 ] ; then if [ $? -ne 0 ]; then
echo "Could not find domain SID" | subunit_fail_test "test_idmap_ad" echo "Could not find domain SID" | subunit_fail_test "test_idmap_ad"
exit 1 exit 1
fi fi
ADMINS_SID="$DOMAIN_SID-512" ADMINS_SID="$DOMAIN_SID-512"
@ -35,13 +35,13 @@ $net cache del IDMAP/SID2XID/"$ADMINS_SID"
# connection. # connection.
testit_expect_failure "Deleting0 IDMAP/SID2XID/$ADMINS_SID" $net cache del IDMAP/SID2XID/"$ADMINS_SID" || testit_expect_failure "Deleting0 IDMAP/SID2XID/$ADMINS_SID" $net cache del IDMAP/SID2XID/"$ADMINS_SID" ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
testit_expect_failure "Expecting failure1, no mapping in AD" $wbinfo --sid-to-gid "$ADMINS_SID" || testit_expect_failure "Expecting failure1, no mapping in AD" $wbinfo --sid-to-gid "$ADMINS_SID" ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
testit "Deleting1 IDMAP/SID2XID/$ADMINS_SID" $net cache del IDMAP/SID2XID/"$ADMINS_SID" || testit "Deleting1 IDMAP/SID2XID/$ADMINS_SID" $net cache del IDMAP/SID2XID/"$ADMINS_SID" ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
# allow our kerberos ticket to expire # allow our kerberos ticket to expire
testit "Sleeping for 6 seconds" sleep 6 || failed=$(expr $failed + 1) testit "Sleeping for 6 seconds" sleep 6 || failed=$(expr $failed + 1)
@ -62,13 +62,13 @@ testit "Sleeping for 6 seconds" sleep 6 || failed=$(expr $failed + 1)
START=$(date +%s) START=$(date +%s)
testit_expect_failure "Expecting failure2, no mapping in AD" $wbinfo --sid-to-gid "$ADMINS_SID" || testit_expect_failure "Expecting failure2, no mapping in AD" $wbinfo --sid-to-gid "$ADMINS_SID" ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
END=$(date +%s) END=$(date +%s)
DURATION=$(expr $END - $START) DURATION=$(expr $END - $START)
testit "timeout DURATION[$DURATION] < 8" test "$DURATION" -le 8 || testit "timeout DURATION[$DURATION] < 8" test "$DURATION" -le 8 ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
testit "Deleting2 IDMAP/SID2XID/$ADMINS_SID" $net cache del IDMAP/SID2XID/"$ADMINS_SID" || testit "Deleting2 IDMAP/SID2XID/$ADMINS_SID" $net cache del IDMAP/SID2XID/"$ADMINS_SID" ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
exit $failed exit $failed

View File

@ -1,10 +1,10 @@
#!/bin/sh #!/bin/sh
# Blackbox test for wbinfo # Blackbox test for wbinfo
if [ $# -lt 4 ]; then if [ $# -lt 4 ]; then
cat <<EOF cat <<EOF
Usage: test_wbinfo.sh DOMAIN USERNAME PASSWORD TARGET Usage: test_wbinfo.sh DOMAIN USERNAME PASSWORD TARGET
EOF EOF
exit 1; exit 1
fi fi
DOMAIN=$1 DOMAIN=$1
@ -17,38 +17,40 @@ failed=0
samba4bindir="$BINDIR" samba4bindir="$BINDIR"
wbinfo="$VALGRIND $samba4bindir/wbinfo" wbinfo="$VALGRIND $samba4bindir/wbinfo"
. `dirname $0`/../../testprogs/blackbox/subunit.sh . $(dirname $0)/../../testprogs/blackbox/subunit.sh
testfail() { testfail()
{
name="$1" name="$1"
shift shift
cmdline="$*" cmdline="$*"
echo "test: $name" echo "test: $name"
$cmdline $cmdline
status=$? status=$?
if [ x$status = x0 ]; then if [ x$status = x0 ]; then
echo "failure: $name" echo "failure: $name"
else else
echo "success: $name" echo "success: $name"
fi fi
return $status return $status
} }
knownfail() { knownfail()
name="$1" {
shift name="$1"
cmdline="$*" shift
echo "test: $name" cmdline="$*"
$cmdline echo "test: $name"
status=$? $cmdline
if [ x$status = x0 ]; then status=$?
echo "failure: $name [unexpected success]" if [ x$status = x0 ]; then
status=1 echo "failure: $name [unexpected success]"
else status=1
echo "knownfail: $name" else
status=0 echo "knownfail: $name"
fi status=0
return $status fi
return $status
} }
KRB5CCNAME_PATH="$PREFIX/test_wbinfo_krb5ccache" KRB5CCNAME_PATH="$PREFIX/test_wbinfo_krb5ccache"
@ -58,52 +60,52 @@ KRB5CCNAME="FILE:$KRB5CCNAME_PATH"
export KRB5CCNAME export KRB5CCNAME
# List users # List users
testit "wbinfo -u against $TARGET" $wbinfo -u || failed=`expr $failed + 1` testit "wbinfo -u against $TARGET" $wbinfo -u || failed=$(expr $failed + 1)
# List groups # List groups
testit "wbinfo -g against $TARGET" $wbinfo -g || failed=`expr $failed + 1` testit "wbinfo -g against $TARGET" $wbinfo -g || failed=$(expr $failed + 1)
# Convert netbios name to IP # Convert netbios name to IP
# Does not work yet # Does not work yet
testit "wbinfo -N against $TARGET" $wbinfo -N $NETBIOSNAME || failed=`expr $failed + 1` testit "wbinfo -N against $TARGET" $wbinfo -N $NETBIOSNAME || failed=$(expr $failed + 1)
# Convert IP to netbios name # Convert IP to netbios name
# Does not work yet # Does not work yet
testit "wbinfo -I against $TARGET" $wbinfo -I $SERVER_IP || failed=`expr $failed + 1` testit "wbinfo -I against $TARGET" $wbinfo -I $SERVER_IP || failed=$(expr $failed + 1)
# Convert name to SID # Convert name to SID
testit "wbinfo -n against $TARGET" $wbinfo -n "$DOMAIN/$USERNAME" || failed=`expr $failed + 1` testit "wbinfo -n against $TARGET" $wbinfo -n "$DOMAIN/$USERNAME" || failed=$(expr $failed + 1)
admin_sid=`$wbinfo -n "$DOMAIN/$USERNAME" | cut -d " " -f1` admin_sid=$($wbinfo -n "$DOMAIN/$USERNAME" | cut -d " " -f1)
echo "$DOMAIN/$USERNAME resolved to $admin_sid" echo "$DOMAIN/$USERNAME resolved to $admin_sid"
testit "wbinfo -s $admin_sid against $TARGET" $wbinfo -s $admin_sid || failed=`expr $failed + 1` testit "wbinfo -s $admin_sid against $TARGET" $wbinfo -s $admin_sid || failed=$(expr $failed + 1)
admin_name=`$wbinfo -s $admin_sid | cut -d " " -f1| tr a-z A-Z` admin_name=$($wbinfo -s $admin_sid | cut -d " " -f1 | tr a-z A-Z)
echo "$admin_sid resolved to $admin_name" echo "$admin_sid resolved to $admin_name"
tested_name=`echo $DOMAIN/$USERNAME | tr a-z A-Z` tested_name=$(echo $DOMAIN/$USERNAME | tr a-z A-Z)
echo "test: wbinfo -s check for sane mapping" echo "test: wbinfo -s check for sane mapping"
if test x$admin_name != x$tested_name; then if test x$admin_name != x$tested_name; then
echo "$admin_name does not match $tested_name" echo "$admin_name does not match $tested_name"
echo "failure: wbinfo -s check for sane mapping" echo "failure: wbinfo -s check for sane mapping"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
else else
echo "success: wbinfo -s check for sane mapping" echo "success: wbinfo -s check for sane mapping"
fi fi
while read SID ; do while read SID; do
read NAME read NAME
testit "wbinfo -s $SID against $TARGET" $wbinfo -s $SID || failed=`expr $failed + 1` testit "wbinfo -s $SID against $TARGET" $wbinfo -s $SID || failed=$(expr $failed + 1)
RESOLVED_NAME=`$wbinfo -s $SID | tr a-z A-Z` RESOLVED_NAME=$($wbinfo -s $SID | tr a-z A-Z)
echo "$SID resolved to $RESOLVED_NAME" echo "$SID resolved to $RESOLVED_NAME"
echo "test: wbinfo -s $SID against $TARGET" echo "test: wbinfo -s $SID against $TARGET"
if test x"$RESOLVED_NAME" != x"$NAME" ; then if test x"$RESOLVED_NAME" != x"$NAME"; then
echo "$RESOLVED_NAME does not match $NAME" echo "$RESOLVED_NAME does not match $NAME"
echo "failure: wbinfo -s $SID against $TARGET" echo "failure: wbinfo -s $SID against $TARGET"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
else else
echo "success: wbinfo -s $SID against $TARGET" echo "success: wbinfo -s $SID against $TARGET"
fi fi
done <<EOF done <<EOF
S-1-1-0 S-1-1-0
/EVERYONE 5 /EVERYONE 5
@ -113,133 +115,133 @@ S-1-5-1
NT AUTHORITY/DIALUP 5 NT AUTHORITY/DIALUP 5
EOF EOF
testit "wbinfo -n on the returned name against $TARGET" $wbinfo -n $admin_name || failed=`expr $failed + 1` testit "wbinfo -n on the returned name against $TARGET" $wbinfo -n $admin_name || failed=$(expr $failed + 1)
test_sid=`$wbinfo -n $tested_name | cut -d " " -f1` test_sid=$($wbinfo -n $tested_name | cut -d " " -f1)
echo "test: wbinfo -n check for sane mapping" echo "test: wbinfo -n check for sane mapping"
if test x$admin_sid != x$test_sid; then if test x$admin_sid != x$test_sid; then
echo "$admin_sid does not match $test_sid" echo "$admin_sid does not match $test_sid"
echo "failure: wbinfo -n check for sane mapping" echo "failure: wbinfo -n check for sane mapping"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
else else
echo "success: wbinfo -n check for sane mapping" echo "success: wbinfo -n check for sane mapping"
fi fi
echo "test: wbinfo -n NT Authority/Authenticated Users" echo "test: wbinfo -n NT Authority/Authenticated Users"
$wbinfo -n "NT Authority/Authenticated Users" $wbinfo -n "NT Authority/Authenticated Users"
if [ $? -ne 0 ] ; then if [ $? -ne 0 ]; then
echo "failure: wbinfo -n NT Authority/Authenticated Users" echo "failure: wbinfo -n NT Authority/Authenticated Users"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
else else
echo "success: wbinfo -n NT Authority/Authenticated Users" echo "success: wbinfo -n NT Authority/Authenticated Users"
fi fi
echo "test: wbinfo --group-info NT Authority/Authenticated Users" echo "test: wbinfo --group-info NT Authority/Authenticated Users"
$wbinfo --group-info "NT Authority/Authenticated Users" $wbinfo --group-info "NT Authority/Authenticated Users"
if [ $? -ne 0 ] ; then if [ $? -ne 0 ]; then
echo "failure: wbinfo --group-info NT Authority/Authenticated Users" echo "failure: wbinfo --group-info NT Authority/Authenticated Users"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
else else
echo "success: wbinfo --group-info NT Authority/Authenticated Users" echo "success: wbinfo --group-info NT Authority/Authenticated Users"
fi fi
testit "wbinfo -U against $TARGET" $wbinfo -U 30000 || failed=`expr $failed + 1` testit "wbinfo -U against $TARGET" $wbinfo -U 30000 || failed=$(expr $failed + 1)
echo "test: wbinfo -U check for sane mapping" echo "test: wbinfo -U check for sane mapping"
sid_for_30000=`$wbinfo -U 30000` sid_for_30000=$($wbinfo -U 30000)
if test x$sid_for_30000 != "xS-1-22-1-30000"; then if test x$sid_for_30000 != "xS-1-22-1-30000"; then
echo "uid 30000 mapped to $sid_for_30000, not S-1-22-1-30000" echo "uid 30000 mapped to $sid_for_30000, not S-1-22-1-30000"
echo "failure: wbinfo -U check for sane mapping" echo "failure: wbinfo -U check for sane mapping"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
else else
echo "success: wbinfo -U check for sane mapping" echo "success: wbinfo -U check for sane mapping"
fi fi
admin_uid=`$wbinfo -S $admin_sid` admin_uid=$($wbinfo -S $admin_sid)
testit "wbinfo -G against $TARGET" $wbinfo -G 30000 || failed=`expr $failed + 1` testit "wbinfo -G against $TARGET" $wbinfo -G 30000 || failed=$(expr $failed + 1)
echo "test: wbinfo -G check for sane mapping" echo "test: wbinfo -G check for sane mapping"
sid_for_30000=`$wbinfo -G 30000` sid_for_30000=$($wbinfo -G 30000)
if test x$sid_for_30000 != "xS-1-22-2-30000"; then if test x$sid_for_30000 != "xS-1-22-2-30000"; then
echo "gid 30000 mapped to $sid_for_30000, not S-1-22-2-30000" echo "gid 30000 mapped to $sid_for_30000, not S-1-22-2-30000"
echo "failure: wbinfo -G check for sane mapping" echo "failure: wbinfo -G check for sane mapping"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
else else
echo "success: wbinfo -G check for sane mapping" echo "success: wbinfo -G check for sane mapping"
fi fi
testit "wbinfo -S against $TARGET" $wbinfo -S "S-1-22-1-30000" || failed=`expr $failed + 1` testit "wbinfo -S against $TARGET" $wbinfo -S "S-1-22-1-30000" || failed=$(expr $failed + 1)
echo "test: wbinfo -S check for sane mapping" echo "test: wbinfo -S check for sane mapping"
uid_for_sid=`$wbinfo -S S-1-22-1-30000` uid_for_sid=$($wbinfo -S S-1-22-1-30000)
if test 0$uid_for_sid -ne 30000; then if test 0$uid_for_sid -ne 30000; then
echo "S-1-22-1-30000 mapped to $uid_for_sid, not 30000" echo "S-1-22-1-30000 mapped to $uid_for_sid, not 30000"
echo "failure: wbinfo -S check for sane mapping" echo "failure: wbinfo -S check for sane mapping"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
else else
echo "success: wbinfo -S check for sane mapping" echo "success: wbinfo -S check for sane mapping"
fi fi
testfail "wbinfo -S against $TARGET using invalid SID" $wbinfo -S "S-1-22-2-30000" && failed=`expr $failed + 1` testfail "wbinfo -S against $TARGET using invalid SID" $wbinfo -S "S-1-22-2-30000" && failed=$(expr $failed + 1)
testit "wbinfo -Y against $TARGET" $wbinfo -Y "S-1-22-2-30000" || failed=`expr $failed + 1` testit "wbinfo -Y against $TARGET" $wbinfo -Y "S-1-22-2-30000" || failed=$(expr $failed + 1)
echo "test: wbinfo -Y check for sane mapping" echo "test: wbinfo -Y check for sane mapping"
gid_for_sid=`$wbinfo -Y S-1-22-2-30000` gid_for_sid=$($wbinfo -Y S-1-22-2-30000)
if test 0$gid_for_sid -ne 30000; then if test 0$gid_for_sid -ne 30000; then
echo "S-1-22-2-30000 mapped to $gid_for_sid, not 30000" echo "S-1-22-2-30000 mapped to $gid_for_sid, not 30000"
echo "failure: wbinfo -Y check for sane mapping" echo "failure: wbinfo -Y check for sane mapping"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
else else
echo "success: wbinfo -Y check for sane mapping" echo "success: wbinfo -Y check for sane mapping"
fi fi
testfail "wbinfo -Y against $TARGET using invalid SID" $wbinfo -Y "S-1-22-1-30000" && failed=`expr $failed + 1` testfail "wbinfo -Y against $TARGET using invalid SID" $wbinfo -Y "S-1-22-1-30000" && failed=$(expr $failed + 1)
testit "wbinfo -t against $TARGET" $wbinfo -t || failed=`expr $failed + 1` testit "wbinfo -t against $TARGET" $wbinfo -t || failed=$(expr $failed + 1)
#didn't really work anyway #didn't really work anyway
testit "wbinfo --trusted-domains against $TARGET" $wbinfo --trusted-domains || failed=`expr $failed + 1` testit "wbinfo --trusted-domains against $TARGET" $wbinfo --trusted-domains || failed=$(expr $failed + 1)
testit "wbinfo --all-domains against $TARGET" $wbinfo --all-domains || failed=`expr $failed + 1` testit "wbinfo --all-domains against $TARGET" $wbinfo --all-domains || failed=$(expr $failed + 1)
testit "wbinfo --own-domain against $TARGET" $wbinfo --own-domain || failed=`expr $failed + 1` testit "wbinfo --own-domain against $TARGET" $wbinfo --own-domain || failed=$(expr $failed + 1)
echo "test: wbinfo --own-domain against $TARGET check output" echo "test: wbinfo --own-domain against $TARGET check output"
own_domain=`$wbinfo --own-domain` own_domain=$($wbinfo --own-domain)
if test x$own_domain = x$DOMAIN; then if test x$own_domain = x$DOMAIN; then
echo "success: wbinfo --own-domain against $TARGET check output" echo "success: wbinfo --own-domain against $TARGET check output"
else else
echo "Own domain reported as $own_domain instead of $DOMAIN" echo "Own domain reported as $own_domain instead of $DOMAIN"
echo "failure: wbinfo --own-domain against $TARGET check output" echo "failure: wbinfo --own-domain against $TARGET check output"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
fi fi
# this does not work # this does not work
knownfail "wbinfo --sequence against $TARGET" $wbinfo --sequence knownfail "wbinfo --sequence against $TARGET" $wbinfo --sequence
# this is stubbed out now # this is stubbed out now
testit "wbinfo -D against $TARGET" $wbinfo -D $DOMAIN || failed=`expr $failed + 1` testit "wbinfo -D against $TARGET" $wbinfo -D $DOMAIN || failed=$(expr $failed + 1)
testit "wbinfo -i against $TARGET" $wbinfo -i "$DOMAIN/$USERNAME" || failed=`expr $failed + 1` testit "wbinfo -i against $TARGET" $wbinfo -i "$DOMAIN/$USERNAME" || failed=$(expr $failed + 1)
echo "test: wbinfo --group-info against $TARGET" echo "test: wbinfo --group-info against $TARGET"
gid=`$wbinfo --group-info "$DOMAIN/Domain users" | cut -d: -f3` gid=$($wbinfo --group-info "$DOMAIN/Domain users" | cut -d: -f3)
if test x$? = x0; then if test x$? = x0; then
echo "success: wbinfo --group-info against $TARGET" echo "success: wbinfo --group-info against $TARGET"
else else
echo "failure: wbinfo --group-info against $TARGET" echo "failure: wbinfo --group-info against $TARGET"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
fi fi
test_name="wbinfo -i against $TARGET" test_name="wbinfo -i against $TARGET"
subunit_start_test "$test_name" subunit_start_test "$test_name"
passwd_line=`$wbinfo -i "$DOMAIN/$USERNAME"` passwd_line=$($wbinfo -i "$DOMAIN/$USERNAME")
if test x$? = x0; then if test x$? = x0; then
subunit_pass_test "$test_name" subunit_pass_test "$test_name"
else else
subunit_fail_test "$test_name" subunit_fail_test "$test_name"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
fi fi
test_name="confirm output of wbinfo -i against $TARGET" test_name="confirm output of wbinfo -i against $TARGET"
@ -260,17 +262,17 @@ if test "x$passwd_line" = "x$expected1_line" -o "x$passwd_line" = "x$expected2_l
subunit_pass_test "$test_name" subunit_pass_test "$test_name"
else else
echo "expected '$expected1_line' or '$expected2_line' got '$passwd_line'" | subunit_fail_test "$test_name" echo "expected '$expected1_line' or '$expected2_line' got '$passwd_line'" | subunit_fail_test "$test_name"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
fi fi
test_name="wbinfo --uid-info against $TARGET" test_name="wbinfo --uid-info against $TARGET"
subunit_start_test "$test_name" subunit_start_test "$test_name"
passwd_line=`$wbinfo --uid-info=$admin_uid` passwd_line=$($wbinfo --uid-info=$admin_uid)
if test x$? = x0; then if test x$? = x0; then
subunit_pass_test "$test_name" subunit_pass_test "$test_name"
else else
subunit_fail_test "$test_name" subunit_fail_test "$test_name"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
fi fi
test_name="confirm output of wbinfo --uid-info against $TARGET" test_name="confirm output of wbinfo --uid-info against $TARGET"
@ -279,38 +281,38 @@ if test "x$passwd_line" = "x$expected1_line" -o "x$passwd_line" = "x$expected2_l
subunit_pass_test "$test_name" subunit_pass_test "$test_name"
else else
echo "expected '$expected1_line' or '$expected2_line' got '$passwd_line'" | subunit_fail_test "$test_name" echo "expected '$expected1_line' or '$expected2_line' got '$passwd_line'" | subunit_fail_test "$test_name"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
fi fi
testfail "wbinfo --group-info against $TARGET with $USERNAME" $wbinfo --group-info $USERNAME && failed=`expr $failed + 1` testfail "wbinfo --group-info against $TARGET with $USERNAME" $wbinfo --group-info $USERNAME && failed=$(expr $failed + 1)
testit "wbinfo --gid-info against $TARGET" $wbinfo --gid-info $gid || failed=`expr $failed + 1` testit "wbinfo --gid-info against $TARGET" $wbinfo --gid-info $gid || failed=$(expr $failed + 1)
testit "wbinfo -r against $TARGET" $wbinfo -r "$DOMAIN/$USERNAME" || failed=`expr $failed + 1` testit "wbinfo -r against $TARGET" $wbinfo -r "$DOMAIN/$USERNAME" || failed=$(expr $failed + 1)
testit "wbinfo --user-domgroups against $TARGET" $wbinfo --user-domgroups $admin_sid || failed=`expr $failed + 1` testit "wbinfo --user-domgroups against $TARGET" $wbinfo --user-domgroups $admin_sid || failed=$(expr $failed + 1)
testit "wbinfo --user-sids against $TARGET" $wbinfo --user-sids $admin_sid || failed=`expr $failed + 1` testit "wbinfo --user-sids against $TARGET" $wbinfo --user-sids $admin_sid || failed=$(expr $failed + 1)
testit "wbinfo -a against $TARGET with domain creds" $wbinfo -a "$DOMAIN/$USERNAME"%"$PASSWORD" || failed=`expr $failed + 1` testit "wbinfo -a against $TARGET with domain creds" $wbinfo -a "$DOMAIN/$USERNAME"%"$PASSWORD" || failed=$(expr $failed + 1)
testit "wbinfo --getdcname against $TARGET" $wbinfo --getdcname=$DOMAIN testit "wbinfo --getdcname against $TARGET" $wbinfo --getdcname=$DOMAIN
testit "wbinfo -p against $TARGET" $wbinfo -p || failed=`expr $failed + 1` testit "wbinfo -p against $TARGET" $wbinfo -p || failed=$(expr $failed + 1)
testit "wbinfo -K against $TARGET with domain creds" $wbinfo --krb5ccname=$KRB5CCNAME --krb5auth="$DOMAIN/$USERNAME"%"$PASSWORD" || failed=`expr $failed + 1` testit "wbinfo -K against $TARGET with domain creds" $wbinfo --krb5ccname=$KRB5CCNAME --krb5auth="$DOMAIN/$USERNAME"%"$PASSWORD" || failed=$(expr $failed + 1)
testit "wbinfo --separator against $TARGET" $wbinfo --separator || failed=`expr $failed + 1` testit "wbinfo --separator against $TARGET" $wbinfo --separator || failed=$(expr $failed + 1)
if test "$TARGET" = "ad_member"; then if test "$TARGET" = "ad_member"; then
testit "wbinfo --domain-info=$DOMAIN" $wbinfo --domain-info=$DOMAIN || failed=`expr $failed + 1` testit "wbinfo --domain-info=$DOMAIN" $wbinfo --domain-info=$DOMAIN || failed=$(expr $failed + 1)
testit "wbinfo --dc-info=$DOMAIN" $wbinfo --dc-info=$DOMAIN || failed=`expr $failed + 1` testit "wbinfo --dc-info=$DOMAIN" $wbinfo --dc-info=$DOMAIN || failed=$(expr $failed + 1)
fi fi
testit_expect_failure "wbinfo -a against $TARGET with invalid password" $wbinfo -a "$DOMAIN/$USERNAME%InvalidPassword" && failed=`expr $failed + 1` testit_expect_failure "wbinfo -a against $TARGET with invalid password" $wbinfo -a "$DOMAIN/$USERNAME%InvalidPassword" && failed=$(expr $failed + 1)
testit_expect_failure "wbinfo -K against $TARGET with invalid password" $wbinfo -K "$DOMAIN/$USERNAME%InvalidPassword" && failed=`expr $failed + 1` testit_expect_failure "wbinfo -K against $TARGET with invalid password" $wbinfo -K "$DOMAIN/$USERNAME%InvalidPassword" && failed=$(expr $failed + 1)
rm -f $KRB5CCNAME_PATH rm -f $KRB5CCNAME_PATH

View File

@ -1,10 +1,10 @@
#!/bin/sh #!/bin/sh
# Blackbox test for wbinfo name lookup # Blackbox test for wbinfo name lookup
if [ $# -lt 3 ]; then if [ $# -lt 3 ]; then
cat <<EOF cat <<EOF
Usage: test_wbinfo.sh DOMAIN REALM DC_USERNAME Usage: test_wbinfo.sh DOMAIN REALM DC_USERNAME
EOF EOF
exit 1; exit 1
fi fi
DOMAIN=$1 DOMAIN=$1
@ -16,23 +16,23 @@ failed=0
sambabindir="$BINDIR" sambabindir="$BINDIR"
wbinfo="$VALGRIND $sambabindir/wbinfo" wbinfo="$VALGRIND $sambabindir/wbinfo"
. `dirname $0`/../../testprogs/blackbox/subunit.sh . $(dirname $0)/../../testprogs/blackbox/subunit.sh
# Correct query is expected to work # Correct query is expected to work
testit "name-to-sid.single-separator" \ testit "name-to-sid.single-separator" \
$wbinfo -n $DOMAIN/$DC_USERNAME || \ $wbinfo -n $DOMAIN/$DC_USERNAME ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
testit "name-to-sid.at_domain" \ testit "name-to-sid.at_domain" \
$wbinfo -n $DOMAIN/ || \ $wbinfo -n $DOMAIN/ ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
testit "name-to-sid.upn" \ testit "name-to-sid.upn" \
$wbinfo -n $DC_USERNAME@$REALM || \ $wbinfo -n $DC_USERNAME@$REALM ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
testit "name-to-sid.realm-user" \ testit "name-to-sid.realm-user" \
$wbinfo -n $REALM/$DC_USERNAME || \ $wbinfo -n $REALM/$DC_USERNAME ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
# For the name-to-sid.realm-user query, ensure # For the name-to-sid.realm-user query, ensure
@ -43,22 +43,22 @@ out=$($wbinfo -s $sid | sed -e 's/ .//')
# winbindd returns usernames in lowercase # winbindd returns usernames in lowercase
lcuser=$(echo $DC_USERNAME | tr A-Z a-z) lcuser=$(echo $DC_USERNAME | tr A-Z a-z)
testit "Verify DOMAIN/USER output" \ testit "Verify DOMAIN/USER output" \
test "$out" = "$DOMAIN/$lcuser" || \ test "$out" = "$DOMAIN/$lcuser" ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
# Two separator characters should fail # Two separator characters should fail
testit_expect_failure "name-to-sid.double-separator" \ testit_expect_failure "name-to-sid.double-separator" \
$wbinfo -n $DOMAIN//$DC_USERNAME || \ $wbinfo -n $DOMAIN//$DC_USERNAME ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
# Invalid domain is expected to fail # Invalid domain is expected to fail
testit_expect_failure "name-to-sid.invalid-domain" \ testit_expect_failure "name-to-sid.invalid-domain" \
$wbinfo -n INVALID/$DC_USERNAME || \ $wbinfo -n INVALID/$DC_USERNAME ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
# Invalid domain with two separator characters is expected to fail # Invalid domain with two separator characters is expected to fail
testit_expect_failure "name-to-sid.double-separator-invalid-domain" \ testit_expect_failure "name-to-sid.double-separator-invalid-domain" \
$wbinfo -n INVALID//$DC_USERNAME || \ $wbinfo -n INVALID//$DC_USERNAME ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
exit $failed exit $failed

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
incdir=`dirname $0`/../../testprogs/blackbox incdir=$(dirname $0)/../../testprogs/blackbox
. $incdir/subunit.sh . $incdir/subunit.sh
# #
@ -9,7 +9,7 @@ incdir=`dirname $0`/../../testprogs/blackbox
# #
wbinfo_some_mapped() wbinfo_some_mapped()
{ {
output=`$VALGRIND $BINDIR/wbinfo --sids-to-unix-ids=S-1-5-123456789,S-1-5-11` output=$($VALGRIND $BINDIR/wbinfo --sids-to-unix-ids=S-1-5-123456789,S-1-5-11)
test x"$?" = x"0" || { test x"$?" = x"0" || {
return 1 return 1
} }
@ -27,6 +27,6 @@ wbinfo_some_mapped()
return 0 return 0
} }
testit "wbinfo some mapped" wbinfo_some_mapped || failed=`expr $failed + 1` testit "wbinfo some mapped" wbinfo_some_mapped || failed=$(expr $failed + 1)
testok $0 $failed testok $0 $failed

View File

@ -1,15 +1,15 @@
#!/bin/sh #!/bin/sh
if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
cat <<EOF cat <<EOF
Usage: test_wbinfo_simple.sh <wbinfo args> Usage: test_wbinfo_simple.sh <wbinfo args>
EOF EOF
exit 1; exit 1
fi fi
ADDARGS="$*" ADDARGS="$*"
incdir=`dirname $0`/../../testprogs/blackbox incdir=$(dirname $0)/../../testprogs/blackbox
. $incdir/subunit.sh . $incdir/subunit.sh
KRB5CCNAME_PATH="$PREFIX/test_wbinfo_simple_krb5ccname" KRB5CCNAME_PATH="$PREFIX/test_wbinfo_simple_krb5ccname"
@ -18,7 +18,7 @@ rm -f $KRB5CCNAME_PATH
KRB5CCNAME="FILE:$KRB5CCNAME_PATH" KRB5CCNAME="FILE:$KRB5CCNAME_PATH"
export KRB5CCNAME export KRB5CCNAME
testit "wbinfo" $VALGRIND $BINDIR/wbinfo --krb5ccname="$KRB5CCNAME" $ADDARGS || failed=`expr $failed + 1` testit "wbinfo" $VALGRIND $BINDIR/wbinfo --krb5ccname="$KRB5CCNAME" $ADDARGS || failed=$(expr $failed + 1)
rm -f $KRB5CCNAME_PATH rm -f $KRB5CCNAME_PATH

View File

@ -3,10 +3,10 @@
# Copyright (c) 2018 Andreas Schneider <asn@samba.org> # Copyright (c) 2018 Andreas Schneider <asn@samba.org>
if [ $# -lt 6 ]; then if [ $# -lt 6 ]; then
cat <<EOF cat <<EOF
Usage: $(basename $0) DOMAIN REALM OWN_DOMAIN USERNAME1 UPN_NAME1 USERNAME2 UPN_NAME2 ENVNAME Usage: $(basename $0) DOMAIN REALM OWN_DOMAIN USERNAME1 UPN_NAME1 USERNAME2 UPN_NAME2 ENVNAME
EOF EOF
exit 1; exit 1
fi fi
DOMAIN=$1 DOMAIN=$1
@ -120,16 +120,16 @@ testit "getpwnam.domain.$DOMAIN.$USERNAME1" test_getpwnam "$DOMAIN/$USERNAME1" 0
testit "getpwnam.upn.$UPN_NAME1" test_getpwnam "$UPN1" 0 "$DOMAIN/$USERNAME1" || failed=$(expr $failed + 1) testit "getpwnam.upn.$UPN_NAME1" test_getpwnam "$UPN1" 0 "$DOMAIN/$USERNAME1" || failed=$(expr $failed + 1)
case ${ENVNAME} in case ${ENVNAME} in
ad_member*) ad_member*)
# We should not be able to lookup the user just by the name # We should not be able to lookup the user just by the name
test_ret=2 test_ret=2
test_output="" test_output=""
;; ;;
fl2008r2dc*) fl2008r2dc*)
test_ret=0 test_ret=0
test_output="$OWN_DOMAIN/$USERNAME1" test_output="$OWN_DOMAIN/$USERNAME1"
;; ;;
*) *)
test_ret=0 test_ret=0
test_output="$DOMAIN/$USERNAME1" test_output="$DOMAIN/$USERNAME1"
;; ;;

View File

@ -3,10 +3,10 @@
# Copyright (c) 2020 Andreas Schneider <asn@samba.org> # Copyright (c) 2020 Andreas Schneider <asn@samba.org>
if [ $# -lt 5 ]; then if [ $# -lt 5 ]; then
cat <<EOF cat <<EOF
Usage: $(basename $0) DOMAIN REALM USERNAME PASSWORD PRIMARY_GROUP Usage: $(basename $0) DOMAIN REALM USERNAME PASSWORD PRIMARY_GROUP
EOF EOF
exit 1; exit 1
fi fi
DOMAIN=$1 DOMAIN=$1