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
. `dirname $0`/../../testprogs/blackbox/subunit.sh
. $(dirname $0)/../../testprogs/blackbox/subunit.sh
DOMAIN_SID=$($wbinfo -n "$DOMAIN/" | cut -f 1 -d " ")
if [ $? -ne 0 ]; then

View File

@ -11,7 +11,7 @@ wbinfo="$VALGRIND $BINDIR/wbinfo"
failed=0
. `dirname $0`/../../testprogs/blackbox/subunit.sh
. $(dirname $0)/../../testprogs/blackbox/subunit.sh
testit "wbinfo returns domain SID" $wbinfo -n "$DOMAIN/" || exit 1
DOMAIN_SID=$($wbinfo -n "$DOMAIN/" | cut -f 1 -d " ")

View File

@ -44,7 +44,7 @@ fi
failed=0
. `dirname $0`/../../testprogs/blackbox/subunit.sh
. $(dirname $0)/../../testprogs/blackbox/subunit.sh
# Delete LDAP records
$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"
failed=0
. `dirname $0`/../../testprogs/blackbox/subunit.sh
. $(dirname $0)/../../testprogs/blackbox/subunit.sh
DOMAIN_SID=$($wbinfo -n "$DOMAIN/" | cut -f 1 -d " ")
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)
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)
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)
gid=$($wbinfo --sid-to-gid=$GROUP_SID)
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)
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)
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)
group_pw="$DOMAIN/domain users:*:$uid:$gid::/home/$DOMAIN/domain users:/bin/false"
out=$(getent passwd "$GROUP")
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)
test "$out" = "$group_pw"
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)
out=$(getent passwd $uid)
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)
test "$out" = "$group_pw"
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)
group_gr="$DOMAIN/domain users:x:$gid:"
out=$(getent group "$GROUP")
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)
test "$out" = "$group_gr"
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)
out=$(getent group "$gid")
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)
test "$out" = "$group_gr"
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)
#
@ -139,60 +139,60 @@ USER_SID=$($wbinfo --name-to-sid="$USER" | sed -e 's/ .*//')
uid=$($wbinfo --sid-to-uid=$USER_SID)
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)
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)
gid=$($wbinfo --sid-to-gid=$USER_SID)
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)
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)
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)
user_pw="$DOMAIN/administrator:*:$uid:$dom_users_gid::/home/$DOMAIN/administrator:/bin/false"
out=$(getent passwd "$USER")
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)
test "$out" = "$user_pw"
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)
out=$(getent passwd $uid)
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)
test "$out" = "$user_pw"
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)
user_gr="$DOMAIN/administrator:x:$gid:$DOMAIN/administrator"
out=$(getent group "$USER")
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)
test "$out" = "$user_gr"
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)
out=$(getent group "$gid")
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)
test "$out" = "$user_gr"
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)
exit $failed

View File

