fix testbreak with SSH_ASKPASS change (#394)
Added askpass utility to support change around SSH_ASKPASS logic. Since prompt is now passed as a commandline parameter to SSH_ASKPASS, "cmd /c echo" based logic no longer works for automated passing of password.
This commit is contained in:
parent
675e761d75
commit
d9773976a7
|
@ -345,10 +345,13 @@ function Get-LocalUserProfile
|
|||
if (-not (Test-Path $userProfileRegistry) ) {
|
||||
#create profile
|
||||
if (-not($env:DISPLAY)) { $env:DISPLAY = 1 }
|
||||
$env:SSH_ASKPASS="$($env:ComSpec) /c echo $($OpenSSHTestAccountsPassword)"
|
||||
$askpass_util = Join-Path $Script:E2ETestDirectory "utilities\askpass_util\askpass_util.exe"
|
||||
$env:SSH_ASKPASS=$askpass_util
|
||||
$env:ASKPASS_PASSWORD=$OpenSSHTestAccountsPassword
|
||||
$ret = ssh -p 47002 "$User@localhost" echo %userprofile%
|
||||
if ($env:DISPLAY -eq 1) { Remove-Item env:\DISPLAY }
|
||||
remove-item "env:SSH_ASKPASS" -ErrorAction SilentlyContinue
|
||||
Remove-item "env:ASKPASS_PASSWORD" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
(Get-ItemProperty -Path $userProfileRegistry -Name 'ProfileImagePath').ProfileImagePath
|
||||
|
|
|
@ -97,7 +97,9 @@ function Add-PasswordSetting
|
|||
$platform = Get-Platform
|
||||
if ($platform -eq [PlatformType]::Windows) {
|
||||
if (-not($env:DISPLAY)) {$env:DISPLAY = 1}
|
||||
$env:SSH_ASKPASS="cmd.exe /c echo $pass"
|
||||
$askpass_util = Join-Path $PSScriptRoot "utilities\askpass_util\askpass_util.exe"
|
||||
$env:SSH_ASKPASS=$askpass_util
|
||||
$env:ASKPASS_PASSWORD=$pass
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,6 +107,7 @@ function Remove-PasswordSetting
|
|||
{
|
||||
if ($env:DISPLAY -eq 1) { Remove-Item env:\DISPLAY }
|
||||
Remove-item "env:SSH_ASKPASS" -ErrorAction SilentlyContinue
|
||||
Remove-item "env:ASKPASS_PASSWORD" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
$Taskfolder = "\OpenSSHTestTasks\"
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
askpass_util is a test utility to be used in conjunction with SSH_ASKPASS in ssh.
|
||||
|
||||
It simply spits out environment variable stored in ASKPASS_PASSWORD.
|
|
@ -0,0 +1,13 @@
|
|||
// askpass_util.cpp : Defines the entry point for the console application.
|
||||
//
|
||||
|
||||
#include <Windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
//read from environment variable, spit it out on stdout
|
||||
printf("%s", getenv("ASKPASS_PASSWORD"));
|
||||
return 0;
|
||||
}
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue