Update to new upstream release

- Removed at-3.1.14-usePOSIXtimers.patch and at-3.2.23-coverity-fix.patch,
    because upstream implemented them
- Defined folder paths without %%{buildroot} in order to make them work
    with latest Makefile changes
- Resolves: rhbz#2048132
This commit is contained in:
Ondřej Pohořelský 2022-02-22 17:01:05 +01:00
parent 0bf0345468
commit 61a47903a5
12 changed files with 208 additions and 427 deletions

4
.gitignore vendored
View File

@ -13,3 +13,7 @@ at_3.1.12.orig.tar.gz
/at_3.2.1.orig.tar.gz.asc
/at_3.2.2.orig.tar.gz
/at_3.2.2.orig.tar.gz.asc
/at_3.2.4.orig.tar.gz
/at_3.2.4.orig.tar.gz.asc
/at_3.2.5.orig.tar.gz
/at_3.2.5.orig.tar.gz.sig

View File

@ -1,111 +0,0 @@
diff -up at-3.1.14/atd.c.timers at-3.1.14/atd.c
--- at-3.1.14/atd.c.timers 2013-12-02 11:03:01.250080057 +0100
+++ at-3.1.14/atd.c 2013-12-02 11:06:15.560243498 +0100
@@ -831,6 +831,54 @@ run_loop()
return next_job;
}
+#ifdef HAVE_TIMER_CREATE
+timer_t timer;
+struct itimerspec timeout;
+
+void timer_setup()
+{
+ struct sigevent sev;
+
+ sev.sigev_notify = SIGEV_SIGNAL;
+ sev.sigev_signo = SIGHUP;
+ sev.sigev_value.sival_ptr = &timer;
+
+ memset(&timeout, 0, sizeof(timeout));
+
+ if (timer_create(CLOCK_REALTIME, &sev, &timer) < 0)
+ pabort("unable to create timer");
+}
+
+time_t atd_gettime()
+{
+ struct timespec curtime;
+
+ clock_gettime(CLOCK_REALTIME, &curtime);
+
+ return curtime.tv_sec;
+}
+
+void atd_setalarm(time_t next)
+{
+ timeout.it_value.tv_sec = next;
+ timer_settime(timer, TIMER_ABSTIME, &timeout, NULL);
+ pause();
+}
+#else
+void timer_setup()
+{
+}
+
+time_t atd_gettime()
+{
+ return time(NULL);
+}
+
+void atd_setalarm(time_t next)
+{
+ sleep(next - atd_gettime());
+}
+#endif
/* Global functions */
int
@@ -936,7 +984,7 @@ main(int argc, char *argv[])
sigaction(SIGCHLD, &act, NULL);
if (!run_as_daemon) {
- now = time(NULL);
+ now = atd_gettime();
run_loop();
exit(EXIT_SUCCESS);
}
@@ -959,13 +1007,14 @@ main(int argc, char *argv[])
act.sa_handler = set_term;
sigaction(SIGINT, &act, NULL);
+ timer_setup();
daemon_setup();
do {
- now = time(NULL);
+ now = atd_gettime();
next_invocation = run_loop();
if (next_invocation > now) {
- sleep(next_invocation - now);
+ atd_setalarm(next_invocation);
}
} while (!term_signal);
daemon_cleanup();
diff -up at-3.1.14/config.h.in.timers at-3.1.14/config.h.in
--- at-3.1.14/config.h.in.timers 2013-12-02 11:00:27.000000000 +0100
+++ at-3.1.14/config.h.in 2013-12-02 11:02:06.521033976 +0100
@@ -38,6 +38,9 @@
/* Define to 1 if you have the `getloadavg' function. */
#undef HAVE_GETLOADAVG
+/* Define to 1 if you have the `timer_create' function. */
+#undef HAVE_TIMER_CREATE
+
/* Define to 1 if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
diff -up at-3.1.14/configure.ac.timers at-3.1.14/configure.ac
--- at-3.1.14/configure.ac.timers 2013-12-02 11:00:27.000000000 +0100
+++ at-3.1.14/configure.ac 2013-12-02 11:02:45.217066560 +0100
@@ -254,6 +254,10 @@ AC_CHECK_LIB(selinux, is_selinux_enabled
AC_SUBST(SELINUXLIB)
AC_SUBST(WITH_SELINUX)
+dnl check for POSIX timer functions
+AC_SEARCH_LIBS([timer_create],[rt])
+AC_CHECK_FUNCS([timer_create])
+
AC_MSG_CHECKING(groupname to run under)
AC_ARG_WITH(daemon_groupname,
[ --with-daemon_groupname=DAEMON_GROUPNAME Groupname to run under (default daemon) ],

View File

@ -1,84 +0,0 @@
diff -ur b/Makefile.in a/Makefile.in
--- b/Makefile.in 2021-04-25 03:31:30.000000000 +0200
+++ a/Makefile.in 2021-05-20 17:44:24.477236293 +0200
@@ -71,13 +71,13 @@
all: at atd atd.service atrun
at: $(ATOBJECTS)
- $(CC) $(LDFLAGS) -o at $(ATOBJECTS) $(LIBS) $(LEXLIB)
+ $(CC) $(LDFLAGS) -pie -o at $(ATOBJECTS) $(LIBS) $(LEXLIB)
rm -f $(CLONES)
$(LN_S) -f at atq
$(LN_S) -f at atrm
atd: $(RUNOBJECTS)
- $(CC) $(LDFLAGS) -o atd $(RUNOBJECTS) $(LIBS) $(PAMLIB) $(SELINUXLIB)
+ $(CC) $(LDFLAGS) -pie -o atd $(RUNOBJECTS) $(LIBS) $(PAMLIB) $(SELINUXLIB)
y.tab.c y.tab.h: parsetime.y
$(YACC) -d parsetime.y
@@ -92,40 +92,41 @@
configure
.c.o:
- $(CC) -c $(CFLAGS) $(DEFS) $*.c
+ $(CC) -c $(CFLAGS) -fPIE $(DEFS) $*.c
install: all
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(etcdir)
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(bindir)
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(sbindir)
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(atdatadir)
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(docdir)
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(atdocdir)
- $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 755 -d $(IROOT)$(ATSPOOL_DIR) $(IROOT)$(ATJOB_DIR)
- chmod 1770 $(IROOT)$(ATSPOOL_DIR) $(IROOT)$(ATJOB_DIR)
+ $(INSTALL) -m 755 -d $(IROOT)$(etcdir)
+ $(INSTALL) -m 755 -d $(IROOT)$(bindir)
+ $(INSTALL) -m 755 -d $(IROOT)$(sbindir)
+ $(INSTALL) -m 755 -d $(IROOT)$(docdir)
+ $(INSTALL) -m 755 -d $(IROOT)$(atdocdir)
+ $(INSTALL) -m 755 -d $(IROOT)$(etcdir)/pam.d/
+ $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 755 -d $(IROOT)$(ATSPOOL_DIR)
+ chmod 700 $(IROOT)$(ATJOB_DIR) $(IROOT)$(ATSPOOL_DIR)
+ chown $(DAEMON_USERNAME):$(DAEMON_GROUPNAME) $(IROOT)$(ATJOB_DIR) $(IROOT)$(ATSPOOL_DIR)
touch $(IROOT)$(LFILE)
chmod 600 $(IROOT)$(LFILE)
chown $(DAEMON_USERNAME):$(DAEMON_GROUPNAME) $(IROOT)$(LFILE)
- test -f $(IROOT)$(etcdir)/at.allow || test -f $(IROOT)$(etcdir)/at.deny || $(INSTALL) -o root -g $(DAEMON_GROUPNAME) -m 640 at.deny $(IROOT)$(etcdir)/
- $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 6755 at $(IROOT)$(bindir)
+ test -f $(IROOT)$(etcdir)/at.allow || test -f $(IROOT)$(etcdir)/at.deny || $(INSTALL) -m 600 at.deny $(IROOT)$(etcdir)/
+ $(INSTALL) -o $(INSTALL_ROOT_USER) -g $(DAEMON_GROUPNAME) pam_atd $(IROOT)$(etcdir)/pam.d/atd
+ $(INSTALL) -m 4755 at $(IROOT)$(bindir)
$(LN_S) -f at $(IROOT)$(bindir)/atq
$(LN_S) -f at $(IROOT)$(bindir)/atrm
- $(INSTALL) -g root -o root -m 755 batch $(IROOT)$(bindir)
- $(INSTALL) -g root -o root -m 755 batch-job $(IROOT)$(atdatadir)
- $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man1dir)
- $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man5dir)
- $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man8dir)
- $(INSTALL) -g root -o root -m 755 atd $(IROOT)$(sbindir)
- $(INSTALL) -g root -o root -m 755 atrun $(IROOT)$(sbindir)
- $(INSTALL) -g root -o root -m 644 at.1 $(IROOT)$(man1dir)/
+ $(INSTALL) -m 755 batch $(IROOT)$(bindir)
+ $(INSTALL) -d -m 755 $(IROOT)$(man1dir)
+ $(INSTALL) -d -m 755 $(IROOT)$(man5dir)
+ $(INSTALL) -d -m 755 $(IROOT)$(man8dir)
+ $(INSTALL) -m 755 atd $(IROOT)$(sbindir)
+ $(INSTALL) -m 755 atrun $(IROOT)$(sbindir)
+ $(INSTALL) -m 644 at.1 $(IROOT)$(man1dir)/
cd $(IROOT)$(man1dir) && $(LN_S) -f at.1 atq.1 && $(LN_S) -f at.1 batch.1 && $(LN_S) -f at.1 atrm.1
- $(INSTALL) -g root -o root -m 644 atd.8 $(IROOT)$(man8dir)/
+ $(INSTALL) -m 644 atd.8 $(IROOT)$(man8dir)/
sed "s,\$${exec_prefix},$(exec_prefix),g" <atrun.8>tmpman
- $(INSTALL) -g root -o root -m 644 tmpman $(IROOT)$(man8dir)/atrun.8
+ $(INSTALL) -m 644 tmpman $(IROOT)$(man8dir)/atrun.8
rm -f tmpman
- $(INSTALL) -g root -o root -m 644 at.allow.5 $(IROOT)$(man5dir)/
+ $(INSTALL) -m 644 at.allow.5 $(IROOT)$(man5dir)/
cd $(IROOT)$(man5dir) && $(LN_S) -f at.allow.5 at.deny.5
- $(INSTALL) -g root -o root -m 644 $(DOCS) $(IROOT)$(atdocdir)
+ $(INSTALL) -m 644 $(DOCS) $(IROOT)$(atdocdir)
rm -f $(IROOT)$(mandir)/cat1/at.1* $(IROOT)$(mandir)/cat1/batch.1* \
$(IROOT)$(mandir)/cat1/atq.1*
rm -f $(IROOT)$(mandir)/cat1/atd.8*

View File

@ -1,115 +0,0 @@
From 4be4813262b3b57a95a5f3ce909d30741aa3ac72 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= <jstanek@redhat.com>
Date: Fri, 9 Apr 2021 16:47:33 +0200
Subject: [PATCH] Address issues raised by static analysis
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jan Staněk <jstanek@redhat.com>
---
at.c | 22 ++++++++++++++++++----
daemon.c | 21 ++++++++++++++-------
2 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/at.c b/at.c
index df55dc9..0c74e2e 100644
--- a/at.c
+++ b/at.c
@@ -545,17 +545,27 @@ writefile(time_t runtimer, char queue)
return;
}
- if (fstat(fd, &statbuf) == -1)
+ if (fstat(fd, &statbuf) == -1) {
+ close(fd);
return;
+ }
if ((statbuf.st_uid != 0) || !S_ISREG(statbuf.st_mode) ||
- (statbuf.st_mode & (S_IWGRP | S_IWOTH)))
+ (statbuf.st_mode & (S_IWGRP | S_IWOTH))) {
+ close(fd);
return;
+ }
fp = fdopen(fd, "r");
- if (fp == NULL)
+ if (fp == NULL) {
+ close(fd);
return;
- if (fscanf(fp, "%d", &pid) != 1)
+ }
+ if (fscanf(fp, "%d", &pid) != 1) {
+ fclose(fp);
return;
+ } else {
+ fclose(fp);
+ }
kill_errno = 0;
@@ -640,6 +650,8 @@ list_jobs(void)
else
printf("%ld\t%s %c\n", jobno, timestr, queue);
}
+ closedir(spool);
+
PRIV_END
}
@@ -722,6 +734,8 @@ process_jobs(int argc, char **argv, int what)
putchar(ch);
}
done = 1;
+ fclose(fp);
+ fp = NULL;
}
else {
perr("Cannot open %.500s", dirent->d_name);
diff --git a/daemon.c b/daemon.c
index 4003b56..bc8191e 100644
--- a/daemon.c
+++ b/daemon.c
@@ -122,18 +122,23 @@ daemon_setup()
/* Set up standard daemon environment */
pid_t pid;
mode_t old_umask;
- int fd;
+ int fd, devnull;
FILE *fp;
if (!daemon_debug) {
- close(0);
- close(1);
- close(2);
- if ((open("/dev/null", O_RDWR) != 0) ||
- (open("/dev/null", O_RDWR) != 1) ||
- (open("/dev/null", O_RDWR) != 2)) {
+ devnull = open("/dev/null", O_RDWR);
+ if (devnull == -1) {
perr("Error redirecting I/O");
}
+
+ if ((dup2(devnull, 0) == -1) ||
+ (dup2(devnull, 1) == -1) ||
+ (dup2(devnull, 2) == -1)) {
+ close(devnull);
+ perr("Error redirecting I/O");
+ } else {
+ close(devnull);
+ }
}
if (daemon_foreground)
@@ -208,6 +213,8 @@ daemon_setup()
fcntl(fd, F_SETFD, FD_CLOEXEC);
PRIV_END
+ /* See the above comment. */
+ /* coverity[leaked_storage: FALSE] */
return;
}
--
2.31.1

