Ensure that we don't accidentally attempt to use or fclose() a file which
we have already fclose()d.
This commit is contained in:
parent
2802804a49
commit
efbd8d58cc
40
krb5-1.5-fclose.patch
Normal file
40
krb5-1.5-fclose.patch
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
Ensure that we don't accidentally attempt to use or fclose() a file which we
|
||||||
|
have already fclose()d.
|
||||||
|
|
||||||
|
--- krb5-1.5/src/lib/krb5/keytab/kt_file.c 2006-06-13 10:14:27.000000000 -0400
|
||||||
|
+++ krb5-1.5/src/lib/krb5/keytab/kt_file.c 2006-07-05 14:55:11.000000000 -0400
|
||||||
|
@@ -1083,29 +1083,32 @@
|
||||||
|
if (writevno) {
|
||||||
|
kt_vno = htons(krb5_kt_default_vno);
|
||||||
|
KTVERSION(id) = krb5_kt_default_vno;
|
||||||
|
if (!xfwrite(&kt_vno, sizeof(kt_vno), 1, KTFILEP(id))) {
|
||||||
|
- kerror = errno;
|
||||||
|
+ kerror = errno ? errno : EIO;
|
||||||
|
(void) krb5_unlock_file(context, fileno(KTFILEP(id)));
|
||||||
|
(void) fclose(KTFILEP(id));
|
||||||
|
+ KTFILEP(id) = 0;
|
||||||
|
return kerror;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* gotta verify it instead... */
|
||||||
|
if (!xfread(&kt_vno, sizeof(kt_vno), 1, KTFILEP(id))) {
|
||||||
|
if (feof(KTFILEP(id)))
|
||||||
|
kerror = KRB5_KEYTAB_BADVNO;
|
||||||
|
else
|
||||||
|
- kerror = errno;
|
||||||
|
+ kerror = errno ? errno : EIO;
|
||||||
|
(void) krb5_unlock_file(context, fileno(KTFILEP(id)));
|
||||||
|
(void) fclose(KTFILEP(id));
|
||||||
|
+ KTFILEP(id) = 0;
|
||||||
|
return kerror;
|
||||||
|
}
|
||||||
|
kt_vno = KTVERSION(id) = ntohs(kt_vno);
|
||||||
|
if ((kt_vno != KRB5_KT_VNO) &&
|
||||||
|
(kt_vno != KRB5_KT_VNO_1)) {
|
||||||
|
(void) krb5_unlock_file(context, fileno(KTFILEP(id)));
|
||||||
|
(void) fclose(KTFILEP(id));
|
||||||
|
+ KTFILEP(id) = 0;
|
||||||
|
return KRB5_KEYTAB_BADVNO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
Loading…
Reference in New Issue
Block a user