summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorSebastian Benoit <benno@cvs.openbsd.org>2019-08-12 18:01:45 +0000
committerSebastian Benoit <benno@cvs.openbsd.org>2019-08-12 18:01:45 +0000
commit4dcb9eaa77fece297f909cdcf7526dcc5a397fc9 (patch)
tree8249ae97acab42752755c4ce8f8c12fa3e3167e4 /usr.sbin
parent05bb7fa4dcfe849045e5b94937fb2a989b7bdc8a (diff)
Do not exit with error if the challenge file already exists, instead truncate it and
write the challenge again. We can get asked to supply the same challenge multiple times. bug found and patch tested by jmc@ patch discussed with, mangled and okayed by florian@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/acme-client/chngproc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/acme-client/chngproc.c b/usr.sbin/acme-client/chngproc.c
index 8b255647bed..476daed3416 100644
--- a/usr.sbin/acme-client/chngproc.c
+++ b/usr.sbin/acme-client/chngproc.c
@@ -1,4 +1,4 @@
-/* $Id: chngproc.c,v 1.14 2019/06/16 19:49:13 florian Exp $ */
+/* $Id: chngproc.c,v 1.15 2019/08/12 18:01:44 benno Exp $ */
/*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -104,7 +104,7 @@ chngproc(int netsock, const char *root)
* Note: we use file descriptors instead of FILE
* because we want to minimise our pledges.
*/
- fd = open(fs[fsz - 1], O_WRONLY|O_EXCL|O_CREAT, 0444);
+ fd = open(fs[fsz - 1], O_WRONLY|O_CREAT|O_TRUNC, 0444);
if (fd == -1) {
warn("%s", fs[fsz - 1]);
goto out;