summaryrefslogtreecommitdiffstats
path: root/testsuite/nsswitch/groupmem_dom.exp
blob: 3ba34bb810e0a971dfe2ebd64fb9158d10a9a817 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#
# @(#) Test whether members of domain groups all have domain names
#

load_lib util-defs.exp

set group_list [split [util_start "getent group" ""] "\n"]
set failed 0

foreach { group } $group_list {
    set group_entry [split $group ":"]

    set group_name [lindex $group_entry 0]
    set group_members [split [lindex $group_entry 3] ","]

    if { [regexp {^[^/]+/} $group_name] } {
	
	verbose "group $group_name has members $group_members"

	foreach { user } $group_members {
	    if { ![regexp {^[^/]+/} $user] } {
		fail "group $group has non-domain user $user"
		set failed 1
	    }
	}
    } else {
	verbose "ignoring non-domain group $group_name"
    }
}

if { !$failed } {
    pass "domain groups contain only domain members"
}