From 4dcb9eaa77fece297f909cdcf7526dcc5a397fc9 Mon Sep 17 00:00:00 2001 From: Sebastian Benoit Date: Mon, 12 Aug 2019 18:01:45 +0000 Subject: 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@ --- usr.sbin/acme-client/chngproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'usr.sbin') 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 * @@ -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; -- cgit v1.2.3