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 <tytso@dcl>
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)) &&
!= 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;
}
}
}
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 <tytso@dcl>
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) &&
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;
}
}
}