pam_get_data Subroutine

Purpose

Retrieves information for a specific PAM module for this PAM session.

Library

PAM Library (libpam.a)

Syntax

#include <security/pam_appl.h>

int pam_get_data (PAMHandle, ModuleDataName, Data)
pam_handle_t *PAMHandle;
const char *ModuleDataName;
void **Data;

Description

The pam_get_data subroutine is used to retrieve module-specific data from the PAM handle. This subroutine is used by modules and should not be called by applications. If the ModuleDataName identifier exists, the reference for its data is returned in Data. If the identifier does not exist, a NULL reference is returned in Data. The caller should not modify or free the memory returned in Data. Instead, a cleanup function should be specified through a call to pam_set_data(). The cleanup function will be called when pam_end() is invoked in order to free any memory allocated.

Parameters

Item Description
PAMHandle (in) The PAM handle representing the current user authentication session. This handle is obtained by a call to pam_start().
ModuleDataName A unique identifier for Data.
Data Returned reference to the data denoted by ModuleDataName.

Return Values

Upon successful completion, pam_get_data returns PAM_SUCCESS. If ModuleDataName exists and pam_get_data completes successfully, Data will be a valid reference. Otherwise, Data will be NULL. If the routine fails, either PAM_SYSTEM_ERR, PAM_BUF_ERR, or PAM_NO_MODULE_DATA 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.
PAM_NO_MODULE_DATA No module-specific data was found.