summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenno <benno@openbsd.org>2019-01-29 16:38:29 +0000
committerbenno <benno@openbsd.org>2019-01-29 16:38:29 +0000
commit1e4d29584c2e329596b808535809c0712b6e8ce4 (patch)
treed0494691c0d800ea86c368687ee852ba7897ec51
parentWe don't need IMSG_SHUTDOWN, we can just close the sockets. (diff)
downloadwireguard-openbsd-1e4d29584c2e329596b808535809c0712b6e8ce4.tar.xz
wireguard-openbsd-1e4d29584c2e329596b808535809c0712b6e8ce4.zip
add an extra check for existing "api ..." line in the config.
move the check of existing "account ..." line from main.c to the parser. ok deraadt@
-rw-r--r--usr.sbin/acme-client/main.c7
-rw-r--r--usr.sbin/acme-client/parse.y13
2 files changed, 12 insertions, 8 deletions
diff --git a/usr.sbin/acme-client/main.c b/usr.sbin/acme-client/main.c
index d96bf40e036..083c16c0747 100644
--- a/usr.sbin/acme-client/main.c
+++ b/usr.sbin/acme-client/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.41 2018/07/30 09:59:03 benno Exp $ */
+/* $Id: main.c,v 1.42 2019/01/29 16:38:29 benno Exp $ */
/*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -156,11 +156,6 @@ main(int argc, char *argv[])
acctkey = authority->account;
- if (acctkey == NULL) {
- /* XXX replace with existance check in parse.y */
- err(EXIT_FAILURE, "no account key in config?");
- }
-
if ((chngdir = domain->challengedir) == NULL)
if ((chngdir = strdup(WWW_DIR)) == NULL)
err(EXIT_FAILURE, "strdup");
diff --git a/usr.sbin/acme-client/parse.y b/usr.sbin/acme-client/parse.y
index dc38e120bb6..5f7785bbb32 100644
--- a/usr.sbin/acme-client/parse.y
+++ b/usr.sbin/acme-client/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.31 2018/11/01 00:18:44 sashan Exp $ */
+/* $OpenBSD: parse.y,v 1.32 2019/01/29 16:38:29 benno Exp $ */
/*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -186,7 +186,16 @@ authority : AUTHORITY STRING {
YYERROR;
}
} '{' optnl authorityopts_l '}' {
- /* XXX enforce minimum config here */
+ if (auth->api == NULL) {
+ yyerror("authority %s: no api URL specified",
+ auth->name);
+ YYERROR;
+ }
+ if (auth->account == NULL) {
+ yyerror("authority %s: no account key file "
+ "specified", auth->name);
+ YYERROR;
+ }
auth = NULL;
}
;