pam_putenv(3)

pam_putenv3

Set or change pam environment variable

Usage

#include <security/pam_appl.h>

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

Overview

The pam_putenv function is used to add or change the value of PAM environment variables as associated with the pamh handle.

The pamh argument is an authentication handle obtained by a prior call to pam_start(). The name_value argument is a single NUL terminated string of one of the following forms:

NAME=value of variable

In this case the environment variable of the given NAME is set to the indicated value: value of variable. If this variable is already known, it is overwritten. Otherwise it is added to the PAM environment.

NAME=

This function sets the variable to an empty value. It is listed separately to indicate that this is the correct way to achieve such a setting.

NAME

Without an '=' the pam_putenv() function will delete the corresponding variable from the PAM environment.

pam_putenv() operates on a copy of name_value, which means in contrast to putenv(3), the application is responsible for freeing the data.

Return values

PAM_PERM_DENIED

Argument name_value given is a NULL pointer.

PAM_BAD_ITEM

Variable requested (for deletion) is not currently set.

PAM_ABORT

The pamh handle is corrupt.

PAM_BUF_ERR

Memory buffer error.

PAM_SUCCESS

The environment variable was successfully updated.

Releases

13 releases since Debian 2.1 (Slink); the text changed 11 times.

  1. 2.1
  2. 2.2
  3. 3.0
  4. 5.0
  5. 6.0
  6. 7
  7. 8–9
  8. 10
  9. 11
  10. 12
  11. 13
  12. Arch

From pam 1.7.3-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.