OpenSSHUtils ProfilePath parsing issues ()

1. ignore the historical (.bak) profile entries from the registry
2. do not match against different profiles that share the beginning of their path
This commit is contained in:
annulus 2017-09-01 19:29:02 +02:00 committed by Yanbing
parent 7f64fc729a
commit e8a303673e
1 changed files with 3 additions and 1 deletions
contrib/win32/openssh

View File

@ -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)
{