From 75ebfc6f7a7692d772b729b2d83038a9054b4f90 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 12 May 2000 06:55:09 +0000 Subject: Merge from TNG. (This used to be commit af5ded9f17addb4bc89ecb762b9b99d2f99463ab) --- testsuite/nsswitch/getpwuid.exp | 54 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 testsuite/nsswitch/getpwuid.exp (limited to 'testsuite/nsswitch/getpwuid.exp') diff --git a/testsuite/nsswitch/getpwuid.exp b/testsuite/nsswitch/getpwuid.exp new file mode 100644 index 0000000000..48e7dcb2be --- /dev/null +++ b/testsuite/nsswitch/getpwuid.exp @@ -0,0 +1,54 @@ +# +# @(#) Test reverse lookup of user ids from getent match getpwuid() output +# + +load_lib util-defs.exp +load_lib "$srcdir/config/env.exp" +load_lib "$srcdir/config/default-nt-names.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 + +foreach {line} [split $output "\n"] { + + # Process user + + set pwd_entry [split $line ":"] + set user [lindex $pwd_entry 0] + + if {[regexp "^($domain)/" $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" ""] + if {[regexp "PASS:" $output]} { + pass "getpwuid $uid ($user)" + } else { + fail "getpwuid $uid ($user)" + } + } +} + +if {!$got_entries} { + perror "No domain users returned from getent" +} -- cgit