diff options
author | Martin Kosek <mkosek@redhat.com> | 2012-02-02 11:55:14 +0100 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2012-02-03 17:21:33 +0100 |
commit | f2cc9c8d33e50b52554a2df8148d4bf7c92fc89a (patch) | |
tree | 5a31136a2688526ca5d394b6efe3753da5c10e08 /util/ipa_pwd.c | |
parent | cf12f3106a7f55fbdb03d64588e8201f14470fe8 (diff) | |
download | freeipa-f2cc9c8d33e50b52554a2df8148d4bf7c92fc89a.tar.gz freeipa-f2cc9c8d33e50b52554a2df8148d4bf7c92fc89a.tar.xz freeipa-f2cc9c8d33e50b52554a2df8148d4bf7c92fc89a.zip |
Improve password change error message
User always receives the same error message if he changes his password
via "ipa passwd" command and the new password fails configured
password policy. He then has to investigate on his own the actual
reason why was the policy violated. This patch improves our SLAPI PWD
plugins to provide a better error message explaining the violation
reason.
https://fedorahosted.org/freeipa/ticket/2067
Diffstat (limited to 'util/ipa_pwd.c')
-rw-r--r-- | util/ipa_pwd.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/util/ipa_pwd.c b/util/ipa_pwd.c index fda6cb34e..b6ed929b3 100644 --- a/util/ipa_pwd.c +++ b/util/ipa_pwd.c @@ -538,6 +538,26 @@ int ipapwd_check_policy(struct ipapwd_policy *policy, return IPAPWD_POLICY_OK; } +char * IPAPWD_ERROR_STRINGS[] = { + "Password is OK", + "Account expired", + "Too soon to change password", + "Password is too short", + "Password reuse not permitted", + "Password is too simple" +}; + +char * IPAPWD_ERROR_STRING_GENERAL = "Password does not meet the policy requirements"; + +char * ipapwd_error2string(enum ipapwd_error err) { + if (err < 0 || err > IPAPWD_POLICY_PWD_COMPLEXITY) { + /* IPAPWD_POLICY_ERROR or out of boundary, return general error */ + return IPAPWD_ERROR_STRING_GENERAL; + } + + return IPAPWD_ERROR_STRINGS[err]; +} + /** * @brief Generate a new password history using the new password * |