1238730Sdelphij/*
2293190Sdelphij * Copyright (c) 2004 Kungliga Tekniska H�gskolan
3238730Sdelphij * (Royal Institute of Technology, Stockholm, Sweden).
4238730Sdelphij * All rights reserved.
5238730Sdelphij *
6238730Sdelphij * Redistribution and use in source and binary forms, with or without
7238730Sdelphij * modification, are permitted provided that the following conditions
8238730Sdelphij * are met:
960786Sps *
1060786Sps * 1. Redistributions of source code must retain the above copyright
1160786Sps *    notice, this list of conditions and the following disclaimer.
1260786Sps *
1360786Sps * 2. Redistributions in binary form must reproduce the above copyright
1460786Sps *    notice, this list of conditions and the following disclaimer in the
1560786Sps *    documentation and/or other materials provided with the distribution.
1660786Sps *
1760786Sps * 3. Neither the name of the Institute nor the names of its contributors
1860786Sps *    may be used to endorse or promote products derived from this software
1960786Sps *    without specific prior written permission.
2060786Sps *
2160786Sps * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
2260786Sps * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2360786Sps * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2460786Sps * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
2560786Sps * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2660786Sps * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2760786Sps * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2860786Sps * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2960786Sps * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3060786Sps * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31170259Sdelphij * SUCH DAMAGE.
3260786Sps */
3360786Sps
3460786Sps#include "krb5/gsskrb5_locl.h"
3560786Sps
3660786SpsRCSID("$Id: ticket_flags.c 18334 2006-10-07 22:16:04Z lha $");
3760786Sps
3860786SpsOM_uint32
3960786Sps_gsskrb5_get_tkt_flags(OM_uint32 *minor_status,
4060786Sps		       gsskrb5_ctx ctx,
4160786Sps		       OM_uint32 *tkt_flags)
4260786Sps{
4389022Sps    if (ctx == NULL) {
4460786Sps	*minor_status = EINVAL;
4589022Sps	return GSS_S_NO_CONTEXT;
4660786Sps    }
4789022Sps    HEIMDAL_MUTEX_lock(&ctx->ctx_id_mutex);
4860786Sps
4989022Sps    if (ctx->ticket == NULL) {
5060786Sps	HEIMDAL_MUTEX_unlock(&ctx->ctx_id_mutex);
5160786Sps	*minor_status = EINVAL;
5289022Sps	return GSS_S_BAD_MECH;
5389022Sps    }
54170259Sdelphij
55170259Sdelphij    *tkt_flags = TicketFlags2int(ctx->ticket->ticket.flags);
5660786Sps    HEIMDAL_MUTEX_unlock(&ctx->ctx_id_mutex);
5760786Sps
5860786Sps    *minor_status = 0;
5960786Sps    return GSS_S_COMPLETE;
6089022Sps}
6160786Sps