2 # @(#) Test reverse lookup of group ids from getent match getgrgid() output
6 load_lib "$srcdir/config/env.exp"
7 load_lib "$srcdir/config/default-nt-names.exp"
11 set output [target_compile "$srcdir/$subdir/getgrgid.c" \
12 "$srcdir/$subdir/getgrgid" executable {additional_flags="-g"}]
15 perror "compile getgrgid"
20 # Get list of uids using getent
22 set output [util_start "getent" "group" ""]
25 foreach {line} [split $output "\n"] {
29 set grp_entry [split $line ":"]
30 set group [lindex $grp_entry 0]
32 if {[regexp "^($domain)/" $group]} {
36 # Only lookup winbindd users
38 set gid [lindex $grp_entry 2]
40 # Test lookup of gid succeeds
42 set output [util_start "$srcdir/$subdir/getgrgid" "$gid" ""]
43 if {[regexp "PASS:" $output]} {
44 pass "getgrgid $gid ($group)"
46 fail "getgrgid $gid ($group)"
53 perror "No domain groups returned from getent"