summaryrefslogtreecommitdiff
path: root/testsuite/nsswitch/finger.exp
blob: ab3b28f58fc46395d0208895ad995dd1883f380b (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
#
# @(#) Test default domain users resolve using the finger command
#

load_lib util-defs.exp

set output [util_start "bin/wbinfo" "-u"]
if { [regexp "Error" $output] } {
    fail "error running wbinfo"
    return
}

set user_list [split $output "\n"]

# Look up all users using finger.  This should test getpwnam()

foreach { user } $user_list {
    set output [util_start "finger" "-m $user" "" "no such user"]
    verbose $output

    if { [regexp "no such user" $output] } {
        fail "finger -m $user"
    } else {
        pass "finger -m $user"
    }
}

verbose "testing finger -m"

# Run finger without the -m to also test set/get/endpwent()

foreach { user } $user_list {
    set output [util_start "finger" "-m $user"]
    verbose $output
    
    if { [regexp "no such user" $output] } {
        fail "finger $user"
    } else {
        pass "finger $user"
    }
}