2 # @
(#
) Test the getent command returns domain
/local users and groups
7 load_lib $srcdir
/lib
/nsswitch
-config.exp
10 # @
(#
) Test getent passwd returns domain users
13 set wbinfo_output
[util_start
"bin/wbinfo" "-u"]
14 set getent_output
[util_start
"getent" "passwd" ""]
16 if { ![regexp
"$domain/" $getent_output] } {
17 fail
"no domain users in getent passwd"
21 if { [regexp
"Error" $wbinfo_output] } {
22 fail
"wbinfo -u failed"
27 # @
(#
) Test each user in the output of wbinfo is also in the output of
31 # Test wbinfo user names are in getent user names
33 foreach
{ user
} [split $wbinfo_output
"\n"] {
35 verbose
"looking for $user"
37 set test_desc
"getent passwd does not contain $user"
39 if { ![regexp
"$user" $getent_output] } {
46 # Test getent user names are in wbinfo user names
48 foreach
{ user
} [split $getent_output
"\n"] {
50 set user_info
[split $user
":"]
51 set username
[lindex $user_info
0]
53 if { [regexp
{^
[^
/]+/} $username
] } {
55 set test_desc
"wbinfo -u does not contain $username"
57 if { ![regexp
"$username" $wbinfo_output] } {
63 verbose
"ignoring non-domain user $username"
68 # @
(#
) Test each group in the output of wbinfo is also in the output of
72 set wbinfo_output
[util_start
"bin/wbinfo" "-g"]
73 set getent_output
[util_start
"getent" "group" ""]
75 if { ![regexp
"$domain/" $getent_output] } {
76 fail
"no domain groups in getent passwd"
80 if { [regexp
"Error" $wbinfo_output] } {
81 fail
"wbinfo -g failed"
85 # Test wbinfo group names are in getent group names
87 foreach
{ group
} [split $wbinfo_output
"\n"] {
89 verbose
"looking for $group"
91 set test_desc
"getent group does not contain $group"
93 if { ![regexp
"$group" $getent_output] } {
100 # Test getent group names are in wbinfo group names
102 foreach
{ group
} [split $getent_output
"\n"] {
104 set group_info
[split $group
":"]
105 set groupname
[lindex $group_info
0]
107 if { [regexp
{^
[^
/]+/} $groupname
] } {
109 set test_desc
"wbinfo -g does not contain $groupname"
111 if { ![regexp
"$groupname" $wbinfo_output] } {
117 verbose
"ignoring non-domain group $groupname"
122 # @
(#
) Test out of order and repeat calls of pwent functions
123 # @
(#
) Test out of order and repeat calls of grent functions
126 set getent_tests
[list \
127 { "out of order pwent operations" "getent_pwent" } \
128 { "out of order grent operations" "getent_grent" } \
131 #
Compile and run each test
133 foreach
{ test
} $getent_tests
{
134 set test_desc
[lindex $test
0]
135 set test_file
[lindex $test
1]
137 simple_compile $test_file
138 set output
[util_start
"$srcdir/$subdir/$test_file" ]
140 if { [regexp
"PASS" $output] } {
142 file
delete "$srcdir/$subdir/$test_file" "$srcdir/$subdir/$test_file.o"