summary refs log tree commit diff
path: root/listen.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-11-01 01:38:50 -0400
committerJune McEnroe <june@causal.agency>2019-11-01 01:38:50 -0400
commit4e465eacef72a3b4c822c8baee9d2ccca78e6cd1 (patch)
tree26279b6f0fdb626afc91f413306e5f8a4e2bb6bc /listen.c
parentRe-read cert and key from the same FILEs (diff)
downloadpounce-4e465eacef72a3b4c822c8baee9d2ccca78e6cd1.tar.gz
pounce-4e465eacef72a3b4c822c8baee9d2ccca78e6cd1.zip
Reload certificates using openat
This is more versatile since files are more likely to be replaced than
overwritten.
Diffstat (limited to 'listen.c')
-rw-r--r--listen.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/listen.c b/listen.c
index 9fc2443..f943ff2 100644
--- a/listen.c
+++ b/listen.c
@@ -29,7 +29,7 @@
 
 static struct tls *server;
 
-static byte *reread(size_t *len, FILE *file) {
+static byte *readFile(size_t *len, FILE *file) {
 	struct stat stat;
 	int error = fstat(fileno(file), &stat);
 	if (error) err(EX_IOERR, "fstat");
@@ -37,8 +37,6 @@ static byte *reread(size_t *len, FILE *file) {
 	byte *buf = malloc(stat.st_size);
 	if (!buf) err(EX_OSERR, "malloc");
 
-	fpurge(file);
-	rewind(file);
 	*len = fread(buf, 1, stat.st_size, file);
 	if (ferror(file)) err(EX_IOERR, "fread");
 
@@ -54,14 +52,14 @@ void listenConfig(FILE *cert, FILE *priv) {
 	if (!config) errx(EX_SOFTWARE, "tls_config_new");
 
 	size_t len;
-	byte *buf = reread(&len, cert);
+	byte *buf = readFile(&len, cert);
 	int error = tls_config_set_cert_mem(config, buf, len);
 	if (error) {
 		errx(EX_CONFIG, "tls_config_set_cert_mem: %s", tls_config_error(config));
 	}
 	free(buf);
 
-	buf = reread(&len, priv);
+	buf = readFile(&len, priv);
 	error = tls_config_set_key_mem(config, buf, len);
 	if (error) {
 		errx(EX_CONFIG, "tls_config_set_key_mem: %s", tls_config_error(config));
4237ecdde38a3a23f2bf7d&follow=1'>Clean up html.cJune McEnroe 2020-04-27Style groups in recipientsJune McEnroe Can't actually test this oops. 2020-04-27Clean up export.cJune McEnroe 2020-04-27Clean up decode.cJune McEnroe 2020-04-26Free orderJune McEnroe Oops 2. 2020-04-26Clean up atom.c and fix base URLsJune McEnroe Base URL should not be URL escaped! 2020-04-26Clean up archive.cJune McEnroe 2020-04-26Add -q to exit non-zero on early exitJune McEnroe 2020-04-26Rearrange some of archive.hJune McEnroe 2020-04-26Free part.parts.ptrJune McEnroe Oops. 2020-04-26Rename part->id to part->contentIDJune McEnroe Disambiguate with messageID. 2020-04-26Iterate through nested multiparts to find content for AtomJune McEnroe Also fixes content for multipart/signed. 2020-04-26Include Cc address in reply mailtosJune McEnroe 2020-04-26Use %R for RFC numbers in STANDARDS sectionJune McEnroe 2020-04-26Add mailto spec to STANDARDSJune McEnroe 2020-04-26Increase space between nav itemsJune McEnroe 2020-04-26Add mailto address for the archiveJune McEnroe 2020-04-26Put dates on new lines in indexJune McEnroe 2020-04-26Include <> around Message-Id in mailto: URLsJune McEnroe 2020-04-26Add link to index on thread pagesJune McEnroe 2020-04-26Fall back to Content-Type name parameter for attachmentsJune McEnroe 2020-04-26Remove margins in article.message headerJune McEnroe 2020-04-26Generate index.atomJune McEnroe 2020-04-26Generate XHTML content in Atom entriesJune McEnroe 2020-04-25Style index pageJune McEnroe 2020-04-25Render index.htmlJune McEnroe 2020-04-25Wrap <summary> replies count in <data>June McEnroe 2020-04-25Accumulate thread envelopes before concatenationJune McEnroe 2020-04-24Free envelope in concatDataJune McEnroe 2020-04-24Use replyTo address in mailto:June McEnroe 2020-04-23Wrap quoted lines in <q>June McEnroe