pam_putenv Subroutine

Purpose

Defines a PAM environment variable.

Library

PAM Library (libpam.a)

Syntax

#include <security/pam_appl.h>

int pam_putenv (PAMHandle, NameValue)
pam_handle_t *PAMHandle;
const char *NameValue;

Description

The pam_putenv subroutine sets and deletes environment variables in the PAM handle, PAMHandle. Applications can retrieve the defined variables by calling pam_getenv() or pam_getenvlist() and add them to the user's session. If a variable with the same name is already defined, the old value is replaced by the new value.

Parameters

Item Description
PAMHandle The PAM authentication handle, obtained from a previous call to pam_start().
NameValue A string of the form name=value to be stored in the environment section of the PAM handle. The following behavior is exhibited with regards to the format of the passed-in string:
NAME=VALUE
Creates or overwrites the value for the variable in the environment.
NAME=
Sets the variable to the empty string.
NAME
Deletes the variable from the environment, if it is currently defined.

Return Values

Upon successful completion, pam_putenv returns PAM_SUCCESS. If the routine fails, either PAM_SYSTEM_ERR or PAM_BUF_ERR is returned, depending on the actual error.

Error Codes

Item Description
PAM_SYSTEM_ERR A system error occurred.
PAM_BUF_ERR A memory error occurred.