Use log_warning() instead of log_fatal() if the ticket or lecture

path is too long and just return an error.  This can only happen
from a misconfiguration so just ignoring the ticket/lecture file
is safe.
This commit is contained in:
Todd C. Miller
2014-03-26 14:22:46 -06:00
parent 639ac92e6d
commit db54815996

View File

@@ -310,8 +310,9 @@ build_timestamp(struct passwd *pw)
len = snprintf(timestamp_file, sizeof(timestamp_file), "%s/%s",
def_timestampdir, user_name);
if (len <= 0 || (size_t)len >= sizeof(timestamp_file)) {
log_fatal(0, N_("timestamp path too long: %s/%s"),
log_warning(0, N_("timestamp path too long: %s/%s"),
def_timestampdir, user_name);
len = -1;
}
debug_return_int(len);
@@ -598,12 +599,12 @@ already_lectured(int unused)
if (ts_secure_dir(def_lecture_status_dir, false, true)) {
len = snprintf(status_file, sizeof(status_file), "%s/%s",
def_lecture_status_dir, user_name);
if (len <= 0 || (size_t)len >= sizeof(status_file)) {
log_fatal(0, N_("lecture status path too long: %s/%s"),
def_lecture_status_dir, user_name);
}
if (len > 0 && (size_t)len < sizeof(status_file)) {
debug_return_bool(stat(status_file, &sb) == 0);
}
log_warning(0, N_("lecture status path too long: %s/%s"),
def_lecture_status_dir, user_name);
}
debug_return_bool(false);
}
@@ -621,8 +622,9 @@ set_lectured(void)
len = snprintf(lecture_status, sizeof(lecture_status), "%s/%s",
def_lecture_status_dir, user_name);
if (len <= 0 || (size_t)len >= sizeof(lecture_status)) {
log_fatal(0, N_("lecture status path too long: %s/%s"),
log_warning(0, N_("lecture status path too long: %s/%s"),
def_lecture_status_dir, user_name);
goto done;
}
/* Sanity check lecture dir and create if missing. */