Enhance collect tool to detect passwordless sudo
The collect tool expects a password prompt for all sudo operations. When passwordless sudo is enabled the collect script times out waiting for a password prompt that never comes. This update enhances collect tool to detect passwordless sudo for getting a password prompt on its first sudo operaton and fails the collect if there is no password prompt. Test plan: Verify by enabling passwordless sudo PASS: collect fails with message Verify by disabling passwordless sudo PASS: No passwordless sudo passes and collect proceeds PASS: Collect is rejected when provided with incorrect password Story: 2009968 Task: 46767 Signed-off-by: Salma Police <salma.police@windriver.com> Change-Id: I11239a25757a929a5679441b7a90586657a623f8
This commit is contained in:
parent
aeeb5bb0c5
commit
8ef2b5500f
|
@ -1088,12 +1088,11 @@ pw=${pw/\"/\\\"} # replace '"' with '\"'
|
|||
|
||||
function password_test()
|
||||
{
|
||||
local dir=${1}
|
||||
|
||||
/usr/bin/expect << EOF
|
||||
log_user ${USER_LOG_MODE}
|
||||
spawn bash -i
|
||||
set timeout 10
|
||||
set timeout 60
|
||||
expect -re $
|
||||
send "sudo cat /usr/local/sbin/expect_done\n"
|
||||
expect {
|
||||
|
@ -1120,13 +1119,12 @@ password_test
|
|||
|
||||
###########################################################################
|
||||
#
|
||||
# Name : check_host_reachable
|
||||
# Name :function password_test
|
||||
#
|
||||
# Purpose : Verify a host is reachable before trying to collect from it
|
||||
# Purpose : Verify to detect passwordless sudo for getting a password prompt and fails the collect,
|
||||
# if there is no password prompt
|
||||
#
|
||||
# Description: ls the content of the scratch dir
|
||||
# Parameters : $1 - remote hostname
|
||||
# $2 - dir or file with full path
|
||||
# Description: cat the content of the /usr/local/sbin/expect_done
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
|
|
Loading…
Reference in New Issue