|
|
76a39a |
diff -up at-3.1.18/atd.c.nit at-3.1.18/atd.c
|
|
|
76a39a |
--- at-3.1.18/atd.c.nit 2016-03-23 12:46:49.222277787 +0100
|
|
|
76a39a |
+++ at-3.1.18/atd.c 2016-03-23 12:47:50.521639804 +0100
|
|
|
76a39a |
@@ -196,6 +196,18 @@ myfork()
|
|
|
76a39a |
|
|
|
76a39a |
#define fork myfork
|
|
|
76a39a |
#endif
|
|
|
76a39a |
+#undef ATD_MAIL_PROGRAM
|
|
|
76a39a |
+#undef ATD_MAIL_NAME
|
|
|
76a39a |
+#if defined(SENDMAIL)
|
|
|
76a39a |
+#define ATD_MAIL_PROGRAM SENDMAIL
|
|
|
76a39a |
+#define ATD_MAIL_NAME "sendmail"
|
|
|
76a39a |
+#elif defined(MAILC)
|
|
|
76a39a |
+#define ATD_MAIL_PROGRAM MAILC
|
|
|
76a39a |
+#define ATD_MAIL_NAME "mail"
|
|
|
76a39a |
+#elif defined(MAILX)
|
|
|
76a39a |
+#define ATD_MAIL_PROGRAM MAILX
|
|
|
76a39a |
+#define ATD_MAIL_NAME "mailx"
|
|
|
76a39a |
+#endif
|
|
|
76a39a |
|
|
|
76a39a |
#ifdef WITH_SELINUX
|
|
|
76a39a |
static int
|
|
|
76a39a |
@@ -339,6 +351,9 @@ run_file(const char *filename, uid_t uid
|
|
|
76a39a |
free(newname);
|
|
|
76a39a |
return;
|
|
|
76a39a |
}
|
|
|
76a39a |
+
|
|
|
76a39a |
+ (void) setsid(); /* own session for process */
|
|
|
76a39a |
+
|
|
|
76a39a |
/* Let's see who we mail to. Hopefully, we can read it from
|
|
|
76a39a |
* the command file; if not, send it to the owner, or, failing that,
|
|
|
76a39a |
* to root.
|
|
|
76a39a |
@@ -507,6 +522,9 @@ run_file(const char *filename, uid_t uid
|
|
|
76a39a |
if (setuid(uid) < 0)
|
|
|
76a39a |
perr("Cannot set user id");
|
|
|
76a39a |
|
|
|
76a39a |
+ if (SIG_ERR == signal(SIGCHLD, SIG_DFL))
|
|
|
76a39a |
+ perr("Cannot reset signal handler to default");
|
|
|
76a39a |
+
|
|
|
76a39a |
chdir("/");
|
|
|
76a39a |
|
|
|
76a39a |
execle("/bin/sh", "sh", (char *) NULL, nenvp);
|
|
|
76a39a |
@@ -572,6 +590,9 @@ run_file(const char *filename, uid_t uid
|
|
|
76a39a |
if (setuid(uid) < 0)
|
|
|
76a39a |
perr("Cannot set user id");
|
|
|
76a39a |
|
|
|
76a39a |
+ if (SIG_ERR == signal(SIGCHLD, SIG_DFL))
|
|
|
76a39a |
+ perr("Cannot reset signal handler to default");
|
|
|
76a39a |
+
|
|
|
76a39a |
chdir ("/");
|
|
|
76a39a |
|
|
|
76a39a |
#if defined(SENDMAIL)
|
|
|
76a39a |
@@ -699,6 +720,7 @@ run_loop()
|
|
|
76a39a |
* Let's remove the lockfile and reschedule.
|
|
|
76a39a |
*/
|
|
|
76a39a |
strncpy(lock_name, dirent->d_name, sizeof(lock_name));
|
|
|
76a39a |
+ lock_name[sizeof(lock_name)-1] = '\0';
|
|
|
76a39a |
lock_name[0] = '=';
|
|
|
76a39a |
unlink(lock_name);
|
|
|
76a39a |
next_job = now;
|
|
|
76a39a |
@@ -733,6 +755,7 @@ run_loop()
|
|
|
76a39a |
run_batch++;
|
|
|
76a39a |
if (strcmp(batch_name, dirent->d_name) > 0) {
|
|
|
76a39a |
strncpy(batch_name, dirent->d_name, sizeof(batch_name));
|
|
|
76a39a |
+ batch_name[sizeof(batch_name)-1] = '\0';
|
|
|
76a39a |
batch_uid = buf.st_uid;
|
|
|
76a39a |
batch_gid = buf.st_gid;
|
|
|
76a39a |
batch_queue = queue;
|
|
|
76a39a |
diff -up at-3.1.18/at.1.in.nit at-3.1.18/at.1.in
|
|
|
76a39a |
--- at-3.1.18/at.1.in.nit 2015-12-06 16:45:10.000000000 +0100
|
|
|
76a39a |
+++ at-3.1.18/at.1.in 2016-03-23 12:46:49.226277876 +0100
|
|
|
76a39a |
@@ -210,7 +210,7 @@ queue for
|
|
|
76a39a |
.BR batch .
|
|
|
76a39a |
Queues with higher letters run with increased niceness. The special
|
|
|
76a39a |
queue "=" is reserved for jobs which are currently running.
|
|
|
76a39a |
-.P
|
|
|
76a39a |
+
|
|
|
76a39a |
If a job is submitted to a queue designated with an uppercase letter, the
|
|
|
76a39a |
job is treated as if it were submitted to batch at the time of the job.
|
|
|
76a39a |
Once the time is reached, the batch processing rules with respect to load
|