+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 <eichin@cygnus.com>
* configure.in: take out ISODE_DEFS.
* This file contains the source code for krb5_scc_generate_new.
*/
-
#include "scc.h"
-
#include "k5-int.h"
-#ifdef KRB5_USE_INET
-#include <netinet/in.h>
-#else
- #error find some way to use net-byte-order file version numbers.
-#endif
-
extern krb5_cc_ops krb5_scc_ops;
/*
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);
* 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
* This file contains the source code for conditional open/close calls.
*/
-
#include "scc.h"
#include "k5-int.h"
-#ifdef KRB5_USE_INET
-#include <netinet/in.h>
-#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
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;
/* 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);
}
} 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;