getpwuid.exp
来自「samba-3.0.22.tar.gz 编译smb服务器的源码」· EXP 代码 · 共 60 行
EXP
60 行
## @(#) Test reverse lookup of user ids from getent match getpwuid() output#load_lib util-defs.exp# Compile getpwuid.cset 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 getentset output [util_start "getent" "passwd" ""]set got_entries 0verbose $outputforeach {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"}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?