Update gnulib files.
[shishi.git] / lib / internal.h
blob401589894a3e0a15e82d7ac065b26472f20a7f94
1 /* internal.h --- Internal header file for Shishi.
2 * Copyright (C) 2002, 2003, 2004, 2006, 2007 Simon Josefsson
4 * This file is part of Shishi.
6 * Shishi is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * Shishi is distributed in the hope that it will be useful, but
12 * 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, see http://www.gnu.org/licenses or write
18 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
19 * Floor, Boston, MA 02110-1301, USA
23 #ifndef _INTERNAL_H
24 #define _INTERNAL_H
26 #if HAVE_CONFIG_H
27 #include "config.h"
28 #endif
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <stdarg.h>
33 #include <ctype.h>
34 #include <string.h>
35 #include <stdbool.h>
36 #include <stdint.h>
37 #include <sys/types.h>
38 #include <sys/socket.h>
39 #include <sys/select.h>
40 #include <sys/stat.h>
41 #include <unistd.h>
43 #ifdef HAVE_SYS_IOCTL_H
44 #include <sys/ioctl.h>
45 #endif
47 #ifdef HAVE_NETDB_H
48 #include <netdb.h>
49 #endif
51 #if defined HAVE_DECL_H_ERRNO && !HAVE_DECL_H_ERRNO
52 /*extern int h_errno;*/
53 #endif
55 #ifdef HAVE_PWD_H
56 #include <pwd.h>
57 #endif
59 #ifdef HAVE_FCNTL_H
60 #include <fcntl.h>
61 #endif
63 #ifdef HAVE_ERRNO_H
64 #include <errno.h>
65 #endif
67 #if TIME_WITH_SYS_TIME
68 # include <sys/time.h>
69 # include <time.h>
70 #else
71 # if HAVE_SYS_TIME_H
72 # include <sys/time.h>
73 # else
74 # include <time.h>
75 # endif
76 #endif
78 #ifdef HAVE_SIGNAL_H
79 #include <signal.h>
80 #endif
82 #ifdef HAVE_NETINET_IN_H
83 #include <netinet/in.h>
84 #endif
85 #ifdef HAVE_NETINET_IN6_H
86 #include <netinet/in6.h>
87 #endif
88 #ifdef HAVE_ARPA_INET_H
89 #include <arpa/inet.h>
90 #endif
92 #ifdef HAVE_ARPA_NAMESER_H
93 #include <arpa/nameser.h>
94 #endif
95 #ifdef HAVE_RESOLV_H
96 #include <resolv.h>
97 #endif
99 #ifdef HAVE_SYSLOG_H
100 #include <syslog.h>
101 #endif
103 #include "gettext.h"
105 #include "xvasprintf.h"
106 #include "base64.h"
107 #include "getdate.h"
108 #include "read-file.h"
109 #include "xalloc.h"
110 #include "xgethostname.h"
111 #include "xgetdomainname.h"
112 #include "xstrndup.h"
114 #include "shishi.h"
116 #define _(String) dgettext (PACKAGE, String)
117 #define gettext_noop(String) String
118 #define N_(String) gettext_noop (String)
120 #define MAX_KEY_LEN 32
121 #define MAX_RANDOM_LEN 32
122 #define MAX_HASH_LEN 32
123 #define MAX_CKSUM_LEN 32
125 #define SHISHI_VERBOSE_NOISE (1<<1)
126 #define SHISHI_VERBOSE_ASN1 (1<<2)
127 #define SHISHI_VERBOSE_CRYPTO (1<<3)
128 #define SHISHI_VERBOSE_CRYPTO_NOISE (1<<4)
130 #define KRBTGT "krbtgt"
131 #define PRINCIPAL_DELIMITER "/"
133 #define VERBOSENOISE(h) (h->verbose & SHISHI_VERBOSE_NOISE)
134 #define VERBOSEASN1(h) (h->verbose & SHISHI_VERBOSE_ASN1)
135 #define VERBOSECRYPTO(h) (h->verbose & SHISHI_VERBOSE_CRYPTO)
136 #define VERBOSECRYPTONOISE(h) (h->verbose & SHISHI_VERBOSE_CRYPTO_NOISE)
137 #define VERBOSES (SHISHI_VERBOSE_ASN1 | \
138 SHISHI_VERBOSE_CRYPTO | \
139 SHISHI_VERBOSE_NOISE | \
140 SHISHI_VERBOSE_CRYPTO_NOISE)
141 #define VERBOSE(h) (h->verbose & ~VERBOSES)
143 /* For resolv.c and netio.c, on old systems. */
144 #ifndef T_SRV
145 # define T_SRV (33)
146 #endif
148 enum
150 UDP,
151 TCP,
155 struct Shishi_kdcinfo
157 char *name;
158 struct sockaddr sockaddress;
159 int protocol;
162 struct Shishi_realminfo
164 char *name;
165 struct Shishi_kdcinfo *kdcaddresses;
166 size_t nkdcaddresses;
167 char **serverwildcards;
168 size_t nserverwildcards;
171 struct Shishi
173 Shishi_asn1 asn1;
174 int verbose;
175 int outputtype;
176 char *default_realm;
177 char *default_principal;
178 size_t kdctimeout;
179 size_t kdcretries;
180 int ticketlife;
181 int renewlife;
182 int32_t *clientkdcetypes;
183 size_t nclientkdcetypes;
184 int32_t *authorizationtypes;
185 size_t nauthorizationtypes;
186 struct Shishi_realminfo *realminfos;
187 size_t nrealminfos;
188 char *kdc;
189 char error[1024];
190 char gztime_buf[40];
191 char *userdirectory;
192 char *usercfgfile;
193 char *tktsdefaultfile;
194 char *ccachedefault;
195 char *hostkeysdefaultfile;
196 char *x509cafile;
197 char *x509certfile;
198 char *x509keyfile;
199 char *stringprocess;
200 Shishi_tkts *tkts;
203 #define TICKETLIFE (60*60*8) /* Work day */
204 #define RENEWLIFE (60*60*24*7) /* Week */
206 #endif /* _INTERNAL_H */