1/* $NetBSD: krb5-v4compat.h,v 1.2 2017/01/28 21:31:49 christos Exp $ */ 2 3/* 4 * Copyright (c) 1997 - 2003 Kungliga Tekniska H��gskolan 5 * (Royal Institute of Technology, Stockholm, Sweden). 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 19 * 3. Neither the name of the Institute nor the names of its contributors 20 * may be used to endorse or promote products derived from this software 21 * without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 */ 35 36/* Id */ 37 38#ifndef __KRB5_V4COMPAT_H__ 39#define __KRB5_V4COMPAT_H__ 40 41#include <krb5/krb_err.h> 42 43/* 44 * This file must only be included with v4 compat glue stuff in 45 * heimdal sources. 46 * 47 * It MUST NOT be installed. 48 */ 49 50#define KRB_PROT_VERSION 4 51 52#define AUTH_MSG_KDC_REQUEST (1<<1) 53#define AUTH_MSG_KDC_REPLY (2<<1) 54#define AUTH_MSG_APPL_REQUEST (3<<1) 55#define AUTH_MSG_APPL_REQUEST_MUTUAL (4<<1) 56#define AUTH_MSG_ERR_REPLY (5<<1) 57#define AUTH_MSG_PRIVATE (6<<1) 58#define AUTH_MSG_SAFE (7<<1) 59#define AUTH_MSG_APPL_ERR (8<<1) 60#define AUTH_MSG_KDC_FORWARD (9<<1) 61#define AUTH_MSG_KDC_RENEW (10<<1) 62#define AUTH_MSG_DIE (63<<1) 63 64/* General definitions */ 65#define KSUCCESS 0 66#define KFAILURE 255 67 68/* */ 69 70#define MAX_KTXT_LEN 1250 71 72#define ANAME_SZ 40 73#define REALM_SZ 40 74#define SNAME_SZ 40 75#define INST_SZ 40 76 77struct ktext { 78 unsigned int length; /* Length of the text */ 79 unsigned char dat[MAX_KTXT_LEN]; /* The data itself */ 80 uint32_t mbz; /* zero to catch runaway strings */ 81}; 82 83struct credentials { 84 char service[ANAME_SZ]; /* Service name */ 85 char instance[INST_SZ]; /* Instance */ 86 char realm[REALM_SZ]; /* Auth domain */ 87 char session[8]; /* Session key */ 88 int lifetime; /* Lifetime */ 89 int kvno; /* Key version number */ 90 struct ktext ticket_st; /* The ticket itself */ 91 int32_t issue_date; /* The issue time */ 92 char pname[ANAME_SZ]; /* Principal's name */ 93 char pinst[INST_SZ]; /* Principal's instance */ 94}; 95 96#define TKTLIFENUMFIXED 64 97#define TKTLIFEMINFIXED 0x80 98#define TKTLIFEMAXFIXED 0xBF 99#define TKTLIFENOEXPIRE 0xFF 100#define MAXTKTLIFETIME (30*24*3600) /* 30 days */ 101#ifndef NEVERDATE 102#define NEVERDATE ((time_t)0x7fffffffL) 103#endif 104 105#define KERB_ERR_NULL_KEY 10 106 107#define CLOCK_SKEW 5*60 108 109#ifndef TKT_ROOT 110#ifdef KRB5_USE_PATH_TOKENS 111#define TKT_ROOT "%{TEMP}/tkt" 112#else 113#define TKT_ROOT "/tmp/tkt" 114#endif 115#endif 116 117struct _krb5_krb_auth_data { 118 int8_t k_flags; /* Flags from ticket */ 119 char *pname; /* Principal's name */ 120 char *pinst; /* His Instance */ 121 char *prealm; /* His Realm */ 122 uint32_t checksum; /* Data checksum (opt) */ 123 krb5_keyblock session; /* Session Key */ 124 unsigned char life; /* Life of ticket */ 125 uint32_t time_sec; /* Time ticket issued */ 126 uint32_t address; /* Address in ticket */ 127}; 128 129KRB5_LIB_FUNCTION time_t KRB5_LIB_CALL 130_krb5_krb_life_to_time (int, int); 131 132KRB5_LIB_FUNCTION int KRB5_LIB_CALL 133_krb5_krb_time_to_life (time_t, time_t); 134 135KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL 136_krb5_krb_tf_setup (krb5_context, struct credentials *, 137 const char *, int); 138 139KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL 140_krb5_krb_dest_tkt(krb5_context, const char *); 141 142#define krb_time_to_life _krb5_krb_time_to_life 143#define krb_life_to_time _krb5_krb_life_to_time 144 145#endif /* __KRB5_V4COMPAT_H__ */ 146