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