2 .\" Copyright (c) 2007, 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 GSS_ADD_CRED 3GSS "Jun 30, 2005"
8 gss_add_cred \- add a credential-element to a credential
12 \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lgss\fR [ \fIlibrary\fR... ]
13 #include <gssapi/gssapi.h>
15 \fBOM_uint32\fR \fBgss_add_cred\fR(\fBOM_uint32 *\fR\fIminor_status\fR,
16 \fBconst gss_cred_id_t\fR \fIinput_cred_handle\fR,
17 \fBconst gss_name_t\fR \fIdesired_name\fR,
18 \fBconst gss_OID\fR \fIdesired_mech\fR,
19 \fBgss_cred_usage_t\fR \fIcred_usage\fR,
20 \fBOM_uint32\fR \fIinitiator_time_req\fR,
21 \fBOM_uint32\fR \fIacceptor_time_req\fR,
22 \fBgss_cred_id_t *\fR\fIoutput_cred_handle\fR,
23 \fBgss_OID_set *\fR\fIactual_mechs\fR,
24 \fBOM_uint32 *\fR\fIinitiator_time_rec\fR,
25 \fBOM_uint32 *\fR\fIacceptor_time_rec\fR);
31 The parameter descriptions for \fBgss_add_cred()\fR follow:
35 \fB\fIminor_status\fR\fR
38 Mechanism specific status code.
44 \fB\fIinput_cred_handle\fR\fR
47 Credential to which the credential-element is added. If
48 \fBGSS_C_NO_CREDENTIAL\fR is specified, the function composes the new
49 credential based on default behavior. While the credential-handle is not
50 modified by \fBgss_add_cred()\fR, the underlying credential is modified if
51 \fIoutput_credential_handle\fR is \fBNULL\fR.
57 \fB\fIdesired_name\fR\fR
60 Name of the principal for which a credential should be acquired.
66 \fB\fIdesired_mech\fR\fR
69 Underlying security mechanism with which the credential can be used.
70 GSS_C_NULL_OID can be used to obtain a default.
76 \fB\fIcred_usage\fR\fR
79 Flag that indicates how a credential is used to initiate or accept security
80 credentials. If the flag is \fBGSS_C_ACCEPT\fR, the credentials are used only
81 to accept security credentials. If the flag is \fBGSS_C_INITIATE\fR, the
82 credentials are used only to initiate security credentials. If the flag is
83 GSS_C_BOTH, the credentials can be used to either initiate or accept security
90 \fB\fIinitiator_time_req\fR\fR
93 Number of seconds that the credential may remain valid for initiating security
94 contexts. This argument is ignored if the composed credentials are of the
95 \fBGSS_C_ACCEPT\fR type. Specify \fBGSS_C_INDEFINITE\fR to request that the
96 credentials have the maximum permitted initiator lifetime.
102 \fB\fIacceptor_time_req\fR\fR
105 Number of seconds that the credential may remain valid for accepting security
106 contexts. This argument is ignored if the composed credentials are of the
107 \fBGSS_C_INITIATE\fR type. Specify \fBGSS_C_INDEFINITE\fR to request that the
108 credentials have the maximum permitted initiator lifetime.
114 \fB\fIoutput_cred_handle\fR\fR
117 Returned credential handle that contains the new credential-element and all the
118 credential-elements from \fIinput_cred_handle\fR. If a valid pointer to a
119 \fBgss_cred_id_t\fR is supplied for this parameter, \fBgss_add_cred()\fR
120 creates a new credential handle that contains all credential-elements from
121 \fIinput_cred_handle\fR and the newly acquired credential-element. If
122 \fBNULL\fR is specified for this parameter, the newly acquired
123 credential-element is added to the credential identified by
124 \fIinput_cred_handle\fR.
126 The resources associated with any credential handle returned by means of this
127 parameter must be released by the application after use by a call to
128 \fBgss_release_cred\fR(3GSS).
134 \fB\fIactual_mechs\fR\fR
137 Complete set of mechanisms for which the new credential is valid. Storage for
138 the returned \fBOID\fR-set must be freed by the application after use by a call
139 to \fBgss_release_oid_set\fR(3GSS). Specify \fBNULL\fR if this parameter is not
146 \fB\fIinitiator_time_rec\fR\fR
149 Actual number of seconds for which the returned credentials remain valid for
150 initiating contexts using the specified mechanism. If a mechanism does not
151 support expiration of credentials, the value \fBGSS_C_INDEFINITE\fR is
152 returned. Specify \fBNULL\fR if this parameter is not required.
158 \fB\fIacceptor_time_rec\fR\fR
161 Actual number of seconds for which the returned credentials remain valid for
162 accepting security contexts using the specified mechanism. If a mechanism does
163 not support expiration of credentials, the value \fBGSS_C_INDEFINITE\fR is
164 returned. Specify \fBNULL\fR if this parameter is not required.
170 The \fBgss_add_cred()\fR function adds a credential-element to a credential.
171 The credential-element is identified by the name of the principal to which it
172 refers. This function is not intended as a function to login to the network. A
173 function for login to the network would involve creating new mechanism-specific
174 authentication data, rather than acquiring a handle to existing data.
177 If the value of \fIdesired_name\fR is \fBGSS_C_NO_NAME\fR, the call is
178 interpreted as a request to add a credential-element to invoke default behavior
179 when passed to \fBgss_init_sec_context\fR(3GSS) if the value of
180 \fIcred_usage\fR is \fBGSS_C_INITIATE\fR or \fBGSS_C_BOTH\fR. The call is also
181 interpreted as a request to add a credential-element to the invoke default
182 behavior when passed to \fBgss_accept_sec_context\fR(3GSS) if the value of
183 \fIcred_usage\fR is \fBGSS_C_ACCEPT\fR or \fBGSS_C_BOTH\fR.
186 The \fBgss_add_cred()\fR function is expected to be used primarily by context
187 acceptors. The \fBGSS-API\fR provides mechanism-specific ways to obtain
188 \fBGSS-API\fR initiator credentials through the system login process.
189 Consequently, the \fBGSS-API\fR does not support acquiring \fBGSS_C_INITIATE\fR
190 or \fBGSS_C_BOTH\fR credentials by means of \fBgss_acquire_cred\fR(3GSS) for
191 any name other than the following:
202 Name produced by \fBgss_inquire_cred\fR(3GSS) applied to a valid credential
208 Name produced by \fBgss_inquire_context\fR(3GSS) applied to an active context
212 If credential acquisition is time consuming for a mechanism, the mechanism can
213 choose to delay the actual acquisition until the credential is required by
214 \fBgss_init_sec_context\fR(3GSS), for example, or by
215 \fBgss_accept_sec_context\fR(3GSS). Such mechanism-specific implementation
216 decisions are invisible to the calling application. A call to
217 \fBgss_inquire_cred\fR(3GSS) immediately following the call
218 \fBgss_add_cred()\fR returns valid credential data as well as incurring the
219 overhead of deferred credential acquisition.
222 The \fBgss_add_cred()\fR function can be used either to compose a new
223 credential that contains all credential-elements of the original in addition to
224 the newly-acquired credential-element. The function can also be used to add the
225 new credential-element to an existing credential. If the value of the
226 \fIoutput_cred_handle\fR parameter is \fBNULL\fR, the new credential-element is
227 added to the credential identified by \fIinput_cred_handle\fR. If a valid
228 pointer is specified for the \fIoutput_cred_handle\fR parameter, a new
229 credential handle is created.
232 If the value of \fIinput_cred_handle\fR is \fBGSS_C_NO_CREDENTIAL\fR, the
233 \fBgss_add_cred()\fR function composes a credential and sets the
234 \fIoutput_cred_handle\fR parameter based on the default behavior. The call has
235 the same effect as a call first made by the application to
236 \fBgss_acquire_cred\fR(3GSS) to specify the same usage and to pass
237 \fBGSS_C_NO_NAME\fR as the \fIdesired_name\fR parameter. Such an application
238 call obtains an explicit credential handle that incorporates the default
239 behaviors, then passes the credential handle to \fBgss_add_cred()\fR, and
240 finally calls \fBgss_release_cred\fR(3GSS) on the first credential handle.
243 If the value of the \fIinput_cred_handle\fR parameter is
244 \fBGSS_C_NO_CREDENTIAL\fR, a non-\fBNULL\fR value must be supplied for the
245 \fIoutput_cred_handle\fR parameter.
249 The \fBgss_add_cred()\fR function can return the following status codes:
253 \fB\fBGSS_S_COMPLETE\fR\fR
256 Successful completion.
262 \fB\fBGSS_S_BAD_MECH\fR\fR
265 An unavailable mechanism has been requested.
271 \fB\fBGSS_S_BAD_NAMETYPE\fR\fR
274 The type contained within the \fIdesired_name\fR parameter is not supported.
280 \fB\fBGSS_S_BAD_NAME\fR\fR
283 The value supplied for \fIdesired_name\fR parameter is ill formed.
289 \fB\fBGSS_S_DUPLICATE_ELEMENT\fR\fR
292 The credential already contains an element for the requested mechanism that has
293 overlapping usage and validity period.
299 \fB\fBGSS_S_CREDENTIALS_EXPIRED\fR\fR
302 The credentials could not be added because they have expired.
308 \fB\fBGSS_S_NO_CRED\fR\fR
311 No credentials were found for the specified name.
317 \fB\fBGSS_S_FAILURE\fR\fR
320 The underlying mechanism detected an error for which no specific \fBGSS\fR
321 status code is defined. The mechanism-specific status code reported by means of
322 the \fIminor_status\fR parameter details the error condition.
328 See \fBattributes\fR(5) for descriptions of the following attributes:
336 ATTRIBUTE TYPE ATTRIBUTE VALUE
344 \fBgss_accept_sec_context\fR(3GSS), \fBgss_acquire_cred\fR(3GSS),
345 \fBgss_init_sec_context\fR(3GSS), \fBgss_inquire_context\fR(3GSS),
346 \fBgss_inquire_cred\fR(3GSS), \fBgss_release_cred\fR(3GSS),
347 \fBgss_release_oid_set\fR(3GSS), \fBlibgss\fR(3LIB), \fBattributes\fR(5)
350 \fISolaris Security for Developers Guide\fR