e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh * CDDL HEADER START
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh * The contents of this file are subject to the terms of the
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh * Common Development and Distribution License (the "License").
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh * You may not use this file except in compliance with the License.
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh * or http://www.opensolaris.org/os/licensing.
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh * See the License for the specific language governing permissions
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh * and limitations under the License.
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh * When distributing Covered Code, include this CDDL HEADER in each
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh * If applicable, add the following below this CDDL HEADER, with the
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh * fields enclosed by brackets "[]" replaced with your own identifying
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh * information: Portions Copyright [yyyy] [name of copyright owner]
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh * CDDL HEADER END
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh * glue routine for gss_export_sec_context
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh /* Initialize outputs. */
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh /* Validate arguments. */
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh if (context_handle == NULL || *context_handle == GSS_C_NO_CONTEXT)
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT);
cad45ba11ec3572296361f53f5852ffb97a97fa3Lennart Poettering if (interprocess_token == GSS_C_NO_BUFFER)
cad45ba11ec3572296361f53f5852ffb97a97fa3Lennart Poettering * select the approprate underlying mechanism routine and
cad45ba11ec3572296361f53f5852ffb97a97fa3Lennart Poettering ctx = (gss_union_ctx_id_t)*context_handle;
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh status = mech->gss_export_sec_context(minor_status,
cad45ba11ec3572296361f53f5852ffb97a97fa3Lennart Poettering length = token.length + 4 + ctx->mech_type->length;
c3090674833c8bd34fbdb0e743f1c47d85dd14fbLennart Poettering interprocess_token->value = malloc(length);
c3090674833c8bd34fbdb0e743f1c47d85dd14fbLennart Poettering (void) gss_release_buffer(minor_status, &token);
c3090674833c8bd34fbdb0e743f1c47d85dd14fbLennart Poettering buf[2] = (unsigned char) (length & 0xFF);
c3090674833c8bd34fbdb0e743f1c47d85dd14fbLennart Poettering buf[0] = (unsigned char) (length & 0xFF);
c3090674833c8bd34fbdb0e743f1c47d85dd14fbLennart Poettering (void) memcpy(buf+4, ctx->mech_type->elements,
c3090674833c8bd34fbdb0e743f1c47d85dd14fbLennart Poettering (void) memcpy(buf+4+ctx->mech_type->length, token.value, token.length);
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh (void) gss_release_buffer(minor_status, &token);
cad45ba11ec3572296361f53f5852ffb97a97fa3Lennart Poettering#endif /* LEAN_CLIENT */