summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2014-09-29 18:44:49 +0000
committermillert <millert@openbsd.org>2014-09-29 18:44:49 +0000
commit1a456c1907e83478f2e03eeb5122daa7b1fd8cf3 (patch)
treee15e647908dec81f7dca58c52dbd440936930474
parentAdd locking for our private descriptor message queue. (diff)
downloadwireguard-openbsd-1a456c1907e83478f2e03eeb5122daa7b1fd8cf3.tar.xz
wireguard-openbsd-1a456c1907e83478f2e03eeb5122daa7b1fd8cf3.zip
When setting environment variables in the atrun script, use the
"export foo=bar" form instead of "foo=bar; export foo" since the former allows the shell to catch variable names that are not valid shell identifiers. This will cause /bin/sh to exit with an error (which gets mailed to the at user) and it will not run the script. OK miod@
-rw-r--r--usr.bin/at/at.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c
index f1ce091a945..63727c1ec43 100644
--- a/usr.bin/at/at.c
+++ b/usr.bin/at/at.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: at.c,v 1.62 2013/11/25 18:02:50 deraadt Exp $ */
+/* $OpenBSD: at.c,v 1.63 2014/09/29 18:44:49 millert Exp $ */
/*
* at.c : Put file into atrun queue
@@ -319,6 +319,7 @@ writefile(const char *cwd, time_t runtimer, char queue)
}
if (export) {
+ (void)fputs("export ", fp);
(void)fwrite(*atenv, sizeof(char), eqp - *atenv, fp);
for (ap = eqp; *ap != '\0'; ap++) {
if (*ap == '\n')
@@ -340,8 +341,6 @@ writefile(const char *cwd, time_t runtimer, char queue)
(void)fputc(*ap, fp);
}
}
- (void)fputs("; export ", fp);
- (void)fwrite(*atenv, sizeof(char), eqp - *atenv - 1, fp);
(void)fputc('\n', fp);
}
}