2 # Blackbox test for wbinfo
5 Usage: test_wbinfo.sh DOMAIN USERNAME PASSWORD TARGET
17 samba4bindir
=`dirname $0`/..
/..
/source4/bin
18 wbinfo
=$samba4bindir/wbinfo
20 .
`dirname $0`/..
/..
/testprogs
/blackbox
/subunit.sh
29 if [ x
$status = x0
]; then
44 if [ x
$status = x0
]; then
45 echo "failure: $name [unexpected success]"
48 echo "knownfail: $name"
55 testit
"wbinfo -u against $TARGET" $wbinfo -u || failed
=`expr $failed + 1`
58 knownfail
"wbinfo -g against $TARGET" $wbinfo -g || failed
=`expr $failed + 1`
59 # Convert netbios name to IP
61 knownfail
"wbinfo -N against $TARGET" $wbinfo -N $NETBIOSNAME || failed
=`expr $failed + 1`
62 # Convert IP to netbios name
64 knownfail
"wbinfo -I against $TARGET" $wbinfo -I $SERVER_IP || failed
=`expr $failed + 1`
67 testit
"wbinfo -n against $TARGET" $wbinfo -n "$DOMAIN/$USERNAME" || failed
=`expr $failed + 1`
68 admin_sid
=`$wbinfo -n "$DOMAIN/$USERNAME" | cut -d " " -f1`
69 echo "$DOMAIN/$USERNAME resolved to $admin_sid"
71 testit
"wbinfo -s $admin_sid against $TARGET" $wbinfo -s $admin_sid || failed
=`expr $failed + 1`
72 admin_name
=`$wbinfo -s $admin_sid | cut -d " " -f1| tr a-z A-Z`
73 echo "$admin_sid resolved to $admin_name"
75 tested_name
=`echo $DOMAIN/$USERNAME | tr a-z A-Z`
77 echo "test: wbinfo -s check for sane mapping"
78 if test x
$admin_name != x
$tested_name; then
79 echo "$admin_name does not match $tested_name"
80 echo "failure: wbinfo -s check for sane mapping"
81 failed
=`expr $failed + 1`
83 echo "success: wbinfo -s check for sane mapping"
86 testit
"wbinfo -n on the returned name against $TARGET" $wbinfo -n $admin_name || failed
=`expr $failed + 1`
87 test_sid
=`$wbinfo -n $tested_name | cut -d " " -f1`
89 echo "test: wbinfo -n check for sane mapping"
90 if test x
$admin_sid != x
$test_sid; then
91 echo "$admin_sid does not match $test_sid"
92 echo "failure: wbinfo -n check for sane mapping"
93 failed
=`expr $failed + 1`
95 echo "success: wbinfo -n check for sane mapping"
98 testit
"wbinfo -U against $TARGET" $wbinfo -U 30000 || failed
=`expr $failed + 1`
100 echo "test: wbinfo -U check for sane mapping"
101 sid_for_30000
=`$wbinfo -U 30000`
102 if test x
$sid_for_30000 != "xS-1-22-1-30000"; then
103 echo "uid 30000 mapped to $sid_for_30000, not S-1-22-1-30000"
104 echo "failure: wbinfo -U check for sane mapping"
105 failed
=`expr $failed + 1`
107 echo "success: wbinfo -U check for sane mapping"
110 admin_uid
=`$wbinfo -S $admin_sid`
112 testit
"wbinfo -G against $TARGET" $wbinfo -G 30000 || failed
=`expr $failed + 1`
114 echo "test: wbinfo -G check for sane mapping"
115 sid_for_30000
=`$wbinfo -G 30000`
116 if test x
$sid_for_30000 != "xS-1-22-2-30000"; then
117 echo "gid 30000 mapped to $sid_for_30000, not S-1-22-2-30000"
118 echo "failure: wbinfo -G check for sane mapping"
119 failed
=`expr $failed + 1`
121 echo "success: wbinfo -G check for sane mapping"
124 testit
"wbinfo -S against $TARGET" $wbinfo -S "S-1-22-1-30000" || failed
=`expr $failed + 1`
126 echo "test: wbinfo -S check for sane mapping"
127 uid_for_sid
=`$wbinfo -S S-1-22-1-30000`
128 if test 0$uid_for_sid -ne 30000; then
129 echo "S-1-22-1-30000 mapped to $uid_for_sid, not 30000"
130 echo "failure: wbinfo -S check for sane mapping"
131 failed
=`expr $failed + 1`
133 echo "success: wbinfo -S check for sane mapping"
136 testfail
"wbinfo -S against $TARGET using invalid SID" $wbinfo -S "S-1-22-2-30000" && failed
=`expr $failed + 1`
138 testit
"wbinfo -Y against $TARGET" $wbinfo -Y "S-1-22-2-30000" || failed
=`expr $failed + 1`
140 echo "test: wbinfo -Y check for sane mapping"
141 gid_for_sid
=`$wbinfo -Y S-1-22-2-30000`
142 if test 0$gid_for_sid -ne 30000; then
143 echo "S-1-22-2-30000 mapped to $gid_for_sid, not 30000"
144 echo "failure: wbinfo -Y check for sane mapping"
145 failed
=`expr $failed + 1`
147 echo "success: wbinfo -Y check for sane mapping"
150 testfail
"wbinfo -Y against $TARGET using invalid SID" $wbinfo -Y "S-1-22-1-30000" && failed
=`expr $failed + 1`
152 testit
"wbinfo -t against $TARGET" $wbinfo -t || failed
=`expr $failed + 1`
154 testit
"wbinfo --trusted-domains against $TARGET" $wbinfo --trusted-domains || failed
=`expr $failed + 1`
155 testit
"wbinfo --all-domains against $TARGET" $wbinfo --all-domains || failed
=`expr $failed + 1`
156 testit
"wbinfo --own-domain against $TARGET" $wbinfo --own-domain || failed
=`expr $failed + 1`
158 echo "test: wbinfo --own-domain against $TARGET check output"
159 own_domain
=`$wbinfo --own-domain`
160 if test x
$own_domain = x
$DOMAIN; then
161 echo "success: wbinfo --own-domain against $TARGET check output"
163 echo "Own domain reported as $own_domain instead of $DOMAIN"
164 echo "failure: wbinfo --own-domain against $TARGET check output"
168 knownfail
"wbinfo --sequence against $TARGET" $wbinfo --sequence
169 knownfail
"wbinfo -D against $TARGET" $wbinfo -D $DOMAIN || failed
=`expr $failed + 1`
171 testit
"wbinfo -i against $TARGET" $wbinfo -i "$DOMAIN/$USERNAME" || failed
=`expr $failed + 1`
173 testit
"wbinfo --uid-info against $TARGET" $wbinfo --uid-info $admin_uid
176 knownfail
"wbinfo --group-info against $TARGET" $wbinfo --group-info "S-1-22-2-0"
177 knownfail
"wbinfo -r against $TARGET" $wbinfo -r "$DOMAIN/$USERNAME"
179 testit
"wbinfo --user-domgroups against $TARGET" $wbinfo --user-domgroups $admin_sid || failed
=`expr $failed + 1`
181 testit
"wbinfo --user-sids against $TARGET" $wbinfo --user-sids $admin_sid || failed
=`expr $failed + 1`
183 testit
"wbinfo -a against $TARGET with domain creds" $wbinfo -a "$DOMAIN/$USERNAME"%"$PASSWORD" || failed
=`expr $failed + 1`
186 knwonfail
"wbinfo --getdcname against $TARGET" $wbinfo --getdcname=$DOMAIN
188 testit
"wbinfo -p against $TARGET" $wbinfo -p || failed
=`expr $failed + 1`
190 testit
"wbinfo -K against $TARGET with domain creds" $wbinfo -K "$DOMAIN/$USERNAME"%"$PASSWORD" || failed
=`expr $failed + 1`
192 testit
"wbinfo --separator against $TARGET" $wbinfo --separator || failed
=`expr $failed + 1`