From e8a303673e905f92a54bc0c7fde5f8dc2e8c27e9 Mon Sep 17 00:00:00 2001 From: annulus Date: Fri, 1 Sep 2017 19:29:02 +0200 Subject: [PATCH] OpenSSHUtils ProfilePath parsing issues (#192) 1. ignore the historical (.bak) profile entries from the registry 2. do not match against different profiles that share the beginning of their path --- contrib/win32/openssh/OpenSSHUtils.psm1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/win32/openssh/OpenSSHUtils.psm1 b/contrib/win32/openssh/OpenSSHUtils.psm1 index a68fd8523..a2a52d132 100644 --- a/contrib/win32/openssh/OpenSSHUtils.psm1 +++ b/contrib/win32/openssh/OpenSSHUtils.psm1 @@ -168,7 +168,9 @@ function Repair-AuthorizedKeyPermission $userProfilePath = $properties.ProfileImagePath } $userProfilePath = $userProfilePath.Replace("\", "\\") - $fullPath -match "^$userProfilePath[\\|\W|\w]+authorized_keys$" + if ( $properties.PSChildName -notmatch '\.bak$') { + $fullPath -match "^$userProfilePath\\[\\|\W|\w]+authorized_keys$" + } } if($profileItem) {