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