1178825Sdfr/* 2233294Sstas * Copyright (c) 1997 - 2008 Kungliga Tekniska H��gskolan 3233294Sstas * (Royal Institute of Technology, Stockholm, Sweden). 4233294Sstas * All rights reserved. 5178825Sdfr * 6233294Sstas * Redistribution and use in source and binary forms, with or without 7233294Sstas * modification, are permitted provided that the following conditions 8233294Sstas * are met: 9178825Sdfr * 10233294Sstas * 1. Redistributions of source code must retain the above copyright 11233294Sstas * notice, this list of conditions and the following disclaimer. 12178825Sdfr * 13233294Sstas * 2. Redistributions in binary form must reproduce the above copyright 14233294Sstas * notice, this list of conditions and the following disclaimer in the 15233294Sstas * documentation and/or other materials provided with the distribution. 16178825Sdfr * 17233294Sstas * 3. Neither the name of the Institute nor the names of its contributors 18233294Sstas * may be used to endorse or promote products derived from this software 19233294Sstas * without specific prior written permission. 20178825Sdfr * 21233294Sstas * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22233294Sstas * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23233294Sstas * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24233294Sstas * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25233294Sstas * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26233294Sstas * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27233294Sstas * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28233294Sstas * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29233294Sstas * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30233294Sstas * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31233294Sstas * SUCH DAMAGE. 32178825Sdfr */ 33178825Sdfr 34233294Sstas/* $Id$ */ 35178825Sdfr 36178825Sdfr#ifndef GSSKRB5_LOCL_H 37178825Sdfr#define GSSKRB5_LOCL_H 38178825Sdfr 39178825Sdfr#include <config.h> 40178825Sdfr 41178825Sdfr#include <krb5_locl.h> 42178825Sdfr#include <gkrb5_err.h> 43178825Sdfr#include <gssapi.h> 44178825Sdfr#include <gssapi_mech.h> 45233294Sstas#include <gssapi_krb5.h> 46178825Sdfr#include <assert.h> 47178825Sdfr 48178825Sdfr#include "cfx.h" 49178825Sdfr 50178825Sdfr/* 51178825Sdfr * 52178825Sdfr */ 53178825Sdfr 54178825Sdfrstruct gss_msg_order; 55178825Sdfr 56233294Sstastypedef struct gsskrb5_ctx { 57178825Sdfr struct krb5_auth_context_data *auth_context; 58233294Sstas struct krb5_auth_context_data *deleg_auth_context; 59178825Sdfr krb5_principal source, target; 60178825Sdfr#define IS_DCE_STYLE(ctx) (((ctx)->flags & GSS_C_DCE_STYLE) != 0) 61178825Sdfr OM_uint32 flags; 62233294Sstas enum { LOCAL = 1, OPEN = 2, 63178825Sdfr COMPAT_OLD_DES3 = 4, 64178825Sdfr COMPAT_OLD_DES3_SELECTED = 8, 65233294Sstas ACCEPTOR_SUBKEY = 16, 66233294Sstas RETRIED = 32, 67233294Sstas CLOSE_CCACHE = 64, 68233294Sstas IS_CFX = 128 69178825Sdfr } more_flags; 70178825Sdfr enum gss_ctx_id_t_state { 71178825Sdfr /* initiator states */ 72178825Sdfr INITIATOR_START, 73233294Sstas INITIATOR_RESTART, 74178825Sdfr INITIATOR_WAIT_FOR_MUTAL, 75178825Sdfr INITIATOR_READY, 76178825Sdfr /* acceptor states */ 77178825Sdfr ACCEPTOR_START, 78178825Sdfr ACCEPTOR_WAIT_FOR_DCESTYLE, 79178825Sdfr ACCEPTOR_READY 80178825Sdfr } state; 81233294Sstas krb5_creds *kcred; 82233294Sstas krb5_ccache ccache; 83178825Sdfr struct krb5_ticket *ticket; 84178825Sdfr OM_uint32 lifetime; 85178825Sdfr HEIMDAL_MUTEX ctx_id_mutex; 86178825Sdfr struct gss_msg_order *order; 87178825Sdfr krb5_keyblock *service_keyblock; 88178825Sdfr krb5_data fwd_data; 89233294Sstas krb5_crypto crypto; 90178825Sdfr} *gsskrb5_ctx; 91178825Sdfr 92178825Sdfrtypedef struct { 93178825Sdfr krb5_principal principal; 94178825Sdfr int cred_flags; 95178825Sdfr#define GSS_CF_DESTROY_CRED_ON_RELEASE 1 96233294Sstas#define GSS_CF_NO_CI_FLAGS 2 97178825Sdfr struct krb5_keytab_data *keytab; 98178825Sdfr OM_uint32 lifetime; 99178825Sdfr gss_cred_usage_t usage; 100178825Sdfr gss_OID_set mechanisms; 101178825Sdfr struct krb5_ccache_data *ccache; 102178825Sdfr HEIMDAL_MUTEX cred_id_mutex; 103178825Sdfr krb5_enctype *enctypes; 104178825Sdfr} *gsskrb5_cred; 105178825Sdfr 106178825Sdfrtypedef struct Principal *gsskrb5_name; 107178825Sdfr 108178825Sdfr/* 109178825Sdfr * 110178825Sdfr */ 111178825Sdfr 112178825Sdfrextern krb5_keytab _gsskrb5_keytab; 113178825Sdfrextern HEIMDAL_MUTEX gssapi_keytab_mutex; 114178825Sdfr 115178825Sdfr/* 116178825Sdfr * Prototypes 117178825Sdfr */ 118178825Sdfr 119233294Sstas#include <gsskrb5-private.h> 120178825Sdfr 121178825Sdfr#define GSSAPI_KRB5_INIT(ctx) do { \ 122178825Sdfr krb5_error_code kret_gss_init; \ 123178825Sdfr if((kret_gss_init = _gsskrb5_init (ctx)) != 0) { \ 124178825Sdfr *minor_status = kret_gss_init; \ 125178825Sdfr return GSS_S_FAILURE; \ 126178825Sdfr } \ 127178825Sdfr} while (0) 128178825Sdfr 129178825Sdfr/* sec_context flags */ 130178825Sdfr 131178825Sdfr#define SC_LOCAL_ADDRESS 0x01 132178825Sdfr#define SC_REMOTE_ADDRESS 0x02 133178825Sdfr#define SC_KEYBLOCK 0x04 134178825Sdfr#define SC_LOCAL_SUBKEY 0x08 135178825Sdfr#define SC_REMOTE_SUBKEY 0x10 136178825Sdfr 137233294Sstas/* type to signal that that dns canon maybe should be done */ 138233294Sstas#define MAGIC_HOSTBASED_NAME_TYPE 4711 139233294Sstas 140178825Sdfr#endif 141