Add support for MAX PASSWORD LENGTH
As per NIST Guideline https://pages.nist.gov/800-63-4/sp800-63b.html
Verifiers and CSPs SHOULD permit a MaxPasswordLength must be at least
64 characters therefore added this support. Added this as a meson option
each organization can configure their own MAX PASSWORD LENGTH. Default
value is as per NIST guideline recommendation
Testing:
Validated MinPasswordLangth > MaxPasswordLength test cases and worked
as expected.
Change-Id: I75b0056a0acc038d3103016ebbdaa6be08df74a1
Signed-off-by: Chandramohan Harkude <chandramohan.harkude@gmail.com>
diff --git a/test/user_mgr_test.cpp b/test/user_mgr_test.cpp
index 9dd799a..187d3c2 100644
--- a/test/user_mgr_test.cpp
+++ b/test/user_mgr_test.cpp
@@ -802,6 +802,17 @@
EXPECT_EQ(AccountPolicyIface::minPasswordLength(), 8);
}
+TEST_F(UserMgrInTest, MinPasswordLengthGreaterThanMaxPasswordLength)
+{
+ initializeAccountPolicy();
+
+ EXPECT_EQ(AccountPolicyIface::minPasswordLength(), 8);
+ EXPECT_THROW(
+ UserMgr::minPasswordLength(maxPasswdLength + 1),
+ sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument);
+ EXPECT_EQ(AccountPolicyIface::minPasswordLength(), 8);
+}
+
TEST_F(UserMgrInTest, RememberOldPasswordTimesReturnsIfValueIsTheSame)
{
initializeAccountPolicy();