blob: be6a01cb9e1a8942457f046a17af8640e55fa52d (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#
# @(#) Test reverse lookup of user ids from getent match getpwuid() output
#
load_lib util-defs.exp
# Compile getpwuid.c
set output [target_compile "$srcdir/$subdir/getpwuid.c" \
"$srcdir/$subdir/getpwuid" executable {additional_flags="-g"}]
if {$output != ""} {
perror "compile getpwuid"
puts $output
return
}
# Get list of uids using getent
set output [util_start "getent" "passwd" ""]
set got_entries 0
verbose $output
foreach {line} [split $output "\n"] {
# Process user
set pwd_entry [split $line ":"]
set user [lindex $pwd_entry 0]
if {[regexp {^[^/]+/} $user]} {
set got_entries 1
# Only lookup winbindd users
set uid [lindex $pwd_entry 2]
set gid [lindex $pwd_entry 3]
# Test lookup of uid succeeds
set output [util_start "$srcdir/$subdir/getpwuid" "$uid" ""]
verbose $output
set test_desc "getpwuid $uid ($user)"
if {[regexp "PASS:" $output]} {
pass $test_desc
} else {
fail $test_desc
}
}
}
if {!$got_entries} {
perror "No domain users returned from getent"
}
|