diff options
author | Stefan Schubert <schubi@suse.de> | 2024-06-27 16:06:36 +0200 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2024-07-02 08:00:00 +0000 |
commit | bc461898448a1bf306fc094cdf6a5a197c4e2753 (patch) | |
tree | 03a14e47e3cbdfbe55e15aee53a2183700dd9737 /modules | |
parent | efa6e33b1da594f2a2c4c2c8871416a3d5011015 (diff) | |
download | pam-bc461898448a1bf306fc094cdf6a5a197c4e2753.tar.gz pam-bc461898448a1bf306fc094cdf6a5a197c4e2753.tar.bz2 pam-bc461898448a1bf306fc094cdf6a5a197c4e2753.zip |
libpam_internal: introduce pam_econf_readconfig
Use this new function instead of econf_readDirs() and
econf_readDirsWithCallback().
Co-authored-by: Dmitry V. Levin <ldv@strace.io>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/pam_env/Makefile.am | 5 | ||||
-rw-r--r-- | modules/pam_env/pam_env.c | 7 | ||||
-rw-r--r-- | modules/pam_shells/Makefile.am | 8 | ||||
-rw-r--r-- | modules/pam_shells/pam_shells.c | 24 |
4 files changed, 24 insertions, 20 deletions
diff --git a/modules/pam_env/Makefile.am b/modules/pam_env/Makefile.am index 885c9aa3..e75b3485 100644 --- a/modules/pam_env/Makefile.am +++ b/modules/pam_env/Makefile.am @@ -22,8 +22,9 @@ secureconfdir = $(SCONFIGDIR) endif AM_CFLAGS = -I$(top_srcdir)/libpam_internal/include \ - -I$(top_srcdir)/libpam/include $(WARN_CFLAGS) \ - -DSYSCONFDIR=\"$(sysconfdir)\" $(ECONF_CFLAGS) + -I$(top_srcdir)/libpam/include \ + -I$(top_srcdir)/libpam_internal/include \ + -DSYSCONFDIR=\"$(sysconfdir)\" $(WARN_CFLAGS) $(ECONF_CFLAGS) AM_LDFLAGS = -no-undefined -avoid-version -module if HAVE_VERSIONING AM_LDFLAGS += -Wl,--version-script=$(srcdir)/../modules.map diff --git a/modules/pam_env/pam_env.c b/modules/pam_env/pam_env.c index 7c146439..1bb7b2c3 100644 --- a/modules/pam_env/pam_env.c +++ b/modules/pam_env/pam_env.c @@ -21,7 +21,7 @@ #include <sys/types.h> #include <unistd.h> #ifdef USE_ECONF -#include <libeconf.h> +#include "pam_econf.h" #endif #include <security/pam_modules.h> @@ -241,9 +241,8 @@ econf_read_file(const pam_handle_t *pamh, const char *filename, const char *deli } } - D(("Read configuration from directory %s and %s", vendor_dir, sysconf_dir)); - error = econf_readDirs (&key_file, vendor_dir, sysconf_dir, name, suffix, - delim, "#"); + error = pam_econf_readconfig (&key_file, vendor_dir, sysconf_dir, name, suffix, + delim, "#", NULL, NULL); free(vendor_dir); free(sysconf_dir); if (error != ECONF_SUCCESS) { diff --git a/modules/pam_shells/Makefile.am b/modules/pam_shells/Makefile.am index 18b44fa4..913bde6a 100644 --- a/modules/pam_shells/Makefile.am +++ b/modules/pam_shells/Makefile.am @@ -21,14 +21,18 @@ else secureconfdir = $(SCONFIGDIR) endif -AM_CFLAGS = -I$(top_srcdir)/libpam/include $(WARN_CFLAGS) $(ECONF_CFLAGS) +AM_CFLAGS = -I$(top_srcdir)/libpam/include \ + -I$(top_srcdir)/libpam_internal/include \ + $(WARN_CFLAGS) $(ECONF_CFLAGS) AM_LDFLAGS = -no-undefined -avoid-version -module if HAVE_VERSIONING AM_LDFLAGS += -Wl,--version-script=$(srcdir)/../modules.map endif securelib_LTLIBRARIES = pam_shells.la -pam_shells_la_LIBADD = $(top_builddir)/libpam/libpam.la $(ECONF_LIBS) +pam_shells_la_LIBADD = $(top_builddir)/libpam/libpam.la \ + $(top_builddir)/libpam_internal/libpam_internal.la \ + $(ECONF_LIBS) if ENABLE_REGENERATE_MAN dist_noinst_DATA = README diff --git a/modules/pam_shells/pam_shells.c b/modules/pam_shells/pam_shells.c index d5f8ec35..bacf4f55 100644 --- a/modules/pam_shells/pam_shells.c +++ b/modules/pam_shells/pam_shells.c @@ -19,7 +19,7 @@ #include <syslog.h> #include <unistd.h> #if defined (USE_ECONF) && defined (VENDORDIR) -#include <libeconf.h> +#include "pam_econf.h" #endif #include <security/pam_modules.h> @@ -81,17 +81,17 @@ static int perform_check(pam_handle_t *pamh) size_t size = 0; econf_err error; char **keys; - econf_file *key_file; - - error = econf_readDirsWithCallback(&key_file, - VENDORDIR, - ETCDIR, - SHELLS, - NULL, - "", /* key only */ - "#", /* comment */ - check_file, pamh); - if (error) { + econf_file *key_file = NULL; + + error = pam_econf_readconfig(&key_file, + VENDORDIR, + ETCDIR, + SHELLS, + NULL, + "", /* key only */ + "#", /* comment */ + check_file, pamh); + if (error != ECONF_SUCCESS) { pam_syslog(pamh, LOG_ERR, "Cannot parse shell files: %s", econf_errString(error)); |