summaryrefslogtreecommitdiffstats
path: root/util/ipa_pwd.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/ipa_pwd.c')
-rw-r--r--util/ipa_pwd.c20
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
*