f0eb90949b
- pam_env-fix-enable-vendordir-fallback.patch - pam_env-fix_vendordir.patch - pam_env-remove-escaped-newlines.patch OBS-URL: https://build.opensuse.org/package/show/Linux-PAM/pam?expand=0&rev=285
55 lines
1.6 KiB
Diff
55 lines
1.6 KiB
Diff
From ef51c51523b4c6ce6275b2863a0de1a3a6dff1e5 Mon Sep 17 00:00:00 2001
|
|
From: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
Date: Thu, 18 Jan 2024 20:25:20 +0100
|
|
Subject: [PATCH] pam_env: remove escaped newlines from econf lines
|
|
|
|
The libeconf routines do not remove escaped newlines the way we want to
|
|
process them later on. Manually remove them from values.
|
|
|
|
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
---
|
|
modules/pam_env/pam_env.c | 23 +++++++++++++++++++++++
|
|
1 file changed, 23 insertions(+)
|
|
|
|
diff --git a/modules/pam_env/pam_env.c b/modules/pam_env/pam_env.c
|
|
index a0b812fff..5f53fbb10 100644
|
|
--- a/modules/pam_env/pam_env.c
|
|
+++ b/modules/pam_env/pam_env.c
|
|
@@ -160,6 +160,28 @@ isDirectory(const char *path) {
|
|
return S_ISDIR(statbuf.st_mode);
|
|
}
|
|
|
|
+/*
|
|
+ * Remove escaped newline from string.
|
|
+ *
|
|
+ * All occurrences of "\\n" will be removed from string.
|
|
+ */
|
|
+static void
|
|
+econf_unescnl(char *val)
|
|
+{
|
|
+ char *dest, *p;
|
|
+
|
|
+ dest = p = val;
|
|
+
|
|
+ while (*p != '\0') {
|
|
+ if (p[0] == '\\' && p[1] == '\n') {
|
|
+ p += 2;
|
|
+ } else {
|
|
+ *dest++ = *p++;
|
|
+ }
|
|
+ }
|
|
+ *dest = '\0';
|
|
+}
|
|
+
|
|
static int
|
|
econf_read_file(const pam_handle_t *pamh, const char *filename, const char *delim,
|
|
const char *name, const char *suffix, const char *subpath,
|
|
@@ -270,6 +292,7 @@ econf_read_file(const pam_handle_t *pamh, const char *filename, const char *deli
|
|
keys[i],
|
|
econf_errString(error));
|
|
} else {
|
|
+ econf_unescnl(val);
|
|
if (asprintf(&(*lines)[i],"%s%c%s", keys[i], delim[0], val) < 0) {
|
|
pam_syslog(pamh, LOG_ERR, "Cannot allocate memory.");
|
|
econf_free(keys);
|