1/* 2 * type functions split out of here to make things look nicer in the 3 * various include files which need these definitions, as well as in 4 * the util/ directories. 5 */ 6 7#ifndef _KRB5_WIN_MAC_H 8#define _KRB5_WIN_MAC_H 9 10#if (defined(_MSDOS) || defined(_WIN32)) 11/* 12 * Machine-type definitions: PC Clone 386 running Microloss Windows 13 */ 14 15#define ID_READ_PWD_DIALOG 10000 16#define ID_READ_PWD_PROMPT 10001 17#define ID_READ_PWD_PROMPT2 10002 18#define ID_READ_PWD_PWD 10003 19 20#ifdef RES_ONLY 21 22#define APSTUDIO_HIDDEN_SYMBOLS 23#include <windows.h> 24 25#else 26 27#if defined(_MSDOS) 28 /* Windows 16 specific */ 29#define BITS16 30#define SIZEOF_INT 2 31#define SIZEOF_SHORT 2 32#define SIZEOF_LONG 4 33 34#ifndef KRB5_CALLCONV 35#define KRB5_CALLCONV __far __export __pascal 36#define KRB5_CALLCONV_C __far __export __cdecl 37#define KRB5_EXPORTVAR __far __export 38#define KRB5_DLLIMP 39#endif /* !KRB5_CALLCONV */ 40 41#include <windows.h> 42 43/* 44 * The following defines are needed to make <windows.h> work 45 * in stdc mode (/Za flag). Winsock.h needs <windows.h>. 46 */ 47#ifndef FAR 48#define FAR __far 49#define NEAR __near 50#endif 51 52#ifndef _far 53#define _far __far 54#define _near __near 55#define _pascal __pascal 56#define _cdecl __cdecl 57#define _huge __huge 58#endif 59 60#else 61 /* Windows 32 specific */ 62#define SIZEOF_INT 4 63#define SIZEOF_SHORT 2 64#define SIZEOF_LONG 4 65 66#include <windows.h> /* always include this here, to get correct FAR and NEAR */ 67 68#define HAVE_LABS 69 70#ifndef KRB5_CALLCONV 71# ifdef _MSC_VER 72# ifdef KRB5_DLL_FILE 73# define KRB5_DLLIMP __declspec(dllexport) 74# else 75# define KRB5_DLLIMP __declspec(dllimport) 76# endif 77# ifdef GSS_DLL_FILE 78# define GSS_DLLIMP __declspec(dllexport) 79# else 80# define GSS_DLLIMP __declspec(dllimport) 81# endif 82# else /* !_MSC_VER */ 83# define KRB5_DLLIMP 84# define GSS_DLLIMP 85# endif 86# define KRB5_CALLCONV __stdcall 87# define KRB5_CALLCONV_C __cdecl 88# define KRB5_EXPORTVAR 89#endif /* !KRB5_CALLCONV */ 90 91#endif /* _MSDOS */ 92 93#ifndef KRB5_SYSTYPES__ 94#define KRB5_SYSTYPES__ 95#include <sys/types.h> 96typedef unsigned long u_long; /* Not part of sys/types.h on the pc */ 97typedef unsigned int u_int; 98typedef unsigned short u_short; 99typedef unsigned char u_char; 100#endif /* KRB5_SYSTYPES__ */ 101 102#define MAXHOSTNAMELEN 512 103#ifndef MAXPATHLEN 104#define MAXPATHLEN 256 /* Also for Windows temp files */ 105#endif 106 107#define HAVE_NETINET_IN_H 108#define MSDOS_FILESYSTEM 109#define HAVE_STRING_H 110#define HAVE_SRAND 111#define HAVE_ERRNO 112#define HAVE_STRDUP 113#define NO_USERID 114#define NO_PASSWORD 115 116#define WM_KERBEROS5_CHANGED "Kerberos5 Changed" 117#ifdef KRB4 118#define WM_KERBEROS_CHANGED "Kerberos Changed" 119#endif 120 121/* Kerberos Windows initialization file */ 122#define KERBEROS_INI "kerberos.ini" 123#ifdef CYGNUS 124#define KERBEROS_HLP "kerbnet.hlp" 125#else 126#define KERBEROS_HLP "krb5clnt.hlp" 127#endif 128#define INI_DEFAULTS "Defaults" 129#define INI_USER "User" /* Default user */ 130#define INI_INSTANCE "Instance" /* Default instance */ 131#define INI_REALM "Realm" /* Default realm */ 132#define INI_POSITION "Position" 133#define INI_OPTIONS "Options" 134#define INI_DURATION "Duration" /* Ticket duration in minutes */ 135#define INI_EXPIRATION "Expiration" /* Action on expiration (alert or beep) */ 136#define INI_ALERT "Alert" 137#define INI_BEEP "Beep" 138#define INI_FILES "Files" 139#ifdef KRB4 140#define INI_KRB_CONF "krb.conf" /* Location of krb.conf file */ 141#define DEF_KRB_CONF "krb.conf" /* Default name for krb.conf file */ 142#else 143#define INI_KRB5_CONF "krb5.ini" /* From k5-config.h */ 144#define INI_KRB_CONF INI_KRB5_CONF /* Location of krb.conf file */ 145#define DEF_KRB_CONF INI_KRB5_CONF /* Default name for krb.conf file */ 146#define INI_TICKETOPTS "TicketOptions" /* Ticket options */ 147#define INI_FORWARDABLE "Forwardable" /* get forwardable tickets */ 148#define INI_KRB_CCACHE "krb5cc" /* From k5-config.h */ 149#endif 150#define INI_KRB_REALMS "krb.realms" /* Location of krb.realms file */ 151#define DEF_KRB_REALMS "krb.realms" /* Default name for krb.realms file */ 152#define INI_RECENT_LOGINS "Recent Logins" 153#define INI_LOGIN "Login" 154 155#define HAS_ANSI_VOLATILE 156#define HAS_VOID_TYPE 157#define KRB5_PROVIDE_PROTOTYPES 158#define HAVE_STDARG_H 159#define HAVE_SYS_TYPES_H 160#define HAVE_STDLIB_H 161 162/* This controls which encryption routines libcrypto will provide */ 163#define PROVIDE_DES_CBC_MD5 164#define PROVIDE_DES_CBC_CRC 165#define PROVIDE_DES_CBC_RAW 166#define PROVIDE_DES_CBC_CKSUM 167#define PROVIDE_CRC32 168#define PROVIDE_RSA_MD4 169#define PROVIDE_RSA_MD5 170/* #define PROVIDE_DES3_CBC_SHA */ 171/* #define PROVIDE_DES3_CBC_RAW */ 172/* #define PROVIDE_NIST_SHA */ 173 174/* Ugly. Microsoft, in stdc mode, doesn't support the low-level i/o 175 * routines directly. Rather, they only export the _<function> version. 176 * The following defines works around this problem. 177 */ 178#include <sys\types.h> 179#include <sys\stat.h> 180#include <fcntl.h> 181#include <io.h> 182#include <process.h> 183#define THREEPARAMOPEN(x,y,z) open(x,y,z) 184#ifndef _WIN32 185#define O_RDONLY _O_RDONLY 186#define O_WRONLY _O_WRONLY 187#define O_RDWR _O_RDWR 188#define O_APPEND _O_APPEND 189#define O_CREAT _O_CREAT 190#define O_TRUNC _O_TRUNC 191#define O_EXCL _O_EXCL 192#define O_TEXT _O_TEXT 193#define O_BINARY _O_BINARY 194#define O_NOINHERIT _O_NOINHERIT 195#define stat _stat 196#define unlink _unlink 197#define lseek _lseek 198#define write _write 199#define open _open 200#define close _close 201#define read _read 202#define fstat _fstat 203#define mktemp _mktemp 204#define dup _dup 205 206#define getpid _getpid 207#endif 208 209#ifdef NEED_SYSERROR 210/* Only needed by util/et/error_message.c but let's keep the source clean */ 211#define sys_nerr _sys_nerr 212#define sys_errlist _sys_errlist 213#endif 214 215/* 216 * Functions with slightly different names on the PC 217 */ 218#define strcasecmp stricmp 219#define strncasecmp strnicmp 220 221HINSTANCE get_lib_instance(void); 222 223#endif /* !RES_ONLY */ 224 225#endif /* _MSDOS || _WIN32 */ 226 227#ifdef macintosh 228 229#include <KerberosSupport/KerberosConditionalMacros.h> 230 231#define USE_LOGIN_LIBRARY 232 233#define KRB5_CALLCONV 234#define KRB5_CALLCONV_C 235#define KRB5_DLLIMP 236#define GSS_DLLIMP 237#ifndef FAR 238#define FAR 239#endif 240#ifndef NEAR 241#define NEAR 242#endif 243 244#define SIZEOF_INT 4 245#define SIZEOF_SHORT 2 246#define HAVE_SRAND 247#define NO_PASSWORD 248#define HAVE_LABS 249/*#define ENOMEM 12*/ 250#include <ctype.h> 251 252/* 253 * Which encryption routines libcrypto will provide is controlled by 254 * mac/libraries/KerberosHeaders.h. 255 */ 256 257/* there is no <stat.h> for mpw */ 258#ifndef __MWERKS__ 259typedef unsigned long size_t; 260typedef unsigned long mode_t; 261typedef unsigned long ino_t; 262typedef unsigned long dev_t; 263typedef short nlink_t; 264typedef unsigned long uid_t; 265typedef unsigned long gid_t; 266typedef long off_t; 267 268struct stat 269{ 270 mode_t st_mode; /* File mode; see #define's below */ 271 ino_t st_ino; /* File serial number */ 272 dev_t st_dev; /* ID of device containing this file */ 273 nlink_t st_nlink; /* Number of links */ 274 uid_t st_uid; /* User ID of the file's owner */ 275 gid_t st_gid; /* Group ID of the file's group */ 276 dev_t st_rdev; /* Device type */ 277 off_t st_size; /* File size in bytes */ 278 unsigned long st_atime; /* Time of last access */ 279 unsigned long st_mtime; /* Time of last data modification */ 280 unsigned long st_ctime; /* Time of last file status change */ 281 long st_blksize; /* Optimal blocksize */ 282 long st_blocks; /* blocks allocated for file */ 283}; 284 285int stat(const char *path, struct stat *buf); 286#endif 287 288int fstat(int fildes, struct stat *buf); 289 290#define EFBIG 1000 291 292#define NOFCHMOD 1 293#define NOCHMOD 1 294#define _MACSOCKAPI_ 295 296#define THREEPARAMOPEN(x,y,z) open(x,y) 297#else /* macintosh */ 298#define THREEPARAMOPEN(x,y,z) open(x,y,z) 299#endif /* macintosh */ 300 301#ifndef KRB5_CALLCONV 302#define KRB5_CALLCONV 303#define KRB5_CALLCONV_C 304#define KRB5_DLLIMP 305#endif 306#ifndef FAR 307#define FAR 308#endif 309#ifndef NEAR 310#define NEAR 311#endif 312 313#endif /* _KRB5_WIN_MAC_H */ 314