1178825Sdfr/* 2178825Sdfr * Copyright (c) 2004, PADL Software Pty Ltd. 3178825Sdfr * All rights reserved. 4178825Sdfr * 5178825Sdfr * Redistribution and use in source and binary forms, with or without 6178825Sdfr * modification, are permitted provided that the following conditions 7178825Sdfr * are met: 8178825Sdfr * 9178825Sdfr * 1. Redistributions of source code must retain the above copyright 10178825Sdfr * notice, this list of conditions and the following disclaimer. 11178825Sdfr * 12178825Sdfr * 2. Redistributions in binary form must reproduce the above copyright 13178825Sdfr * notice, this list of conditions and the following disclaimer in the 14178825Sdfr * documentation and/or other materials provided with the distribution. 15178825Sdfr * 16178825Sdfr * 3. Neither the name of PADL Software nor the names of its contributors 17178825Sdfr * may be used to endorse or promote products derived from this software 18178825Sdfr * without specific prior written permission. 19178825Sdfr * 20178825Sdfr * THIS SOFTWARE IS PROVIDED BY PADL SOFTWARE AND CONTRIBUTORS ``AS IS'' AND 21178825Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22178825Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23178825Sdfr * ARE DISCLAIMED. IN NO EVENT SHALL PADL SOFTWARE OR CONTRIBUTORS BE LIABLE 24178825Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25178825Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26178825Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27178825Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28178825Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29178825Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30178825Sdfr * SUCH DAMAGE. 31178825Sdfr */ 32178825Sdfr 33233294Sstas/* $Id$ */ 34178825Sdfr 35178825Sdfr#ifndef SPNEGO_LOCL_H 36178825Sdfr#define SPNEGO_LOCL_H 37178825Sdfr 38178825Sdfr#include <config.h> 39178825Sdfr 40178825Sdfr#ifdef HAVE_SYS_TYPES_H 41178825Sdfr#include <sys/types.h> 42178825Sdfr#endif 43178825Sdfr#ifdef HAVE_SYS_PARAM_H 44178825Sdfr#include <sys/param.h> 45178825Sdfr#endif 46178825Sdfr 47233294Sstas#include <roken.h> 48233294Sstas 49178825Sdfr#ifdef HAVE_PTHREAD_H 50178825Sdfr#include <pthread.h> 51178825Sdfr#endif 52178825Sdfr 53178825Sdfr#include <gssapi.h> 54233294Sstas#include <gssapi_krb5.h> 55233294Sstas#include <gssapi_spnego.h> 56178825Sdfr#include <assert.h> 57178825Sdfr#include <stdlib.h> 58178825Sdfr#include <string.h> 59178825Sdfr#include <errno.h> 60178825Sdfr#include <ctype.h> 61178825Sdfr#ifdef HAVE_NETDB_H 62178825Sdfr#include <netdb.h> 63178825Sdfr#endif 64178825Sdfr 65178825Sdfr#include <heim_threads.h> 66178825Sdfr#include <asn1_err.h> 67178825Sdfr 68178825Sdfr#include <gssapi_mech.h> 69178825Sdfr 70178825Sdfr#include "spnego_asn1.h" 71233294Sstas#include "utils.h" 72178825Sdfr#include <der.h> 73178825Sdfr 74233294Sstas#include <heimbase.h> 75178825Sdfr 76178825Sdfr#define ALLOC(X, N) (X) = calloc((N), sizeof(*(X))) 77178825Sdfr 78178825Sdfrtypedef struct { 79178825Sdfr MechTypeList initiator_mech_types; 80178825Sdfr gss_OID preferred_mech_type; 81178825Sdfr gss_OID negotiated_mech_type; 82178825Sdfr gss_ctx_id_t negotiated_ctx_id; 83178825Sdfr OM_uint32 mech_flags; 84178825Sdfr OM_uint32 mech_time_rec; 85178825Sdfr gss_name_t mech_src_name; 86178825Sdfr unsigned int open : 1; 87178825Sdfr unsigned int local : 1; 88178825Sdfr unsigned int require_mic : 1; 89178825Sdfr unsigned int verified_mic : 1; 90178825Sdfr unsigned int maybe_open : 1; 91178825Sdfr HEIMDAL_MUTEX ctx_id_mutex; 92178825Sdfr 93178825Sdfr gss_name_t target_name; 94178825Sdfr 95178825Sdfr u_char oidbuf[17]; 96178825Sdfr size_t oidlen; 97178825Sdfr 98178825Sdfr} *gssspnego_ctx; 99178825Sdfr 100178825Sdfrtypedef struct { 101178825Sdfr gss_OID_desc type; 102178825Sdfr gss_buffer_desc value; 103178825Sdfr gss_name_t mech; 104178825Sdfr} *spnego_name; 105178825Sdfr 106178825Sdfrextern gss_OID_desc _gss_spnego_mskrb_mechanism_oid_desc; 107178825Sdfrextern gss_OID_desc _gss_spnego_krb5_mechanism_oid_desc; 108178825Sdfr 109233294Sstas#include <spnego-private.h> 110178825Sdfr 111178825Sdfr#endif /* SPNEGO_LOCL_H */ 112