Improve exceed length limit error message

The error message printed when username or password length exceeds the
limit uses a hex value without 0x prefix, which is really confusing in
some cases. This patch changes them to decimal format. Also use removes
extra strlen calls as they are of O(1) complexity.

Tested:
Update an ipmi user with a 22-char password, 22 is logged instead of 16

Change-Id: Idec08d920c6377d4db9af7dd616c73f618a1e839
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
diff --git a/src/pam_ipmisave/pam_ipmisave.c b/src/pam_ipmisave/pam_ipmisave.c
index 058e079..c105ba6 100644
--- a/src/pam_ipmisave/pam_ipmisave.c
+++ b/src/pam_ipmisave/pam_ipmisave.c
@@ -672,13 +672,15 @@
 
 	if (spec_grp_usr) {
 		// verify the new password is acceptable.
-		if (strlen(pass_new) > MAX_SPEC_GRP_PASS_LENGTH
-		    || strlen(user) > MAX_SPEC_GRP_USER_LENGTH) {
+		size_t pass_len = strlen(pass_new);
+		size_t user_len = strlen(user);
+		if (pass_len > MAX_SPEC_GRP_PASS_LENGTH
+		    || user_len > MAX_SPEC_GRP_USER_LENGTH) {
 			pam_syslog(
 				pamh, LOG_ERR,
-				"Password length (%x) / User name length (%x) not acceptable",
-				strlen(pass_new), strlen(user));
-			pass_new = NULL;
+				"Password length (%zu) / User name length (%zu) is not acceptable for IPMI",
+				pass_len, user_len);
+			pass_new = pass_old = NULL;
 			return PAM_AUTHTOK_ERR;
 		}
 		if (spec_pass_file == NULL) {