pam-ipmi: fix ipmitool user set password failed in 64bit environment

Symptom:
We try to use ipmitool user set password command to change root
password but we got IPMI command failed as below in our 64bit platform

root@evb-npcm845:~# ipmitool user set password 1 0penBmc0
IPMI command failed: Invalid data field in request
Set User Password command failed (user 1)

Root cause:
There is default ipmi_pass file be created and encrypted in 32bit
environment from pam-ipmi original design before. According the
failed message, we found that PAM_AUTHTOK_ERR return from
update_pass_special_file() function that cause ipmid got bad
authentication token. Seems this file cannot be used in 64bit
environment by default that will cause ipmitool user set password
got failed

Solution:
According current pam-ipmi design that already consider if this file
does not exist then BMC will create it once a user in the ipmi group
has been added. There should not be any file there by default.
Thus, there is no need for this file. Without install this file
by default then we can got command successful

Verified:
root@evb-npcm845:~# ipmitool user set password 1 0penBmc0
Set User Password command successful (user 1)
After device reboot, we can use new password to login successfully

Signed-off-by: Tim Lee <timlee660101@gmail.com>
Change-Id: Ic4e557568d18f64f59e41f9b02fd348aff97dd24
diff --git a/Makefile.am b/Makefile.am
index ef21831..165097b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,8 +2,17 @@
 
 CLEANFILES = *~
 
-sysconf_DATA = key_file ipmi_pass
+sysconf_DATA = key_file ipmi_pass_32 ipmi_pass_64
+
+FILE_32 := ipmi_pass_32
+FILE_64 := ipmi_pass_64
+
+CP_FILE := $(FILE_$(TARGET_OS_ARCH))
+
 install-exec-hook:
+	cp $(DESTDIR)$(sysconfdir)/$(CP_FILE) $(DESTDIR)$(sysconfdir)/ipmi_pass
+	rm $(DESTDIR)$(sysconfdir)/ipmi_pass_64
+	rm $(DESTDIR)$(sysconfdir)/ipmi_pass_32
 	chmod 0600 $(DESTDIR)$(sysconfdir)/key_file
 	chmod 0600 $(DESTDIR)$(sysconfdir)/ipmi_pass
 
diff --git a/configure.ac b/configure.ac
index 24bb490..668f744 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,6 +9,7 @@
 
 AC_SUBST(PACKAGE)
 AC_SUBST(VERSION)
+AC_SUBST([TARGET_OS_ARCH])
 
 # Checks for programs
 AM_PROG_AR
@@ -16,6 +17,19 @@
 AC_PROG_INSTALL
 AC_PROG_MAKE_SET
 
+# Checks for arch
+AC_CANONICAL_TARGET
+TARGET_OS_ARCH=""
+AS_CASE([$target_cpu],
+        [x86_64|aarch64*|mips64*|ppc64*|sparc64],
+        [
+            TARGET_OS_ARCH="64"
+        ],
+        [i?86|arm*|mips*|ppc*|sparc],
+        [
+            TARGET_OS_ARCH="32"
+        ])
+
 AX_CHECK_OPENSSL([], [AC_MSG_ERROR(["openssl required and not found"])])
 AC_CHECK_LIB([pam], [pam_start], [], [AC_MSG_ERROR([libpam not found])])
 
diff --git a/ipmi_pass b/ipmi_pass_32
similarity index 100%
rename from ipmi_pass
rename to ipmi_pass_32
Binary files differ
diff --git a/ipmi_pass_64 b/ipmi_pass_64
new file mode 100644
index 0000000..5c6a217
--- /dev/null
+++ b/ipmi_pass_64
Binary files differ