]> granicus.if.org Git - sudo/commitdiff
Use log_warning() instead of log_fatal() if the ticket or lecture
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 26 Mar 2014 20:22:46 +0000 (14:22 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 26 Mar 2014 20:22:46 +0000 (14:22 -0600)
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.

plugins/sudoers/timestamp.c

index 021eb7e0f47b5b4eaa929a47a3026235e76bbbde..265427481647482d6ec8859854af396704c42849 100644 (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,11 +599,11 @@ 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);
        }
-       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. */