WHATSNEW: Update changes since 3.3.0pre2.
[Samba.git] / testsuite / nsswitch / login.exp
blobc2bb0e5a40aac0381b4b73ef856e880e793d05b4
2 # @(#) Test logins using pam_winbind.so module using telnet
5 load_lib util-defs.exp
6 load_lib nsswitch-config.exp
9 # @(#) Test user can login
12 spawn telnet localhost
14 set test_desc "telnet localhost (login)"
16 expect {
17 "login:" { }
18 timeout { fail "timed out in $test_desc"; return }
19 eof { fail "end of file in $test_desc"; return }
22 send "$domain/$USER\r"
24 set test_desc "telnet localhost (password)"
26 expect {
27 "Password:" { }
28 timeout { fail "timed out in $test_desc"; return }
29 eof { fail "end of file in $test_desc"; return }
32 send "$PASSWORD\r"
34 expect {
35 "$ " { }
36 "Login incorrect" { fail "login incorrect"; return }
37 timeout { fail "timed out in $test_desc"; return }
38 eof { fail "end of file in $test_desc"; return }
41 pass "login $domain/$USER"
44 # @(#) Check supplementary group membership
47 set test_desc "supplementary groups"
49 # Get list of groups
51 send "id -G\r"
53 expect {
54 -re "((\[0-9]+ )*\[0-9]+\r)" { exp_continue; }
55 "$ " { }
56 timeout { fail "timed out in $test_desc"; return }
57 eof { fail "end of file in $test_desc"; return }
60 set groups $expect_out(1,string)
61 set wb_groups [util_start "bin/wbinfo" "-r $domain/$USER"]
63 verbose "id groups are $groups"
64 verbose "wbinfo groups are $wb_groups"
66 # Check all groups from id are in wbinfo and vice-versa
68 set failed 0
70 foreach { group } $groups {
71 set got_group 0
72 foreach { wb_group } $wb_groups {
73 if { $wb_group == $group } {
74 set got_group 1
75 break
79 if { !$got_group } {
80 fail "group $group not in output of wbinfo -r"
81 set failed 1
85 foreach { wb_group } $wb_groups {
86 set got_group 0
87 foreach { group } $groups {
88 if { $group == $wb_group } {
89 set got_group 1
90 break
94 if { !$got_group } {
95 fail "group $group not in output of id -G"
96 set failed 1
100 if { !$failed } {
101 pass "id/wbinfo groups match"