@ -4,7 +4,7 @@ if [ $# -lt 4 ]; then
cat <<EOF
Usage: test_rfc2307_mapping.sh DOMAIN USERNAME PASSWORD SERVER UID_RFC2307TEST GID_RFC2307TEST
EOF
exit 1;
exit 1
fi
DOMAIN=$1
@ -26,9 +26,10 @@ else
ldbmodify="ldbmodify"
fi
. `dirname $0`/../../testprogs/blackbox/subunit.sh
. $(dirname $0)/../../testprogs/blackbox/subunit.sh
testfail() {
testfail()
{
name="$1"
shift
cmdline="$*"
@ -43,7 +44,8 @@ testfail() {
return $status
}
knownfail() {
knownfail()
{
name="$1"
shift
cmdline="$*"
@ -60,7 +62,6 @@ knownfail() {
return $status
}
# Create new testing account
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
# Convert name to SID
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`
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)
echo "$DOMAIN/rfc2307_test_user resolved to $user_sid"
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`
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)
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)
echo "test: wbinfo -s check for sane mapping"
if test x$user_name != x$tested_name; then
echo "$user_name does not match $tested_name"
echo "failure: wbinfo -s check for sane mapping"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
else
echo "success: wbinfo -s check for sane mapping"
fi
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`
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)
echo "test: wbinfo -n check for sane mapping"
if test x$user_sid != x$test_sid; then
echo "$user_sid does not match $test_sid"
echo "failure: wbinfo -n check for sane mapping"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
else
echo "success: wbinfo -n check for sane mapping"
fi
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`
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)
echo "$DOMAIN/rfc2307_test_group resolved to $group_sid"
# Then add a uidNumber to the group record using ldbmodify
@ -114,7 +115,7 @@ add: uidNumber
uidNumber: $UID_RFC2307TEST
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
cat >$PREFIX/tmpldbmodify <<EOF
@ -124,58 +125,58 @@ add: gidNumber
gidNumber: $GID_RFC2307TEST
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
# 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"
sid_for_user=`$wbinfo -U $UID_RFC2307TEST`
sid_for_user=$($wbinfo -U $UID_RFC2307TEST)
if test x"$sid_for_user" != x"$user_sid"; then
echo "uid $UID_RFC2307TEST mapped to $sid_for_user, not $user_sid"
echo "failure: wbinfo -U check for sane mapping"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
else
echo "success: wbinfo -U check for sane mapping"
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"
sid_for_group=`$wbinfo -G $GID_RFC2307TEST`
sid_for_group=$($wbinfo -G $GID_RFC2307TEST)
if test x$sid_for_group != "x$group_sid"; then
echo "gid $GID_RFC2307TEST mapped to $sid_for_group, not $group_sid"
echo "failure: wbinfo -G check for sane mapping"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
else
echo "success: wbinfo -G check for sane mapping"
fi
# 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"
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
echo "$user_sid mapped to $uid_for_sid, not $UID_RFC2307TEST"
echo "failure: wbinfo -S check for sane mapping"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
else
echo "success: wbinfo -S check for sane mapping"
fi
# 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"
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
echo "$group_sid mapped to $gid_for_sid, not $GID_RFC2307TEST"
echo "failure: wbinfo -Y check for sane mapping"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
else
echo "success: wbinfo -Y check for sane mapping"
fi

View File

@ -13,7 +13,7 @@ net="$VALGRIND $BINDIR/net"
failed=0
. `dirname $0`/../../testprogs/blackbox/subunit.sh
. $(dirname $0)/../../testprogs/blackbox/subunit.sh
DOMAIN_SID=$($wbinfo -n "$DOMAIN/" | cut -f 1 -d " ")
if [ $? -ne 0 ]; then

View File

@ -4,7 +4,7 @@ if [ $# -lt 4 ]; then
cat <<EOF
Usage: test_wbinfo.sh DOMAIN USERNAME PASSWORD TARGET
EOF
exit 1;
exit 1
fi
DOMAIN=$1
@ -17,9 +17,10 @@ failed=0
samba4bindir="$BINDIR"
wbinfo="$VALGRIND $samba4bindir/wbinfo"
. `dirname $0`/../../testprogs/blackbox/subunit.sh
. $(dirname $0)/../../testprogs/blackbox/subunit.sh
testfail() {
testfail()
{
name="$1"
shift
cmdline="$*"
@ -34,7 +35,8 @@ testfail() {
return $status
}
knownfail() {
knownfail()
{
name="$1"
shift
cmdline="$*"
@ -58,32 +60,32 @@ KRB5CCNAME="FILE:$KRB5CCNAME_PATH"
export KRB5CCNAME
# 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
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
# 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
# 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
testit "wbinfo -n against $TARGET" $wbinfo -n "$DOMAIN/$USERNAME" || failed=`expr $failed + 1`
admin_sid=`$wbinfo -n "$DOMAIN/$USERNAME" | cut -d " " -f1`
testit "wbinfo -n against $TARGET" $wbinfo -n "$DOMAIN/$USERNAME" || failed=$(expr $failed + 1)
admin_sid=$($wbinfo -n "$DOMAIN/$USERNAME" | cut -d " " -f1)
echo "$DOMAIN/$USERNAME resolved to $admin_sid"
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`
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)
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"
if test x$admin_name != x$tested_name; then
echo "$admin_name does not match $tested_name"
echo "failure: wbinfo -s check for sane mapping"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
else
echo "success: wbinfo -s check for sane mapping"
fi
@ -91,16 +93,16 @@ fi
while read SID; do
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 "test: wbinfo -s $SID against $TARGET"
if test x"$RESOLVED_NAME" != x"$NAME"; then
echo "$RESOLVED_NAME does not match $NAME"
echo "failure: wbinfo -s $SID against $TARGET"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
else
echo "success: wbinfo -s $SID against $TARGET"
fi
@ -113,14 +115,14 @@ S-1-5-1
NT AUTHORITY/DIALUP 5
EOF
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`
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)
echo "test: wbinfo -n check for sane mapping"
if test x$admin_sid != x$test_sid; then
echo "$admin_sid does not match $test_sid"
echo "failure: wbinfo -n check for sane mapping"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
else
echo "success: wbinfo -n check for sane mapping"
fi
@ -129,7 +131,7 @@ echo "test: wbinfo -n NT Authority/Authenticated Users"
$wbinfo -n "NT Authority/Authenticated Users"
if [ $? -ne 0 ]; then
echo "failure: wbinfo -n NT Authority/Authenticated Users"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
else
echo "success: wbinfo -n NT Authority/Authenticated Users"
fi
@ -138,108 +140,108 @@ echo "test: wbinfo --group-info NT Authority/Authenticated Users"
$wbinfo --group-info "NT Authority/Authenticated Users"
if [ $? -ne 0 ]; then
echo "failure: wbinfo --group-info NT Authority/Authenticated Users"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
else
echo "success: wbinfo --group-info NT Authority/Authenticated Users"
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"
sid_for_30000=`$wbinfo -U 30000`
sid_for_30000=$($wbinfo -U 30000)
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 "failure: wbinfo -U check for sane mapping"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
else
echo "success: wbinfo -U check for sane mapping"
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"
sid_for_30000=`$wbinfo -G 30000`
sid_for_30000=$($wbinfo -G 30000)
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 "failure: wbinfo -G check for sane mapping"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
else
echo "success: wbinfo -G check for sane mapping"
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"
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
echo "S-1-22-1-30000 mapped to $uid_for_sid, not 30000"
echo "failure: wbinfo -S check for sane mapping"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
else
echo "success: wbinfo -S check for sane mapping"
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"
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
echo "S-1-22-2-30000 mapped to $gid_for_sid, not 30000"
echo "failure: wbinfo -Y check for sane mapping"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
else
echo "success: wbinfo -Y check for sane mapping"
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
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 --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 --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"
own_domain=`$wbinfo --own-domain`
own_domain=$($wbinfo --own-domain)
if test x$own_domain = x$DOMAIN; then
echo "success: wbinfo --own-domain against $TARGET check output"
else
echo "Own domain reported as $own_domain instead of $DOMAIN"
echo "failure: wbinfo --own-domain against $TARGET check output"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
fi
# this does not work
knownfail "wbinfo --sequence against $TARGET" $wbinfo --sequence
# 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"
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
echo "success: wbinfo --group-info against $TARGET"
else
echo "failure: wbinfo --group-info against $TARGET"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
fi
test_name="wbinfo -i against $TARGET"
subunit_start_test "$test_name"
passwd_line=`$wbinfo -i "$DOMAIN/$USERNAME"`
passwd_line=$($wbinfo -i "$DOMAIN/$USERNAME")
if test x$? = x0; then
subunit_pass_test "$test_name"
else
subunit_fail_test "$test_name"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
fi
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"
else
echo "expected '$expected1_line' or '$expected2_line' got '$passwd_line'" | subunit_fail_test "$test_name"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
fi
test_name="wbinfo --uid-info against $TARGET"
subunit_start_test "$test_name"
passwd_line=`$wbinfo --uid-info=$admin_uid`
passwd_line=$($wbinfo --uid-info=$admin_uid)
if test x$? = x0; then
subunit_pass_test "$test_name"
else
subunit_fail_test "$test_name"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
fi
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"
else
echo "expected '$expected1_line' or '$expected2_line' got '$passwd_line'" | subunit_fail_test "$test_name"
failed=`expr $failed + 1`
failed=$(expr $failed + 1)
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 -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
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
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

View File

@ -4,7 +4,7 @@ if [ $# -lt 3 ]; then
cat <<EOF
Usage: test_wbinfo.sh DOMAIN REALM DC_USERNAME
EOF
exit 1;
exit 1
fi
DOMAIN=$1
@ -16,23 +16,23 @@ failed=0
sambabindir="$BINDIR"
wbinfo="$VALGRIND $sambabindir/wbinfo"
. `dirname $0`/../../testprogs/blackbox/subunit.sh
. $(dirname $0)/../../testprogs/blackbox/subunit.sh
# Correct query is expected to work
testit "name-to-sid.single-separator" \
$wbinfo -n $DOMAIN/$DC_USERNAME || \
$wbinfo -n $DOMAIN/$DC_USERNAME ||
failed=$(expr $failed + 1)
testit "name-to-sid.at_domain" \
$wbinfo -n $DOMAIN/ || \
$wbinfo -n $DOMAIN/ ||
failed=$(expr $failed + 1)
testit "name-to-sid.upn" \
$wbinfo -n $DC_USERNAME@$REALM || \
$wbinfo -n $DC_USERNAME@$REALM ||
failed=$(expr $failed + 1)
testit "name-to-sid.realm-user" \
$wbinfo -n $REALM/$DC_USERNAME || \
$wbinfo -n $REALM/$DC_USERNAME ||
failed=$(expr $failed + 1)
# 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
lcuser=$(echo $DC_USERNAME | tr A-Z a-z)
testit "Verify DOMAIN/USER output" \
test "$out" = "$DOMAIN/$lcuser" || \
test "$out" = "$DOMAIN/$lcuser" ||
failed=$(expr $failed + 1)
# Two separator characters should fail
testit_expect_failure "name-to-sid.double-separator" \
$wbinfo -n $DOMAIN//$DC_USERNAME || \
$wbinfo -n $DOMAIN//$DC_USERNAME ||
failed=$(expr $failed + 1)
# Invalid domain is expected to fail
testit_expect_failure "name-to-sid.invalid-domain" \
$wbinfo -n INVALID/$DC_USERNAME || \
$wbinfo -n INVALID/$DC_USERNAME ||
failed=$(expr $failed + 1)
# Invalid domain with two separator characters is expected to fail
testit_expect_failure "name-to-sid.double-separator-invalid-domain" \
$wbinfo -n INVALID//$DC_USERNAME || \
$wbinfo -n INVALID//$DC_USERNAME ||
failed=$(expr $failed + 1)
exit $failed

View File

@ -1,6 +1,6 @@
#!/bin/sh
incdir=`dirname $0`/../../testprogs/blackbox
incdir=$(dirname $0)/../../testprogs/blackbox
. $incdir/subunit.sh
#
@ -9,7 +9,7 @@ incdir=`dirname $0`/../../testprogs/blackbox
#
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" || {
return 1
}
@ -27,6 +27,6 @@ wbinfo_some_mapped()
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

View File

@ -4,12 +4,12 @@ if [ $# -lt 1 ]; then
cat <<EOF
Usage: test_wbinfo_simple.sh <wbinfo args>
EOF
exit 1;
exit 1
fi
ADDARGS="$*"
incdir=`dirname $0`/../../testprogs/blackbox
incdir=$(dirname $0)/../../testprogs/blackbox
. $incdir/subunit.sh
KRB5CCNAME_PATH="$PREFIX/test_wbinfo_simple_krb5ccname"
@ -18,7 +18,7 @@ rm -f $KRB5CCNAME_PATH
KRB5CCNAME="FILE:$KRB5CCNAME_PATH"
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

View File

@ -6,7 +6,7 @@ if [ $# -lt 6 ]; then
cat <<EOF
Usage: $(basename $0) DOMAIN REALM OWN_DOMAIN USERNAME1 UPN_NAME1 USERNAME2 UPN_NAME2 ENVNAME
EOF
exit 1;
exit 1
fi
DOMAIN=$1

View File

@ -6,7 +6,7 @@ if [ $# -lt 5 ]; then
cat <<EOF
Usage: $(basename $0) DOMAIN REALM USERNAME PASSWORD PRIMARY_GROUP
EOF
exit 1;
exit 1
fi
DOMAIN=$1