1#
2# @(#) Test that all users are members of the Domain Users group.
3#
4# Note that this isn't necessarily true all the time but you have to
5# explicitly move people out of that group so it should be OK for te
6#
7
8load_lib util-defs.exp
9load_lib $srcdir/lib/nsswitch-config.exp
10
11# Get list of users and stick usernames in a hash
12
13set user_list [util_start "getent" "passwd" ""]
14
15foreach { user } [split $user_list "\n"] {
16    set user_elts [split $user ":"]
17    set users([lindex $user_elts 0]) 1
18}
19
20# Get list of groups
21
22set group_list [util_start "getent" "group" ""]
23
24foreach { group } [split $group_list "\n"] {
25    set group_elts [split $group ":"]
26
27    # Look for domain users group
28
29    if { ![regexp "Domain Users" [lindex $group_elts 0]] } {
30        continue
31    }
32
33    # Check each member of group was found in getent passwd
34
35    foreach { mem } [split [lindex $group_elts 3] ","] {
36        set mems($mem) 1
37    }
38}
39