1 /* internal.h internal header file for shishi
2 * Copyright (C) 2002, 2003 Simon Josefsson
4 * This file is part of Shishi.
6 * Shishi is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * Shishi is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with Shishi; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
44 #if defined HAVE_DECL_H_ERRNO && !HAVE_DECL_H_ERRNO
52 #ifdef HAVE_SYS_TYPES_H
53 #include <sys/types.h>
56 #ifdef HAVE_SYS_SELECT_H
57 #include <sys/select.h>
60 #ifdef HAVE_SYS_SOCKET_H
61 #include <sys/socket.h>
64 #ifdef HAVE_SYS_IOCTL_H
65 #include <sys/ioctl.h>
68 #ifdef HAVE_SYS_STAT_H
81 # include <inttypes.h>
88 #if TIME_WITH_SYS_TIME
89 # include <sys/time.h>
93 # include <sys/time.h>
100 # if !STDC_HEADERS && HAVE_MEMORY_H
106 # include <strings.h>
113 #ifdef HAVE_NETINET_IN_H
114 #include <netinet/in.h>
116 #ifdef HAVE_NETINET_IN6_H
117 #include <netinet/in6.h>
119 #ifdef HAVE_ARPA_INET_H
120 #include <arpa/inet.h>
123 #ifdef HAVE_ARPA_NAMESER_H
124 #include <arpa/nameser.h>
131 #include "vasprintf.h"
136 #define _(String) dgettext (PACKAGE, String)
137 #define gettext_noop(String) String
138 #define N_(String) gettext_noop (String)
140 #define GENERALIZEDTIME_TIME_LEN 15
141 #define MAX_KEY_LEN 32
142 #define MAX_RANDOM_LEN 32
143 #define MAX_HASH_LEN 32
144 #define MAX_CKSUM_LEN 32
146 #define SHISHI_VERBOSE_CRYPTO (1<<1)
147 #define SHISHI_VERBOSE_ASN1 (1<<2)
148 #define SHISHI_VERBOSE_NOICE (1<<3)
150 #define KRBTGT "krbtgt"
151 #define PRINCIPAL_DELIMITER "/"
153 #define VERBOSEASN1(h) (h->verbose & SHISHI_VERBOSE_ASN1)
154 #define VERBOSECRYPTO(h) (h->verbose & SHISHI_VERBOSE_CRYPTO)
155 #define VERBOSENOICE(h) (h->verbose & SHISHI_VERBOSE_NOICE)
156 #define VERBOSES (SHISHI_VERBOSE_ASN1 | \
157 SHISHI_VERBOSE_CRYPTO | \
158 SHISHI_VERBOSE_NOICE)
159 #define VERBOSE(h) (h->verbose & ~VERBOSES)
161 #ifndef HOST_NAME_MAX
162 #define HOST_NAME_MAX BUFSIZ
165 struct Shishi_kdcinfo
168 struct sockaddr sockaddress
;
171 struct Shishi_realminfo
174 struct Shishi_kdcinfo
*kdcaddresses
;
183 char *default_principal
;
186 int32_t *clientkdcetypes
;
187 int nclientkdcetypes
;
188 struct Shishi_realminfo
*realminfos
;
195 char *tktsdefaultfile
;
196 char *hostkeysdefaultfile
;
201 #define BASE_DIR "/.shishi"
202 #define TICKET_FILE BASE_DIR "/tickets"
203 #define USERCFG_FILE BASE_DIR "/shishi.conf"
206 _shishi_print_armored_data (Shishi
* handle
,
208 Shishi_asn1 asn1
, char *asn1type
, char *headers
);
210 _shishi_save_data (Shishi
* handle
, FILE * fh
, Shishi_asn1 asn1
,
214 _shishi_authenticator_input (Shishi
* handle
,
215 FILE * fh
, Shishi_asn1
* authenticator
,
218 _shishi_apreq_input (Shishi
* handle
, FILE * fh
, Shishi_asn1
* apreq
,
220 int _shishi_aprep_input (Shishi
* handle
, FILE * fh
, Shishi_asn1
* aprep
,
222 int _shishi_kdcreq_input (Shishi
* handle
, FILE * fh
, Shishi_asn1
* asreq
,
224 int _shishi_kdcrep_input (Shishi
* handle
, FILE * fh
, Shishi_asn1
* asrep
,
226 int _shishi_krberror_input (Shishi
* handle
, FILE * fh
,
227 Shishi_asn1
* krberror
, int type
);
228 int _shishi_encapreppart_input (Shishi
* handle
, FILE * fh
,
229 Shishi_asn1
* encapreppart
, int type
);
230 int _shishi_safe_input (Shishi
* handle
, FILE * fh
,
231 Shishi_asn1
* safe
, int type
);
233 Shishi_asn1
_shishi_asn1_read (void);
234 int _shishi_cipher_init (void);
237 shishi_asn1_integer2_field (Shishi
* handle
,
238 Shishi_asn1 node
, unsigned long *i
,
241 #if defined(WITH_DMALLOC) && WITH_DMALLOC
245 /* older systems might not have these */
250 typedef struct dnshost_st
252 struct dnshost_st
*next
;
261 typedef struct dns_srv_st
263 unsigned int priority
;
266 unsigned int rweight
;
271 dnshost_t
_shishi_resolv (const char *zone
, unsigned int type
);
272 void _shishi_resolv_free (dnshost_t dns
);
274 #endif /* _INTERNAL_H */