From 0f28ba68da6eaba92fb25a8ff39c8d602c067305 Mon Sep 17 00:00:00 2001 From: Keith Vetter Date: Wed, 1 Mar 1995 23:25:24 +0000 Subject: [PATCH] Updated rcache's makefile.in. Small change to confirm I'm back in a sane configuration. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5049 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/rcache/ChangeLog | 11 +++++ src/lib/krb5/rcache/Makefile.in | 16 ++++--- src/lib/krb5/rcache/rc_base.c | 14 +++--- src/lib/krb5/rcache/rc_conv.c | 2 +- src/lib/krb5/rcache/rc_dfl.c | 36 ++++++++------- src/lib/krb5/rcache/rc_dfl.h | 26 +++++++---- src/lib/krb5/rcache/rc_io.c | 81 +++++++++++++++++++++++++++------ src/lib/krb5/rcache/rc_io.h | 29 ++++++++---- 8 files changed, 149 insertions(+), 66 deletions(-) diff --git a/src/lib/krb5/rcache/ChangeLog b/src/lib/krb5/rcache/ChangeLog index e5ef39572..e831b7c4b 100644 --- a/src/lib/krb5/rcache/ChangeLog +++ b/src/lib/krb5/rcache/ChangeLog @@ -1,3 +1,14 @@ +Wed Mar 1 12:03:30 1995 Keith Vetter (keithv@fusion.com) + + * *.c, *.h Added windows INTERFACE keyword + * Makefile.in: made to work on the PC. + * rc_dfl.c: Some int/long changes for the PC + * rc_io.c: hack to get Microsoft C in std-c mode to allow + low-level i/o routines. Probably not a permanent solution + but keep until we decide on a better method. + * rc_io.h: added 2 missing prototypes + * rc_dfl.h: added 2 missing prototypes + Tue Feb 28 01:03:34 1995 John Gilmore (gnu at toad.com) * *.c: Avoid includes. diff --git a/src/lib/krb5/rcache/Makefile.in b/src/lib/krb5/rcache/Makefile.in index a80e4a148..81d3660bc 100644 --- a/src/lib/krb5/rcache/Makefile.in +++ b/src/lib/krb5/rcache/Makefile.in @@ -1,14 +1,16 @@ CFLAGS = $(CCOPTS) $(DEFS) LDFLAGS = -g -all:: $(OBJS) +##DOSBUILDTOP = ..\..\.. +##DOSLIBNAME=..\libkrb5.lib +##DOS!include $(BUILDTOP)\config\windows.in OBJS= \ - rc_base.o \ - rc_dfl.o \ - rc_io.o \ - rcdef.o \ - rc_conv.o + rc_base.$(OBJEXT) \ + rc_dfl.$(OBJEXT) \ + rc_io.$(OBJEXT) \ + rcdef.$(OBJEXT) \ + rc_conv.$(OBJEXT) SRCS= \ $(srcdir)/rc_base.c \ @@ -16,3 +18,5 @@ SRCS= \ $(srcdir)/rc_io.c \ $(srcdir)/rcdef.c \ $(srcdir)/rc_conv.c + +all:: $(OBJS) diff --git a/src/lib/krb5/rcache/rc_base.c b/src/lib/krb5/rcache/rc_base.c index e0ff8d0c4..f7f9e44de 100644 --- a/src/lib/krb5/rcache/rc_base.c +++ b/src/lib/krb5/rcache/rc_base.c @@ -30,7 +30,7 @@ static struct krb5_rc_typelist *typehead = &krb5_rc_typelist_dfl; semaphore ex_typelist = 1; #endif -krb5_error_code krb5_rc_register_type(context, ops) +krb5_error_code INTERFACE krb5_rc_register_type(context, ops) krb5_context context; krb5_rc_ops *ops; { @@ -59,7 +59,7 @@ krb5_error_code krb5_rc_register_type(context, ops) return 0; } -krb5_error_code krb5_rc_resolve_type(context, id, type) +krb5_error_code INTERFACE krb5_rc_resolve_type(context, id, type) krb5_context context; krb5_rcache *id; char *type; @@ -80,14 +80,14 @@ krb5_error_code krb5_rc_resolve_type(context, id, type) return 0; } -char *krb5_rc_get_type(context, id) +char * INTERFACE krb5_rc_get_type(context, id) krb5_context context; krb5_rcache id; { return id->ops->type; } -char *krb5_rc_default_type(context) +char * INTERFACE krb5_rc_default_type(context) krb5_context context; { char *s; @@ -97,7 +97,7 @@ char *krb5_rc_default_type(context) return "dfl"; } -char *krb5_rc_default_name(context) +char * INTERFACE krb5_rc_default_name(context) krb5_context context; { char *s; @@ -107,7 +107,7 @@ char *krb5_rc_default_name(context) return (char *) 0; } -krb5_error_code +krb5_error_code INTERFACE krb5_rc_default(context, id) krb5_context context; krb5_rcache *id; @@ -129,7 +129,7 @@ krb5_rc_default(context, id) } -krb5_error_code krb5_rc_resolve_full(context, id, string_name) +krb5_error_code INTERFACE krb5_rc_resolve_full(context, id, string_name) krb5_context context; krb5_rcache *id; char *string_name; diff --git a/src/lib/krb5/rcache/rc_conv.c b/src/lib/krb5/rcache/rc_conv.c index 92cf77f8d..2ba4fca9c 100644 --- a/src/lib/krb5/rcache/rc_conv.c +++ b/src/lib/krb5/rcache/rc_conv.c @@ -21,7 +21,7 @@ Local stuff: given auth, take important information and make rep; return -1 if failed */ -krb5_error_code +krb5_error_code INTERFACE krb5_auth_to_rep(context, auth, rep) krb5_context context; krb5_tkt_authent *auth; diff --git a/src/lib/krb5/rcache/rc_dfl.c b/src/lib/krb5/rcache/rc_dfl.c index d631d91f2..a6476109b 100644 --- a/src/lib/krb5/rcache/rc_dfl.c +++ b/src/lib/krb5/rcache/rc_dfl.c @@ -14,6 +14,7 @@ #include "rc_base.h" #include "rc_dfl.h" #include "rc_io.h" +#include /* If NOIOSTUFF is defined at compile time, dfl rcaches will be per-process. @@ -59,8 +60,8 @@ static int hash(rep, hsize) krb5_donot_replay *rep; int hsize; { - return (((rep->cusec + rep->ctime + *rep->server + *rep->client) - % hsize) + hsize) % hsize; + return (int) ((((rep->cusec + rep->ctime + *rep->server + *rep->client) + % hsize) + hsize) % hsize); /* We take this opportunity to once again complain about C's idiotic %. */ } @@ -164,14 +165,14 @@ static int store(context, id, rep) return CMP_HOHUM; } -char *krb5_rc_dfl_get_name(context, id) +char * INTERFACE krb5_rc_dfl_get_name(context, id) krb5_context context; krb5_rcache id; { return ((struct dfl_data *) (id->data))->name; } -krb5_error_code krb5_rc_dfl_get_span(context, id, lifespan) +krb5_error_code INTERFACE krb5_rc_dfl_get_span(context, id, lifespan) krb5_context context; krb5_rcache id; krb5_deltat *lifespan; @@ -180,7 +181,7 @@ krb5_error_code krb5_rc_dfl_get_span(context, id, lifespan) return 0; } -krb5_error_code krb5_rc_dfl_init(context, id, lifespan) +krb5_error_code INTERFACE krb5_rc_dfl_init(context, id, lifespan) krb5_context context; krb5_rcache id; krb5_deltat lifespan; @@ -199,7 +200,7 @@ krb5_deltat lifespan; return 0; } -krb5_error_code krb5_rc_dfl_close_no_free(context, id) +krb5_error_code INTERFACE krb5_rc_dfl_close_no_free(context, id) krb5_context context; krb5_rcache id; { @@ -224,7 +225,7 @@ krb5_error_code krb5_rc_dfl_close_no_free(context, id) return 0; } -krb5_error_code krb5_rc_dfl_close(context, id) +krb5_error_code INTERFACE krb5_rc_dfl_close(context, id) krb5_context context; krb5_rcache id; { @@ -233,7 +234,7 @@ krb5_error_code krb5_rc_dfl_close(context, id) return 0; } -krb5_error_code krb5_rc_dfl_destroy(context, id) +krb5_error_code INTERFACE krb5_rc_dfl_destroy(context, id) krb5_context context; krb5_rcache id; { @@ -244,7 +245,7 @@ krb5_rcache id; return krb5_rc_dfl_close(context, id); } -krb5_error_code krb5_rc_dfl_resolve(context, id, name) +krb5_error_code INTERFACE krb5_rc_dfl_resolve(context, id, name) krb5_context context; krb5_rcache id; char *name; @@ -291,7 +292,7 @@ cleanup: return retval; } -void krb5_rc_free_entry (context, rep) +void INTERFACE krb5_rc_free_entry (context, rep) krb5_context context; krb5_donot_replay **rep; { @@ -311,7 +312,7 @@ void krb5_rc_free_entry (context, rep) } } -krb5_error_code krb5_rc_io_fetch(context, t, rep, maxlen) +static krb5_error_code krb5_rc_io_fetch(context, t, rep, maxlen) krb5_context context; struct dfl_data *t; krb5_donot_replay *rep; @@ -376,7 +377,7 @@ errout: -krb5_error_code krb5_rc_dfl_recover(context, id) +krb5_error_code INTERFACE krb5_rc_dfl_recover(context, id) krb5_context context; krb5_rcache id; { @@ -387,7 +388,7 @@ krb5_rcache id; struct dfl_data *t = (struct dfl_data *)id->data; krb5_donot_replay *rep; krb5_error_code retval; - int max_size; + long max_size; if (retval = krb5_rc_io_open(context, &t->d,t->name)) return retval; @@ -415,7 +416,7 @@ krb5_rcache id; rep->client = NULL; rep->server = NULL; - retval = krb5_rc_io_fetch (context, t, rep, max_size); + retval = krb5_rc_io_fetch (context, t, rep, (int) max_size); if (retval == KRB5_RC_IO_EOF) break; @@ -455,7 +456,8 @@ io_fail: #endif } -krb5_error_code krb5_rc_io_store (context, t, rep) +static krb5_error_code +krb5_rc_io_store (context, t, rep) krb5_context context; struct dfl_data *t; krb5_donot_replay *rep; @@ -484,7 +486,7 @@ krb5_error_code krb5_rc_io_store (context, t, rep) return ret; } -krb5_error_code krb5_rc_dfl_store(context, id, rep) +krb5_error_code INTERFACE krb5_rc_dfl_store(context, id, rep) krb5_context context; krb5_rcache id; krb5_donot_replay *rep; @@ -520,7 +522,7 @@ krb5_donot_replay *rep; return 0; } -krb5_error_code krb5_rc_dfl_expunge(context, id) +krb5_error_code INTERFACE krb5_rc_dfl_expunge(context, id) krb5_context context; krb5_rcache id; { diff --git a/src/lib/krb5/rcache/rc_dfl.h b/src/lib/krb5/rcache/rc_dfl.h index 76e0e58cd..0245ed06b 100644 --- a/src/lib/krb5/rcache/rc_dfl.h +++ b/src/lib/krb5/rcache/rc_dfl.h @@ -15,36 +15,42 @@ extern krb5_rc_ops krb5_rc_dfl_ops; /* initialized to the following */ -krb5_error_code krb5_rc_dfl_init +krb5_error_code INTERFACE krb5_rc_dfl_init PROTOTYPE((krb5_context, krb5_rcache, krb5_deltat)); -krb5_error_code krb5_rc_dfl_recover +krb5_error_code INTERFACE krb5_rc_dfl_recover PROTOTYPE((krb5_context, krb5_rcache)); -krb5_error_code krb5_rc_dfl_destroy +krb5_error_code INTERFACE krb5_rc_dfl_destroy PROTOTYPE((krb5_context, krb5_rcache)); -krb5_error_code krb5_rc_dfl_close +krb5_error_code INTERFACE krb5_rc_dfl_close PROTOTYPE((krb5_context, krb5_rcache)); -krb5_error_code krb5_rc_dfl_store +krb5_error_code INTERFACE krb5_rc_dfl_store PROTOTYPE((krb5_context, krb5_rcache, krb5_donot_replay *)); -krb5_error_code krb5_rc_dfl_expunge +krb5_error_code INTERFACE krb5_rc_dfl_expunge PROTOTYPE((krb5_context, krb5_rcache)); -krb5_error_code krb5_rc_dfl_get_span +krb5_error_code INTERFACE krb5_rc_dfl_get_span PROTOTYPE((krb5_context, krb5_rcache, krb5_deltat *)); -char *krb5_rc_dfl_get_name +char * INTERFACE krb5_rc_dfl_get_name PROTOTYPE((krb5_context, krb5_rcache)); -krb5_error_code krb5_rc_dfl_resolve +krb5_error_code INTERFACE krb5_rc_dfl_resolve PROTOTYPE((krb5_context, krb5_rcache, char *)); - +krb5_error_code INTERFACE krb5_rc_dfl_close_no_free + PROTOTYPE((krb5_context, + krb5_rcache)); +void INTERFACE krb5_rc_free_entry + PROTOTYPE((krb5_context, + krb5_donot_replay **)); #endif + diff --git a/src/lib/krb5/rcache/rc_io.c b/src/lib/krb5/rcache/rc_io.c index c6814e318..99ac03261 100644 --- a/src/lib/krb5/rcache/rc_io.c +++ b/src/lib/krb5/rcache/rc_io.c @@ -13,20 +13,60 @@ #define KRB5_RC_VNO 0x0501 /* krb5, rcache v 1 */ +#define NEED_WINSOCK_H #include /* for P_tmpdir */ - +#include #include "rc_base.h" #include "rc_dfl.h" #include "rc_io.h" +/* 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. Perhaps this should + * go into config.h but leave it here for now until we see how prevalent + * this problem is. + */ +#ifdef MSDOS_FILESYSTEM +#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 stat _stat +#define getpid _getpid +#define unlink _unlink +#define lseek _lseek +#define write _write +#define open _open +#define close _close +#define read _read +#define fstat _fstat +#endif + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + #ifdef KRB5_USE_INET +#ifndef _WINSOCKAPI_ #include +#endif #else #error find some way to use net-byte-order file version numbers. #endif +#ifndef HAVE_ERRNO extern int errno; /* this should be in errno.h, but isn't on some systems */ +#endif #define FREE(x) ((void) free((char *) (x))) #define UNIQUE getpid() /* hopefully unique number */ @@ -55,7 +95,7 @@ static void getdir() } } -krb5_error_code krb5_rc_io_creat (context, d, fn) +krb5_error_code INTERFACE krb5_rc_io_creat (context, d, fn) krb5_context context; krb5_rc_iostuff *d; char **fn; @@ -72,7 +112,7 @@ krb5_error_code krb5_rc_io_creat (context, d, fn) (void) strcpy(d->fn,dir); (void) strcat(d->fn,"/"); (void) strcat(d->fn,*fn); - d->fd = open(d->fn,O_WRONLY | O_CREAT | O_TRUNC | O_EXCL,0600); + d->fd = open(d->fn,O_WRONLY | O_CREAT | O_TRUNC | O_EXCL | O_BINARY,0600); } else { @@ -86,7 +126,7 @@ krb5_error_code krb5_rc_io_creat (context, d, fn) (void) sprintf(d->fn,"%s/krb5_RC%d",dir,UNIQUE); c = d->fn + strlen(d->fn); (void) strcpy(c,"aaa"); - while ((d->fd = open(d->fn,O_WRONLY|O_CREAT|O_TRUNC|O_EXCL,0600)) == -1) + while ((d->fd = open(d->fn,O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_BINARY,0600)) == -1) { if ((c[2]++) == 'z') { @@ -139,14 +179,16 @@ krb5_error_code krb5_rc_io_creat (context, d, fn) return 0; } -krb5_error_code krb5_rc_io_open (context, d, fn) +krb5_error_code INTERFACE krb5_rc_io_open (context, d, fn) krb5_context context; krb5_rc_iostuff *d; char *fn; { krb5_int16 rc_vno; krb5_error_code retval; +#ifndef NO_USERID struct stat statb; +#endif GETDIR; if (!(d->fn = malloc(strlen(fn) + dirlen + 1))) @@ -154,6 +196,10 @@ krb5_error_code krb5_rc_io_open (context, d, fn) (void) strcpy(d->fn,dir); (void) strcat(d->fn,"/"); (void) strcat(d->fn,fn); + +#ifdef NO_USERID + d->fd = open(d->fn,O_RDWR | O_BINARY,0600); +#else if ((d->fd = stat(d->fn, &statb)) != -1) { uid_t me; @@ -164,8 +210,9 @@ krb5_error_code krb5_rc_io_open (context, d, fn) FREE(d->fn); return KRB5_RC_IO_PERM; } - d->fd = open(d->fn,O_RDWR,0600); + d->fd = open(d->fn,O_RDWR | O_BINARY,0600); } +#endif if (d->fd == -1) { switch(errno) { @@ -210,7 +257,7 @@ krb5_error_code krb5_rc_io_open (context, d, fn) return 0; } -krb5_error_code krb5_rc_io_move (context, new, old) +krb5_error_code INTERFACE krb5_rc_io_move (context, new, old) krb5_context context; krb5_rc_iostuff *new; krb5_rc_iostuff *old; @@ -223,7 +270,7 @@ krb5_error_code krb5_rc_io_move (context, new, old) return 0; } -krb5_error_code krb5_rc_io_write (context, d, buf, num) +krb5_error_code INTERFACE krb5_rc_io_write (context, d, buf, num) krb5_context context; krb5_rc_iostuff *d; krb5_pointer buf; @@ -244,10 +291,11 @@ krb5_error_code krb5_rc_io_write (context, d, buf, num) return 0; } -krb5_error_code krb5_rc_io_sync (context, d) +krb5_error_code INTERFACE krb5_rc_io_sync (context, d) krb5_context context; krb5_rc_iostuff *d; { +#ifndef MSDOS_FILESYSTEM if (fsync(d->fd) == -1) { switch(errno) { @@ -256,10 +304,11 @@ krb5_error_code krb5_rc_io_sync (context, d) default: return KRB5_RC_IO_UNKNOWN; } } +#endif return 0; } -krb5_error_code krb5_rc_io_read (context, d, buf, num) +krb5_error_code INTERFACE krb5_rc_io_read (context, d, buf, num) krb5_context context; krb5_rc_iostuff *d; krb5_pointer buf; @@ -278,7 +327,7 @@ krb5_error_code krb5_rc_io_read (context, d, buf, num) return 0; } -krb5_error_code krb5_rc_io_close (context, d) +krb5_error_code INTERFACE krb5_rc_io_close (context, d) krb5_context context; krb5_rc_iostuff *d; { @@ -289,7 +338,7 @@ krb5_error_code krb5_rc_io_close (context, d) return 0; } -krb5_error_code krb5_rc_io_destroy (context, d) +krb5_error_code INTERFACE krb5_rc_io_destroy (context, d) krb5_context context; krb5_rc_iostuff *d; { @@ -306,7 +355,7 @@ krb5_error_code krb5_rc_io_destroy (context, d) return 0; } -krb5_error_code krb5_rc_io_mark (context, d) +krb5_error_code INTERFACE krb5_rc_io_mark (context, d) krb5_context context; krb5_rc_iostuff *d; { @@ -314,7 +363,7 @@ krb5_error_code krb5_rc_io_mark (context, d) return 0; } -krb5_error_code krb5_rc_io_unmark (context, d) +krb5_error_code INTERFACE krb5_rc_io_unmark (context, d) krb5_context context; krb5_rc_iostuff *d; { @@ -322,7 +371,9 @@ krb5_error_code krb5_rc_io_unmark (context, d) return 0; } -int krb5_rc_io_size (context, d) +long INTERFACE +krb5_rc_io_size (context, d) + krb5_context context; krb5_rc_iostuff *d; { struct stat statb; diff --git a/src/lib/krb5/rcache/rc_io.h b/src/lib/krb5/rcache/rc_io.h index b88e3b2d5..74df1a0ae 100644 --- a/src/lib/krb5/rcache/rc_io.h +++ b/src/lib/krb5/rcache/rc_io.h @@ -16,46 +16,55 @@ typedef struct krb5_rc_iostuff { int fd; +#ifdef MSDOS_FILESYSTEM + long mark; +#else int mark; /* on newer systems, should be pos_t */ +#endif char *fn; } krb5_rc_iostuff; /* first argument is always iostuff for result file */ -krb5_error_code krb5_rc_io_creat +krb5_error_code INTERFACE krb5_rc_io_creat PROTOTYPE((krb5_context, krb5_rc_iostuff *, char **)); -krb5_error_code krb5_rc_io_open +krb5_error_code INTERFACE krb5_rc_io_open PROTOTYPE((krb5_context, krb5_rc_iostuff *, char *)); -krb5_error_code krb5_rc_io_move +krb5_error_code INTERFACE krb5_rc_io_move PROTOTYPE((krb5_context, krb5_rc_iostuff *, krb5_rc_iostuff *)); -krb5_error_code krb5_rc_io_write +krb5_error_code INTERFACE krb5_rc_io_write PROTOTYPE((krb5_context, krb5_rc_iostuff *, krb5_pointer, int)); -krb5_error_code krb5_rc_io_read +krb5_error_code INTERFACE krb5_rc_io_read PROTOTYPE((krb5_context, krb5_rc_iostuff *, krb5_pointer, int)); -krb5_error_code krb5_rc_io_close +krb5_error_code INTERFACE krb5_rc_io_close PROTOTYPE((krb5_context, krb5_rc_iostuff *)); -krb5_error_code krb5_rc_io_destroy +krb5_error_code INTERFACE krb5_rc_io_destroy PROTOTYPE((krb5_context, krb5_rc_iostuff *)); -krb5_error_code krb5_rc_io_mark +krb5_error_code INTERFACE krb5_rc_io_mark PROTOTYPE((krb5_context, krb5_rc_iostuff *)); -krb5_error_code krb5_rc_io_unmark +krb5_error_code INTERFACE krb5_rc_io_unmark + PROTOTYPE((krb5_context, + krb5_rc_iostuff *)); +krb5_error_code INTERFACE krb5_rc_io_sync + PROTOTYPE((krb5_context, + krb5_rc_iostuff *)); +long INTERFACE krb5_rc_io_size PROTOTYPE((krb5_context, krb5_rc_iostuff *)); - #endif -- 2.26.2