1PAM_GET_ITEM(3) Linux-PAM Manual PAM_GET_ITEM(3)
2
3
4
6 pam_get_item - getting PAM information
7
9 #include <security/pam_modules.h>
10
11 int pam_get_item(const pam_handle_t *pamh, int item_type,
12 const void **item);
13
15 The pam_get_item function allows applications and PAM service modules
16 to access and retrieve PAM information of item_type. Upon successful
17 return, item contains a pointer to the value of the corresponding item.
18 Note, this is a pointer to the actual data and should not be free()'ed
19 or over-written! The following values are supported for item_type:
20
21 PAM_SERVICE
22 The service name (which identifies that PAM stack that the PAM
23 functions will use to authenticate the program).
24
25 PAM_USER
26 The username of the entity under whose identity service will be
27 given. That is, following authentication, PAM_USER identifies the
28 local entity that gets to use the service. Note, this value can be
29 mapped from something (eg., "anonymous") to something else (eg.
30 "guest119") by any module in the PAM stack. As such an application
31 should consult the value of PAM_USER after each call to a PAM
32 function.
33
34 PAM_USER_PROMPT
35 The string used when prompting for a user's name. The default value
36 for this string is a localized version of "login: ".
37
38 PAM_TTY
39 The terminal name: prefixed by /dev/ if it is a device file; for
40 graphical, X-based, applications the value for this item should be
41 the $DISPLAY variable.
42
43 PAM_RUSER
44 The requesting user name: local name for a locally requesting user
45 or a remote user name for a remote requesting user.
46
47 Generally an application or module will attempt to supply the value
48 that is most strongly authenticated (a local account before a
49 remote one. The level of trust in this value is embodied in the
50 actual authentication stack associated with the application, so it
51 is ultimately at the discretion of the system administrator.
52
53 PAM_RUSER@PAM_RHOST should always identify the requesting user. In
54 some cases, PAM_RUSER may be NULL. In such situations, it is
55 unclear who the requesting entity is.
56
57 PAM_RHOST
58 The requesting hostname (the hostname of the machine from which the
59 PAM_RUSER entity is requesting service). That is
60 PAM_RUSER@PAM_RHOST does identify the requesting user. In some
61 applications, PAM_RHOST may be NULL. In such situations, it is
62 unclear where the authentication request is originating from.
63
64 PAM_AUTHTOK
65 The authentication token (often a password). This token should be
66 ignored by all module functions besides pam_sm_authenticate(3) and
67 pam_sm_chauthtok(3). In the former function it is used to pass the
68 most recent authentication token from one stacked module to
69 another. In the latter function the token is used for another
70 purpose. It contains the currently active authentication token.
71
72 PAM_OLDAUTHTOK
73 The old authentication token. This token should be ignored by all
74 module functions except pam_sm_chauthtok(3).
75
76 PAM_CONV
77 The pam_conv structure. See pam_conv(3).
78
79 The following additional items are specific to Linux-PAM and should not
80 be used in portable applications:
81
82 PAM_FAIL_DELAY
83 A function pointer to redirect centrally managed failure delays.
84 See pam_fail_delay(3).
85
86 PAM_XDISPLAY
87 The name of the X display. For graphical, X-based applications the
88 value for this item should be the $DISPLAY variable. This value may
89 be used independently of PAM_TTY for passing the name of the
90 display.
91
92 PAM_XAUTHDATA
93 A pointer to a structure containing the X authentication data
94 required to make a connection to the display specified by
95 PAM_XDISPLAY, if such information is necessary. See
96 pam_xauth_data(3).
97
98 PAM_AUTHTOK_TYPE
99 The default action is for the module to use the following prompts
100 when requesting passwords: "New UNIX password: " and "Retype UNIX
101 password: ". The example word UNIX can be replaced with this item,
102 by default it is empty. This item is used by pam_get_authtok(3).
103
104 If a service module wishes to obtain the name of the user, it should
105 not use this function, but instead perform a call to pam_get_user(3).
106
107 Only a service module is privileged to read the authentication tokens,
108 PAM_AUTHTOK and PAM_OLDAUTHTOK.
109
111 PAM_BAD_ITEM
112 The application attempted to set an undefined or inaccessible item.
113
114 PAM_BUF_ERR
115 Memory buffer error.
116
117 PAM_PERM_DENIED
118 The value of item was NULL.
119
120 PAM_SUCCESS
121 Data was successful updated.
122
123 PAM_SYSTEM_ERR
124 The pam_handle_t passed as first argument was invalid.
125
127 pam_set_item(3), pam_strerror(3)
128
129
130
131Linux-PAM Manual 09/03/2021 PAM_GET_ITEM(3)