etc/services - sync with NetBSD-8
[minix.git] / crypto / external / bsd / heimdal / dist / lib / krb5 / krb5-v4compat.h
blob218818a34e50938bcfcafda82c61643ca2994c3b
1 /* $NetBSD: krb5-v4compat.h,v 1.1.1.2 2011/04/14 14:09:22 elric Exp $ */
3 /*
4 * Copyright (c) 1997 - 2003 Kungliga Tekniska Högskolan
5 * (Royal Institute of Technology, Stockholm, Sweden).
6 * All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
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.
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.
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.
36 /* Id */
38 #ifndef __KRB5_V4COMPAT_H__
39 #define __KRB5_V4COMPAT_H__
41 #include <krb5/krb_err.h>
44 * This file must only be included with v4 compat glue stuff in
45 * heimdal sources.
47 * It MUST NOT be installed.
50 #define KRB_PROT_VERSION 4
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)
64 /* General definitions */
65 #define KSUCCESS 0
66 #define KFAILURE 255
68 /* */
70 #define MAX_KTXT_LEN 1250
72 #define ANAME_SZ 40
73 #define REALM_SZ 40
74 #define SNAME_SZ 40
75 #define INST_SZ 40
77 struct 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 */
83 struct 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 */
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
105 #define KERB_ERR_NULL_KEY 10
107 #define CLOCK_SKEW 5*60
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
117 struct _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 */
129 KRB5_LIB_FUNCTION time_t KRB5_LIB_CALL
130 _krb5_krb_life_to_time (int, int);
132 KRB5_LIB_FUNCTION int KRB5_LIB_CALL
133 _krb5_krb_time_to_life (time_t, time_t);
135 KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
136 _krb5_krb_tf_setup (krb5_context, struct credentials *,
137 const char *, int);
139 KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
140 _krb5_krb_dest_tkt(krb5_context, const char *);
142 #define krb_time_to_life _krb5_krb_time_to_life
143 #define krb_life_to_time _krb5_krb_life_to_time
145 #endif /* __KRB5_V4COMPAT_H__ */