Blame SOURCES/pam-1.5.1-pam-pwhistory-load-conf-from-file.patch

db3d82
diff -up Linux-PAM-1.5.1/modules/pam_pwhistory/Makefile.am.pam-pwhistory-load-conf-from-file Linux-PAM-1.5.1/modules/pam_pwhistory/Makefile.am
db3d82
--- Linux-PAM-1.5.1/modules/pam_pwhistory/Makefile.am.pam-pwhistory-load-conf-from-file	2020-11-25 17:57:02.000000000 +0100
db3d82
+++ Linux-PAM-1.5.1/modules/pam_pwhistory/Makefile.am	2022-08-22 09:08:48.916487811 +0200
db3d82
@@ -9,9 +9,10 @@ MAINTAINERCLEANFILES = $(MANS) README
db3d82
 EXTRA_DIST = $(XMLS)
db3d82
 
db3d82
 if HAVE_DOC
db3d82
-dist_man_MANS = pam_pwhistory.8 pwhistory_helper.8
db3d82
+dist_man_MANS = pam_pwhistory.8 pwhistory_helper.8 pwhistory.conf.5
db3d82
 endif
db3d82
-XMLS = README.xml pam_pwhistory.8.xml pwhistory_helper.8.xml
db3d82
+XMLS = README.xml pam_pwhistory.8.xml pwhistory_helper.8.xml \
db3d82
+  pwhistory.conf.5.xml
db3d82
 dist_check_SCRIPTS = tst-pam_pwhistory
db3d82
 TESTS = $(dist_check_SCRIPTS)
db3d82
 
db3d82
@@ -26,12 +27,14 @@ if HAVE_VERSIONING
db3d82
   pam_pwhistory_la_LDFLAGS += -Wl,--version-script=$(srcdir)/../modules.map
db3d82
 endif
db3d82
 
db3d82
-noinst_HEADERS = opasswd.h
db3d82
+noinst_HEADERS = opasswd.h pwhistory_config.h
db3d82
+
db3d82
+dist_secureconf_DATA = pwhistory.conf
db3d82
 
db3d82
 securelib_LTLIBRARIES = pam_pwhistory.la
db3d82
 pam_pwhistory_la_CFLAGS = $(AM_CFLAGS)
db3d82
 pam_pwhistory_la_LIBADD = $(top_builddir)/libpam/libpam.la @LIBCRYPT@ @LIBSELINUX@
db3d82
-pam_pwhistory_la_SOURCES = pam_pwhistory.c opasswd.c
db3d82
+pam_pwhistory_la_SOURCES = pam_pwhistory.c opasswd.c pwhistory_config.c
db3d82
 
db3d82
 sbin_PROGRAMS = pwhistory_helper
db3d82
 pwhistory_helper_CFLAGS = $(AM_CFLAGS) -DHELPER_COMPILE=\"pwhistory_helper\" @EXE_CFLAGS@
db3d82
diff -up Linux-PAM-1.5.1/modules/pam_pwhistory/pam_pwhistory.8.xml.pam-pwhistory-load-conf-from-file Linux-PAM-1.5.1/modules/pam_pwhistory/pam_pwhistory.8.xml
db3d82
--- Linux-PAM-1.5.1/modules/pam_pwhistory/pam_pwhistory.8.xml.pam-pwhistory-load-conf-from-file	2020-11-25 17:57:02.000000000 +0100
db3d82
+++ Linux-PAM-1.5.1/modules/pam_pwhistory/pam_pwhistory.8.xml	2022-08-22 09:13:08.715628372 +0200
db3d82
@@ -36,6 +36,9 @@
db3d82
       <arg choice="opt">
db3d82
         authtok_type=<replaceable>STRING</replaceable>
db3d82
       </arg>
db3d82
+      <arg choice="opt">
db3d82
+	      conf=<replaceable>/path/to/config-file</replaceable>
db3d82
+      </arg>
db3d82
 
db3d82
     </cmdsynopsis>
db3d82
   </refsynopsisdiv>
db3d82
@@ -104,7 +107,7 @@
db3d82
         <listitem>
db3d82
           <para>
db3d82
             The last <replaceable>N</replaceable> passwords for each
db3d82
-            user are saved in <filename>/etc/security/opasswd</filename>.
db3d82
+            user are saved.
db3d82
             The default is <emphasis>10</emphasis>. Value of
