aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvorlon <Unknown>2007-09-01 00:27:15 +0000
committervorlon <Unknown>2007-09-01 00:27:15 +0000
commitb60c6630cb096c593b30972bec8872363e03125f (patch)
tree8cf2eb505b36cccefee814519ef8c51e2fa82ace
parentcee9fe92a8c918c97bf9e2e83d7d53f37353590e (diff)
downloadpam-b60c6630cb096c593b30972bec8872363e03125f.tar.gz
pam-b60c6630cb096c593b30972bec8872363e03125f.tar.bz2
pam-b60c6630cb096c593b30972bec8872363e03125f.zip
tweak the patch based on feedback from upstream: instead of ignoring
PAM_BAD_ITEM, check for unset variables first with pam_getenv().
-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;