From 0fd0ac683800e1ed5207cb418e59a5e29819b8b2 Mon Sep 17 00:00:00 2001 From: PaulHigin Date: Tue, 2 Aug 2022 16:04:12 -0700 Subject: [PATCH] Fix sshd executable name and resolve source path. --- contrib/win32/openssh/OpenSSHTestHelper.psm1 | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/contrib/win32/openssh/OpenSSHTestHelper.psm1 b/contrib/win32/openssh/OpenSSHTestHelper.psm1 index 94d540fea..d1e6c41c3 100644 --- a/contrib/win32/openssh/OpenSSHTestHelper.psm1 +++ b/contrib/win32/openssh/OpenSSHTestHelper.psm1 @@ -146,7 +146,7 @@ WARNING: Following changes will be made to OpenSSH configuration Get-ChildItem $testSvcConfigDir | foreach {$acl | set-acl $_.FullName} - $SSHDTestSvcNameCmdLine = (Join-Path $script:OpenSSHBinPath sshd) + " -f " + $testSshdConfig + $SSHDTestSvcNameCmdLine = (Join-Path $script:OpenSSHBinPath 'sshd.exe') + " -f " + $testSshdConfig New-Service -Name $SSHDTestSvcName -DisplayName "OpenSSH SSH Test Server for E2E tests" -BinaryPathName $SSHDTestSvcNameCmdLine -StartupType Manual | Out-Null sc.exe privs $SSHDTestSvcName SeAssignPrimaryTokenPrivilege/SeTcbPrivilege/SeBackupPrivilege/SeRestorePrivilege/SeImpersonatePrivilege @@ -317,14 +317,12 @@ function Set-BasicTestInfo } else { - if (-not (Test-Path (Join-Path $OpenSSHBinPath ssh.exe) -PathType Leaf)) + $script:OpenSSHBinPath = (Resolve-Path -Path $OpenSSHBinPath -ErrorAction Stop).Path + + if (-not (Test-Path (Join-Path $script:OpenSSHBinPath ssh.exe) -PathType Leaf)) { Throw "Cannot find OpenSSH binaries under $OpenSSHBinPath. Please specify -OpenSSHBinPath to the OpenSSH installed location" } - else - { - $script:OpenSSHBinPath = $OpenSSHBinPath - } } $Global:OpenSSHTestInfo.Add("OpenSSHBinPath", $script:OpenSSHBinPath)