db3d82
             <emphasis>0</emphasis> makes the module to keep the existing
db3d82
             contents of the <filename>opasswd</filename> file unchanged.
db3d82
@@ -137,7 +140,26 @@
db3d82
           </listitem>
db3d82
         </varlistentry>
db3d82
 
db3d82
+        <varlistentry>
db3d82
+          <term>
db3d82
+            <option>conf=<replaceable>/path/to/config-file</replaceable></option>
db3d82
+          </term>
db3d82
+          <listitem>
db3d82
+            <para>
db3d82
+              Use another configuration file instead of the default
db3d82
+              <filename>/etc/security/pwhistory.conf</filename>.
db3d82
+            </para>
db3d82
+          </listitem>
db3d82
+        </varlistentry>
db3d82
+
db3d82
     </variablelist>
db3d82
+    <para>
db3d82
+      The options for configuring the module behavior are described in the
db3d82
+      <citerefentry><refentrytitle>pwhistory.conf</refentrytitle>
db3d82
+      <manvolnum>5</manvolnum></citerefentry> manual page. The options
db3d82
+      specified on the module command line override the values from the
db3d82
+      configuration file.
db3d82
+    </para>
db3d82
   </refsect1>
db3d82
 
db3d82
   <refsect1 id="pam_pwhistory-types">
db3d82
@@ -223,6 +245,9 @@ password     required       pam_unix.so
db3d82
     <title>SEE ALSO</title>
db3d82
     <para>
db3d82
       <citerefentry>
db3d82
+	<refentrytitle>pwhistory.conf</refentrytitle><manvolnum>5</manvolnum>
db3d82
+      </citerefentry>,
db3d82
+      <citerefentry>
db3d82
 	<refentrytitle>pam.conf</refentrytitle><manvolnum>5</manvolnum>
db3d82
       </citerefentry>,
db3d82
       <citerefentry>
db3d82
diff -up Linux-PAM-1.5.1/modules/pam_pwhistory/pam_pwhistory.c.pam-pwhistory-load-conf-from-file Linux-PAM-1.5.1/modules/pam_pwhistory/pam_pwhistory.c
db3d82
--- Linux-PAM-1.5.1/modules/pam_pwhistory/pam_pwhistory.c.pam-pwhistory-load-conf-from-file	2020-11-25 17:57:02.000000000 +0100
db3d82
+++ Linux-PAM-1.5.1/modules/pam_pwhistory/pam_pwhistory.c	2022-08-22 09:11:34.949855242 +0200
db3d82
@@ -63,14 +63,8 @@
db3d82
 
db3d82
 #include "opasswd.h"
db3d82
 #include "pam_inline.h"
db3d82
+#include "pwhistory_config.h"
db3d82
 
db3d82
-struct options_t {
db3d82
-  int debug;
db3d82
-  int enforce_for_root;
db3d82
-  int remember;
db3d82
-  int tries;
db3d82
-};
db3d82
-typedef struct options_t options_t;
db3d82
 
db3d82
 
db3d82
 static void
