g_init_sec_context.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* glue routine for gss_init_sec_context
*/
#include <mechglueP.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
const gss_name_t target_name;
const gss_OID req_mech_type;
const gss_buffer_t input_token;
{
if (minor_status == NULL)
return (GSS_S_CALL_INACCESSIBLE_WRITE);
*minor_status = 0;
/* clear output values */
if (actual_mech_type)
*actual_mech_type = NULL;
if (context_handle == NULL)
return (GSS_S_CALL_INACCESSIBLE_WRITE | GSS_S_NO_CONTEXT);
if (target_name == NULL)
return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_BAD_NAME);
if (output_token == NULL)
return (GSS_S_CALL_INACCESSIBLE_WRITE);
output_token->length = 0;
if (req_mech_type)
/*
* obtain the gss mechanism information for the requested
* mechanism. If mech_type is NULL, set it to the resultant
* mechanism
*/
return (GSS_S_BAD_MECH);
return (GSS_S_UNAVAILABLE);
if (mech_type == GSS_C_NULL_OID)
/*
* If target_name is mechanism_specific, then it must match the
* mech_type that we're about to use. Otherwise, do an import on
* the external_name form of the target name.
*/
if (union_name->mech_type &&
} else {
&internal_name)) != 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) {
malloc(sizeof (gss_union_ctx_id_desc));
if (union_ctx_id == NULL)
goto end;
goto end;
}
/* copy the supplied context handle */
} 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 call the approprate underlying mechanism routine
*/
time_rec);
/*
* the spec says (the preferred) method is to delete all
* context info on the first call to init, and on all
* subsequent calls make the caller responsible for
* calling gss_delete_sec_context
*/
if (*context_handle == GSS_C_NO_CONTEXT) {
}
} else if (*context_handle == GSS_C_NO_CONTEXT)
end:
}
return (status);
}