diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2020-05-10 17:34:08 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2020-05-10 17:34:08 +0000 |
commit | aa1c5762db8017c4ae4e23a1d0155f6def746cae (patch) | |
tree | 5bebc60d07da20057dc82e77e4df896d61710b99 /usr.sbin/acme-client/json.c | |
parent | 4d7df22a57fcda282548ed681652f5e3e512afeb (diff) |
In case the order fails print the human readable reason from the
challenge objects that the server hopefully provides.
input & OK deraadt
OK beck, benno
Diffstat (limited to 'usr.sbin/acme-client/json.c')
-rw-r--r-- | usr.sbin/acme-client/json.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/acme-client/json.c b/usr.sbin/acme-client/json.c index 36c7be4c988..ca3012f9bd5 100644 --- a/usr.sbin/acme-client/json.c +++ b/usr.sbin/acme-client/json.c @@ -1,4 +1,4 @@ -/* $Id: json.c,v 1.16 2020/01/22 22:25:22 tedu Exp $ */ +/* $Id: json.c,v 1.17 2020/05/10 17:34:07 florian Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -265,7 +265,6 @@ json_getarray(struct jsmnn *n, const char *name) return n->d.obj[i].rhs; } -#ifdef notyet /* * Extract subtree from the returned JSON object, making sure that it's * the correct type. @@ -292,7 +291,6 @@ json_getobj(struct jsmnn *n, const char *name) return NULL; return n->d.obj[i].rhs; } -#endif /* notyet */ /* * Extract a single string from the returned JSON object, making sure @@ -375,7 +373,7 @@ json_parse_response(struct jsmnn *n) int json_parse_challenge(struct jsmnn *n, struct chng *p) { - struct jsmnn *array, *obj; + struct jsmnn *array, *obj, *error; size_t i; int rc; char *type; @@ -401,6 +399,10 @@ json_parse_challenge(struct jsmnn *n, struct chng *p) p->uri = json_getstr(obj, "url"); p->token = json_getstr(obj, "token"); p->status = json_parse_response(obj); + if (p->status == CHNG_INVALID) { + error = json_getobj(obj, "error"); + p->error = json_getstr(error, "detail"); + } return p->uri != NULL && p->token != NULL; } |