Make fixes as requested by AI
This commit is contained in:
parent
6fd979edaa
commit
92fbb0ca56
1 changed files with 2 additions and 7 deletions
|
|
@ -6,12 +6,7 @@ use utils;
|
|||
|
||||
sub run_as_user {
|
||||
my ($user, $cmd) = @_;
|
||||
enter_cmd("su - $user");
|
||||
sleep(2);
|
||||
my $output = script_output($cmd, timeout => 60);
|
||||
enter_cmd("exit");
|
||||
sleep(2);
|
||||
return $output;
|
||||
return script_output("su - $user -c '$cmd'", timeout => 60);
|
||||
}
|
||||
|
||||
sub assert_as_user_eq {
|
||||
|
|
@ -32,7 +27,7 @@ sub assert_password {
|
|||
my ($user, $password) = @_;
|
||||
enter_cmd("su - $user"); # Switch to user account to lose admin rights.
|
||||
# The following command will not show the username without the correct password
|
||||
my $result = script_run("su - $user -c 'whoami' <<< $password | grep -x $user");
|
||||
my $result = script_run("echo $password | sudo -S -u $user whoami | grep -x $user");
|
||||
enter_cmd("exit");
|
||||
return $result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue