From 2116c820cadda1775e261897cdf802ea076be788 Mon Sep 17 00:00:00 2001 From: Tess Gauthier Date: Wed, 19 Oct 2022 15:56:48 -0400 Subject: [PATCH] add #ifdef SUPPORT_CRLF back into auth_check_principals_line method that was moved/renamed --- auth2-pubkeyfile.c | 6 ++++++ regress/pesterTests/CertAuth.Tests.ps1 | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/auth2-pubkeyfile.c b/auth2-pubkeyfile.c index f7d262a17..126823ba3 100644 --- a/auth2-pubkeyfile.c +++ b/auth2-pubkeyfile.c @@ -186,6 +186,12 @@ auth_check_principals_line(char *cp, const struct sshkey_cert *cert, while (ep > cp && (*ep == '\n' || *ep == ' ' || *ep == '\t')) *ep-- = '\0'; +#ifdef SUPPORT_CRLF + /* account for \r at line end */ + if (*ep == '\r') + *ep-- = '\0'; +#endif + /* * If the line has internal whitespace then assume it has * key options. diff --git a/regress/pesterTests/CertAuth.Tests.ps1 b/regress/pesterTests/CertAuth.Tests.ps1 index a3c404ad9..2e6a8e216 100644 --- a/regress/pesterTests/CertAuth.Tests.ps1 +++ b/regress/pesterTests/CertAuth.Tests.ps1 @@ -70,7 +70,7 @@ Describe "E2E scenarios for certificate authentication" -Tags "CI" { $pcOutFile = Join-Path $testDir "$tC.$tI.pcout.txt" $logFile = Join-Path $testDir "$tC.$tI.log.txt" Remove-Item -Force $pcOutFile -ErrorAction SilentlyContinue - $sshdArgs = "-ddd -f $sshdconfig -E $logFile -o `"AuthorizedKeysFile .fake/authorized_keys`"" + $sshdArgs = "-d -f $sshdconfig -E $logFile -o `"AuthorizedKeysFile .fake/authorized_keys`"" $sshdArgs += " -o `"AuthorizedPrincipalsCommand=$env:windir\system32\cmd.exe /c echo otheruser& echo $pkuser& whoami > $pcOutFile`"" $sshdArgs += " -o `"AuthorizedPrincipalsCommandUser=$ssouser`"" $sshdArgs += " -o PasswordAuthentication=no" @@ -79,7 +79,7 @@ Describe "E2E scenarios for certificate authentication" -Tags "CI" { #set up SSH_ASKPASS for key passphrase Add-PasswordSetting -Pass $keypassphrase - $o = ssh -vvv -i $user_key -p 47004 $pkuser@$server echo 2345 + $o = ssh -i $user_key -p 47004 $pkuser@$server echo 2345 Remove-PasswordSetting Stop-SSHDTestDaemon -Port 47004