~zulcss/samba/server-dailies-3.4

« back to all changes in this revision

Viewing changes to testsuite/nsswitch/domusers.exp

  • Committer: Chuck Short
  • Date: 2010-09-28 20:38:39 UTC
  • Revision ID: zulcss@ubuntu.com-20100928203839-pgjulytsi9ue63x1
Initial version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
8
load_lib util-defs.exp
 
9
load_lib $srcdir/lib/nsswitch-config.exp
 
10
 
 
11
# Get list of users and stick usernames in a hash
 
12
 
 
13
set user_list [util_start "getent" "passwd" ""]
 
14
 
 
15
foreach { 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
 
 
22
set group_list [util_start "getent" "group" ""]
 
23
 
 
24
foreach { 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
}