summaryrefslogtreecommitdiff
path: root/Linux-PAM/libpam_misc/help_env.c
diff options
context:
space:
mode:
Diffstat (limited to 'Linux-PAM/libpam_misc/help_env.c')
-rw-r--r--Linux-PAM/libpam_misc/help_env.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/Linux-PAM/libpam_misc/help_env.c b/Linux-PAM/libpam_misc/help_env.c
index e1390984..f57951af 100644
--- a/Linux-PAM/libpam_misc/help_env.c
+++ b/Linux-PAM/libpam_misc/help_env.c
@@ -1,33 +1,18 @@
/*
- * $Id: help_env.c,v 1.2 2000/12/04 19:02:34 baggins Exp $
+ * $Id: help_env.c,v 1.4 2005/09/20 08:31:27 kukuk Exp $
*
* This file was written by Andrew G. Morgan <morgan@parc.power.net>
*
*/
+#include "config.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <security/pam_misc.h>
/*
- * This is a useful function for dumping the Linux-PAM environment
- * into some local memory, prior to it all getting lost when pam_end()
- * is called.
- *
- * Initially it was assumed that libpam did not do this part correctly
- * (based on a loose email definition). The X/Open XSSO spec makes it
- * clear that this function is a duplicate of the one already in
- * libpam and therefore unnecessary. IT WILL BE COMPLETELY REMOVED
- * IN libpam_misc 1.0 */
-
-char **pam_misc_copy_env(pam_handle_t *pamh);
-char **pam_misc_copy_env(pam_handle_t *pamh)
-{
- return pam_getenvlist(pamh);
-}
-
-/*
* This function should be used to carefully dispose of the copied
* environment.
*
@@ -89,9 +74,7 @@ int pam_misc_setenv(pam_handle_t *pamh, const char *name
return PAM_PERM_DENIED; /* not allowed to overwrite */
}
}
- tmp = malloc(2+strlen(name)+strlen(value));
- if (tmp != NULL) {
- sprintf(tmp,"%s=%s",name,value);
+ if (asprintf(&tmp, "%s=%s", name, value) >= 0) {
D(("pam_putt()ing: %s", tmp));
retval = pam_putenv(pamh, tmp);
_pam_overwrite(tmp); /* purge */