db3d82
@@ -299,6 +293,8 @@ pam_sm_chauthtok (pam_handle_t *pamh, in
db3d82
   options.remember = 10;
db3d82
   options.tries = 1;
db3d82
 
db3d82
+  parse_config_file(pamh, argc, argv, &options);
db3d82
+
db3d82
   /* Parse parameters for module */
db3d82
   for ( ; argc-- > 0; argv++)
db3d82
     parse_option (pamh, *argv, &options);
db3d82
@@ -306,7 +302,6 @@ pam_sm_chauthtok (pam_handle_t *pamh, in
db3d82
   if (options.debug)
db3d82
     pam_syslog (pamh, LOG_DEBUG, "pam_sm_chauthtok entered");
db3d82
 
db3d82
-
db3d82
   if (options.remember == 0)
db3d82
     return PAM_IGNORE;
db3d82
 
db3d82
diff -up Linux-PAM-1.5.1/modules/pam_pwhistory/pwhistory.conf.5.xml.pam-pwhistory-load-conf-from-file Linux-PAM-1.5.1/modules/pam_pwhistory/pwhistory.conf.5.xml
db3d82
--- Linux-PAM-1.5.1/modules/pam_pwhistory/pwhistory.conf.5.xml.pam-pwhistory-load-conf-from-file	2022-08-22 09:08:48.916487811 +0200
db3d82
+++ Linux-PAM-1.5.1/modules/pam_pwhistory/pwhistory.conf.5.xml	2022-08-22 09:08:48.916487811 +0200
db3d82
@@ -0,0 +1,155 @@
db3d82
+
db3d82
+
db3d82
+	"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
db3d82
+
db3d82
+<refentry id="pwhistory.conf">
db3d82
+
db3d82
+  <refmeta>
db3d82
+    <refentrytitle>pwhistory.conf</refentrytitle>
db3d82
+    <manvolnum>5</manvolnum>
db3d82
+    <refmiscinfo class="sectdesc">Linux-PAM Manual</refmiscinfo>
db3d82
+  </refmeta>
db3d82
+
db3d82
+  <refnamediv id="pwhistory.conf-name">
db3d82
+    <refname>pwhistory.conf</refname>
db3d82
+    <refpurpose>pam_pwhistory configuration file</refpurpose>
db3d82
+  </refnamediv>
db3d82
+
db3d82
+  <refsect1 id="pwhistory.conf-description">
db3d82
+
db3d82
+    <title>DESCRIPTION</title>
db3d82
+    <para>
db3d82
+       <emphasis remap='B'>pwhistory.conf</emphasis> provides a way to configure the
db3d82
+       default settings for saving the last passwords for each user.
db3d82
+       This file is read by the <emphasis>pam_pwhistory</emphasis> module and is the
db3d82
+       preferred method over configuring <emphasis>pam_pwhistory</emphasis> directly.
db3d82
+    </para>
db3d82
+    <para>
db3d82
+       The file has a very simple <emphasis>name = value</emphasis> format with possible comments
db3d82
+       starting with <emphasis>#</emphasis> character. The whitespace at the beginning of line, end
db3d82
+       of line, and around the <emphasis>=</emphasis> sign is ignored.
db3d82
+    </para>
db3d82
+  </refsect1>
db3d82
+
db3d82
+  <refsect1 id="pwhistory.conf-options">
db3d82
+
db3d82
+    <title>OPTIONS</title>
db3d82
+         <variablelist>
db3d82
+            <varlistentry>
db3d82
+              <term>
db3d82
+                <option>debug</option>
db3d82
+              </term>
db3d82
+              <listitem>
db3d82
+                <para>
db3d82
+                  Turns on debugging via
db3d82
+                  <citerefentry>
db3d82
+                    <refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum>
db3d82
+                  </citerefentry>.
db3d82
+                </para>
db3d82
+              </listitem>
db3d82
+            </varlistentry>
db3d82
+            <varlistentry>
db3d82
+              <term>
db3d82
+                <option>enforce_for_root</option>
db3d82
+              </term>
db3d82
+              <listitem>
db3d82
+                <para>
db3d82
+                  If this option is set, the check is enforced for root, too.
db3d82
+                </para>
db3d82
+              </listitem>
db3d82
+            </varlistentry>
db3d82
+            <varlistentry>
db3d82
+              <term>
db3d82
+                <option>remember=<replaceable>N</replaceable></option>
db3d82
+              </term>
db3d82
+              <listitem>
db3d82
+                <para>
db3d82
+                  The last <replaceable>N</replaceable> passwords for each
db3d82
+                  user are saved.
db3d82
+                  The default is <emphasis>10</emphasis>. Value of
db3d82
+                  <emphasis>0</emphasis> makes the module to keep the existing
db3d82
+                  contents of the <filename>opasswd</filename> file unchanged.
db3d82
+                </para>
db3d82
+              </listitem>
db3d82
+            </varlistentry>
db3d82
+            <varlistentry>
db3d82
+              <term>
db3d82
+                <option>retry=<replaceable>N</replaceable></option>
db3d82
+              </term>
db3d82
+              <listitem>
db3d82
+                <para>
db3d82
+                  Prompt user at most <replaceable>N</replaceable> times
db3d82
+                  before returning with error. The default is 1.
db3d82
+                </para>
db3d82
+              </listitem>
db3d82
+            </varlistentry>
db3d82
+            <varlistentry>
db3d82
+              <term>
db3d82
+                <option>file=<replaceable>/path/filename</replaceable></option>
db3d82
+              </term>
db3d82
+              <listitem>
db3d82
+                <para>
db3d82
+                  Store password history in file
db3d82
+                  <replaceable>/path/filename</replaceable> rather than the default
db3d82
+                  location. The default location is
db3d82
+	                <filename>/etc/security/opasswd</filename>.
db3d82
+                </para>
db3d82
+              </listitem>
db3d82
+            </varlistentry>
db3d82
+        </variablelist>
db3d82
+  </refsect1>
db3d82
+
db3d82
+  <refsect1 id='pwhistory.conf-examples'>
db3d82
+    <title>EXAMPLES</title>
db3d82
+    <para>
db3d82
+      /etc/security/pwhistory.conf file example:
db3d82
+    </para>
db3d82
+    <programlisting>
db3d82
+debug
db3d82
+remember=5
db3d82
+file=/tmp/opasswd
db3d82
+    </programlisting>
db3d82
+  </refsect1>
db3d82
+
db3d82
+  <refsect1 id="pwhistory.conf-files">
db3d82
+    <title>FILES</title>
db3d82
+    <variablelist>
db3d82
+      <varlistentry>
db3d82
+        <term><filename>/etc/security/pwhistory.conf</filename></term>
db3d82
+        <listitem>
db3d82
+          <para>the config file for custom options</para>
db3d82
+        </listitem>
db3d82
+      </varlistentry>
db3d82
+    </variablelist>
db3d82
+  </refsect1>
db3d82
+
db3d82
+  <refsect1 id='pwhistory.conf-see_also'>
db3d82
+    <title>SEE ALSO</title>
db3d82
+    <para>
db3d82
+      <citerefentry>
db3d82
+        <refentrytitle>pwhistory</refentrytitle><manvolnum>8</manvolnum>
db3d82
+      </citerefentry>,
db3d82
+      <citerefentry>
db3d82
+        <refentrytitle>pam_pwhistory</refentrytitle><manvolnum>8</manvolnum>
db3d82
+      </citerefentry>,
db3d82
+      <citerefentry>
db3d82
+        <refentrytitle>pam.conf</refentrytitle><manvolnum>5</manvolnum>
db3d82
+      </citerefentry>,
db3d82
+      <citerefentry>
db3d82
+        <refentrytitle>pam.d</refentrytitle><manvolnum>5</manvolnum>
db3d82
+      </citerefentry>,
db3d82
+      <citerefentry>
db3d82
+        <refentrytitle>pam</refentrytitle><manvolnum>8</manvolnum>
db3d82
+      </citerefentry>
db3d82
+    </para>
db3d82
+  </refsect1>
db3d82
+
db3d82
+  <refsect1 id='pwhistory.conf-author'>
db3d82
+    <title>AUTHOR</title>
db3d82
+      <para>
db3d82
+        pam_pwhistory was written by Thorsten Kukuk. The support for
db3d82
+        pwhistory.conf was written by Iker Pedrosa.
db3d82
+      </para>
db3d82
+  </refsect1>
db3d82
+
db3d82
+</refentry>
db3d82
diff -up Linux-PAM-1.5.1/modules/pam_pwhistory/pwhistory_config.c.pam-pwhistory-load-conf-from-file Linux-PAM-1.5.1/modules/pam_pwhistory/pwhistory_config.c
db3d82
--- Linux-PAM-1.5.1/modules/pam_pwhistory/pwhistory_config.c.pam-pwhistory-load-conf-from-file	2022-08-22 09:08:48.916487811 +0200
db3d82
+++ Linux-PAM-1.5.1/modules/pam_pwhistory/pwhistory_config.c	2022-08-22 09:08:48.916487811 +0200
db3d82
@@ -0,0 +1,115 @@
db3d82
+/*
db3d82
+ * Copyright (c) 2022 Iker Pedrosa <ipedrosa@redhat.com>
db3d82
+ *
db3d82
+ * Redistribution and use in source and binary forms, with or without
db3d82
+ * modification, are permitted provided that the following conditions
db3d82
+ * are met:
db3d82
+ * 1. Redistributions of source code must retain the above copyright
db3d82
+ *    notice, and the entire permission notice in its entirety,
db3d82
+ *    including the disclaimer of warranties.
db3d82
+ * 2. Redistributions in binary form must reproduce the above copyright
db3d82
+ *    notice, this list of conditions and the following disclaimer in the
db3d82
+ *    documentation and/or other materials provided with the distribution.
db3d82
+ * 3. The name of the author may not be used to endorse or promote
db3d82
+ *    products derived from this software without specific prior
db3d82
+ *    written permission.
db3d82
+ *
db3d82
+ * ALTERNATIVELY, this product may be distributed under the terms of
db3d82
+ * the GNU Public License, in which case the provisions of the GPL are
db3d82
+ * required INSTEAD OF the above restrictions.  (This clause is
db3d82
+ * necessary due to a potential bad interaction between the GPL and
db3d82
+ * the restrictions contained in a BSD-style copyright.)
db3d82
+ *
db3d82
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
db3d82
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
db3d82
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
db3d82
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
db3d82
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
db3d82
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
db3d82
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
db3d82
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
db3d82
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
db3d82
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
db3d82
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
db3d82
+ */
db3d82
+
db3d82
+#include "config.h"
db3d82
+
db3d82
+#include <stdio.h>
db3d82
+#include <stdlib.h>
db3d82
+#include <string.h>
db3d82
+#include <syslog.h>
db3d82
+
db3d82
+#include <security/pam_modutil.h>
db3d82
+
db3d82
+#include "pam_inline.h"
db3d82
+#include "pwhistory_config.h"
db3d82
+
db3d82
+#define PWHISTORY_DEFAULT_CONF "/etc/security/pwhistory.conf"
db3d82
+
db3d82
+void
db3d82
+parse_config_file(pam_handle_t *pamh, int argc, const char **argv,
db3d82
+                  struct options_t *options)
db3d82
+{
db3d82
+    const char *fname = NULL;
db3d82
+    int i;
db3d82
+    char *val;
db3d82
+
db3d82
+    for (i = 0; i < argc; ++i) {
db3d82
+        const char *str = pam_str_skip_prefix(argv[i], "conf=");
db3d82
+
db3d82
+        if (str != NULL) {
db3d82
+            fname = str;
db3d82
+        }
db3d82
+    }
db3d82
+
db3d82
+    if (fname == NULL) {
db3d82
+        fname = PWHISTORY_DEFAULT_CONF;
db3d82
+    }
db3d82
+
db3d82
+    val = pam_modutil_search_key (pamh, fname, "debug");
db3d82
+    if (val != NULL) {
db3d82
+        options->debug = 1;
db3d82
+        free(val);
db3d82
+    }
db3d82
+
db3d82
+    val = pam_modutil_search_key (pamh, fname, "enforce_for_root");
db3d82
+    if (val != NULL) {
db3d82
+        options->enforce_for_root = 1;
db3d82
+        free(val);
db3d82
+    }
db3d82
+
db3d82
+    val = pam_modutil_search_key (pamh, fname, "remember");
db3d82
+    if (val != NULL) {
db3d82
+        unsigned int temp;
db3d82
+        if (sscanf(val, "%u", &temp) != 1) {
db3d82
+            pam_syslog(pamh, LOG_ERR,
db3d82
+                "Bad number supplied for remember argument");
db3d82
+        } else {
db3d82
+            options->remember = temp;
db3d82
+        }
db3d82
+        free(val);
db3d82
+    }
db3d82
+
db3d82
+    val = pam_modutil_search_key (pamh, fname, "retry");
db3d82
+    if (val != NULL) {
db3d82
+        unsigned int temp;
db3d82
+        if (sscanf(val, "%u", &temp) != 1) {
db3d82
+            pam_syslog(pamh, LOG_ERR,
db3d82
+                "Bad number supplied for retry argument");
db3d82
+        } else {
db3d82
+            options->tries = temp;
db3d82
+        }
db3d82
+        free(val);
db3d82
+    }
db3d82
+
db3d82
+    val = pam_modutil_search_key (pamh, fname, "file");
db3d82
+    if (val != NULL) {
db3d82
+        if (*val != '/') {
db3d82
+            pam_syslog (pamh, LOG_ERR,
db3d82
+                "File path should be absolute: %s", val);
db3d82
+        } else {
db3d82
+            options->filename = val;
db3d82
+        }
db3d82
+    }
db3d82
+}
db3d82
diff -up Linux-PAM-1.5.1/modules/pam_pwhistory/pwhistory_config.h.pam-pwhistory-load-conf-from-file Linux-PAM-1.5.1/modules/pam_pwhistory/pwhistory_config.h
db3d82
--- Linux-PAM-1.5.1/modules/pam_pwhistory/pwhistory_config.h.pam-pwhistory-load-conf-from-file	2022-08-22 09:08:48.916487811 +0200
db3d82
+++ Linux-PAM-1.5.1/modules/pam_pwhistory/pwhistory_config.h	2022-08-22 09:08:48.916487811 +0200
db3d82
@@ -0,0 +1,54 @@
db3d82
+/*
db3d82
+ * Copyright (c) 2022 Iker Pedrosa <ipedrosa@redhat.com>
db3d82
+ *
db3d82
+ * Redistribution and use in source and binary forms, with or without
db3d82
+ * modification, are permitted provided that the following conditions
db3d82
+ * are met:
db3d82
+ * 1. Redistributions of source code must retain the above copyright
db3d82
+ *    notice, and the entire permission notice in its entirety,
db3d82
+ *    including the disclaimer of warranties.
db3d82
+ * 2. Redistributions in binary form must reproduce the above copyright
db3d82
+ *    notice, this list of conditions and the following disclaimer in the
db3d82
+ *    documentation and/or other materials provided with the distribution.
db3d82
+ * 3. The name of the author may not be used to endorse or promote
db3d82
+ *    products derived from this software without specific prior
db3d82
+ *    written permission.
db3d82
+ *
db3d82
+ * ALTERNATIVELY, this product may be distributed under the terms of
db3d82
+ * the GNU Public License, in which case the provisions of the GPL are
db3d82
+ * required INSTEAD OF the above restrictions.  (This clause is
db3d82
+ * necessary due to a potential bad interaction between the GPL and
db3d82
+ * the restrictions contained in a BSD-style copyright.)
db3d82
+ *
db3d82
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
db3d82
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
db3d82
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
db3d82
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
db3d82
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
db3d82
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
db3d82
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
db3d82
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
db3d82
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
db3d82
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
db3d82
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
db3d82
+ */
db3d82
+
db3d82
+#ifndef _PWHISTORY_CONFIG_H
db3d82
+#define _PWHISTORY_CONFIG_H
db3d82
+
db3d82
+#include <security/pam_ext.h>
db3d82
+
db3d82
+struct options_t {
db3d82
+    int debug;
db3d82
+    int enforce_for_root;
db3d82
+    int remember;
db3d82
+    int tries;
db3d82
+    const char *filename;
db3d82
+};
db3d82
+typedef struct options_t options_t;
db3d82
+
db3d82
+void
db3d82
+parse_config_file(pam_handle_t *pamh, int argc, const char **argv,
db3d82
+                  struct options_t *options);
db3d82
+
db3d82
+#endif /* _PWHISTORY_CONFIG_H */
db3d82
diff -up Linux-PAM-1.5.1/modules/pam_pwhistory/pwhistory.conf.pam-pwhistory-load-conf-from-file Linux-PAM-1.5.1/modules/pam_pwhistory/pwhistory.conf
db3d82
--- Linux-PAM-1.5.1/modules/pam_pwhistory/pwhistory.conf.pam-pwhistory-load-conf-from-file	2022-08-22 09:08:48.916487811 +0200
db3d82
+++ Linux-PAM-1.5.1/modules/pam_pwhistory/pwhistory.conf	2022-08-22 09:08:48.916487811 +0200
db3d82
@@ -0,0 +1,21 @@
db3d82
+# Configuration for remembering the last passwords used by a user.
db3d82
+#
db3d82
+# Enable the debugging logs.
db3d82
+# Enabled if option is present.
db3d82
+# debug
db3d82
+#
db3d82
+# root account's passwords are also remembered.
db3d82
+# Enabled if option is present.
db3d82
+# enforce_for_root
db3d82
+#
db3d82
+# Number of passwords to remember.
db3d82
+# The default is 10.
db3d82
+# remember = 10
db3d82
+#
db3d82
+# Number of times to prompt for the password.
db3d82
+# The default is 1.
db3d82
+# retry = 1
db3d82
+#
db3d82
+# The directory where the last passwords are kept.
db3d82
+# The default is /etc/security/opasswd.
db3d82
+# file = /etc/security/opasswd