Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/crypto/krb5/src/include/win-mac.h
34878 views
1
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
/*
3
* This file is now only used on Windows
4
*/
5
6
/*
7
* type functions split out of here to make things look nicer in the
8
* various include files which need these definitions, as well as in
9
* the util/ directories.
10
*/
11
12
#ifndef _KRB5_WIN_MAC_H
13
#define _KRB5_WIN_MAC_H
14
15
#ifdef _WIN32
16
#define ID_READ_PWD_DIALOG 10000
17
#define ID_READ_PWD_PROMPT 10001
18
#define ID_READ_PWD_PROMPT2 10002
19
#define ID_READ_PWD_PWD 10003
20
21
#ifdef RES_ONLY
22
23
#define APSTUDIO_HIDDEN_SYMBOLS
24
#include <windows.h>
25
26
#else /* ! RES_ONLY */
27
#include <stdlib.h>
28
#ifdef DEBUG
29
#include <crtdbg.h>
30
#endif
31
32
/* To ensure backward compatibility of the ABI use 32-bit time_t on
33
* 32-bit Windows.
34
*/
35
#ifdef _KRB5_INT_H
36
#ifdef KRB5_GENERAL__
37
#error krb5.h included before k5-int.h
38
#endif /* KRB5_GENERAL__ */
39
#if _INTEGRAL_MAX_BITS >= 64 && _MSC_VER >= 1400 && !defined(_WIN64) && !defined(_USE_32BIT_TIME_T)
40
#if defined(_TIME_T_DEFINED) || defined(_INC_IO) || defined(_INC_TIME) || defined(_INC_WCHAR)
41
#error time_t has been defined as a 64-bit integer which is incompatible with Kerberos on this platform.
42
#endif /* _TIME_T_DEFINED */
43
#define _USE_32BIT_TIME_T
44
#endif
45
#endif
46
47
#define SIZEOF_INT 4
48
#define SIZEOF_SHORT 2
49
#define SIZEOF_LONG 4
50
51
#include <windows.h>
52
#include <limits.h>
53
54
#ifndef SIZE_MAX /* in case Microsoft defines max size of size_t */
55
#ifdef MAX_SIZE /* Microsoft defines MAX_SIZE as max size of size_t */
56
#define SIZE_MAX MAX_SIZE
57
#else
58
#define SIZE_MAX UINT_MAX
59
#endif
60
#endif
61
62
#ifndef KRB5_CALLCONV
63
# define KRB5_CALLCONV __stdcall
64
# define KRB5_CALLCONV_C __cdecl
65
66
/*
67
* Use this to mark an incorrect calling convention that has been
68
* "immortalized" because it was incorrectly exported in a previous
69
* release.
70
*/
71
72
# define KRB5_CALLCONV_WRONG KRB5_CALLCONV_C
73
74
#endif /* !KRB5_CALLCONV */
75
76
#ifndef KRB5_SYSTYPES__
77
#define KRB5_SYSTYPES__
78
#include <sys/types.h>
79
typedef unsigned long u_long; /* Not part of sys/types.h on the pc */
80
typedef unsigned int u_int;
81
typedef unsigned short u_short;
82
typedef unsigned char u_char;
83
typedef unsigned short uint16_t;
84
typedef short int16_t;
85
typedef unsigned int uint32_t;
86
typedef int int32_t;
87
#if _INTEGRAL_MAX_BITS >= 64
88
typedef unsigned __int64 uint64_t;
89
typedef __int64 int64_t;
90
#endif
91
#ifndef SSIZE_T_DEFINED
92
#ifdef ssize_t
93
#undef ssize_t
94
#endif
95
#ifdef _WIN64
96
typedef __int64 ssize_t;
97
#else
98
typedef _W64 int ssize_t;
99
#endif
100
#define SSIZE_T_DEFINED
101
#endif
102
#endif /* KRB5_SYSTYPES__ */
103
104
#ifndef MAXHOSTNAMELEN
105
#define MAXHOSTNAMELEN 512
106
#endif
107
108
#ifndef MAXPATHLEN
109
#define MAXPATHLEN 256 /* Also for Windows temp files */
110
#endif
111
112
#ifdef KRB5_PRIVATE
113
#define HAVE_NETINET_IN_H
114
#define MSDOS_FILESYSTEM
115
#define HAVE_STRING_H
116
#define HAVE_SRAND
117
#define HAVE_ERRNO
118
#define HAVE_STRDUP
119
#define HAVE_GETADDRINFO
120
#define HAVE_GETNAMEINFO
121
#define NO_USERID
122
#define NO_PASSWORD
123
#define HAVE_STRERROR
124
#define SYS_ERRLIST_DECLARED
125
#if _MSC_VER >= 1900
126
#define HAVE_VSNPRINTF
127
#endif
128
/* Visual Studio 2012 errors out when we macroize keywords in C++ mode */
129
#ifndef __cplusplus
130
#define inline __inline
131
#endif
132
#define NEED_INSIXADDR_ANY
133
#define ENABLE_THREADS
134
#endif
135
136
#define WM_KERBEROS5_CHANGED "Kerberos5 Changed"
137
#ifdef KRB4
138
#define WM_KERBEROS_CHANGED "Kerberos Changed"
139
#endif
140
141
/* Kerberos Windows initialization file */
142
#define KERBEROS_INI "kerberos.ini"
143
#ifdef CYGNUS
144
#define KERBEROS_HLP "kerbnet.hlp"
145
#else
146
#define KERBEROS_HLP "krb5clnt.hlp"
147
#endif
148
#define INI_DEFAULTS "Defaults"
149
#define INI_USER "User" /* Default user */
150
#define INI_INSTANCE "Instance" /* Default instance */
151
#define INI_REALM "Realm" /* Default realm */
152
#define INI_POSITION "Position"
153
#define INI_OPTIONS "Options"
154
#define INI_DURATION "Duration" /* Ticket duration in minutes */
155
#define INI_EXPIRATION "Expiration" /* Action on expiration (alert or beep) */
156
#define INI_ALERT "Alert"
157
#define INI_BEEP "Beep"
158
#define INI_FILES "Files"
159
#ifdef KRB4
160
#define INI_KRB_CONF "krb.conf" /* Location of krb.conf file */
161
#define DEF_KRB_CONF "krb.conf" /* Default name for krb.conf file */
162
#else
163
#define INI_KRB5_CONF "krb5.ini" /* From k5-config.h */
164
#define INI_KRB_CONF INI_KRB5_CONF /* Location of krb.conf file */
165
#define DEF_KRB_CONF INI_KRB5_CONF /* Default name for krb.conf file */
166
#define INI_TICKETOPTS "TicketOptions" /* Ticket options */
167
#define INI_FORWARDABLE "Forwardable" /* get forwardable tickets */
168
#define INI_KRB_CCACHE "krb5cc" /* From k5-config.h */
169
#endif
170
#define INI_KRB_REALMS "krb.realms" /* Location of krb.realms file */
171
#define DEF_KRB_REALMS "krb.realms" /* Default name for krb.realms file */
172
#define INI_RECENT_LOGINS "Recent Logins"
173
#define INI_LOGIN "Login"
174
175
#ifdef KRB5_PRIVATE
176
#define HAS_VOID_TYPE
177
#define HAVE_STDARG_H
178
#define HAVE_SYS_TYPES_H
179
#define HAVE_STDLIB_H
180
#endif
181
182
/* Ugly. Microsoft, in stdc mode, doesn't support the low-level i/o
183
* routines directly. Rather, they only export the _<function> version.
184
* The following defines works around this problem.
185
*/
186
#include <sys\types.h>
187
#include <sys\stat.h>
188
#include <fcntl.h>
189
#include <io.h>
190
#include <process.h>
191
#include <wincrypt.h>
192
193
#ifdef NEED_SYSERROR
194
/* Only needed by util/et/error_message.c but let's keep the source clean */
195
#define sys_nerr _sys_nerr
196
#define sys_errlist _sys_errlist
197
#endif
198
199
/*
200
* Functions with slightly different names on the PC
201
*/
202
#ifndef strcasecmp
203
#define strcasecmp _stricmp
204
#endif
205
#ifndef strncasecmp
206
#define strncasecmp _strnicmp
207
#endif
208
209
/* VS2005 has deprecated strdup */
210
#ifndef strdup
211
#define strdup _strdup
212
#endif
213
214
/* Windows has its own name for reentrant strtok. */
215
#define strtok_r strtok_s
216
217
HINSTANCE get_lib_instance(void);
218
219
#define GETSOCKNAME_ARG3_TYPE size_t
220
#define GETPEERNAME_ARG3_TYPE GETSOCKNAME_ARG3_TYPE
221
222
#endif /* !RES_ONLY */
223
224
#endif /* _WIN32 */
225
226
#define THREEPARAMOPEN(x,y,z) open(x,y,z)
227
228
#define DEFKTNAME "FILE:%{WINDOWS}\\krb5kt"
229
#define DEFCKTNAME "FILE:%{WINDOWS}\\krb5clientkt"
230
231
#ifndef KRB5_CALLCONV
232
#define KRB5_CALLCONV
233
#endif
234
235
#ifndef KRB5_CALLCONV_C
236
#define KRB5_CALLCONV_C
237
#endif
238
239
#ifndef PKCS11_MODNAME
240
#define PKCS11_MODNAME "C:\\Program Files\\OpenSC Project\\OpenSC\\pkcs11\\opensc-pkcs11.dll"
241
#endif
242
243
#endif /* _KRB5_WIN_MAC_H */
244
245