From 731056fb3afd5f83f94f7ac48af049d39fed58e1 Mon Sep 17 00:00:00 2001 From: Keith Vetter Date: Tue, 7 Mar 1995 23:32:30 +0000 Subject: [PATCH] PC porting: more prototyping, defines for overflow checking on the PC and numerous PC additions to k5-config.h. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5080 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/krb5/ChangeLog | 11 ++++ src/include/krb5/Makefile.in | 2 +- src/include/krb5/ccache.h | 28 +++++----- src/include/krb5/encryption.h | 6 +-- src/include/krb5/k5-config.h | 60 ++++++++++++++++++++- src/include/krb5/stock/ChangeLog | 5 ++ src/include/krb5/stock/osconf.win | 89 +++++++++++++++++++++++++++++++ src/include/krb5/wordsize.h | 4 ++ 8 files changed, 185 insertions(+), 20 deletions(-) create mode 100644 src/include/krb5/stock/osconf.win diff --git a/src/include/krb5/ChangeLog b/src/include/krb5/ChangeLog index fa501a7a7..1d8d83c36 100644 --- a/src/include/krb5/ChangeLog +++ b/src/include/krb5/ChangeLog @@ -1,3 +1,14 @@ +Tue Mar 7 14:54:02 1995 Keith Vetter (keithv@fusion.com) + + * ccache.h: added windows INTERFACE keyword to all functions. + * encryption.h: more segment games for the PC--added NEAR to three + external data objects. + * wordsize.h: added constants VALID_INT_BTIS and VALID_UINT_BITS for + detecting overflow when casting a long to an int. + * k5-config.h: numerous PC changes such as adding NEED_LOWLEVEL_IO + which enables the read/write level of I/O. + * Makefile.in: osconf.h now pulled in from stock/osconf.win. + Thu Mar 2 23:21:46 1995 John Gilmore (gnu at toad.com) Make include files start to work on the Macintosh. diff --git a/src/include/krb5/Makefile.in b/src/include/krb5/Makefile.in index 1391298e1..91455ad97 100644 --- a/src/include/krb5/Makefile.in +++ b/src/include/krb5/Makefile.in @@ -19,7 +19,7 @@ all:: all-$(WHAT) all-unix:: $(BUILT_HEADERS) all-windows: - echo /* not used in windows */ > osconf.h + copy stock\osconf.win osconf.h echo /* not used in windows */ > autoconf.h includes:: autoconf.h diff --git a/src/include/krb5/ccache.h b/src/include/krb5/ccache.h index 880275846..90d855da3 100644 --- a/src/include/krb5/ccache.h +++ b/src/include/krb5/ccache.h @@ -39,30 +39,30 @@ typedef struct _krb5_ccache { typedef struct _krb5_cc_ops { krb5_magic magic; char *prefix; - char *(*get_name) NPROTOTYPE((krb5_context, krb5_ccache)); - krb5_error_code (*resolve) NPROTOTYPE((krb5_context, krb5_ccache *, + char *(INTERFACE *get_name) NPROTOTYPE((krb5_context, krb5_ccache)); + krb5_error_code (INTERFACE *resolve) NPROTOTYPE((krb5_context, krb5_ccache *, char *)); - krb5_error_code (*gen_new) NPROTOTYPE((krb5_context, krb5_ccache *)); - krb5_error_code (*init) NPROTOTYPE((krb5_context, krb5_ccache, + krb5_error_code (INTERFACE *gen_new) NPROTOTYPE((krb5_context, krb5_ccache *)); + krb5_error_code (INTERFACE *init) NPROTOTYPE((krb5_context, krb5_ccache, krb5_principal)); - krb5_error_code (*destroy) NPROTOTYPE((krb5_context, krb5_ccache)); - krb5_error_code (*close) NPROTOTYPE((krb5_context, krb5_ccache)); - krb5_error_code (*store) NPROTOTYPE((krb5_context, krb5_ccache, + krb5_error_code (INTERFACE *destroy) NPROTOTYPE((krb5_context, krb5_ccache)); + krb5_error_code (INTERFACE *close) NPROTOTYPE((krb5_context, krb5_ccache)); + krb5_error_code (INTERFACE *store) NPROTOTYPE((krb5_context, krb5_ccache, krb5_creds *)); - krb5_error_code (*retrieve) NPROTOTYPE((krb5_context, krb5_ccache, + krb5_error_code (INTERFACE *retrieve) NPROTOTYPE((krb5_context, krb5_ccache, krb5_flags, krb5_creds *, krb5_creds *)); - krb5_error_code (*get_princ) NPROTOTYPE((krb5_context, krb5_ccache, + krb5_error_code (INTERFACE *get_princ) NPROTOTYPE((krb5_context, krb5_ccache, krb5_principal *)); - krb5_error_code (*get_first) NPROTOTYPE((krb5_context, krb5_ccache, + krb5_error_code (INTERFACE *get_first) NPROTOTYPE((krb5_context, krb5_ccache, krb5_cc_cursor *)); - krb5_error_code (*get_next) NPROTOTYPE((krb5_context, krb5_ccache, + krb5_error_code (INTERFACE *get_next) NPROTOTYPE((krb5_context, krb5_ccache, krb5_cc_cursor *, krb5_creds *)); - krb5_error_code (*end_get) NPROTOTYPE((krb5_context, krb5_ccache, + krb5_error_code (INTERFACE *end_get) NPROTOTYPE((krb5_context, krb5_ccache, krb5_cc_cursor *)); - krb5_error_code (*remove_cred) NPROTOTYPE((krb5_context, krb5_ccache, + krb5_error_code (INTERFACE *remove_cred) NPROTOTYPE((krb5_context, krb5_ccache, krb5_flags, krb5_creds *)); - krb5_error_code (*set_flags) NPROTOTYPE((krb5_context, krb5_ccache, + krb5_error_code (INTERFACE *set_flags) NPROTOTYPE((krb5_context, krb5_ccache, krb5_flags)); } krb5_cc_ops; diff --git a/src/include/krb5/encryption.h b/src/include/krb5/encryption.h index bbee8ec23..d1e5565f0 100644 --- a/src/include/krb5/encryption.h +++ b/src/include/krb5/encryption.h @@ -156,17 +156,17 @@ typedef struct _krb5_checksum_entry { krb5_roundup((length)+(crypto)->pad_minimum, (crypto)->block_length) /* This array is indexed by encryption type */ -extern krb5_cs_table_entry *krb5_csarray[]; +extern krb5_cs_table_entry * NEAR krb5_csarray[]; extern int krb5_max_cryptosystem; /* max entry in array */ /* This array is indexed by key type, and has (should have) pointers to the same entries as krb5_csarray */ /* XXX what if a given keytype works for several etypes? */ -extern krb5_cs_table_entry *krb5_keytype_array[]; +extern krb5_cs_table_entry * NEAR krb5_keytype_array[]; extern int krb5_max_keytype; /* max entry in array */ /* This array is indexed by checksum type */ -extern krb5_checksum_entry *krb5_cksumarray[]; +extern krb5_checksum_entry * NEAR krb5_cksumarray[]; extern int krb5_max_cksum; /* max entry in array */ #define valid_etype(etype) ((((int) etype) <= krb5_max_cryptosystem) && (etype > 0) && krb5_csarray[etype]) diff --git a/src/include/krb5/k5-config.h b/src/include/krb5/k5-config.h index 340bf7740..10a7b4653 100644 --- a/src/include/krb5/k5-config.h +++ b/src/include/krb5/k5-config.h @@ -38,13 +38,22 @@ #define SIZEOF_INT 2 #define SIZEOF_SHORT 2 #define SIZEOF_LONG 4 +#define MAXHOSTNAMELEN 512 #define KRB5_USE_INET #define MSDOS_FILESYSTEM #define USE_STRING_H #define HAVE_SRAND #define HAVE_ERRNO +#define HAS_STRDUP #define NO_USERID +#define NOFCHMOD + +#define HAS_ANSI_CONST /* For compiling w/o -Za */ +#define HAS_ANSI_VOLATILE +#define HAS_VOID_TYPE +#define KRB5_PROVIDE_PROTOTYPES +#define STDARG_PROTOTYPES #ifndef _SIZE_T_DEFINED typedef unsigned int size_t; @@ -61,12 +70,13 @@ typedef unsigned char u_char; #define INTERFACE __far __export __pascal #define INTERFACE_C __far __export __cdecl #endif -#define FAR _far /* * The following defines are needed to make work * in stdc mode (/Za flag). Winsock.h needs . */ +#define FAR _far +#define NEAR _near #define _far __far #define _near __near #define _pascal __pascal @@ -77,6 +87,43 @@ typedef unsigned char u_char; #include #endif +#ifdef NEED_LOWLEVEL_IO +/* Ugly. Microsoft, in stdc mode, doesn't support the low-level i/o + * routines directly. Rather, they only export the _ version. + * The following defines works around this problem. + */ +#include +#include +#include +#define O_RDONLY _O_RDONLY +#define O_WRONLY _O_WRONLY +#define O_RDWR _O_RDWR +#define O_APPEND _O_APPEND +#define O_CREAT _O_CREAT +#define O_TRUNC _O_TRUNC +#define O_EXCL _O_EXCL +#define O_TEXT _O_TEXT +#define O_BINARY _O_BINARY +#define O_NOINHERIT _O_NOINHERIT +#define S_IREAD _S_IREAD +#define S_IWRITE _S_IWRITE +#define S_IRUSR S_IREAD /* read permission, owner */ +#define S_IWUSR S_IWRITE /* write permission, owner */ +#define stat _stat +#define unlink _unlink +#define lseek _lseek +#define write _write +#define open _open +#define close _close +#define read _read +#define fstat _fstat +#define chmod _chmod +#define mktemp _mktemp + +#define getpid _getpid + +#endif + /* XXX these should be parameterized soon... */ #define PROVIDE_DES_CBC_MD5 #define PROVIDE_DES_CBC_CRC @@ -85,6 +132,14 @@ typedef unsigned char u_char; #define PROVIDE_DES_CBC_CKSUM #define PROVIDE_RSA_MD4 #define PROVIDE_RSA_MD5 +#define DEFAULT_PWD_STRING1 "Enter password:" +#define DEFAULT_PWD_STRING2 "Re-enter password for verification:" + +/* Functions with slightly different names on the PC +*/ +#define strcasecmp _stricmp +#define strdup _strdup +#define off_t _off_t #else /* Rest of include file is for non-Microloss-Windows */ @@ -145,12 +200,13 @@ typedef unsigned char u_char; #define INTERFACE #define INTERFACE_C #define FAR +#define NEAR #ifndef HAS_LABS #define labs(x) abs(x) #endif -#endif /* __windows__ */ +#endif /* _MSDOS */ #endif /* KRB5_CONFIG__ */ diff --git a/src/include/krb5/stock/ChangeLog b/src/include/krb5/stock/ChangeLog index 6020400d0..aeef02f68 100644 --- a/src/include/krb5/stock/ChangeLog +++ b/src/include/krb5/stock/ChangeLog @@ -1,3 +1,8 @@ +Tue Mar 7 15:09:44 1995 Keith Vetter (keithv@fusion.com) + + * osconf.win: new file. Windows version of osconf with valid + path names. + Mon Feb 20 12:30:42 1995 John Gilmore (gnu at toad.com) * config.h, config.win: Remove; merge them both into ../config.h. diff --git a/src/include/krb5/stock/osconf.win b/src/include/krb5/stock/osconf.win new file mode 100644 index 000000000..906057a34 --- /dev/null +++ b/src/include/krb5/stock/osconf.win @@ -0,0 +1,89 @@ +/* + * include/krb5/stock/osconf.h + * + * Copyright 1990,1991 by the Massachusetts Institute of Technology. + * All Rights Reserved. + * + * Export of this software from the United States of America may + * require a specific license from the United States Government. + * It is the responsibility of any person or organization contemplating + * export to obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + * + * + * Site- and OS- dependant configuration. + */ + +#ifndef KRB5_OSCONF__ +#define KRB5_OSCONF__ + +#ifndef KRB5_AUTOCONF__ +#define KRB5_AUTOCONF__ +#include "autoconf.h" +#endif + +#define USE_DBM_LNAME /* Use a DBM database for the aname/lname + conversion */ + +#ifdef KRB5_ATHENA_COMPAT +#define DEFAULT_CONFIG_FILENAME "/etc/athena/krb.conf.v5" +#define DEFAULT_TRANS_FILENAME "/etc/athena/krb.realms" +#define DEFAULT_LNAME_FILENAME "/etc/athena/aname" +#define DEFAULT_KEYTAB_NAME "FILE:/etc/athena/v5srvtab" +#else +#define DEFAULT_CONFIG_FILENAME "/krb.conf" +#define DEFAULT_TRANS_FILENAME "/krb.realms" +#define DEFAULT_LNAME_FILENAME "/aname" +#define DEFAULT_KEYTAB_NAME "FILE:/v5srvtab" +#endif + +#define DEFAULT_KDB_FILE "@KDB5DIR/principal" +#define DEFAULT_ADMIN_ACL "@KDB5DIR/admin_acl_file" + +#define DEFAULT_KDC_ETYPE ETYPE_DES_CBC_CRC +#define DEFAULT_KDC_KEYTYPE KEYTYPE_DES +#define KDCRCACHE "dfl:krb5kdc_rcache" + +#define KDC_PORTNAME "kerberos" /* for /etc/services or equiv. */ +#define KDC_SECONDARY_PORTNAME "kerberos-sec" /* For backwards */ + /* compatibility with */ + /* port 750 clients */ + +#define KRB5_DEFAULT_PORT 88 +#define KRB5_DEFAULT_SEC_PORT 750 + +#define MAX_DGRAM_SIZE 4096 +#define MAX_SKDC_TIMEOUT 30 +#define SKDC_TIMEOUT_SHIFT 2 /* left shift of timeout for backoff */ +#define SKDC_TIMEOUT_1 1 /* seconds for first timeout */ + +#define RCTMPDIR "/usr/tmp" /* directory to store replay caches */ + +#define KRB5_PATH_TTY "/dev/tty" +#define KRB5_PATH_LOGIN "@KRB5ROOT/sbin/login.krb5" +#define KRB5_PATH_RLOGIN "@KRB5ROOT/bin/rlogin" + +#define KRB5_ENV_CCNAME "KRB5CCNAME" + +/* + * krb4 kadmin stuff follows + */ + +/* the default syslog file */ +#define KADM_SYSLOG "@KDB5DIR/admin_server.syslog" + +/* where to find the bad password table */ +#define PW_CHECK_FILE "@KDB5DIR/bad_passwd" + +#define DEFAULT_ACL_DIR "@KDB5DIR" +#endif /* KRB5_OSCONF__ */ diff --git a/src/include/krb5/wordsize.h b/src/include/krb5/wordsize.h index 87ad7aa90..c02357551 100644 --- a/src/include/krb5/wordsize.h +++ b/src/include/krb5/wordsize.h @@ -34,6 +34,8 @@ typedef unsigned char krb5_ui_1; #if (SIZEOF_INT == 2) typedef int krb5_int16; typedef unsigned int krb5_ui_2; +#define VALID_INT_BITS 0x7fff +#define VALID_UINT_BITS 0xffff #elif (SIZEOF_SHORT == 2) typedef short krb5_int16; typedef unsigned short krb5_ui_2; @@ -44,6 +46,8 @@ typedef unsigned short krb5_ui_2; #if (SIZEOF_INT == 4) typedef int krb5_int32; typedef unsigned int krb5_ui_4; +#define VALID_INT_BITS 0x7fffffff +#define VALID_UINT_BITS 0xffffffff #elif (SIZEOF_LONG == 4) typedef long krb5_int32; typedef unsigned long krb5_ui_4; -- 2.26.2