Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions case-lib/hijack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,9 @@ func_hijack_setup_sudo_level()
[[ "$SUDO_LEVEL" ]] && return 0
# root permission, don't need to check
[[ $UID -eq 0 ]] && SUDO_LEVEL=0 && return 0
# now check whether we need sudo passwd using expect
if expect >/dev/null <<END
spawn $SUDO_CMD ls
expect {
"password" {
exit 1
}
exit 0
}
END

# Test for either cached credentials or NOPASSWD
if $SUDO_CMD --non-interactive true
then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need else here to exit 1?

Copy link
Collaborator Author

@marc-hb marc-hb Sep 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exit I removed were expect commands, not shell commands.

SUDO_LEVEL=1 && return 0
fi
Expand Down