From 8055d4ce29fde10ccbf0265e3d2b307892030cde Mon Sep 17 00:00:00 2001 From: John Gilmore Date: Sat, 18 Mar 1995 03:34:17 +0000 Subject: [PATCH] * scc_errs.c: Mac doesn't have EISDIR error. * scc_gennew.c, scc_maybe.c: Eliminate the use of htons and ntohs for byte order handling; just do it by hand. * scc_read.c (krb5_scc_read_authdatum): Zap unused variable "ret". * Makefile.in (LDFLAGS): Eliminate, duplicates config/pre.in. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5159 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/ccache/stdio/ChangeLog | 8 ++++++++ src/lib/krb5/ccache/stdio/Makefile.in | 1 - src/lib/krb5/ccache/stdio/scc_errs.c | 4 +++- src/lib/krb5/ccache/stdio/scc_gennew.c | 14 ++++---------- src/lib/krb5/ccache/stdio/scc_maybe.c | 26 +++++++++++--------------- src/lib/krb5/ccache/stdio/scc_read.c | 1 - 6 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/lib/krb5/ccache/stdio/ChangeLog b/src/lib/krb5/ccache/stdio/ChangeLog index 045707fbf..fea5c2a92 100644 --- a/src/lib/krb5/ccache/stdio/ChangeLog +++ b/src/lib/krb5/ccache/stdio/ChangeLog @@ -1,3 +1,11 @@ +Fri Mar 17 19:24:05 1995 John Gilmore (gnu at toad.com) + + * scc_errs.c: Mac doesn't have EISDIR error. + * scc_gennew.c, scc_maybe.c: Eliminate the use of htons and ntohs + for byte order handling; just do it by hand. + * scc_read.c (krb5_scc_read_authdatum): Zap unused variable "ret". + * Makefile.in (LDFLAGS): Eliminate, duplicates config/pre.in. + Tue Mar 7 19:55:01 1995 Mark Eichin * configure.in: take out ISODE_DEFS. diff --git a/src/lib/krb5/ccache/stdio/Makefile.in b/src/lib/krb5/ccache/stdio/Makefile.in index 9c2f2e541..67d926680 100644 --- a/src/lib/krb5/ccache/stdio/Makefile.in +++ b/src/lib/krb5/ccache/stdio/Makefile.in @@ -1,5 +1,4 @@ CFLAGS = $(CCOPTS) $(DEFS) -LDFLAGS = -g OBJS = scc_close.o scc_destry.o scc_eseq.o \ scc_gennew.o scc_getnam.o scc_gprin.o scc_init.o \ diff --git a/src/lib/krb5/ccache/stdio/scc_errs.c b/src/lib/krb5/ccache/stdio/scc_errs.c index 77ad352af..f12f8b77d 100644 --- a/src/lib/krb5/ccache/stdio/scc_errs.c +++ b/src/lib/krb5/ccache/stdio/scc_errs.c @@ -43,7 +43,9 @@ int errnum; break; case EPERM: case EACCES: - case EISDIR: +#ifdef EISDIR + case EISDIR: /* Mac doesn't have EISDIR */ +#endif case ENOTDIR: case ETXTBSY: case EBUSY: diff --git a/src/lib/krb5/ccache/stdio/scc_gennew.c b/src/lib/krb5/ccache/stdio/scc_gennew.c index 3a1c18168..b5f5cab4c 100644 --- a/src/lib/krb5/ccache/stdio/scc_gennew.c +++ b/src/lib/krb5/ccache/stdio/scc_gennew.c @@ -24,17 +24,9 @@ * This file contains the source code for krb5_scc_generate_new. */ - #include "scc.h" - #include "k5-int.h" -#ifdef KRB5_USE_INET -#include -#else - #error find some way to use net-byte-order file version numbers. -#endif - extern krb5_cc_ops krb5_scc_ops; /* @@ -103,9 +95,11 @@ krb5_scc_generate_new (context, id) retcode = krb5_scc_interpret (context, errno); goto err_out; } else { - krb5_int16 scc_fvno = htons(KRB5_SCC_DEFAULT_FVNO); + unsigned char scc_fvno[2] = { + (unsigned char) (KRB5_SCC_DEFAULT_FVNO >> 8), + (unsigned char) (KRB5_SCC_DEFAULT_FVNO & 0xFF)}; - if (!fwrite((char *)&scc_fvno, sizeof(scc_fvno), 1, f)) { + if (!fwrite((char *)scc_fvno, sizeof(scc_fvno), 1, f)) { retcode = krb5_scc_interpret(context, errno); (void) fclose(f); (void) remove(((krb5_scc_data *) lid->data)->filename); diff --git a/src/lib/krb5/ccache/stdio/scc_maybe.c b/src/lib/krb5/ccache/stdio/scc_maybe.c index f17c5c385..510299a66 100644 --- a/src/lib/krb5/ccache/stdio/scc_maybe.c +++ b/src/lib/krb5/ccache/stdio/scc_maybe.c @@ -4,6 +4,8 @@ * Copyright 1990,1991 by the Massachusetts Institute of Technology. * All Rights Reserved. * + * Copyright 1995 by Cygnus Support. + * * 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 @@ -24,16 +26,9 @@ * This file contains the source code for conditional open/close calls. */ - #include "scc.h" #include "k5-int.h" -#ifdef KRB5_USE_INET -#include -#else - #error find some way to use net-byte-order file version numbers. -#endif - int krb5_scc_default_format = KRB5_SCC_DEFAULT_FVNO; krb5_error_code @@ -81,7 +76,7 @@ krb5_scc_open_file (context, id, mode) krb5_ccache id; int mode; { - krb5_int16 scc_fvno; + char fvno_bytes[2]; /* In nework standard byte order, big endian */ krb5_scc_data *data; FILE *f; char *open_flag; @@ -150,9 +145,10 @@ krb5_scc_open_file (context, id, mode) /* write the version number */ int errsave; - scc_fvno = htons(krb5_scc_default_format); + fvno_bytes[0] = krb5_scc_default_format >> 8; + fvno_bytes[1] = krb5_scc_default_format & 0xFF; data->version = krb5_scc_default_format; - if (!fwrite((char *)&scc_fvno, sizeof(scc_fvno), 1, f)) { + if (!fwrite((char *)fvno_bytes, sizeof(fvno_bytes), 1, f)) { errsave = errno; (void) krb5_unlock_file(context, f, data->filename); (void) fclose(f); @@ -160,19 +156,19 @@ krb5_scc_open_file (context, id, mode) } } else { /* verify a valid version number is there */ - if (!fread((char *)&scc_fvno, sizeof(scc_fvno), 1, f)) { + if (!fread((char *)&fvno_bytes, sizeof(fvno_bytes), 1, f)) { (void) krb5_unlock_file(context, f, data->filename); (void) fclose(f); return KRB5_CCACHE_BADVNO; } - if ((scc_fvno != htons(KRB5_SCC_FVNO_1)) && - (scc_fvno != htons(KRB5_SCC_FVNO_2)) && - (scc_fvno != htons(KRB5_SCC_FVNO_3))) { + data->version = (fvno_bytes[0] << 8) + fvno_bytes[1]; + if ((data->version != KRB5_SCC_FVNO_1) && + (data->version != KRB5_SCC_FVNO_2) && + (data->version != KRB5_SCC_FVNO_3)) { (void) krb5_unlock_file(context, f, data->filename); (void) fclose(f); return KRB5_CCACHE_BADVNO; } - data->version = ntohs(scc_fvno); } data->file = f; return 0; diff --git a/src/lib/krb5/ccache/stdio/scc_read.c b/src/lib/krb5/ccache/stdio/scc_read.c index ea3f9ed2f..88bf62011 100644 --- a/src/lib/krb5/ccache/stdio/scc_read.c +++ b/src/lib/krb5/ccache/stdio/scc_read.c @@ -442,7 +442,6 @@ krb5_scc_read_authdatum(context, id, a) krb5_error_code kret; krb5_int32 int32; krb5_ui_2 ui2; - int ret; a->magic = KV5M_AUTHDATA; a->contents = NULL; -- 2.26.2