2 .\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH PAM_SET_ITEM 3PAM "Oct 31, 2006"
8 pam_set_item, pam_get_item \- authentication information routines for PAM
12 \fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lpam\fR [ \fIlibrary\fR ... ]
13 #include <security/pam_appl.h>
15 \fBint\fR \fBpam_set_item\fR(\fBpam_handle_t *\fR\fIpamh\fR, \fBint\fR \fIitem_type\fR,
16 \fBconst void *\fR\fIitem\fR);
21 \fBint\fR \fBpam_get_item\fR(\fBconst pam_handle_t *\fR\fIpamh\fR, \fBint\fR \fIitem_type\fR,
22 \fBvoid **\fR\fIitem\fR);
28 The \fBpam_get_item()\fR and \fBpam_set_item()\fR functions allow applications
29 and \fBPAM\fR service modules to access and to update \fBPAM\fR information as
30 needed. The information is specified by \fIitem_type\fR, and can be one of the
38 The authenticated user name. Applications that are trusted to correctly
39 identify the authenticated user should set this item to the authenticated user
40 name. See NOTES and \fBpam_unix_cred\fR(5).
46 \fB\fBPAM_AUTHTOK\fR\fR
49 The user authentication token.
58 The \fBpam_conv\fR structure.
64 \fB\fBPAM_OLDAUTHTOK\fR\fR
67 The old user authentication token.
73 \fB\fBPAM_RESOURCE\fR\fR
76 A semicolon-separated list of \fIkey\fR=\fIvalue\fR pairs that represent the
77 set of resource controls for application by \fBpam_setcred\fR(3PAM) or
78 \fBpam_open_session\fR(3PAM). See the individual service module definitions,
79 such as \fBpam_unix_cred\fR(5), for interpretations of the keys and values.
97 The \fBrlogin\fR/\fBrsh\fR untrusted remote user name.
103 \fB\fBPAM_SERVICE\fR\fR
130 \fB\fBPAM_USER_PROMPT\fR\fR
133 The default prompt used by \fBpam_get_user()\fR.
142 The repository that contains the authentication token information.
147 The pam_repository structure is defined as:
151 struct pam_repository {
152 char *type; /* Repository type, e.g., files, */
154 void *scope; /* Optional scope information */
155 size_t scope_len; /* length of scope information */
162 The \fIitem_type\fR \fBPAM_SERVICE\fR can be set only by \fBpam_start()\fR and
163 is read-only to both applications and service modules.
166 For security reasons, the \fIitem_type\fR \fBPAM_AUTHTOK\fR and
167 \fBPAM_OLDAUTHTOK\fR are available only to the module providers. The
168 authentication module, account module, and session management module should
169 treat \fBPAM_AUTHTOK\fR as the current authentication token and ignore
170 \fBPAM_OLDAUTHTOK\fR. The password management module should treat
171 \fBPAM_OLDAUTHTOK\fR as the current authentication token and \fBPAM_AUTHTOK\fR
172 as the new authentication token.
175 The \fBpam_set_item()\fR function is passed the authentication handle,
176 \fIpamh\fR, returned by \fBpam_start()\fR, a pointer to the object, \fIitem\fR,
177 and its type, \fIitem_type\fR. If successful, \fBpam_set_item()\fR copies the
178 item to an internal storage area allocated by the authentication module and
179 returns \fBPAM_SUCCESS\fR. An item that had been previously set will be
180 overwritten by the new value.
183 The \fBpam_get_item()\fR function is passed the authentication handle,
184 \fIpamh\fR, returned by \fBpam_start()\fR, an \fIitem_type\fR, and the address
185 of the pointer, \fIitem\fR, which is assigned the address of the requested
186 object. The object data is valid until modified by a subsequent call to
187 \fBpam_set_item()\fR for the same \fIitem_type\fR, or unless it is modified by
188 any of the underlying service modules. If the item has not been previously set,
189 \fBpam_get_item()\fR returns a null pointer. An \fIitem\fR retrieved by
190 \fBpam_get_item()\fR should not be modified or freed. The item will be
191 released by \fBpam_end()\fR.
195 Upon success, \fBpam_get_item()\fR returns \fBPAM_SUCCESS\fR; otherwise it
196 returns an error code. Refer to \fBpam\fR(3PAM) for information on error
197 related return values.
201 See \fBattributes\fR(5) for description of the following attributes:
209 ATTRIBUTE TYPE ATTRIBUTE VALUE
211 Interface Stability Stable
213 MT-Level MT-Safe with exceptions
218 The functions in \fBlibpam\fR(3LIB) are MT-Safe only if each thread within the
219 multithreaded application uses its own \fBPAM\fR handle.
223 \fBlibpam\fR(3LIB), \fBpam\fR(3PAM), \fBpam_acct_mgmt\fR(3PAM),
224 \fBpam_authenticate\fR(3PAM), \fBpam_chauthtok\fR(3PAM),
225 \fBpam_get_user\fR(3PAM), \fBpam_open_session\fR(3PAM),
226 \fBpam_setcred\fR(3PAM), \fBpam_start\fR(3PAM), \fBattributes\fR(5),
227 \fBpam_unix_cred\fR(5)
231 If the \fBPAM_REPOSITORY\fR \fIitem_type\fR is set and a service module does
232 not recognize the type, the service module does not process any information,
233 and returns \fBPAM_IGNORE\fR. If the \fBPAM_REPOSITORY\fR \fIitem_type\fR is
234 not set, a service module performs its default action.
237 PAM_AUSER is not intended as a replacement for PAM_USER. It is expected to be
238 used to supplement PAM_USER when there is an authenticated user from a source
239 other than \fBpam_authenticate\fR(3PAM). Such sources could be \fBsshd\fR
240 host-based authentication, kerberized \fBrlogin\fR, and \fBsu\fR(1M).