Skip to content

Commit

Permalink
Fixes issues #59 and #60
Browse files Browse the repository at this point in the history
  • Loading branch information
ryannewington committed Mar 17, 2021
1 parent b3b86d0 commit d338fc3
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/ManagedUnitTests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
[assembly: Guid("b94ae2c5-72f3-40fc-bb70-c18b33d19a2b")]

// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.7236.42518")]
[assembly: AssemblyFileVersion("1.0.7236.42518")]
[assembly: AssemblyVersion("1.0.7238.0")]
[assembly: AssemblyFileVersion("1.0.7238.0")]
12 changes: 6 additions & 6 deletions src/NativeUnitTests/PasswordEvaluatorRegexApproveTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@ namespace NativeUnitTests

TEST_METHOD(RegexApprovePass)
{
SetValue(REG_VALUE_REGEXAPPROVE, L"approve.+");
TestString password(L"approve me");
SetValue(REG_VALUE_REGEXAPPROVE, L"approve");
TestString password(L"Please approve me");
Assert::IsTrue(ProcessPasswordRegexApprove(password, std::wstring(L"accountName"), std::wstring(L"full name"), TRUE, reg));
DeleteValue(REG_VALUE_REGEXAPPROVE);
}

TEST_METHOD(RegexApproveFail)
{
SetValue(REG_VALUE_REGEXAPPROVE, L"approve.+");
TestString password(L"don't approve this");
SetValue(REG_VALUE_REGEXAPPROVE, L"fail");
TestString password(L"Don't approve this");
Assert::IsFalse(ProcessPasswordRegexApprove(password, std::wstring(L"accountName"), std::wstring(L"full name"), TRUE, reg));
DeleteValue(REG_VALUE_REGEXAPPROVE);
}

TEST_METHOD(RegexRejectPass)
{
SetValue(REG_VALUE_REGEXREJECT, L"reject.+");
SetValue(REG_VALUE_REGEXREJECT, L"pass");
TestString password(L"don't reject me");
Assert::IsTrue(ProcessPasswordRegexReject(password, std::wstring(L"accountName"), std::wstring(L"full name"), TRUE, reg));
DeleteValue(REG_VALUE_REGEXREJECT);
}

TEST_METHOD(RegexRejectFail)
{
SetValue(REG_VALUE_REGEXREJECT, L"reject.+");
SetValue(REG_VALUE_REGEXREJECT, L"reject");
TestString password(L"reject me");
Assert::IsFalse(ProcessPasswordRegexReject(password, std::wstring(L"accountName"), std::wstring(L"full name"), TRUE, reg));
DeleteValue(REG_VALUE_REGEXREJECT);
Expand Down
Binary file modified src/PasswordFilter/PasswordFilter.rc
Binary file not shown.
8 changes: 4 additions & 4 deletions src/PasswordFilter/passwordevaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ BOOLEAN ProcessPasswordRegexApprove(const SecureArrayT<WCHAR> &password, const s
{
OutputDebugString(L"Checking for regular expression approval match");

std::wregex e(regex);
std::wregex e(regex, std::regex_constants::icase);

if (!std::regex_match(password.get(), e))
if (!std::regex_search(password.get(), e))
{
OutputDebugString(L"Password did not match the approval regular expression");
eventlog::getInstance().logw(EVENTLOG_WARNING_TYPE, MSG_PASSWORD_REJECTED_APPROVAL_REGEX, 3, setOperation ? L"set" : L"change", accountName.c_str(), fullName.c_str());
Expand All @@ -255,9 +255,9 @@ BOOLEAN ProcessPasswordRegexReject(const SecureArrayT<WCHAR> &password, const st
{
OutputDebugString(L"Checking for regular expression rejection match");

std::wregex e(regex);
std::wregex e(regex, std::regex_constants::icase);

if (std::regex_match(password.get(), e))
if (std::regex_search(password.get(), e))
{
OutputDebugString(L"Password matched the rejection regular expression");
eventlog::getInstance().logw(EVENTLOG_WARNING_TYPE, MSG_PASSWORD_REJECTED_REJECTION_REGEX, 3, setOperation ? L"set" : L"change", accountName.c_str(), fullName.c_str());
Expand Down
6 changes: 3 additions & 3 deletions src/PasswordProtection/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.7236.42518")]
[assembly: AssemblyVersion("1.0.7236.42518")]
[assembly: AssemblyFileVersion("1.0.7236.42518")]
// [assembly: AssemblyVersion("1.0.7238.0")]
[assembly: AssemblyVersion("1.0.7238.0")]
[assembly: AssemblyFileVersion("1.0.7238.0")]
6 changes: 3 additions & 3 deletions src/PasswordProtectionPS/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.7236.42518")]
[assembly: AssemblyVersion("1.0.7236.42518")]
[assembly: AssemblyFileVersion("1.0.7236.42518")]
// [assembly: AssemblyVersion("1.0.7238.0")]
[assembly: AssemblyVersion("1.0.7238.0")]
[assembly: AssemblyFileVersion("1.0.7238.0")]

0 comments on commit d338fc3

Please sign in to comment.