Add patch to fix past date handling

Resolves: RHEL-97024
This commit is contained in:
Ondřej Pohořelský 2025-06-30 15:39:44 +02:00
parent 55072d7e68
commit 46e6e618c8
2 changed files with 39 additions and 1 deletions

33
at-3.1.23-past-date.patch Normal file
View File

@ -0,0 +1,33 @@
From 3a5bfc32357bd6bf27bde41a599ce797be221420 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Poho=C5=99elsk=C3=BD?= <opohorel@redhat.com>
Date: Mon, 30 Jun 2025 15:23:26 +0200
Subject: [PATCH] Reject past dates when using -t option
-t option was missing validation to reject past dates, unlike the
regular time parsing.
Add the same past date validation used by parsetime() to the posixtime()
code path to ensure consistent behavior when parsing time.
---
at.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/at.c b/at.c
index 2136e0b..d65168d 100644
--- a/at.c
+++ b/at.c
@@ -860,6 +860,11 @@ main(int argc, char **argv)
fprintf(stderr, "invalid date format: %s\n", optarg);
exit(EXIT_FAILURE);
}
+ /* Check if the parsed time is in the past */
+ if (timer < time(NULL)) {
+ fprintf(stderr, "at: refusing to create job destined in the past\n");
+ exit(EXIT_FAILURE);
+ }
/* drop seconds */
timer -= timer % 60;
break;
--
2.50.0

View File

@ -3,7 +3,7 @@
Summary: Job spooling tools
Name: at
Version: 3.1.23
Release: 11%{?dist}
Release: 12%{?dist}
# http://packages.debian.org/changelogs/pool/main/a/at/current/copyright
# + install-sh is MIT license with changes under Public Domain
License: GPLv3+ and GPLv2+ and ISC and MIT and Public Domain
@ -33,6 +33,7 @@ Patch: at-3.1.20-lock-locks.patch
Patch: at-3.1.23-document-n.patch
Patch: at-3.1.20-log-jobs.patch
Patch: at-3.2.23-coverity-fix.patch
Patch: at-3.1.23-past-date.patch
BuildRequires: gcc
BuildRequires: flex flex-static bison autoconf
@ -166,6 +167,10 @@ chown root:root %{_localstatedir}/spool/at/.SEQ
%attr(0644,root,root) /%{_unitdir}/atd.service
%changelog
* Mon Jun 30 2025 Ondřej Pohořelský <opohorel@redhat.com> - 3.1.23-12
- Add patch to fix past date handling
- Resolves: RHEL-97024
* Fri Apr 01 2022 Jan Staněk <jstanek@redhat.com> - 3.1.23-10
- Add preceding newline to delimiter in at-3.1.20-shell.patch
Resolves: rhbz#2070858