aboutsummaryrefslogtreecommitdiff
path: root/modules/pam_pwhistory/pam_pwhistory.c
diff options
context:
space:
mode:
authorIker Pedrosa <ipedrosa@redhat.com>2022-07-08 11:33:03 +0200
committerDmitry V. Levin <ldv@altlinux.org>2022-07-15 08:00:00 +0000
commitba2f6dd8b81ea2a58262c1709bec906b6852591d (patch)
tree92db271cb8824cc786c4ae41600fe0257bc68fca /modules/pam_pwhistory/pam_pwhistory.c
parent37c8403dbefe9b0f1cb22b1a96c30d926fd568c8 (diff)
downloadpam-ba2f6dd8b81ea2a58262c1709bec906b6852591d.tar.gz
pam-ba2f6dd8b81ea2a58262c1709bec906b6852591d.tar.bz2
pam-ba2f6dd8b81ea2a58262c1709bec906b6852591d.zip
pam_pwhistory: load config from file
* modules/pam_pwhistory/pam_pwhistory.c: Load config from file and provide new conf option to select the file. * modules/pam_pwhistory/pwhistory_config.c: Parse config from file and load to options structure. * modules/pam_pwhistory/pwhistory_config.h: Move options_t structure and define parse_config_file(). * modules/pam_pwhistory/Makefile.am (noinst_HEADERS): Add pwhistory_config.h. (pam_pwhistory_la_SOURCES): Add pwhistory_config.c. (dist_secureconf_DATA): Add pwhistory.conf. * modules/pam_pwhistory/pwhistory.conf: New configuration file. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2068461 Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Diffstat (limited to 'modules/pam_pwhistory/pam_pwhistory.c')
-rw-r--r--modules/pam_pwhistory/pam_pwhistory.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/modules/pam_pwhistory/pam_pwhistory.c b/modules/pam_pwhistory/pam_pwhistory.c
index 9c1bdd87..5a7fb811 100644
--- a/modules/pam_pwhistory/pam_pwhistory.c
+++ b/modules/pam_pwhistory/pam_pwhistory.c
@@ -63,15 +63,8 @@
#include "opasswd.h"
#include "pam_inline.h"
+#include "pwhistory_config.h"
-struct options_t {
- int debug;
- int enforce_for_root;
- int remember;
- int tries;
- const char *filename;
-};
-typedef struct options_t options_t;
static void
@@ -312,6 +305,8 @@ pam_sm_chauthtok (pam_handle_t *pamh, int flags, int argc, const char **argv)
options.remember = 10;
options.tries = 1;
+ parse_config_file(pamh, argc, argv, &options);
+
/* Parse parameters for module */
for ( ; argc-- > 0; argv++)
parse_option (pamh, *argv, &options);
@@ -319,7 +314,6 @@ pam_sm_chauthtok (pam_handle_t *pamh, int flags, int argc, const char **argv)
if (options.debug)
pam_syslog (pamh, LOG_DEBUG, "pam_sm_chauthtok entered");
-
if (options.remember == 0)
return PAM_IGNORE;