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,7 +21,7 @@ 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

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 " ")

View File

@ -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"

View File

@ -14,7 +14,7 @@ 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
@ -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

@ -4,7 +4,7 @@ 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,9 +26,10 @@ 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="$*"
@ -43,7 +44,8 @@ testfail() {
return $status return $status
} }
knownfail() { knownfail()
{
name="$1" name="$1"
shift shift
cmdline="$*" cmdline="$*"
@ -60,7 +62,6 @@ knownfail() {
return $status 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,40 +71,40 @@ 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
@ -114,7 +115,7 @@ 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
@ -124,58 +125,58 @@ 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

@ -13,7 +13,7 @@ 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

View File

@ -4,7 +4,7 @@ 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,9 +17,10 @@ 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="$*"
@ -34,7 +35,8 @@ testfail() {
return $status return $status
} }
knownfail() { knownfail()
{
name="$1" name="$1"
shift shift
cmdline="$*" cmdline="$*"
@ -58,32 +60,32 @@ 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
@ -91,16 +93,16 @@ 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
@ -113,14 +115,14 @@ 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
@ -129,7 +131,7 @@ 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
@ -138,108 +140,108 @@ 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

@ -4,7 +4,7 @@ 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

@ -4,12 +4,12 @@ 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

@ -6,7 +6,7 @@ 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

View File

@ -6,7 +6,7 @@ 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