krb5: Always try mkdir in DIR: ccache (quiet [harmless] TOCTOU warning)
This commit is contained in:
@@ -273,19 +273,18 @@ verify_directory(krb5_context context, const char *path)
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* XXX should use mkdirx_np() */
|
||||||
|
if (rk_mkdir(path, S_IRWXU) == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (stat(path, &sb) != 0) {
|
if (stat(path, &sb) != 0) {
|
||||||
if (errno == ENOENT) {
|
if (errno == ENOENT) {
|
||||||
/* XXX should use mkdirx_np() */
|
|
||||||
if (rk_mkdir(path, S_IRWXU) == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
krb5_set_error_message(context, ENOENT,
|
krb5_set_error_message(context, ENOENT,
|
||||||
N_("DIR directory %s doesn't exists", ""), path);
|
N_("DIR directory %s doesn't exists", ""), path);
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
} else {
|
} else {
|
||||||
int ret = errno;
|
krb5_set_error_message(context, errno,
|
||||||
krb5_set_error_message(context, ret,
|
N_("DIR directory %s is bad: %s", ""), path, strerror(errno));
|
||||||
N_("DIR directory %s is bad: %s", ""), path, strerror(ret));
|
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user