[pam-ipmi]: Fix key & password file permission
Limit keyfile & password file permission to owner read & write
600, instead of reading by group & other users.
This change will update the file permission to correct one,
whenever an update is requested
Tested: changed passwords to see that the permissions get updated.
Change-Id: I7bf6f01e0b92730cc5cfef5d1eb9b0add60e9d83
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/src/pam_ipmisave/pam_ipmisave.c b/src/pam_ipmisave/pam_ipmisave.c
index f53ea86..f00ed4f 100644
--- a/src/pam_ipmisave/pam_ipmisave.c
+++ b/src/pam_ipmisave/pam_ipmisave.c
@@ -347,8 +347,9 @@
}
} else { // Create with this settings if file is not present.
memset(&st, 0, sizeof(st));
- st.st_mode = 0x8000 | S_IRUSR;
}
+ // Override the file permission with S_IWUSR | S_IRUSR
+ st.st_mode = S_IWUSR | S_IRUSR;
if ((fchown(fileno(pwfile), st.st_uid, st.st_gid) == -1)
|| (fchmod(fileno(pwfile), st.st_mode) == -1)) {
if (opwfile != NULL) {