|
Last change
on this file since 559 was 414, checked in by Herwig Bauernfeind, 16 years ago |
|
Samba 3.5.0: Initial import
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | #
|
|---|
| 2 | # @(#) Test reverse lookup of user ids from getent match getpwuid() output
|
|---|
| 3 | #
|
|---|
| 4 |
|
|---|
| 5 | load_lib util-defs.exp
|
|---|
| 6 |
|
|---|
| 7 | # Compile getpwuid.c
|
|---|
| 8 |
|
|---|
| 9 | set output [target_compile "$srcdir/$subdir/getpwuid.c" \
|
|---|
| 10 | "$srcdir/$subdir/getpwuid" executable {additional_flags="-g"}]
|
|---|
| 11 |
|
|---|
| 12 | if {$output != ""} {
|
|---|
| 13 | perror "compile getpwuid"
|
|---|
| 14 | puts $output
|
|---|
| 15 | return
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | # Get list of uids using getent
|
|---|
| 19 |
|
|---|
| 20 | set output [util_start "getent" "passwd" ""]
|
|---|
| 21 | set got_entries 0
|
|---|
| 22 |
|
|---|
| 23 | verbose $output
|
|---|
| 24 |
|
|---|
| 25 | foreach {line} [split $output "\n"] {
|
|---|
| 26 |
|
|---|
| 27 | # Process user
|
|---|
| 28 |
|
|---|
| 29 | set pwd_entry [split $line ":"]
|
|---|
| 30 | set user [lindex $pwd_entry 0]
|
|---|
| 31 |
|
|---|
| 32 | if {[regexp {^[^/]+/} $user]} {
|
|---|
| 33 |
|
|---|
| 34 | set got_entries 1
|
|---|
| 35 |
|
|---|
| 36 | # Only lookup winbindd users
|
|---|
| 37 |
|
|---|
| 38 | set uid [lindex $pwd_entry 2]
|
|---|
| 39 | set gid [lindex $pwd_entry 3]
|
|---|
| 40 |
|
|---|
| 41 | # Test lookup of uid succeeds
|
|---|
| 42 |
|
|---|
| 43 | set output [util_start "$srcdir/$subdir/getpwuid" "$uid" ""]
|
|---|
| 44 |
|
|---|
| 45 | verbose $output
|
|---|
| 46 |
|
|---|
| 47 | set test_desc "getpwuid $uid ($user)"
|
|---|
| 48 |
|
|---|
| 49 | if {[regexp "PASS:" $output]} {
|
|---|
| 50 | pass $test_desc
|
|---|
| 51 | } else {
|
|---|
| 52 | fail $test_desc
|
|---|
| 53 | }
|
|---|
| 54 | }
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 | if {!$got_entries} {
|
|---|
| 58 | perror "No domain users returned from getent"
|
|---|
| 59 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.