diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1996-08-03 20:16:58 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1996-08-03 20:16:58 +0000 |
commit | 14c0ee1fd880d587f6c818255166cf6f4eec5ae7 (patch) | |
tree | db158ef5eba7aeefd3d67de21354e4d76f2e1406 /usr.bin/at | |
parent | 9ed50adf6f37005c454a0723bee27c3a243f48d2 (diff) |
Was runing most of the code with real and effective uid of 0, contrary
to the comments. Fixed that and made sure unlink of job file is done
as root so it can succeed. Also will now detect empty input.
Diffstat (limited to 'usr.bin/at')
-rw-r--r-- | usr.bin/at/at.c | 17 | ||||
-rw-r--r-- | usr.bin/at/panic.c | 15 |
2 files changed, 18 insertions, 14 deletions
diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c index d1de84d0c35..39ee135c94a 100644 --- a/usr.bin/at/at.c +++ b/usr.bin/at/at.c @@ -1,4 +1,4 @@ -/* $OpenBSD: at.c,v 1.2 1996/06/26 05:31:27 deraadt Exp $ */ +/* $OpenBSD: at.c,v 1.3 1996/08/03 20:16:52 millert Exp $ */ /* $NetBSD: at.c,v 1.4 1995/03/25 18:13:31 glass Exp $ */ /* @@ -65,7 +65,7 @@ /* File scope variables */ #ifndef lint -static char rcsid[] = "$OpenBSD: at.c,v 1.2 1996/06/26 05:31:27 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: at.c,v 1.3 1996/08/03 20:16:52 millert Exp $"; #endif char *no_export[] = @@ -248,13 +248,6 @@ writefile(runtimer, queue) PRIV_END /* - * We no longer need suid root; now we just need to be able to - * write to the directory, if necessary. - */ - - REDUCE_PRIV(effective_uid); - - /* * We've successfully created the file; let's set the flag so it * gets removed in case of an interrupt or error. */ @@ -345,8 +338,12 @@ writefile(runtimer, queue) */ fprintf(fp, "cd %s\n", cwdname()); - while ((ch = getchar()) != EOF) + if ((ch = getchar()) == EOF) + panic("Input error"); + + do { fputc(ch, fp); + } while ((ch = getchar()) != EOF); fprintf(fp, "\n"); if (ferror(fp)) diff --git a/usr.bin/at/panic.c b/usr.bin/at/panic.c index b616899085e..d6b03db8edd 100644 --- a/usr.bin/at/panic.c +++ b/usr.bin/at/panic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: panic.c,v 1.2 1996/06/26 05:31:28 deraadt Exp $ */ +/* $OpenBSD: panic.c,v 1.3 1996/08/03 20:16:57 millert Exp $ */ /* $NetBSD: panic.c,v 1.2 1995/03/25 18:13:33 glass Exp $ */ /* @@ -38,11 +38,12 @@ #include "panic.h" #include "at.h" +#include "privs.h" /* File scope variables */ #ifndef lint -static char rcsid[] = "$OpenBSD: panic.c,v 1.2 1996/06/26 05:31:28 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: panic.c,v 1.3 1996/08/03 20:16:57 millert Exp $"; #endif /* External variables */ @@ -56,8 +57,11 @@ panic(a) /* Something fatal has happened, print error message and exit. */ fprintf(stderr, "%s: %s\n", namep, a); - if (fcreated) + if (fcreated) { + PRIV_START unlink(atfile); + PRIV_END + } exit(EXIT_FAILURE); } @@ -69,8 +73,11 @@ perr(a) /* Some operating system error; print error message and exit. */ perror(a); - if (fcreated) + if (fcreated) { + PRIV_START unlink(atfile); + PRIV_END + } exit(EXIT_FAILURE); } |