From 644dc6f0c15bccc7401e47785753e9c8d01018d3 Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Wed, 31 Jan 2024 20:12:58 +0100 Subject: libpam_internal: introduce pam_line The pam_assemble_line function is renamed to pam_line_assemble and moved into libpam_internal so it can be shared across libpam and the pam_env module. Applied renaming to all other relevant functions and data structures so it is easier to locate them in files. Signed-off-by: Tobias Stoeckmann --- modules/pam_env/Makefile.am | 3 ++- modules/pam_env/pam_env.c | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'modules/pam_env') diff --git a/modules/pam_env/Makefile.am b/modules/pam_env/Makefile.am index cf22e9b5..885c9aa3 100644 --- a/modules/pam_env/Makefile.am +++ b/modules/pam_env/Makefile.am @@ -21,7 +21,8 @@ else secureconfdir = $(SCONFIGDIR) endif -AM_CFLAGS = -I$(top_srcdir)/libpam/include $(WARN_CFLAGS) \ +AM_CFLAGS = -I$(top_srcdir)/libpam_internal/include \ + -I$(top_srcdir)/libpam/include $(WARN_CFLAGS) \ -DSYSCONFDIR=\"$(sysconfdir)\" $(ECONF_CFLAGS) AM_LDFLAGS = -no-undefined -avoid-version -module if HAVE_VERSIONING diff --git a/modules/pam_env/pam_env.c b/modules/pam_env/pam_env.c index 6bece0f8..b0f0b453 100644 --- a/modules/pam_env/pam_env.c +++ b/modules/pam_env/pam_env.c @@ -31,7 +31,7 @@ #include "pam_inline.h" #ifndef USE_ECONF -#include "pam_assemble_line.h" +#include "pam_line.h" #endif /* This little structure makes it easier to keep variables together */ @@ -316,9 +316,9 @@ econf_read_file(const pam_handle_t *pamh, const char *filename, const char *deli static int read_file(const pam_handle_t *pamh, const char*filename, char ***lines) { FILE *conf; - struct line_buffer buffer; + struct pam_line_buffer buffer; - _pam_buffer_init(&buffer); + _pam_line_buffer_init(&buffer); D(("Parsed file name is: %s", filename)); @@ -335,7 +335,7 @@ static int read_file(const pam_handle_t *pamh, const char*filename, char ***line return PAM_BUF_ERR; } (*lines)[i] = 0; - while (_pam_assemble_line(conf, &buffer, '\0') > 0) { + while (_pam_line_assemble(conf, &buffer, '\0') > 0) { char *p = buffer.assembled; char **tmp = NULL; D(("Read line: %s", p)); @@ -344,7 +344,7 @@ static int read_file(const pam_handle_t *pamh, const char*filename, char ***line pam_syslog(pamh, LOG_ERR, "Cannot allocate memory."); (void) fclose(conf); free_string_array(*lines); - _pam_buffer_clear(&buffer); + _pam_line_buffer_clear(&buffer); return PAM_BUF_ERR; } *lines = tmp; @@ -353,14 +353,14 @@ static int read_file(const pam_handle_t *pamh, const char*filename, char ***line pam_syslog(pamh, LOG_ERR, "Cannot allocate memory."); (void) fclose(conf); free_string_array(*lines); - _pam_buffer_clear(&buffer); + _pam_line_buffer_clear(&buffer); return PAM_BUF_ERR; } (*lines)[i] = 0; } (void) fclose(conf); - _pam_buffer_clear(&buffer); + _pam_line_buffer_clear(&buffer); return PAM_SUCCESS; } #endif -- cgit v1.2.3