/*
* CDDL HEADER START
*
* 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.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* 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]
*
* CDDL HEADER END
*/
/*
*/
/*
* glue routine for gss_accept_sec_context
*/
#include <mglueP.h>
#include "gssapiP_generic.h"
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <string.h>
#include <errno.h>
#include <syslog.h>
#ifndef LEAN_CLIENT
static OM_uint32
{
/* Initialize outputs. */
if (minor_status != NULL)
*minor_status = 0;
if (output_token != GSS_C_NO_BUFFER) {
output_token->length = 0;
}
/* Validate arguments. */
if (minor_status == NULL)
return (GSS_S_CALL_INACCESSIBLE_WRITE);
if (context_handle == NULL)
return (GSS_S_CALL_INACCESSIBLE_WRITE);
if (input_token_buffer == GSS_C_NO_BUFFER)
return (GSS_S_CALL_INACCESSIBLE_READ);
if (output_token == GSS_C_NO_BUFFER)
return (GSS_S_CALL_INACCESSIBLE_WRITE);
return (GSS_S_COMPLETE);
}
const gss_buffer_t input_token_buffer;
{
d_cred);
if (status != GSS_S_COMPLETE)
return (status);
/*
* if context_handle is GSS_C_NO_CONTEXT, allocate a union context
* descriptor to hold the mech type information as well as the
* underlying mechanism context handle. Otherwise, cast the
* value of *context_handle to the union context variable.
*/
if (*context_handle == GSS_C_NO_CONTEXT) {
if (input_token_buffer == GSS_C_NO_BUFFER)
return (GSS_S_CALL_INACCESSIBLE_READ);
/* Get the token mech type */
if (status)
return (status);
malloc(sizeof (gss_union_ctx_id_desc));
if (!union_ctx_id)
return (GSS_S_FAILURE);
if (status != GSS_S_COMPLETE) {
return (status);
}
/* set the new context handle to caller's data */
} else {
}
/*
* get the appropriate cred handle from the union cred struct.
* defaults to GSS_C_NO_CREDENTIAL if there is no cred, which will
* use the default credential.
*/
/*
* now select the approprate underlying mechanism routine and
* call it.
*/
&flags,
/* If there's more work to do, keep going... */
if (status == GSS_S_CONTINUE_NEEDED) {
/*
* Solaris Kerberos:
* For various minor errors that initiate a recovery
* attempt by Windows clients. Attempt to use mech_type
* as the requested and actual mech used could differ.
*/
else
return (GSS_S_CONTINUE_NEEDED);
}
/* if the call failed, return with failure */
if (status != GSS_S_COMPLETE) {
else {
}
goto error_out;
}
/*
* if src_name is non-NULL,
* convert internal_name into a union name equivalent
* First call the mechanism specific display_name()
* then call gss_import_name() to create
* the union name struct cast to src_name
*/
if (internal_name != NULL) {
if (temp_status != GSS_S_COMPLETE) {
if (output_token->length)
(void) gss_release_buffer(
return (temp_status);
}
*src_name = tmp_src_name;
}
}
/* Ensure we're returning correct creds format */
if ((flags & GSS_C_DELEG_FLAG) &&
/*
* If we got back an OID different from the original
* token OID, assume the delegated_cred is already
* a proper union_cred and just return it. Don't
* try to re-wrap it. This is for SPNEGO or other
* pseudo-mechanisms.
*/
if (*mech_type != GSS_C_NO_OID &&
token_mech_type != GSS_C_NO_OID &&
*d_cred = tmp_d_cred;
} else {
goto error_out;
}
sizeof (gss_union_cred_desc));
&d_u_cred->mechs_array);
if (status != GSS_S_COMPLETE) {
goto error_out;
}
sizeof (gss_cred_id_t));
} else {
goto error_out;
}
if (status != GSS_S_COMPLETE) {
goto error_out;
}
if (mech->gss_inquire_cred) {
NULL);
}
if (status != GSS_S_COMPLETE)
if (internal_name != NULL) {
if (temp_status != GSS_S_COMPLETE) {
if (output_token->length)
(void) gss_release_buffer(
return (temp_status);
}
}
if (tmp_src_name != NULL) {
}
}
}
}
(void) gss_release_name(&t_minstat,
&tmp_src_name);
return (status);
} else {
}
if (union_ctx_id) {
if (union_ctx_id->mech_type) {
}
}
#if 0
/*
* Solaris Kerberos
* Don't release, it causes a problem with error token.
*/
if (output_token->length)
#endif
if (src_name)
if (tmp_src_name != GSS_C_NO_NAME)
(void) gss_release_buffer(&t_minstat,
return (status);
}
#endif /* LEAN_CLIENT */