Signal when trying to set minPasswordLength low

Instead of silently ignoring the request when a user tries to set
minPasswordLength to less than 8 characters emit a log message and
return an error to the sender.

Tested:

root@qemuarm:~# busctl set-property xyz.openbmc_project.User.Manager /xyz/openbmc_project/user xyz.openbmc_project.User.AccountPolicy MinPasswordLength y 8

root@qemuarm:~# busctl set-property xyz.openbmc_project.User.Manager /xyz/openbmc_project/user xyz.openbmc_project.User.AccountPolicy MinPasswordLength y 7
Failed to set property MinPasswordLength on interface xyz.openbmc_project.User.AccountPolicy: Invalid argument was given.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Change-Id: Ied17a46dbc9746212a7e9a4fbf1eed82fc01c3d1
diff --git a/user_mgr.cpp b/user_mgr.cpp
index a5a3f7b..a5ecb8f 100644
--- a/user_mgr.cpp
+++ b/user_mgr.cpp
@@ -469,7 +469,13 @@
     }
     if (value < minPasswdLength)
     {
-        return value;
+        log<level::ERR>(("Attempting to set minPasswordLength to less than " +
+                         std::to_string(minPasswdLength))
+                            .c_str(),
+                        entry("SIZE=%d", value));
+        elog<InvalidArgument>(
+            Argument::ARGUMENT_NAME("minPasswordLength"),
+            Argument::ARGUMENT_VALUE(std::to_string(value).c_str()));
     }
     if (setPamModuleArgValue(pamCrackLib, minPasswdLenProp,
                              std::to_string(value)) != success)