g_accept_sec_context.c revision a6d402a05cacff19c90312f907f076a1cf67870e
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* glue routine for gss_accept_sec_context
*/
#include <mechglueP.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <string.h>
#include <errno.h>
const gss_buffer_t input_token_buffer;
{
/* check parameters first */
if (minor_status == NULL)
return (GSS_S_CALL_INACCESSIBLE_WRITE);
*minor_status = 0;
return (GSS_S_CALL_INACCESSIBLE_WRITE);
/* clear optional fields */
output_token->length = 0;
if (src_name)
if (mech_type)
if (d_cred)
/*
* 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) {
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)
return (GSS_S_CONTINUE_NEEDED);
/* if the call failed, return with failure */
if (status != GSS_S_COMPLETE)
goto error_out;
*mech_type = actual_mech;
/*
* 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(
if (internal_name != GSS_C_NO_NAME)
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 (actual_mech != 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 (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 (output_token->length)
if (src_name)
if (tmp_src_name != GSS_C_NO_NAME)
(void) gss_release_buffer(&t_minstat,
return (status);
}