From: Theodore Tso Date: Thu, 21 Dec 1995 23:55:22 +0000 (+0000) Subject: Use KRB5_CC_FORMAT as an error code instead of KRB5_CCACHE_BADVNO, X-Git-Tag: krb5-1.0-beta6~671 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1b9bcfd033a1c1e823bbf2b75643f9fffbecf185;p=krb5.git Use KRB5_CC_FORMAT as an error code instead of KRB5_CCACHE_BADVNO, when it's really a format error in the credentials cache file. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7248 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/ccache/file/ChangeLog b/src/lib/krb5/ccache/file/ChangeLog index 3a2cba833..9d8e8662d 100644 --- a/src/lib/krb5/ccache/file/ChangeLog +++ b/src/lib/krb5/ccache/file/ChangeLog @@ -4,6 +4,9 @@ Thu Dec 21 18:28:09 1995 Theodore Y. Ts'o FCC_OPEN_AND_ERASE, unlink the old filename, and then add the O_EXCL open flag, to prevent O_CREAT from following a symbolic link. + (krb5_fcc_open_file): Use KRB5_CC_FORMAT as an error code + instead of KRB5_CCACHE_BADVNO, when it's really a format + error in the credentials cache file. Fri Oct 6 22:03:16 1995 Theodore Y. Ts'o diff --git a/src/lib/krb5/ccache/file/fcc_maybe.c b/src/lib/krb5/ccache/file/fcc_maybe.c index 622302a12..2071c681e 100644 --- a/src/lib/krb5/ccache/file/fcc_maybe.c +++ b/src/lib/krb5/ccache/file/fcc_maybe.c @@ -269,7 +269,7 @@ krb5_fcc_open_file (context, id, mode) sizeof(fcc_fvno)) { (void) fcc_lock_file(data, fd, UNLOCK_IT); (void) close(fd); - return KRB5_CCACHE_BADVNO; + return KRB5_CC_FORMAT; } if ((fcc_fvno != htons(KRB5_FCC_FVNO_4)) && (fcc_fvno != htons(KRB5_FCC_FVNO_3)) && @@ -287,14 +287,14 @@ krb5_fcc_open_file (context, id, mode) != sizeof(fcc_flen)) { (void) fcc_lock_file(data, fd, UNLOCK_IT); (void) close(fd); - return KRB5_CCACHE_BADVNO; + return KRB5_CC_FORMAT; } /* Skip past the header info for now */ - if (fcc_flen = htons(fcc_flen)) { + if ((fcc_flen = htons(fcc_flen)) != 0) { if ((krb5_ui_2) read(fd, buf, fcc_flen) != fcc_flen) { (void) fcc_lock_file(data, fd, UNLOCK_IT); (void) close(fd); - return KRB5_CCACHE_BADVNO; + return KRB5_CC_FORMAT; } } } diff --git a/src/lib/krb5/ccache/stdio/ChangeLog b/src/lib/krb5/ccache/stdio/ChangeLog index e7059f7b3..d86d0fc4d 100644 --- a/src/lib/krb5/ccache/stdio/ChangeLog +++ b/src/lib/krb5/ccache/stdio/ChangeLog @@ -4,6 +4,9 @@ Thu Dec 21 18:33:39 1995 Theodore Y. Ts'o SCC_OPEN_AND_ERASE, unlink the filename first, in case there's a symbolic link lurking about. (We should do an exclusive open then, but there's no such thing in stdio.) + (krb5_scc_open_file): Use KRB5_CC_FORMAT as an error code + instead of KRB5_CCACHE_BADVNO, when it's really a format + error in the credentials cache file. Mon Sep 25 16:56:51 1995 Theodore Y. Ts'o diff --git a/src/lib/krb5/ccache/stdio/scc_maybe.c b/src/lib/krb5/ccache/stdio/scc_maybe.c index 5a535e16c..ef6261745 100644 --- a/src/lib/krb5/ccache/stdio/scc_maybe.c +++ b/src/lib/krb5/ccache/stdio/scc_maybe.c @@ -165,7 +165,7 @@ krb5_scc_open_file (context, id, mode) if (!fread((char *)fvno_bytes, sizeof(fvno_bytes), 1, f)) { (void) krb5_unlock_file(context, fileno(f)); (void) fclose(f); - return KRB5_CCACHE_BADVNO; + return KRB5_CC_FORMAT; } data->version = (fvno_bytes[0] << 8) + fvno_bytes[1]; if ((data->version != KRB5_SCC_FVNO_1) && @@ -183,13 +183,13 @@ krb5_scc_open_file (context, id, mode) if (!fread((char *)fvno_bytes, sizeof(fvno_bytes), 1, f)) { (void) krb5_unlock_file(context, fileno(f)); (void) fclose(f); - return KRB5_CCACHE_BADVNO; + return KRB5_CC_FORMAT; } - if (len = (fvno_bytes[0] << 8) + fvno_bytes[1]) { + if ((len = (fvno_bytes[0] << 8) + fvno_bytes[1]) != 0) { if (!fread(buf, len, 1, f)) { (void) krb5_unlock_file(context, fileno(f)); (void) fclose(f); - return KRB5_CCACHE_BADVNO; + return KRB5_CC_FORMAT; } } }