b87895d56cb94bf8ef56e9407268d5bef95372f6
[jelmer/samba4-debian.git] / source / heimdal / kdc / kdc_locl.h
1 /*
2  * Copyright (c) 1997-2005 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 /* 
35  * $Id: kdc_locl.h,v 1.72 2005/08/12 08:46:39 lha Exp $ 
36  */
37
38 #ifndef __KDC_LOCL_H__
39 #define __KDC_LOCL_H__
40
41 #include "headers.h"
42 #include "kdc.h"
43
44 extern sig_atomic_t exit_flag;
45 extern size_t max_request;
46 extern const char *port_str;
47 extern krb5_addresses explicit_addresses;
48
49 extern int enable_http;
50
51 #define DETACH_IS_DEFAULT FALSE
52
53 extern int detach_from_console;
54
55 #define _PATH_KDC_CONF          HDB_DB_DIR "/kdc.conf"
56 #define DEFAULT_LOG_DEST        "0-1/FILE:" HDB_DB_DIR "/kdc.log"
57
58 extern struct timeval _kdc_now;
59 #define kdc_time (_kdc_now.tv_sec)
60
61 krb5_error_code
62 _kdc_as_rep(krb5_context context, 
63             krb5_kdc_configuration *config,
64             KDC_REQ*, const krb5_data*, krb5_data*, 
65             const char*, struct sockaddr*);
66
67 krb5_kdc_configuration *
68 configure(krb5_context context, int argc, char **argv);
69
70 krb5_error_code
71 _kdc_db_fetch(krb5_context, krb5_kdc_configuration *,
72               krb5_principal, enum hdb_ent_type, hdb_entry **);
73
74 void
75 _kdc_free_ent(krb5_context context, hdb_entry *);
76
77 void
78 loop(krb5_context context, krb5_kdc_configuration *config);
79
80 krb5_error_code
81 _kdc_tgs_rep (krb5_context context, 
82               krb5_kdc_configuration *config,
83               KDC_REQ*, krb5_data*, const char*, struct sockaddr *);
84
85 krb5_error_code
86 _kdc_check_flags(krb5_context context, 
87                  krb5_kdc_configuration *config,
88                  hdb_entry *client, const char *client_name,
89                  hdb_entry *server, const char *server_name,
90                  krb5_boolean is_as_req);
91
92 krb5_error_code
93 _kdc_get_des_key(krb5_context context, hdb_entry*, 
94                  krb5_boolean, krb5_boolean, Key**);
95
96 krb5_error_code
97 _kdc_encode_v4_ticket(krb5_context context, 
98                       krb5_kdc_configuration *config,
99                       void *buf, size_t len, const EncTicketPart *et,
100                       const PrincipalName *service, size_t *size);
101 krb5_error_code
102 _kdc_do_524(krb5_context context, 
103             krb5_kdc_configuration *config,
104             const Ticket *t, krb5_data *reply,
105             const char *from, struct sockaddr *addr);
106
107
108 #ifdef PKINIT
109 typedef struct pk_client_params pk_client_params;
110 krb5_error_code _kdc_pk_initialize(krb5_context,
111                                    krb5_kdc_configuration *, 
112                                    const char *,
113                                    const char *);
114 krb5_error_code _kdc_pk_rd_padata(krb5_context, krb5_kdc_configuration *, 
115                               KDC_REQ *, PA_DATA *, pk_client_params **);
116 krb5_error_code _kdc_pk_mk_pa_reply(krb5_context,
117                                     krb5_kdc_configuration *, 
118                                     pk_client_params *,
119                                     const hdb_entry *,
120                                     const KDC_REQ *,
121                                     krb5_keyblock **,
122                                     METHOD_DATA *);
123 krb5_error_code _kdc_pk_check_client(krb5_context, 
124                                      krb5_kdc_configuration *,
125                                      krb5_principal,
126                                      const hdb_entry *, 
127                                      pk_client_params *, char **);
128 void _kdc_pk_free_client_param(krb5_context, pk_client_params *);
129 #endif
130
131 /*
132  * Kerberos 4
133  */
134
135 krb5_error_code
136 _kdc_db_fetch4 (krb5_context context, 
137                 krb5_kdc_configuration *config,
138                 const char*, const char*, const char*, enum hdb_ent_type, hdb_entry**);
139
140 krb5_error_code
141 _kdc_do_version4 (krb5_context context, 
142                   krb5_kdc_configuration *config,
143                   unsigned char*, size_t, krb5_data*, const char*, 
144                   struct sockaddr_in*);
145 int
146 _kdc_maybe_version4(unsigned char*, int);
147
148 krb5_error_code
149 _kdc_do_kaserver (krb5_context context, 
150                   krb5_kdc_configuration *config,
151                   unsigned char*, size_t, krb5_data*,
152                   const char*, struct sockaddr_in*);
153
154
155 #endif /* __KDC_LOCL_H__ */