From: Ezra Peisach Date: Tue, 12 Sep 1995 01:14:12 +0000 (+0000) Subject: Reintegrate changes lost during Macintosh checkin X-Git-Tag: krb5-1.0-beta6~1099 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9e5877591d25d32e4da802563fb15efe87a20e4c;p=krb5.git Reintegrate changes lost during Macintosh checkin git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6763 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/ccache/file/ChangeLog b/src/lib/krb5/ccache/file/ChangeLog index ac4bb51d0..2bde4b58c 100644 --- a/src/lib/krb5/ccache/file/ChangeLog +++ b/src/lib/krb5/ccache/file/ChangeLog @@ -1,3 +1,12 @@ +Mon Sep 11 21:05:40 1995 Ezra Peisach + + * fcc_maybe.c (krb5_fcc_open_file): use THREEPARAMOPEN instead of + just open. + +Wed Sep 06 14:20:57 1995 Chris Provenzano (proven@mit.edu) + + * file_read.c, file_write.c : s/keytype/enctype/g, s/KEYTYPE/ENCTYPE/g + Wed Sept 6 12:00:00 EDT 1995 James Mattly (mattly@fusion.com) * fcc_retrv.c: for _MACINTOSH, defined register to null for compiler @@ -5,6 +14,15 @@ Wed Sept 6 12:00:00 EDT 1995 James Mattly (mattly@fusion.com) * fcc_maybe.c: included +Tue Sep 05 22:58:52 1995 + + * fcc.h : Add another KRB5_FCC_FVNO but don't up the default. + * fcc_gennew.c, fcc_maybe.c : New version saves a length after + version for whatever we want to put into the ccache before + the first credential (like a time skew) + * fcc_read.c, fcc_write.c : Remove krb5_enctype references, and + replace with krb5_keytype where appropriate + Tue Aug 29 13:36:00 EDT 1995 Paul Park (pjpark@mit.edu) * fcc_reslv.c - Set magic number in successfully resolved ccache. diff --git a/src/lib/krb5/ccache/file/fcc.h b/src/lib/krb5/ccache/file/fcc.h index 980a9c17e..0e26fa7f6 100644 --- a/src/lib/krb5/ccache/file/fcc.h +++ b/src/lib/krb5/ccache/file/fcc.h @@ -55,6 +55,7 @@ #define KRB5_FCC_FVNO_1 0x0501 /* krb5 v5, fcc v1 */ #define KRB5_FCC_FVNO_2 0x0502 /* krb5 v5, fcc v2 */ #define KRB5_FCC_FVNO_3 0x0503 /* krb5 v5, fcc v3 */ +#define KRB5_FCC_FVNO_4 0x0504 /* krb5 v5, fcc v4 */ #define KRB5_FCC_DEFAULT_FVNO KRB5_FCC_FVNO_3 diff --git a/src/lib/krb5/ccache/file/fcc_gennew.c b/src/lib/krb5/ccache/file/fcc_gennew.c index 13757e9d5..93d963b15 100644 --- a/src/lib/krb5/ccache/file/fcc_gennew.c +++ b/src/lib/krb5/ccache/file/fcc_gennew.c @@ -107,6 +107,7 @@ krb5_fcc_generate_new (context, id) goto err_out; } else { krb5_int16 fcc_fvno = htons(KRB5_FCC_DEFAULT_FVNO); + krb5_int16 fcc_flen = 0; int errsave, cnt; /* Ignore user's umask, set mode = 0600 */ @@ -125,6 +126,17 @@ krb5_fcc_generate_new (context, id) retcode = (cnt == -1) ? krb5_fcc_interpret(context, errsave) : KRB5_CC_IO; goto err_out; } + /* For version 4 we save a length for the rest of the header */ + if (KRB5_FCC_DEFAULT_FVNO == KRB5_FCC_FVNO_4) { + if ((cnt = write(ret, (char *)&fcc_flen, sizeof(fcc_flen))) + != sizeof(fcc_flen)) { + errsave = errno; + (void) close(ret); + (void) unlink(((krb5_fcc_data *) lid->data)->filename); + retcode = (cnt == -1) ? krb5_fcc_interpret(context, errsave) : KRB5_CC_IO; + goto err_out; + } + } if (close(ret) == -1) { errsave = errno; (void) unlink(((krb5_fcc_data *) lid->data)->filename); diff --git a/src/lib/krb5/ccache/file/fcc_maybe.c b/src/lib/krb5/ccache/file/fcc_maybe.c index 8df018b38..e70645503 100644 --- a/src/lib/krb5/ccache/file/fcc_maybe.c +++ b/src/lib/krb5/ccache/file/fcc_maybe.c @@ -267,15 +267,35 @@ krb5_fcc_open_file (context, id, mode) (void) close(fd); return KRB5_CCACHE_BADVNO; } - if ((fcc_fvno != htons(KRB5_FCC_FVNO_3)) && + if ((fcc_fvno != htons(KRB5_FCC_FVNO_4)) && + (fcc_fvno != htons(KRB5_FCC_FVNO_3)) && (fcc_fvno != htons(KRB5_FCC_FVNO_2)) && (fcc_fvno != htons(KRB5_FCC_FVNO_1))) { (void) fcc_lock_file(data, fd, UNLOCK_IT); (void) close(fd); return KRB5_CCACHE_BADVNO; } - data->version = ntohs(fcc_fvno); - } - data->fd = fd; - return 0; + if (fcc_fvno == htons(KRB5_FCC_FVNO_4)) { + krb5_ui_2 fcc_flen; + char buf[1024]; + + if (read(fd, (char *)&fcc_flen, sizeof(fcc_flen)) + != sizeof(fcc_flen)) { + (void) fcc_lock_file(data, fd, UNLOCK_IT); + (void) close(fd); + return KRB5_CCACHE_BADVNO; + } + /* Skip past the header info for now */ + if (fcc_flen = htons(fcc_flen)) { + if (read(fd, buf, fcc_flen) != fcc_flen) { + (void) fcc_lock_file(data, fd, UNLOCK_IT); + (void) close(fd); + return KRB5_CCACHE_BADVNO; + } + } + } + data->version = ntohs(fcc_fvno); + } + data->fd = fd; + return 0; } diff --git a/src/lib/krb5/ccache/file/fcc_read.c b/src/lib/krb5/ccache/file/fcc_read.c index e963d9eb7..41395f14f 100644 --- a/src/lib/krb5/ccache/file/fcc_read.c +++ b/src/lib/krb5/ccache/file/fcc_read.c @@ -204,14 +204,11 @@ krb5_fcc_read_keyblock(context, id, keyblock) keyblock->contents = 0; kret = krb5_fcc_read_ui_2(context, id, &ui2); - keyblock->keytype = ui2; + keyblock->enctype = ui2; CHECK(kret); - if ((data->version == KRB5_FCC_FVNO_1) || - (data->version == KRB5_FCC_FVNO_2)) - keyblock->etype = ETYPE_UNKNOWN; - else { + if (data->version == KRB5_FCC_FVNO_3) { kret = krb5_fcc_read_ui_2(context, id, &ui2); - keyblock->etype = ui2; + keyblock->enctype = ui2; CHECK(kret); } diff --git a/src/lib/krb5/ccache/file/fcc_write.c b/src/lib/krb5/ccache/file/fcc_write.c index 38067b5f5..566789ef2 100644 --- a/src/lib/krb5/ccache/file/fcc_write.c +++ b/src/lib/krb5/ccache/file/fcc_write.c @@ -147,11 +147,10 @@ krb5_fcc_store_keyblock(context, id, keyblock) krb5_fcc_data *data = (krb5_fcc_data *)id->data; krb5_error_code ret; - ret = krb5_fcc_store_ui_2(context, id, keyblock->keytype); + ret = krb5_fcc_store_ui_2(context, id, keyblock->enctype); CHECK(ret); - if ((data->version != KRB5_FCC_FVNO_1) && - (data->version != KRB5_FCC_FVNO_2)) { - ret = krb5_fcc_store_ui_2(context, id, keyblock->etype); + if (data->version == KRB5_FCC_FVNO_3) { + ret = krb5_fcc_store_ui_2(context, id, keyblock->enctype); CHECK(ret); } ret = krb5_fcc_store_int32(context, id, keyblock->length);