Add console error message for pam-ipmicheck
When changing the password of an IPMI user with passwd command, if a
invalid password is provided, it only gives the default error message.
This patch adds a detailed error message for interactive console in
pam-ipmicheck.
Tested:
Set a 22-char password for an ipmi user with passwd command, it prints:
"Username 4 / Password 22 exceeds IPMI 16/20 limit"
Change-Id: I1267939ae3cdee81e3efad7d6ec45f572bd83f3d
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
diff --git a/src/pam_ipmicheck/pam_ipmicheck.c b/src/pam_ipmicheck/pam_ipmicheck.c
index 82fbbce..100168c 100644
--- a/src/pam_ipmicheck/pam_ipmicheck.c
+++ b/src/pam_ipmicheck/pam_ipmicheck.c
@@ -115,6 +115,10 @@
pamh, LOG_ERR,
"Password length (%zu) / User name length (%zu) is not acceptable for IPMI",
pass_len, user_len);
+ pam_error(
+ pamh,
+ "Username %zu / Password %zu exceeds IPMI 16/20 limit",
+ user_len, pass_len);
pass_new = pass_old = NULL;
return PAM_AUTHTOK_ERR;
}