1120945Snectar/* 2233294Sstas * Copyright (c) 1997 - 2003 Kungliga Tekniska H��gskolan 3233294Sstas * (Royal Institute of Technology, Stockholm, Sweden). 4233294Sstas * All rights reserved. 5120945Snectar * 6233294Sstas * Redistribution and use in source and binary forms, with or without 7233294Sstas * modification, are permitted provided that the following conditions 8233294Sstas * are met: 9120945Snectar * 10233294Sstas * 1. Redistributions of source code must retain the above copyright 11233294Sstas * notice, this list of conditions and the following disclaimer. 12120945Snectar * 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. 16120945Snectar * 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. 20120945Snectar * 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. 32120945Snectar */ 33120945Snectar 34233294Sstas/* $Id$ */ 35120945Snectar 36120945Snectar#ifndef __KRB5_V4COMPAT_H__ 37120945Snectar#define __KRB5_V4COMPAT_H__ 38120945Snectar 39178825Sdfr#include "krb_err.h" 40178825Sdfr 41233294Sstas/* 42120945Snectar * This file must only be included with v4 compat glue stuff in 43120945Snectar * heimdal sources. 44120945Snectar * 45120945Snectar * It MUST NOT be installed. 46120945Snectar */ 47120945Snectar 48178825Sdfr#define KRB_PROT_VERSION 4 49178825Sdfr 50178825Sdfr#define AUTH_MSG_KDC_REQUEST (1<<1) 51178825Sdfr#define AUTH_MSG_KDC_REPLY (2<<1) 52178825Sdfr#define AUTH_MSG_APPL_REQUEST (3<<1) 53178825Sdfr#define AUTH_MSG_APPL_REQUEST_MUTUAL (4<<1) 54178825Sdfr#define AUTH_MSG_ERR_REPLY (5<<1) 55178825Sdfr#define AUTH_MSG_PRIVATE (6<<1) 56178825Sdfr#define AUTH_MSG_SAFE (7<<1) 57178825Sdfr#define AUTH_MSG_APPL_ERR (8<<1) 58178825Sdfr#define AUTH_MSG_KDC_FORWARD (9<<1) 59178825Sdfr#define AUTH_MSG_KDC_RENEW (10<<1) 60178825Sdfr#define AUTH_MSG_DIE (63<<1) 61178825Sdfr 62178825Sdfr/* General definitions */ 63178825Sdfr#define KSUCCESS 0 64178825Sdfr#define KFAILURE 255 65178825Sdfr 66178825Sdfr/* */ 67178825Sdfr 68120945Snectar#define MAX_KTXT_LEN 1250 69120945Snectar 70120945Snectar#define ANAME_SZ 40 71120945Snectar#define REALM_SZ 40 72120945Snectar#define SNAME_SZ 40 73120945Snectar#define INST_SZ 40 74120945Snectar 75120945Snectarstruct ktext { 76120945Snectar unsigned int length; /* Length of the text */ 77120945Snectar unsigned char dat[MAX_KTXT_LEN]; /* The data itself */ 78178825Sdfr uint32_t mbz; /* zero to catch runaway strings */ 79120945Snectar}; 80120945Snectar 81120945Snectarstruct credentials { 82120945Snectar char service[ANAME_SZ]; /* Service name */ 83120945Snectar char instance[INST_SZ]; /* Instance */ 84120945Snectar char realm[REALM_SZ]; /* Auth domain */ 85178825Sdfr char session[8]; /* Session key */ 86120945Snectar int lifetime; /* Lifetime */ 87120945Snectar int kvno; /* Key version number */ 88120945Snectar struct ktext ticket_st; /* The ticket itself */ 89120945Snectar int32_t issue_date; /* The issue time */ 90120945Snectar char pname[ANAME_SZ]; /* Principal's name */ 91120945Snectar char pinst[INST_SZ]; /* Principal's instance */ 92120945Snectar}; 93120945Snectar 94120945Snectar#define TKTLIFENUMFIXED 64 95120945Snectar#define TKTLIFEMINFIXED 0x80 96120945Snectar#define TKTLIFEMAXFIXED 0xBF 97120945Snectar#define TKTLIFENOEXPIRE 0xFF 98120945Snectar#define MAXTKTLIFETIME (30*24*3600) /* 30 days */ 99120945Snectar#ifndef NEVERDATE 100120945Snectar#define NEVERDATE ((time_t)0x7fffffffL) 101120945Snectar#endif 102120945Snectar 103120945Snectar#define KERB_ERR_NULL_KEY 10 104120945Snectar 105178825Sdfr#define CLOCK_SKEW 5*60 106120945Snectar 107178825Sdfr#ifndef TKT_ROOT 108233294Sstas#ifdef KRB5_USE_PATH_TOKENS 109233294Sstas#define TKT_ROOT "%{TEMP}/tkt" 110233294Sstas#else 111178825Sdfr#define TKT_ROOT "/tmp/tkt" 112178825Sdfr#endif 113233294Sstas#endif 114120945Snectar 115178825Sdfrstruct _krb5_krb_auth_data { 116178825Sdfr int8_t k_flags; /* Flags from ticket */ 117178825Sdfr char *pname; /* Principal's name */ 118178825Sdfr char *pinst; /* His Instance */ 119178825Sdfr char *prealm; /* His Realm */ 120178825Sdfr uint32_t checksum; /* Data checksum (opt) */ 121178825Sdfr krb5_keyblock session; /* Session Key */ 122178825Sdfr unsigned char life; /* Life of ticket */ 123178825Sdfr uint32_t time_sec; /* Time ticket issued */ 124178825Sdfr uint32_t address; /* Address in ticket */ 125178825Sdfr}; 126178825Sdfr 127233294SstasKRB5_LIB_FUNCTION time_t KRB5_LIB_CALL 128233294Sstas_krb5_krb_life_to_time (int, int); 129178825Sdfr 130233294SstasKRB5_LIB_FUNCTION int KRB5_LIB_CALL 131233294Sstas_krb5_krb_time_to_life (time_t, time_t); 132233294Sstas 133233294SstasKRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL 134233294Sstas_krb5_krb_tf_setup (krb5_context, struct credentials *, 135233294Sstas const char *, int); 136233294Sstas 137233294SstasKRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL 138233294Sstas_krb5_krb_dest_tkt(krb5_context, const char *); 139233294Sstas 140120945Snectar#define krb_time_to_life _krb5_krb_time_to_life 141120945Snectar#define krb_life_to_time _krb5_krb_life_to_time 142120945Snectar 143120945Snectar#endif /* __KRB5_V4COMPAT_H__ */ 144