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
36 #ifdef HAVE_SYS_TYPES_H
37 #include <sys/types.h>
40 #ifdef HAVE_SYS_SELECT_H
41 #include <sys/select.h>
44 #ifdef HAVE_SYS_SOCKET_H
45 #include <sys/socket.h>
48 #ifdef HAVE_SYS_IOCTL_H
49 #include <sys/ioctl.h>
52 #ifdef HAVE_SYS_STAT_H
64 #if defined HAVE_DECL_H_ERRNO && !HAVE_DECL_H_ERRNO
80 #if TIME_WITH_SYS_TIME
81 # include <sys/time.h>
85 # include <sys/time.h>
92 # if !STDC_HEADERS && HAVE_MEMORY_H
105 #ifdef HAVE_NETINET_IN_H
106 #include <netinet/in.h>
108 #ifdef HAVE_NETINET_IN6_H
109 #include <netinet/in6.h>
111 #ifdef HAVE_ARPA_INET_H
112 #include <arpa/inet.h>
115 #ifdef HAVE_ARPA_NAMESER_H
116 #include <arpa/nameser.h>
125 #include "vasprintf.h"
127 #include "xstrndup.h"
134 #define _(String) dgettext (PACKAGE, String)
135 #define gettext_noop(String) String
136 #define N_(String) gettext_noop (String)
138 #define GENERALIZEDTIME_TIME_LEN 15
139 #define MAX_KEY_LEN 32
140 #define MAX_RANDOM_LEN 32
141 #define MAX_HASH_LEN 32
142 #define MAX_CKSUM_LEN 32
144 #define SHISHI_VERBOSE_CRYPTO (1<<1)
145 #define SHISHI_VERBOSE_ASN1 (1<<2)
146 #define SHISHI_VERBOSE_NOICE (1<<3)
148 #define KRBTGT "krbtgt"
149 #define PRINCIPAL_DELIMITER "/"
151 #define VERBOSEASN1(h) (h->verbose & SHISHI_VERBOSE_ASN1)
152 #define VERBOSECRYPTO(h) (h->verbose & SHISHI_VERBOSE_CRYPTO)
153 #define VERBOSENOICE(h) (h->verbose & SHISHI_VERBOSE_NOICE)
154 #define VERBOSES (SHISHI_VERBOSE_ASN1 | \
155 SHISHI_VERBOSE_CRYPTO | \
156 SHISHI_VERBOSE_NOICE)
157 #define VERBOSE(h) (h->verbose & ~VERBOSES)
159 #ifndef HOST_NAME_MAX
160 #define HOST_NAME_MAX BUFSIZ
169 struct Shishi_kdcinfo
172 struct sockaddr sockaddress
;
176 struct Shishi_realminfo
179 struct Shishi_kdcinfo
*kdcaddresses
;
180 size_t nkdcaddresses
;
181 char **serverwildcards
;
182 size_t nserverwildcards
;
190 char *default_principal
;
195 int32_t *clientkdcetypes
;
196 size_t nclientkdcetypes
;
197 struct Shishi_realminfo
*realminfos
;
204 char *tktsdefaultfile
;
205 char *hostkeysdefaultfile
;
210 #define BASE_DIR "/.shishi"
211 #define TICKET_FILE BASE_DIR "/tickets"
212 #define USERCFG_FILE BASE_DIR "/shishi.conf"
214 #define TICKETLIFE (60*60*8) /* Work day */
215 #define RENEWLIFE (60*60*24*7) /* Week */
218 _shishi_print_armored_data (Shishi
* handle
,
220 Shishi_asn1 asn1
, char *asn1type
, char *headers
);
222 _shishi_save_data (Shishi
* handle
, FILE * fh
, Shishi_asn1 asn1
,
226 _shishi_authenticator_input (Shishi
* handle
,
227 FILE * fh
, Shishi_asn1
* authenticator
,
230 _shishi_apreq_input (Shishi
* handle
, FILE * fh
, Shishi_asn1
* apreq
,
232 int _shishi_aprep_input (Shishi
* handle
, FILE * fh
, Shishi_asn1
* aprep
,
234 int _shishi_kdcreq_input (Shishi
* handle
, FILE * fh
, Shishi_asn1
* asreq
,
236 int _shishi_kdcrep_input (Shishi
* handle
, FILE * fh
, Shishi_asn1
* asrep
,
238 int _shishi_krberror_input (Shishi
* handle
, FILE * fh
,
239 Shishi_asn1
* krberror
, int type
);
240 int _shishi_encapreppart_input (Shishi
* handle
, FILE * fh
,
241 Shishi_asn1
* encapreppart
, int type
);
242 int _shishi_safe_input (Shishi
* handle
, FILE * fh
,
243 Shishi_asn1
* safe
, int type
);
245 Shishi_asn1
_shishi_asn1_read (void);
246 int _shishi_cipher_init (void);
249 shishi_asn1_integer2_field (Shishi
* handle
,
250 Shishi_asn1 node
, unsigned long *i
,
253 extern time_t xtime (time_t * t
);
254 extern int xgettimeofday (struct timeval
*tv
, struct timezone
*tz
);
256 extern struct Shishi_realminfo
*shishi_realminfo (Shishi
* handle
,
258 extern struct Shishi_realminfo
*shishi_realminfo_new (Shishi
* handle
,
261 #if defined(WITH_DMALLOC) && WITH_DMALLOC
265 /* older systems might not have these */
270 typedef struct dnshost_st
272 struct dnshost_st
*next
;
281 typedef struct dns_srv_st
283 unsigned int priority
;
286 unsigned int rweight
;
291 dnshost_t
_shishi_resolv (const char *zone
, unsigned int type
);
292 void _shishi_resolv_free (dnshost_t dns
);
294 #endif /* _INTERNAL_H */