View File

@ -1,14 +1,14 @@
diff -up at-3.1.20/atd.c.aborted at-3.1.20/atd.c
--- at-3.1.20/atd.c.aborted 2017-09-14 15:31:47.971486148 +0200
+++ at-3.1.20/atd.c 2017-09-14 15:43:53.506567281 +0200
@@ -731,12 +731,17 @@ run_loop()
diff -ur b/atd.c a/atd.c
--- b/atd.c 2022-02-22 15:55:28.745663105 +0100
+++ a/atd.c 2022-02-22 16:07:26.416578085 +0100
@@ -722,12 +722,18 @@
/* Is the file already locked?
*/
if (buf.st_nlink > 1) {
+ if (run_time < buf.st_mtime)
+ run_time = buf.st_mtime;
if (run_time + CHECK_INTERVAL <= now) {
-
/* Something went wrong the last time this was executed.
* Let's remove the lockfile and reschedule.
+ * We also change the timestamp to avoid rerunning the job more
@ -17,6 +17,6 @@ diff -up at-3.1.20/atd.c.aborted at-3.1.20/atd.c
strncpy(lock_name, dirent->d_name, sizeof(lock_name));
+ if (utime(lock_name, 0) < 0)
+ syslog(LOG_ERR, "utime couldn't be set for lock file %s\n", lock_name);
lock_name[sizeof(lock_name)-1] = '\0';
lock_name[sizeof(lock_name)-1] = '\0';
lock_name[0] = '=';
unlink(lock_name);

View File

@ -1,7 +1,7 @@
diff -up at-3.1.14/atd.c.mail at-3.1.14/atd.c
--- at-3.1.14/atd.c.mail 2013-12-04 11:39:44.556239282 +0100
+++ at-3.1.14/atd.c 2013-12-04 11:40:50.544234246 +0100
@@ -100,6 +100,10 @@ int selinux_enabled=0;
diff -ur b/atd.c a/atd.c
--- b/atd.c 2022-02-22 15:21:06.649147600 +0100
+++ a/atd.c 2022-02-22 15:49:13.640184845 +0100
@@ -98,6 +98,10 @@
#define BATCH_INTERVAL_DEFAULT 60
#define CHECK_INTERVAL 3600
@ -12,15 +12,15 @@ diff -up at-3.1.14/atd.c.mail at-3.1.14/atd.c
/* Global variables */
uid_t real_uid, effective_uid;
@@ -117,6 +121,7 @@ static time_t last_chg;
static int nothing_to_do;
@@ -115,6 +119,7 @@
static int nothing_to_do = 0;
unsigned int batch_interval;
static int run_as_daemon = 0;
+static int mail_with_hostname = 0;
static int hupped = 0;
static volatile sig_atomic_t term_signal = 0;
@@ -298,6 +303,7 @@ run_file(const char *filename, uid_t uid
@@ -301,6 +306,7 @@
char fmt[64];
unsigned long jobno;
int rc;
@ -28,19 +28,19 @@ diff -up at-3.1.14/atd.c.mail at-3.1.14/atd.c
#ifdef WITH_PAM
int retcode;
#endif
@@ -452,6 +458,11 @@ run_file(const char *filename, uid_t uid
@@ -455,6 +461,11 @@
write_string(fd_out, "Subject: Output from your job ");
write_string(fd_out, jobbuf);
+ if (mail_with_hostname > 0) {
+ gethostname(hostbuf, MAXHOSTNAMELEN-1);
+ gethostname(hostbuf, MAXHOSTNAMELEN-1);
+ write_string(fd_out, " ");
+ write_string(fd_out, hostbuf);
+ }
write_string(fd_out, "\nTo: ");
write_string(fd_out, mailname);
write_string(fd_out, "\n\n");
@@ -843,7 +854,7 @@ main(int argc, char *argv[])
@@ -905,7 +916,7 @@
run_as_daemon = 1;
batch_interval = BATCH_INTERVAL_DEFAULT;
@ -49,7 +49,7 @@ diff -up at-3.1.14/atd.c.mail at-3.1.14/atd.c
switch (c) {
case 'l':
if (sscanf(optarg, "%lf", &load_avg) != 1)
@@ -865,6 +876,10 @@ main(int argc, char *argv[])
@@ -927,6 +938,10 @@
daemon_foreground++;
break;

84
at-3.2.5-make.patch Normal file
View File

@ -0,0 +1,84 @@
diff -ur b/Makefile.in a/Makefile.in
--- b/Makefile.in 2022-01-29 17:42:19.000000000 +0100
+++ a/Makefile.in 2022-02-22 13:22:45.060320153 +0100
@@ -76,13 +76,13 @@
all: at atd atd.service atrun
at: $(ATOBJECTS)
- $(CC) $(LDFLAGS) -o at $(ATOBJECTS) $(LIBS) $(LEXLIB)
+ $(CC) $(LDFLAGS) -pie -o at $(ATOBJECTS) $(LIBS) $(LEXLIB)
rm -f $(CLONES)
$(LN_S) -f at atq
$(LN_S) -f at atrm
atd: $(RUNOBJECTS)
- $(CC) $(LDFLAGS) -o atd $(RUNOBJECTS) $(LIBS) $(PAMLIB) $(SELINUXLIB)
+ $(CC) $(LDFLAGS) -pie -o atd $(RUNOBJECTS) $(LIBS) $(PAMLIB) $(SELINUXLIB)
y.tab.c y.tab.h: parsetime.y
$(YACC) -d parsetime.y
@@ -99,40 +99,41 @@
configure
.c.o:
- $(CC) -c $(CFLAGS) $(DEFS) $*.c
+ $(CC) -c $(CFLAGS) -fPIE $(DEFS) $*.c
install: all
- $(INSTALL) -g root -o root -m 755 -d $(DESTDIR)$(etcdir)
- $(INSTALL) -g root -o root -m 755 -d $(DESTDIR)$(bindir)
- $(INSTALL) -g root -o root -m 755 -d $(DESTDIR)$(sbindir)
- $(INSTALL) -g root -o root -m 755 -d $(DESTDIR)$(atdatadir)
- $(INSTALL) -g root -o root -m 755 -d $(DESTDIR)$(docdir)
- $(INSTALL) -g root -o root -m 755 -d $(DESTDIR)$(atdocdir)
- $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 755 -d $(DESTDIR)$(ATSPOOL_DIR) $(DESTDIR)$(ATJOB_DIR)
- chmod 1770 $(DESTDIR)$(ATSPOOL_DIR) $(DESTDIR)$(ATJOB_DIR)
+ $(INSTALL) -m 755 -d $(DESTDIR)$(etcdir)
+ $(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
+ $(INSTALL) -m 755 -d $(DESTDIR)$(sbindir)
+ $(INSTALL) -m 755 -d $(DESTDIR)$(docdir)
+ $(INSTALL) -m 755 -d $(DESTDIR)$(atdocdir)
+ $(INSTALL) -m 755 -d $(DESTDIR)$(etcdir)/pam.d/
+ $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 755 -d $(DESTDIR)$(ATSPOOL_DIR)
+ chmod 700 $(DESTDIR)$(ATJOB_DIR) $(DESTDIR)$(ATSPOOL_DIR)
+ chown $(DAEMON_USERNAME):$(DAEMON_GROUPNAME) $(DESTDIR)$(ATJOB_DIR) $(DESTDIR)$(ATSPOOL_DIR)
touch $(DESTDIR)$(LFILE)
chmod 600 $(DESTDIR)$(LFILE)
chown $(DAEMON_USERNAME):$(DAEMON_GROUPNAME) $(DESTDIR)$(LFILE)
- test -f $(DESTDIR)$(etcdir)/at.allow || test -f $(DESTDIR)$(etcdir)/at.deny || $(INSTALL) -o root -g $(DAEMON_GROUPNAME) -m 640 at.deny $(DESTDIR)$(etcdir)/
- $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 6755 at $(DESTDIR)$(bindir)
+ test -f $(DESTDIR)$(etcdir)/at.allow || test -f $(DESTDIR)$(etcdir)/at.deny || $(INSTALL) -m 600 at.deny $(DESTDIR)$(etcdir)/
+ $(INSTALL) -o $(INSTALL_ROOT_USER) -g $(DAEMON_GROUPNAME) pam_atd $(DESTDIR)$(etcdir)/pam.d/atd
+ $(INSTALL) -m 4755 at $(DESTDIR)$(bindir)
$(LN_S) -f at $(DESTDIR)$(bindir)/atq
$(LN_S) -f at $(DESTDIR)$(bindir)/atrm
- $(INSTALL) -g root -o root -m 755 batch $(DESTDIR)$(bindir)
- $(INSTALL) -g root -o root -m 755 batch-job $(DESTDIR)$(atdatadir)
- $(INSTALL) -d -o root -g root -m 755 $(DESTDIR)$(man1dir)
- $(INSTALL) -d -o root -g root -m 755 $(DESTDIR)$(man5dir)
- $(INSTALL) -d -o root -g root -m 755 $(DESTDIR)$(man8dir)
- $(INSTALL) -g root -o root -m 755 atd $(DESTDIR)$(sbindir)
- $(INSTALL) -g root -o root -m 755 atrun $(DESTDIR)$(sbindir)
- $(INSTALL) -g root -o root -m 644 at.1 $(DESTDIR)$(man1dir)/
+ $(INSTALL) -m 755 batch $(DESTDIR)$(bindir)
+ $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
+ $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
+ $(INSTALL) -d -m 755 $(DESTDIR)$(man8dir)
+ $(INSTALL) -m 755 atd $(DESTDIR)$(sbindir)
+ $(INSTALL) -m 755 atrun $(DESTDIR)$(sbindir)
+ $(INSTALL) -m 644 at.1 $(DESTDIR)$(man1dir)/
cd $(DESTDIR)$(man1dir) && $(LN_S) -f at.1 atq.1 && $(LN_S) -f at.1 batch.1 && $(LN_S) -f at.1 atrm.1
- $(INSTALL) -g root -o root -m 644 atd.8 $(DESTDIR)$(man8dir)/
+ $(INSTALL) -m 644 atd.8 $(DESTDIR)$(man8dir)/
sed "s,\$${exec_prefix},$(exec_prefix),g" <atrun.8>tmpman
- $(INSTALL) -g root -o root -m 644 tmpman $(DESTDIR)$(man8dir)/atrun.8
+ $(INSTALL) -m 644 tmpman $(DESTDIR)$(man8dir)/atrun.8
rm -f tmpman
- $(INSTALL) -g root -o root -m 644 at.allow.5 $(DESTDIR)$(man5dir)/
+ $(INSTALL) -m 644 at.allow.5 $(DESTDIR)$(man5dir)/
cd $(DESTDIR)$(man5dir) && $(LN_S) -f at.allow.5 at.deny.5
- $(INSTALL) -g root -o root -m 644 $(DOCS) $(DESTDIR)$(atdocdir)
+ $(INSTALL) -m 644 $(DOCS) $(DESTDIR)$(atdocdir)
rm -f $(DESTDIR)$(mandir)/cat1/at.1* $(DESTDIR)$(mandir)/cat1/batch.1* \
$(DESTDIR)$(mandir)/cat1/atq.1*
rm -f $(DESTDIR)$(mandir)/cat1/atd.8*

View File

@ -1,7 +1,19 @@
diff -up at-3.1.18/atd.c.nit at-3.1.18/atd.c
--- at-3.1.18/atd.c.nit 2016-03-23 12:46:49.222277787 +0100
+++ at-3.1.18/atd.c 2016-03-23 12:47:50.521639804 +0100
@@ -196,6 +196,18 @@ myfork()
diff -ur b/at.1.in a/at.1.in
--- b/at.1.in 2022-01-29 17:42:19.000000000 +0100
+++ a/at.1.in 2022-02-22 15:19:47.598996428 +0100
@@ -226,7 +226,7 @@
.BR batch .
Queues with higher letters run with increased niceness. The special
queue "=" is reserved for jobs which are currently running.
-.P
+
If a job is submitted to a queue designated with an uppercase letter, the
job is treated as if it were submitted to batch at the time of the job.
Once the time is reached, the batch processing rules with respect to load
diff -ur b/atd.c a/atd.c
--- b/atd.c 2022-02-22 15:14:02.736336912 +0100
+++ a/atd.c 2022-02-22 15:19:02.163909540 +0100
@@ -197,6 +197,18 @@
#define fork myfork
#endif
@ -20,7 +32,7 @@ diff -up at-3.1.18/atd.c.nit at-3.1.18/atd.c
#ifdef WITH_SELINUX
static int
@@ -339,6 +351,9 @@ run_file(const char *filename, uid_t uid
@@ -340,6 +352,9 @@
free(newname);
return;
}
@ -30,51 +42,39 @@ diff -up at-3.1.18/atd.c.nit at-3.1.18/atd.c
/* Let's see who we mail to. Hopefully, we can read it from
* the command file; if not, send it to the owner, or, failing that,
* to root.
@@ -507,6 +522,9 @@ run_file(const char *filename, uid_t uid
@@ -508,6 +523,9 @@
if (setuid(uid) < 0)
perr("Cannot set user id");
+ if (SIG_ERR == signal(SIGCHLD, SIG_DFL))
+ if (SIG_ERR == signal(SIGCHLD, SIG_DFL))
+ perr("Cannot reset signal handler to default");
+
chdir("/");
execle("/bin/sh", "sh", (char *) NULL, nenvp);
@@ -572,6 +590,9 @@ run_file(const char *filename, uid_t uid
@@ -573,6 +591,9 @@
if (setuid(uid) < 0)
perr("Cannot set user id");
+ if (SIG_ERR == signal(SIGCHLD, SIG_DFL))
+ if (SIG_ERR == signal(SIGCHLD, SIG_DFL))
+ perr("Cannot reset signal handler to default");
+
chdir ("/");
#if defined(SENDMAIL)
@@ -699,6 +720,7 @@ run_loop()
@@ -707,6 +728,7 @@
* Let's remove the lockfile and reschedule.
*/
strncpy(lock_name, dirent->d_name, sizeof(lock_name));
+ lock_name[sizeof(lock_name)-1] = '\0';
+ lock_name[sizeof(lock_name)-1] = '\0';
lock_name[0] = '=';
unlink(lock_name);
next_job = now;
@@ -733,6 +755,7 @@ run_loop()
@@ -741,6 +763,7 @@
run_batch++;
if (strcmp(batch_name, dirent->d_name) > 0) {
strncpy(batch_name, dirent->d_name, sizeof(batch_name));
+ batch_name[sizeof(batch_name)-1] = '\0';
+ batch_name[sizeof(batch_name)-1] = '\0';
batch_uid = buf.st_uid;
batch_gid = buf.st_gid;
batch_queue = queue;
diff -up at-3.1.18/at.1.in.nit at-3.1.18/at.1.in
--- at-3.1.18/at.1.in.nit 2015-12-06 16:45:10.000000000 +0100
+++ at-3.1.18/at.1.in 2016-03-23 12:46:49.226277876 +0100
@@ -210,7 +210,7 @@ queue for
.BR batch .
Queues with higher letters run with increased niceness. The special
queue "=" is reserved for jobs which are currently running.
-.P
+
If a job is submitted to a queue designated with an uppercase letter, the
job is treated as if it were submitted to batch at the time of the job.
Once the time is reached, the batch processing rules with respect to load

View File

@ -1,7 +1,7 @@
diff -up at-3.1.18/atd.c.noabort at-3.1.18/atd.c
--- at-3.1.18/atd.c.noabort 2016-03-23 12:49:15.147520116 +0100
+++ at-3.1.18/atd.c 2016-03-23 12:49:15.148520138 +0100
@@ -349,9 +349,12 @@ run_file(const char *filename, uid_t uid
diff -ur b/atd.c a/atd.c
--- b/atd.c 2022-02-22 16:09:15.683717386 +0100
+++ a/atd.c 2022-02-22 16:12:48.992989327 +0100
@@ -344,9 +344,12 @@
*/
pid = fork();
@ -17,7 +17,7 @@ diff -up at-3.1.18/atd.c.noabort at-3.1.18/atd.c
else if (pid != 0) {
free(mailname);
free(newname);
@@ -669,15 +672,19 @@ run_loop()
@@ -659,16 +662,20 @@
* up.
*/
@ -28,10 +28,11 @@ diff -up at-3.1.18/atd.c.noabort at-3.1.18/atd.c
+ return next_job;
+ }
if (nothing_to_do && buf.st_mtime <= last_chg)
if (nothing_to_do && buf.st_mtime == last_chg)
return next_job;
last_chg = buf.st_mtime;
hupped = 0;
- if ((spool = opendir(".")) == NULL)
- perr("Cannot read " ATJOB_DIR);
+ if ((spool = opendir(".")) == NULL) {

View File

@ -1,7 +1,7 @@
diff -ur b/at.c a/at.c
--- b/at.c 2021-04-25 03:31:30.000000000 +0200
+++ a/at.c 2021-05-20 17:57:36.909775361 +0200
@@ -145,18 +145,12 @@
--- b/at.c 2022-01-29 17:42:19.000000000 +0100
+++ a/at.c 2022-02-23 18:42:45.941757090 +0100
@@ -155,18 +155,12 @@
/* If the user presses ^C, remove the spool file and exit
*/
if (fcreated) {
@ -21,14 +21,14 @@ diff -ur b/at.c a/at.c
}
exit(EXIT_FAILURE);
}
@@ -316,26 +310,19 @@
@@ -326,26 +320,19 @@
* bit. Yes, this is a kluge.
*/
cmask = umask(S_IRUSR | S_IWUSR | S_IXUSR);
- seteuid(real_uid);
+ if ((seteuid(effective_uid)) < 0)
+ perr("Error in seteuid: %s", errno);
if ((fd = open(atfile, O_CREAT | O_EXCL | O_TRUNC | O_WRONLY, S_IRUSR)) == -1)
if ((fd = open(atfile, O_CREAT | O_EXCL | O_TRUNC | O_WRONLY | O_SYNC, S_IRUSR)) == -1)
perr("Cannot create atjob file %.500s", atfile);
- seteuid(effective_uid);
@ -51,7 +51,7 @@ diff -ur b/at.c a/at.c
/* We've successfully created the file; let's set the flag so it
* gets removed in case of an interrupt or error.
*/
@@ -694,7 +681,7 @@
@@ -733,7 +720,7 @@
We need the unprivileged uid here since the file is owned by the real
(not effective) uid.
*/
@ -60,7 +60,7 @@ diff -ur b/at.c a/at.c
if (queue == '=') {
fprintf(stderr, "Warning: deleting running job\n");
@@ -703,8 +690,8 @@
@@ -742,8 +729,8 @@
perr("Cannot unlink %.500s", dirent->d_name);
rc = EXIT_FAILURE;
}
@ -70,7 +70,7 @@ diff -ur b/at.c a/at.c
done = 1;
break;
@@ -714,7 +701,7 @@
@@ -753,7 +740,7 @@
FILE *fp;
int ch;
@ -79,7 +79,7 @@ diff -ur b/at.c a/at.c
fp = fopen(dirent->d_name, "r");
if (fp) {
@@ -727,7 +714,7 @@
@@ -768,7 +755,7 @@
perr("Cannot open %.500s", dirent->d_name);
rc = EXIT_FAILURE;
}
@ -89,8 +89,8 @@ diff -ur b/at.c a/at.c
break;
diff -ur b/atd.c a/atd.c
--- b/atd.c 2021-04-25 03:31:30.000000000 +0200
+++ a/atd.c 2021-05-20 17:57:35.005776469 +0200
--- b/atd.c 2022-01-29 17:42:19.000000000 +0100
+++ a/atd.c 2022-02-23 18:50:53.743511813 +0100
@@ -91,6 +91,10 @@
/* Macros */
@ -102,7 +102,7 @@ diff -ur b/atd.c a/atd.c
#define BATCH_INTERVAL_DEFAULT 60
#define CHECK_INTERVAL 3600
@@ -114,7 +118,7 @@
@@ -115,7 +119,7 @@
static volatile sig_atomic_t term_signal = 0;
@ -111,7 +111,7 @@ diff -ur b/atd.c a/atd.c
#include <security/pam_appl.h>
static pam_handle_t *pamh = NULL;
@@ -123,15 +127,7 @@
@@ -124,15 +128,7 @@
NULL
};
@ -128,7 +128,7 @@ diff -ur b/atd.c a/atd.c
/* Signal handlers */
RETSIGTYPE
@@ -292,7 +288,7 @@
@@ -293,7 +289,7 @@
char fmt[64];
unsigned long jobno;
int rc;
@ -137,7 +137,7 @@ diff -ur b/atd.c a/atd.c
int retcode;
#endif
@@ -449,17 +445,11 @@
@@ -450,17 +446,11 @@
fstat(fd_out, &buf);
size = buf.st_size;
@ -160,11 +160,10 @@ diff -ur b/atd.c a/atd.c
#endif
close(STDIN_FILENO);
@@ -473,7 +463,14 @@
else if (pid == 0) {
@@ -475,6 +465,14 @@
char *nul = NULL;
char **nenvp = &nul;
-
+ char **pam_envp=0L;
+
+ PRIV_START
@ -176,16 +175,15 @@ diff -ur b/atd.c a/atd.c
/* Set up things for the child; we want standard input from the
* input file, and standard output and error sent to our output file.
*/
@@ -492,8 +489,6 @@
@@ -493,7 +491,6 @@
close(fd_in);
close(fd_out);
- PRIV_START
-
nice((tolower((int) queue) - 'a') * 2);
#ifdef WITH_SELINUX
@@ -514,9 +509,9 @@
@@ -515,9 +512,9 @@
chdir("/");
@ -198,7 +196,7 @@ diff -ur b/atd.c a/atd.c
PRIV_END
}
/* We're the parent. Let's wait.
@@ -529,14 +524,6 @@
@@ -530,14 +527,6 @@
*/
waitpid(pid, (int *) NULL, 0);
@ -213,21 +211,21 @@ diff -ur b/atd.c a/atd.c
/* Send mail. Unlink the output file after opening it, so it
* doesn't hang around after the run.
*/
@@ -567,8 +554,13 @@
@@ -568,8 +557,13 @@
unlink(newname);
free(newname);
+#ifdef ATD_MAIL_PROGRAM
if (((send_mail != -1) && (buf.st_size != size)) || (send_mail == 1)) {
+ int mail_pid = -1;
+
+ mail_pid = fork();
+ mail_pid = fork();
+
+ if ( mail_pid == 0 ) {
PRIV_START
if (initgroups(pentry->pw_name, pentry->pw_gid))
@@ -590,7 +582,20 @@
@@ -591,7 +585,20 @@
perr("Exec failed for mail command");
PRIV_END
@ -236,7 +234,7 @@ diff -ur b/atd.c a/atd.c
+ syslog(LOG_ERR, "fork of mailer failed: %m");
+ }
+ /* Parent */
+ waitpid(mail_pid, (int *) NULL, 0);
+ waitpid(mail_pid, (int *) NULL, 0);
}
+
+#ifdef WITH_PAM
@ -249,9 +247,9 @@ diff -ur b/atd.c a/atd.c
}
diff -ur b/config.h.in a/config.h.in
--- b/config.h.in 2021-04-25 03:31:30.000000000 +0200
+++ a/config.h.in 2021-05-20 17:59:32.127708342 +0200
@@ -71,8 +71,8 @@
--- b/config.h.in 2022-01-29 17:42:19.000000000 +0100
+++ a/config.h.in 2022-02-23 18:51:31.467570176 +0100
@@ -74,8 +74,8 @@
/* Define to 1 if you have the <nlist.h> header file. */
#undef HAVE_NLIST_H
@ -263,9 +261,9 @@ diff -ur b/config.h.in a/config.h.in
/* Define to 1 if you have the `pstat_getdynamic' function. */
#undef HAVE_PSTAT_GETDYNAMIC
diff -ur b/configure.ac a/configure.ac
--- b/configure.ac 2021-04-25 03:31:30.000000000 +0200
+++ a/configure.ac 2021-05-20 17:59:29.088710109 +0200
@@ -96,7 +96,7 @@
--- b/configure.ac 2022-01-29 17:42:19.000000000 +0100
+++ a/configure.ac 2022-02-23 18:53:08.516720324 +0100
@@ -97,7 +97,7 @@
AC_CHECK_FUNCS(getcwd mktime strftime setreuid setresuid sigaction waitpid)
AC_CHECK_HEADERS(security/pam_appl.h, [
PAMLIB="-lpam"
@ -274,7 +272,7 @@ diff -ur b/configure.ac a/configure.ac
])
dnl Checking for programs
@@ -257,6 +257,13 @@
@@ -260,6 +260,13 @@
)
AC_SUBST(DAEMON_USERNAME)
@ -289,9 +287,9 @@ diff -ur b/configure.ac a/configure.ac
[ --with-selinux Define to run with selinux (default=check)],
[],
diff -ur b/Makefile.in a/Makefile.in
--- b/Makefile.in 2021-04-25 03:31:30.000000000 +0200
+++ a/Makefile.in 2021-05-20 18:00:04.874689294 +0200
@@ -71,7 +71,7 @@
--- b/Makefile.in 2022-02-23 18:33:26.999892289 +0100
+++ a/Makefile.in 2022-02-23 18:53:28.600751396 +0100
@@ -76,7 +76,7 @@
all: at atd atd.service atrun
at: $(ATOBJECTS)
@ -301,8 +299,8 @@ diff -ur b/Makefile.in a/Makefile.in
$(LN_S) -f at atq
$(LN_S) -f at atrm
diff -ur b/perm.c a/perm.c
--- b/perm.c 2021-04-25 03:31:30.000000000 +0200
+++ a/perm.c 2021-05-20 18:01:58.689621839 +0200
--- b/perm.c 2022-01-29 17:42:19.000000000 +0100
+++ a/perm.c 2022-02-23 18:56:21.401018761 +0100
@@ -51,6 +51,14 @@
#define PRIV_END while(0)
#endif
@ -368,8 +366,8 @@ diff -ur b/perm.c a/perm.c
if (allow==0 || allow==1)
return allow;
diff -ur b/privs.h a/privs.h
--- b/privs.h 2021-04-25 03:31:30.000000000 +0200
+++ a/privs.h 2021-05-20 18:02:51.847589692 +0200
--- b/privs.h 2022-01-29 17:42:19.000000000 +0100
+++ a/privs.h 2022-02-23 18:58:20.920203690 +0100
@@ -144,3 +144,62 @@
#error "Cannot implement user ID swapping without setreuid or setresuid"
#endif

52
at.spec
View File

@ -2,8 +2,8 @@
Summary: Job spooling tools
Name: at
Version: 3.2.2
Release: 3%{?dist}
Version: 3.2.5
Release: 1%{?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
@ -16,22 +16,20 @@ Source3: atd.sysconf
Source5: atd.systemd
Patch: at-aarch64.patch
Patch: at-3.2.2-make.patch
Patch: at-3.2.2-pam.patch
Patch: at-3.2.5-make.patch
Patch: at-3.2.5-pam.patch
Patch: at-3.1.14-opt_V.patch
Patch: at-3.2.2-shell.patch
Patch: at-3.1.18-nitpicks.patch
Patch: at-3.2.5-nitpicks.patch
Patch: at-3.1.14-fix_no_export.patch
Patch: at-3.1.14-mailwithhostname.patch
Patch: at-3.1.14-usePOSIXtimers.patch
Patch: at-3.1.20-aborted-jobs.patch
Patch: at-3.1.18-noabort.patch
Patch: at-3.2.5-mailwithhostname.patch
Patch: at-3.2.5-aborted-jobs.patch
Patch: at-3.2.5-noabort.patch
Patch: at-3.1.16-fclose-error.patch
Patch: at-3.1.16-clear-nonjobs.patch
Patch: at-3.2.2-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
BuildRequires: gcc
BuildRequires: flex flex-static bison autoconf
@ -71,8 +69,6 @@ cp %{SOURCE1} .
%autopatch -p1
%build
# at-3.1.14-usePOSIXtimers.patch touches configure.in
autoconf
# uselles files
rm -f lex.yy.* y.tab.*
@ -87,24 +83,24 @@ make
%install
make install \
DAEMON_USERNAME=`id -nu`\
DAEMON_USERNAME=`id -nu` \
DAEMON_GROUPNAME=`id -ng` \
DESTDIR=%{buildroot}\
sbindir=%{buildroot}%{_prefix}/sbin\
bindir=%{buildroot}%{_bindir}\
prefix=%{buildroot}%{_prefix}\
exec_prefix=%{buildroot}%{_prefix}\
docdir=%{buildroot}/usr/doc\
mandir=%{buildroot}%{_mandir}\
etcdir=%{buildroot}%{_sysconfdir} \
ATJOB_DIR=%{buildroot}%{_localstatedir}/spool/at \
ATSPOOL_DIR=%{buildroot}%{_localstatedir}/spool/at/spool \
DESTDIR=%{buildroot} \
sbindir=%{_prefix}/sbin \
bindir=%{_bindir} \
prefix=%{_prefix} \
exec_prefix=%{_prefix} \
docdir=%{_prefix}/doc \
mandir=%{_mandir} \
etcdir=%{_sysconfdir} \
ATJOB_DIR=%{_localstatedir}/spool/at \
ATSPOOL_DIR=%{_localstatedir}/spool/at/spool \
INSTALL_ROOT_USER=`id -nu` \
INSTALL_ROOT_GROUP=`id -nu`;
echo > %{buildroot}%{_sysconfdir}/at.deny
mkdir docs
cp %{buildroot}/%{_prefix}/doc/at/* docs/
cp %{buildroot}%{_prefix}/doc/at/* docs/
mkdir -p %{buildroot}%{_sysconfdir}/pam.d
install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/pam.d/atd
@ -166,6 +162,14 @@ chown root:root %{_localstatedir}/spool/at/.SEQ
%attr(0644,root,root) /%{_unitdir}/atd.service
%changelog
* Tue Mar 01 2022 Ondřej Pohořelský <opohorel@redhat.com> - 3.2.5-1
- Update to new upstream release
- Removed at-3.1.14-usePOSIXtimers.patch and at-3.2.23-coverity-fix.patch, because
upstream implemented them
- Defined folder paths without %%{buildroot} in order to make them work with latest
Makefile changes
- Resolves: rhbz#2048132
* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

View File

@ -1,2 +1,2 @@
SHA512 (at_3.2.2.orig.tar.gz) = e6f5aeddd89438aadff627d654ebc821a0b0e1a600ebaacc8a5fd3ec2c7c716f593757d00501311736d28f6d4276899667d6901d70836af208ff7d181b5b680f
SHA512 (at_3.2.2.orig.tar.gz.asc) = 54716fef56436c352a08c4bba5b0693a3dd7e187c320dc1ebf4e840b9175f024f3eb11b0a1f5dd428cfb3f2d59de8ab45b394576d71c033f99291a7bee3c1005
SHA512 (at_3.2.5.orig.tar.gz) = 542e8948bbdc1d06934070cbfe242688b541ef6342c6b0351255f8b9d7a3ed915a9304b5cf5442dfc15845b3d2b926ebecbfc5bccd204519d0a2775b27f8139c
SHA512 (at_3.2.5.orig.tar.gz.sig) = 5a38cb7da5b85233ede79e7b90aec7705250e315c5b4bcccb9c1c9a6453a9cc5c79c840023a44ac5d087137596c2b4b98971e233ea1fbbaa0c82833e53dcd8ac