3 .\" Copyright (c) 2005 Doug Rabson
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 .\" The following commands are required for all man pages.
31 .Dt GSS_ACCEPT_SEC_CONTEXT 3 PRM
34 .Nm gss_accept_sec_context
35 .Nd Accept a security context initiated by a peer application
36 .\" This next command is for sections 2 and 3 only.
41 .Fo gss_accept_sec_context
42 .Fa "OM_uint32 *minor_status"
43 .Fa "gss_ctx_id_t *context_handle"
44 .Fa "const gss_cred_id_t acceptor_cred_handle"
45 .Fa "const gss_buffer_t input_token_buffer"
46 .Fa "const gss_channel_bindings_t input_chan_bindings"
47 .Fa "const gss_name_t *src_name"
48 .Fa "gss_OID *mech_type"
49 .Fa "gss_buffer_t output_token"
50 .Fa "OM_uint32 *ret_flags"
51 .Fa "OM_uint32 *time_rec"
52 .Fa "gss_cred_id_t *delegated_cred_handle"
55 Allows a remotely initiated security context between the application and a remote
56 peer to be established.
57 The routine may return a
59 which should be transferred to the peer application,
60 where the peer application will present it to
61 .Xr gss_init_sec_context 3 .
62 If no token need be sent,
63 .Fn gss_accept_sec_context
65 by setting the length field of the
68 To complete the context establishment, one or more reply tokens may be
69 required from the peer application; if so,
70 .Fn gss_accept_sec_context
71 will return a status flag of
72 .Dv GSS_S_CONTINUE_NEEDED , in which case it
73 should be called again when the reply token is received from the peer
74 application, passing the token to
75 .Fn gss_accept_sec_context
80 Portable applications should be constructed to use the token length
81 and return status to determine whether a token needs to be sent or
83 Thus a typical portable caller should always invoke
84 .Fn gss_accept_sec_context
87 gss_ctx_id_t context_hdl = GSS_C_NO_CONTEXT;
90 receive_token_from_peer(input_token);
91 maj_stat = gss_accept_sec_context(&min_stat,
102 if (GSS_ERROR(maj_stat)) {
103 report_error(maj_stat, min_stat);
105 if (output_token->length != 0) {
106 send_token_to_peer(output_token);
108 gss_release_buffer(&min_stat, output_token);
110 if (GSS_ERROR(maj_stat)) {
111 if (context_hdl != GSS_C_NO_CONTEXT)
112 gss_delete_sec_context(&min_stat,
117 } while (maj_stat & GSS_S_CONTINUE_NEEDED);
120 Whenever the routine returns a major status that includes the value
121 .Dv GSS_S_CONTINUE_NEEDED , the context is not fully established and the
122 following restrictions apply to the output parameters:
124 The value returned via the
126 parameter is undefined unless the
129 parameter contains the bit
130 .Dv GSS_C_PROT_READY_FLAG , indicating that per-message services may be
131 applied in advance of a successful completion status, the value
134 parameter may be undefined until the
135 routine returns a major status value of
139 .Dv GSS_C_DELEG_FLAG ,
140 .Dv GSS_C_MUTUAL_FLAG ,
141 .Dv GSS_C_REPLAY_FLAG ,
142 .Dv GSS_C_SEQUENCE_FLAG ,
143 .Dv GSS_C_CONF_FLAG ,
146 .Dv GSS_C_ANON_FLAG bits returned
149 parameter should contain the values that the
150 implementation expects would be valid if context establishment were
154 .Dv GSS_C_PROT_READY_FLAG
156 .Dv GSS_C_TRANS_FLAG bits
159 should indicate the actual state at the time
160 .Fn gss_accept_sec_context
161 returns, whether or not the context is fully established.
163 Although this requires that GSS-API implementations set the
164 .Dv GSS_C_PROT_READY_FLAG
168 (i.e. when accompanied by a
170 status code), applications
171 should not rely on this behavior as the flag was not defined in Version 1 of the GSS-API.
172 Instead, applications should be prepared to use per-message services after a
173 successful context establishment, according to the
176 .Dv GSS_C_CONF_FLAG values.
178 All other bits within the
180 argument should be set to zero.
181 While the routine returns
182 .Dv GSS_S_CONTINUE_NEEDED , the values returned
185 argument indicate the services that the
186 implementation expects to be available from the established context.
188 If the initial call of
189 .Fn gss_accept_sec_context
191 implementation should not create a context object, and should leave
192 the value of the context_handle parameter set to
193 .Dv GSS_C_NO_CONTEXT to
195 In the event of a failure on a subsequent call, the implementation is
196 permitted to delete the "half-built" security context (in which case it
200 .Dv GSS_C_NO_CONTEXT ), but the preferred behavior is to leave the
201 security context (and the context_handle parameter) untouched for the
202 application to delete (using
203 .Xr gss_delete_sec_context 3 ).
205 During context establishment, the informational status bits
208 .Dv GSS_S_DUPLICATE_TOKEN
209 indicate fatal errors, and
210 GSS-API mechanisms should always return them in association with a
212 .Dv GSS_S_FAILURE . This requirement for pairing did not
213 exist in version 1 of the GSS-API specification, so applications that
214 wish to run over version 1 implementations must special-case these
217 .Bl -tag -width ".It input_chan_bindings"
219 Context handle for new context.
221 .Dv GSS_C_NO_CONTEXT for first
222 call; use value returned in subsequent calls.
224 .Fn gss_accept_sec_context
226 value via this parameter, resources have been
227 assigned to the corresponding context, and must
228 be freed by the application after use with a
230 .Xr gss_delete_sec_context 3 .
231 .It acceptor_cred_handle
232 Credential handle claimed by context acceptor.
234 .Dv GSS_C_NO_CREDENTIAL to accept the context as a
237 .Dv GSS_C_NO_CREDENTIAL is
238 specified, but no default acceptor principal is
240 .Dv GSS_S_NO_CRED will be returned.
241 .It input_token_buffer
242 Token obtained from remote application.
243 .It input_chan_bindings
244 Application-specified bindings.
245 Allows application to securely bind channel identification information
246 to the security context.
247 If channel bindings are not used, specify
248 .Dv GSS_C_NO_CHANNEL_BINDINGS .
250 Authenticated name of context initiator.
251 After use, this name should be deallocated by passing it to
252 .Xr gss_release_name 3 .
253 If not required, specify
256 Security mechanism used.
257 The returned OID value will be a pointer into static storage,
258 and should be treated as read-only by the caller
259 (in particular, it does not need to be freed).
260 If not required, specify
263 Token to be passed to peer application.
264 If the length field of the returned token buffer is 0,
265 then no token need be passed to the peer application.
266 If a non-zero length field is returned,
267 the associated storage must be freed after use by the
268 application with a call to
269 .Xr gss_release_buffer 3 .
271 Contains various independent flags,
272 each of which indicates that the context supports a specific service option.
273 If not needed, specify
275 Symbolic names are provided for each flag,
276 and the symbolic names corresponding to the required flags should be
277 logically-ANDed with the
279 value to test whether a given option is supported by the context.
283 .Bl -tag -width "False"
285 Delegated credentials are available via the delegated_cred_handle parameter
287 No credentials were delegated
289 .It GSS_C_MUTUAL_FLAG
290 .Bl -tag -width "False"
292 Remote peer asked for mutual authentication
294 Remote peer did not ask for mutual authentication
296 .It GSS_C_REPLAY_FLAG
297 .Bl -tag -width "False"
299 Replay of protected messages will be detected
301 Replayed messages will not be detected
303 .It GSS_C_SEQUENCE_FLAG
304 .Bl -tag -width "False"
306 Out-of-sequence protected messages will be detected
308 Out-of-sequence messages will not be detected
311 .Bl -tag -width "False"
313 Confidentiality service may be invoked by calling the
317 No confidentiality service (via
321 will provide message encapsulation,
322 data-origin authentication and integrity services only.
325 .Bl -tag -width "False"
327 Integrity service may be invoked by calling either
333 Per-message integrity service unavailable.
336 .Bl -tag -width "False"
338 The initiator does not wish to be authenticated; the
340 parameter (if requested) contains an anonymous internal name.
342 The initiator has been authenticated normally.
344 .It GSS_C_PROT_READY_FLAG
345 .Bl -tag -width "False"
347 Protection services (as specified by the states of the
350 .Dv GSS_C_INTEG_FLAG )
351 are available if the accompanying major status return value is either
354 .Dv GSS_S_CONTINUE_NEEDED.
356 Protection services (as specified by the states of the
359 .Dv GSS_C_INTEG_FLAG )
360 are available only if the accompanying major status return value is
364 .Bl -tag -width "False"
366 The resultant security context may be transferred to other processes
368 .Xr gss_export_sec_context 3 .
370 The security context is not transferable.
374 All other bits should be set to zero.
376 Number of seconds for which the context will remain valid.
380 .It delegated_cred_handle
382 handle for credentials received from context initiator.
388 in which case an explicit credential handle
390 .Dv GSS_C_NO_CREDENTIAL )
391 will be returned; if false,
392 .Fn gss_accept_context
393 will set this parameter to
394 .Dv GSS_C_NO_CREDENTIAL .
395 If a credential handle is returned,
396 the associated resources must be released by the application after use
398 .Xr gss_release_cred 3 .
400 .Dv NULL if not required.
402 Mechanism specific status code.
405 .Bl -tag -width ".It GSS_S_DEFECTIVE_CREDENTIAL"
406 .It GSS_S_CONTINUE_NEEDED
407 Indicates that a token from the peer application is required to
408 complete the context,
409 and that gss_accept_sec_context must be called again with that token.
410 .It GSS_S_DEFECTIVE_TOKEN
411 Indicates that consistency checks performed on the input_token failed.
412 .It GSS_S_DEFECTIVE_CREDENTIAL
413 Indicates that consistency checks performed on the credential failed.
415 The supplied credentials were not valid for context acceptance,
416 or the credential handle did not reference any credentials.
417 .It GSS_S_CREDENTIALS_EXPIRED
418 The referenced credentials have expired.
419 .It GSS_S_BAD_BINDINGS
420 The input_token contains different channel bindings to those specified via the
421 input_chan_bindings parameter.
423 Indicates that the supplied context handle did not refer to a valid context.
425 The input_token contains an invalid MIC.
427 The input_token was too old.
428 This is a fatal error during context establishment.
429 .It GSS_S_DUPLICATE_TOKEN
430 The input_token is valid,
431 but is a duplicate of a token already processed.
432 This is a fatal error during context establishment.
434 The received token specified a mechanism that is not supported by
435 the implementation or the provided credential.
438 .Xr gss_delete_sec_context 3 ,
439 .Xr gss_export_sec_context 3 ,
441 .Xr gss_init_sec_context 3 ,
442 .Xr gss_release_buffer 3 ,
443 .Xr gss_release_cred 3 ,
444 .Xr gss_release_name 3 ,
447 .Bl -tag -width ".It RFC 2743"
449 Generic Security Service Application Program Interface Version 2, Update 1
451 Generic Security Service API Version 2 : C-bindings
456 function first appeared in
459 John Wray, Iris Associates
461 Copyright (C) The Internet Society (2000). All Rights Reserved.
463 This document and translations of it may be copied and furnished to
464 others, and derivative works that comment on or otherwise explain it
465 or assist in its implementation may be prepared, copied, published
466 and distributed, in whole or in part, without restriction of any
467 kind, provided that the above copyright notice and this paragraph are
468 included on all such copies and derivative works. However, this
469 document itself may not be modified in any way, such as by removing
470 the copyright notice or references to the Internet Society or other
471 Internet organizations, except as needed for the purpose of
472 developing Internet standards in which case the procedures for
473 copyrights defined in the Internet Standards process must be
474 followed, or as required to translate it into languages other than
477 The limited permissions granted above are perpetual and will not be
478 revoked by the Internet Society or its successors or assigns.
480 This document and the information contained herein is provided on an
481 "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
482 TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
483 BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
484 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
485 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.