OBS-URL: https://build.opensuse.org/package/show/Base:System/at?expand=0&rev=53100d87b42901e6f6ab596e79dac7ab
226 lines
7.9 KiB
Diff
226 lines
7.9 KiB
Diff
--- Makefile.in.orig
|
|
+++ Makefile.in
|
|
@@ -87,37 +87,35 @@ atrun: atrun.in
|
|
$(CC) -c $(CFLAGS) $(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)$(docdir)
|
|
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(atdocdir)
|
|
+ $(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)$(ATJOB_DIR)
|
|
- $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 755 -d $(IROOT)$(ATSPOOL_DIR)
|
|
+ $(INSTALL) -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 -m 600 at.deny $(IROOT)$(etcdir)/
|
|
- $(INSTALL) -g root -o root -m 4755 -s at $(IROOT)$(bindir)
|
|
+ test -f $(IROOT)$(etcdir)/at.allow || test -f $(IROOT)$(etcdir)/at.deny || $(INSTALL) -m 600 at.deny $(IROOT)$(etcdir)/
|
|
+ $(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) -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 -s 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)/
|
|
- 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 at.allow.5 $(IROOT)$(man5dir)/
|
|
+ $(INSTALL) -m 644 at.deny.5 $(IROOT)$(man5dir)/
|
|
+ $(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*
|
|
--- Problems.orig
|
|
+++ Problems
|
|
@@ -5,7 +5,7 @@ Possible reasons why at may not run for
|
|
|
|
make -f Makefile.old install
|
|
|
|
-- You may not have a user or group 'daemon' on your system.
|
|
+- You may not have a user or group 'at' on your system.
|
|
|
|
- If you find numerous 'try again' error messages in your syslog files,
|
|
you have too many processes running; recompile your kernel for a
|
|
--- README.orig
|
|
+++ README
|
|
@@ -23,7 +23,7 @@ The new one is to start up an atd daemon
|
|
|
|
The old one is to put
|
|
|
|
-* * * * 0,5,10,15,20,25,30,35,40,45,50,55 /usr/lib/atrun
|
|
+* * * * 0,5,10,15,20,25,30,35,40,45,50,55 /usr/sbin/atrun
|
|
|
|
into root's crontab file (or wherever you put the atrun binary;
|
|
don't forget to start up cron.)
|
|
--- atd.c.orig
|
|
+++ atd.c
|
|
@@ -1,4 +1,4 @@
|
|
-/*
|
|
+/*
|
|
* atd.c - run jobs queued by at; run with root privileges.
|
|
* Copyright (C) 1993, 1994, 1996 Thomas Koenig
|
|
*
|
|
@@ -22,7 +22,7 @@
|
|
#include "config.h"
|
|
#endif
|
|
|
|
-/*
|
|
+/*
|
|
* /usr/bin/mail aka /usr/bin/mailx require the subject to be
|
|
* specified on the command line instead of reading it from stdin like
|
|
* /usr/sbin/sendmail does. For now simply disable MAILC and MAILX,
|
|
@@ -121,14 +121,14 @@ static int run_as_daemon = 0;
|
|
static volatile sig_atomic_t term_signal = 0;
|
|
|
|
/* Signal handlers */
|
|
-RETSIGTYPE
|
|
+RETSIGTYPE
|
|
set_term(int dummy)
|
|
{
|
|
term_signal = 1;
|
|
return;
|
|
}
|
|
|
|
-RETSIGTYPE
|
|
+RETSIGTYPE
|
|
sdummy(int dummy)
|
|
{
|
|
/* Empty signal handler */
|
|
@@ -156,7 +156,7 @@ release_zombie(int dummy)
|
|
}
|
|
return;
|
|
}
|
|
-
|
|
+
|
|
|
|
/* Local functions */
|
|
|
|
@@ -196,7 +196,7 @@ run_file(const char *filename, uid_t uid
|
|
*/
|
|
pid_t pid;
|
|
int fd_out, fd_in;
|
|
- char mailbuf[9], jobbuf[9];
|
|
+ char mailbuf[17], jobbuf[9];
|
|
char *mailname = NULL;
|
|
char *newname;
|
|
FILE *stream;
|
|
@@ -290,7 +290,12 @@ run_file(const char *filename, uid_t uid
|
|
if ((fflags = fcntl(fd_in, F_GETFD)) < 0)
|
|
perr("Error in fcntl");
|
|
|
|
- fcntl(fd_in, F_SETFD, fflags & ~FD_CLOEXEC);
|
|
+ /*
|
|
+ ** fcntl(fd_in, F_SETFD, fflags & ~FD_CLOEXEC);
|
|
+ ** What's that? This fcntl() removes the CLOSE_ON_EXEC flag.
|
|
+ */
|
|
+ if(fcntl(fd_in, F_SETFD, fflags | FD_CLOEXEC) < 0)
|
|
+ perr("Error in fcntl");
|
|
|
|
/*
|
|
* If the spool directory is mounted via NFS `atd' isn't able to
|
|
@@ -299,7 +304,7 @@ run_file(const char *filename, uid_t uid
|
|
* NFS and works with local file systems. It's not clear where
|
|
* the bug is located. -Joey
|
|
*/
|
|
- if (fscanf(stream, "#!/bin/sh\n# atrun uid=%d gid=%d\n# mail %8s %d",
|
|
+ if (fscanf(stream, "#!/bin/sh\n# atrun uid=%d gid=%d\n# mail %16s %d",
|
|
&nuid, &ngid, mailbuf, &send_mail) != 4)
|
|
pabort("File %.500s is in wrong format - aborting",
|
|
filename);
|
|
@@ -328,7 +333,7 @@ run_file(const char *filename, uid_t uid
|
|
perr("Cannot chdir to " ATSPOOL_DIR);
|
|
|
|
/* Create a file to hold the output of the job we are about to run.
|
|
- * Write the mail header. Complain in case
|
|
+ * Write the mail header. Complain in case
|
|
*/
|
|
|
|
if (unlink(filename) != -1) {
|
|
@@ -343,7 +348,7 @@ run_file(const char *filename, uid_t uid
|
|
write_string(fd_out, "Subject: Output from your job ");
|
|
write_string(fd_out, jobbuf);
|
|
write_string(fd_out, "\nTo: ");
|
|
- write_string(fd_out, mailname);
|
|
+ write_string(fd_out, mailname);
|
|
write_string(fd_out, "\n\n");
|
|
fstat(fd_out, &buf);
|
|
size = buf.st_size;
|
|
@@ -394,6 +399,9 @@ run_file(const char *filename, uid_t uid
|
|
if (setuid(uid) < 0)
|
|
perr("Cannot set user id");
|
|
|
|
+ if (SIG_ERR == signal(SIGCHLD, SIG_DFL))
|
|
+ perr("Cannot reset signal handler to default");
|
|
+
|
|
chdir("/");
|
|
|
|
if (execle("/bin/sh", "sh", (char *) NULL, nenvp) != 0)
|
|
@@ -408,7 +416,7 @@ run_file(const char *filename, uid_t uid
|
|
|
|
/* We inherited the master's SIGCHLD handler, which does a
|
|
non-blocking waitpid. So this blocking one will eventually
|
|
- return with an ECHILD error.
|
|
+ return with an ECHILD error.
|
|
*/
|
|
waitpid(pid, (int *) NULL, 0);
|
|
|
|
@@ -557,7 +565,8 @@ run_loop()
|
|
/* Something went wrong the last time this was executed.
|
|
* Let's remove the lockfile and reschedule.
|
|
*/
|
|
- strncpy(lock_name, dirent->d_name, sizeof(lock_name));
|
|
+ strncpy(lock_name, dirent->d_name, sizeof(lock_name)-1);
|
|
+ lock_name[sizeof(lock_name)-1] = 0;
|
|
lock_name[0] = '=';
|
|
unlink(lock_name);
|
|
next_job = now;
|
|
@@ -591,7 +600,8 @@ run_loop()
|
|
*/
|
|
run_batch++;
|
|
if (strcmp(batch_name, dirent->d_name) > 0) {
|
|
- strncpy(batch_name, dirent->d_name, sizeof(batch_name));
|
|
+ strncpy(batch_name, dirent->d_name, sizeof(batch_name)-1);
|
|
+ batch_name[sizeof(batch_name)-1] = 0;
|
|
batch_uid = buf.st_uid;
|
|
batch_gid = buf.st_gid;
|
|
batch_queue = queue;
|
|
--- configure.in.orig
|
|
+++ configure.in
|
|
@@ -126,7 +126,7 @@ else
|
|
fi
|
|
|
|
AC_MSG_CHECKING(location of spool directory)
|
|
-if test -d /var/spool/atjobs ; then
|
|
+if test -d /var/spool ; then
|
|
sp=/var/spool
|
|
AC_DEFINE(SPOOLDIR, "/var/spool")
|
|
AC_MSG_RESULT(Using existing /var/spool/at{jobs|run})
|