1PAM_SET_DATA(3)                Linux-PAM Manual                PAM_SET_DATA(3)
2
3
4

NAME

6       pam_set_data - set module internal data
7

SYNOPSIS

9       #include <security/pam_modules.h>
10
11       int pam_set_data(pam_handle_t *pamh, const char *module_data_name,
12                        void *data,
13                        void (*cleanup)(pam_handle_t *pamh, void *data, int error_status));
14

DESCRIPTION

16       The pam_set_data function associates a pointer to an object with the
17       (hopefully) unique string module_data_name in the PAM context specified
18       by the pamh argument.
19
20       PAM modules may be dynamically loadable objects. In general such files
21       should not contain static variables. This function and its counterpart
22       pam_get_data(3), provide a mechanism for a module to associate some
23       data with the handle pamh. Typically a module will call the
24       pam_set_data function to register some data under a (hopefully) unique
25       module_data_name. The data is available for use by other modules too
26       but not by an application. Since this functions stores only a pointer
27       to the data, the module should not modify or free the content of it.
28
29       The function cleanup() is associated with the data and, if non-NULL, it
30       is called when this data is over-written or following a call to
31       pam_end(3).
32
33       The error_status argument is used to indicate to the module the sort of
34       action it is to take in cleaning this data item. As an example,
35       Kerberos creates a ticket file during the authentication phase, this
36       file might be associated with a data item. When pam_end(3) is called by
37       the module, the error_status carries the return value of the
38       pam_authenticate(3) or other libpam function as appropriate. Based on
39       this value the Kerberos module may choose to delete the ticket file
40       (authentication failure) or leave it in place.
41
42       The error_status may have been logically OR'd with either of the
43       following two values:
44
45       PAM_DATA_REPLACE
46           When a data item is being replaced (through a second call to
47           pam_set_data) this mask is used. Otherwise, the call is assumed to
48           be from pam_end(3).
49
50       PAM_DATA_SILENT
51           Which indicates that the process would prefer to perform the
52           cleanup() quietly. That is, discourages logging/messages to the
53           user.
54

RETURN VALUES

56       PAM_BUF_ERR
57           Memory buffer error.
58
59       PAM_SUCCESS
60           Data was successful stored.
61
62       PAM_SYSTEM_ERR
63           A NULL pointer was submitted as PAM handle or the function was
64           called by an application.
65

SEE ALSO

67       pam_end(3), pam_get_data(3), pam_strerror(3)
68
69
70
71Linux-PAM Manual                  09/19/2013                   PAM_SET_DATA(3)
Impressum