pam_putenv -- Add, replace or delete a PAM environment variable


#include <security/pam_appl.h>

int pam_putenv(const pam_handle_t * pamh, const char * name_value);


The pam_putenv() function shall modify the environment list associated with pamh. If name_value contains an '=' character, the characters to the left of the first '=' character represent the name, and the remaining characters after the '=' represent the value.

If the name environment variable exists in the environment associated with pamh, it shall be modified to have the value value. Otherwise, the name shall be added to the environment associated with pamh with the value value.

If there is no '=' character in name_value, the variable in the environment associated with pamh named name_value shall be deleted.

Return Value

On success, the pam_putenv() function shall return PAM_SUCCESS. Otherwise the return value indicates the error:


The name_value argument is a null pointer.


The PAM environment varable named name_value does not exist and therefore cannot be deleted.


The PAM handle identifed by pamh is corrupt.


Memory buffer error.