login.exp

来自「samba-3.0.22.tar.gz 编译smb服务器的源码」· EXP 代码 · 共 103 行

EXP
103
字号
## @(#) Test logins using pam_winbind.so module using telnet#load_lib util-defs.expload_lib nsswitch-config.exp##   @(#) Test user can login#spawn telnet localhostset test_desc "telnet localhost (login)"expect {    "login:"    { }    timeout     { fail "timed out in $test_desc"; return }    eof         { fail "end of file in $test_desc"; return }}send "$domain/$USER\r"set test_desc "telnet localhost (password)"expect {    "Password:" { }    timeout     { fail "timed out in $test_desc"; return }    eof         { fail "end of file in $test_desc"; return }}send "$PASSWORD\r"expect {    "$ " { }    "Login incorrect" { fail "login incorrect"; return }    timeout     { fail "timed out in $test_desc"; return }    eof         { fail "end of file in $test_desc"; return }}pass "login $domain/$USER"##   @(#) Check supplementary group membership#set test_desc "supplementary groups"# Get list of groupssend "id -G\r"expect {    -re "((\[0-9]+ )*\[0-9]+\r)" { exp_continue; }    "$ " { }    timeout     { fail "timed out in $test_desc"; return }    eof         { fail "end of file in $test_desc"; return }}set groups $expect_out(1,string)set wb_groups [util_start "bin/wbinfo" "-r $domain/$USER"]verbose "id groups are $groups"verbose "wbinfo groups are $wb_groups"# Check all groups from id are in wbinfo and vice-versaset failed 0foreach { group } $groups {    set got_group 0    foreach { wb_group } $wb_groups {	if { $wb_group == $group } {	    set got_group 1	    break	}    }    if { !$got_group } {	fail "group $group not in output of wbinfo -r"	set failed 1    }}foreach { wb_group } $wb_groups {    set got_group 0    foreach { group } $groups {	if { $group == $wb_group } {	    set got_group 1	    break	}    }    if { !$got_group } {	fail "group $group not in output of id -G"	set failed 1    }}if { !$failed } {    pass "id/wbinfo groups match"}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?