add [libdefaults]fcache_strict_checking to gate the strict checking, defaults to on

This commit is contained in:
Love Hornquist Astrand
2013-07-11 21:17:49 +02:00
parent 2a565482f4
commit f396f66523
5 changed files with 16 additions and 2 deletions

View File

@@ -395,6 +395,7 @@ fcc_open(krb5_context context,
krb5_error_code ret;
const char *filename;
struct stat sb1, sb2;
int strict_checking;;
int fd;
if (FCACHE(id) == NULL)
@@ -402,7 +403,10 @@ fcc_open(krb5_context context,
filename = FILENAME(id);
if ((flags & O_CREAT) == 0) {
strict_checking = (flags & O_CREAT) == 0 &&
(context->flags & KRB5_CTX_F_FCACHE_STRICT_CHECKING) != 0;
if (strict_checking) {
ret = lstat(filename, &sb1);
if (ret < 0) {
krb5_set_error_message(context, ret, N_("%s lstat(%s)", "file, error"),
@@ -423,7 +427,7 @@ fcc_open(krb5_context context,
}
rk_cloexec(fd);
if ((flags & O_CREAT) == 0) {
if (strict_checking) {
ret = fstat(fd, &sb2);
if (ret < 0) {