aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--patches-applied/pam_env_ignore_garbage.patch18
1 files changed, 11 insertions, 7 deletions
diff --git a/patches-applied/pam_env_ignore_garbage.patch b/patches-applied/pam_env_ignore_garbage.patch
index 3e309edc..b224a02b 100644
--- a/patches-applied/pam_env_ignore_garbage.patch
+++ b/patches-applied/pam_env_ignore_garbage.patch
@@ -29,14 +29,18 @@ Index: pam/Linux-PAM/modules/pam_env/pam_env.c
/* now we try to be smart about quotes around the value,
but not too smart, we can't get all fancy with escaped
-@@ -250,6 +255,10 @@
+@@ -248,6 +253,14 @@
+ key[i] = '\0';
+ }
++ /* if this is a request to delete a variable, check that it's
++ actually set first, so we don't get a vague error back from
++ pam_putenv() */
++ for (i = 0; key[i] != '=' && key[i] != '\0'; i++);
++
++ if (key[i] == '\0' && !pam_getenv(pamh,key))
++ continue;
++
/* set the env var, if it fails, we break out of the loop */
retval = pam_putenv(pamh, key);
-+ if (retval == PAM_BAD_ITEM)
-+ /* expected error from deleting a non-existent env var */
-+ retval = PAM_SUCCESS;
-+
if (retval != PAM_SUCCESS) {
- D(("error setting env \"%s\"", key));
- break;