process_context_token.c revision 303975
1103739Stjr/*
2103739Stjr * Copyright (c) 2003 Kungliga Tekniska H��gskolan
3103739Stjr * (Royal Institute of Technology, Stockholm, Sweden).
4103739Stjr * All rights reserved.
5103739Stjr *
6103739Stjr * Redistribution and use in source and binary forms, with or without
7103739Stjr * modification, are permitted provided that the following conditions
8103739Stjr * are met:
9103739Stjr *
10103739Stjr * 1. Redistributions of source code must retain the above copyright
11103739Stjr *    notice, this list of conditions and the following disclaimer.
12103739Stjr *
13103739Stjr * 2. Redistributions in binary form must reproduce the above copyright
14103739Stjr *    notice, this list of conditions and the following disclaimer in the
15103739Stjr *    documentation and/or other materials provided with the distribution.
16103739Stjr *
17103739Stjr * 3. Neither the name of the Institute nor the names of its contributors
18103739Stjr *    may be used to endorse or promote products derived from this software
19103739Stjr *    without specific prior written permission.
20103739Stjr *
21103739Stjr * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22103739Stjr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23103739Stjr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24103739Stjr * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25103739Stjr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26103739Stjr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27103739Stjr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28103739Stjr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29103739Stjr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30103739Stjr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31103739Stjr * SUCH DAMAGE.
32103739Stjr */
33103739Stjr
34103739Stjr#include "gsskrb5_locl.h"
35103739Stjr
36103739StjrOM_uint32 GSSAPI_CALLCONV _gsskrb5_process_context_token (
37103739Stjr	OM_uint32          *minor_status,
38103739Stjr	const gss_ctx_id_t context_handle,
39103739Stjr	const gss_buffer_t token_buffer
40103739Stjr    )
41103739Stjr{
42103739Stjr    krb5_context context;
43103739Stjr    OM_uint32 ret = GSS_S_FAILURE;
44103739Stjr    gss_buffer_desc empty_buffer;
45103739Stjr
46    empty_buffer.length = 0;
47    empty_buffer.value = NULL;
48
49    GSSAPI_KRB5_INIT (&context);
50
51    ret = _gsskrb5_verify_mic_internal(minor_status,
52				       (gsskrb5_ctx)context_handle,
53				       context,
54				       token_buffer, &empty_buffer,
55				       GSS_C_QOP_DEFAULT,
56				       "\x01\x02");
57
58    if (ret == GSS_S_COMPLETE)
59	ret = _gsskrb5_delete_sec_context(minor_status,
60					  rk_UNCONST(&context_handle),
61					  GSS_C_NO_BUFFER);
62    if (ret == GSS_S_COMPLETE)
63	*minor_status = 0;
64
65    return ret;
66}
67