diff options
author | 2015-10-09 15:09:09 +0000 | |
---|---|---|
committer | 2015-10-09 15:09:09 +0000 | |
commit | 6507df718f47e39a0ed1ecfabba648d1bb9ba538 (patch) | |
tree | 57960c6a5062191a59c675740ac40ce537c86a00 | |
parent | turn our local enqueuer setgid _smtpq and restrict access to offline queue, (diff) | |
download | wireguard-openbsd-6507df718f47e39a0ed1ecfabba648d1bb9ba538.tar.xz wireguard-openbsd-6507df718f47e39a0ed1ecfabba648d1bb9ba538.zip |
if an error occurs during offline enqueuing after we've dropped group, then
attempt to ftruncate() the fp back to 0.
suggested and ok millert@, ok eric@
-rw-r--r-- | usr.sbin/smtpd/enqueue.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/enqueue.c b/usr.sbin/smtpd/enqueue.c index cd65e34aa17..d05bbd89149 100644 --- a/usr.sbin/smtpd/enqueue.c +++ b/usr.sbin/smtpd/enqueue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: enqueue.c,v 1.97 2015/10/09 14:37:38 gilles Exp $ */ +/* $OpenBSD: enqueue.c,v 1.98 2015/10/09 15:09:09 gilles Exp $ */ /* * Copyright (c) 2005 Henning Brauer <henning@bulabula.org> @@ -811,6 +811,7 @@ enqueue_offline(int argc, char *argv[], FILE *ifile, FILE *ofile) for (i = 1; i < argc; i++) { if (strchr(argv[i], '|') != NULL) { warnx("%s contains illegal character", argv[i]); + ftruncate(fileno(ofile), 0); exit(EX_SOFTWARE); } fprintf(ofile, "%s%s", i == 1 ? "" : "|", argv[i]); @@ -821,11 +822,13 @@ enqueue_offline(int argc, char *argv[], FILE *ifile, FILE *ofile) while ((ch = fgetc(ifile)) != EOF) if (fputc(ch, ofile) == EOF) { warn("write error"); + ftruncate(fileno(ofile), 0); exit(EX_UNAVAILABLE); } if (ferror(ifile)) { warn("read error"); + ftruncate(fileno(ofile), 0); exit(EX_UNAVAILABLE); } |