shithub: riscv

Download patch

ref: 9778107f65da594f36efc899838d4e73860b3c04
parent: d56e82d34b02a0aea4076e27b7290a544b98bb9a
author: mia soweli <inbox@tachibana-labs.org>
date: Sun May 28 13:45:10 EDT 2023

auth/acmed: better challenge error reporting.

--- a/sys/src/cmd/auth/acmed.c
+++ b/sys/src/cmd/auth/acmed.c
@@ -570,13 +570,15 @@
 	if((tok = jsonbyname(j, "token")) == nil)
 		return -1;
 
-	if(ty->t != JSONString || url->t != JSONString || tok->t != JSONString)
+	if(ty->t != JSONString || url->t != JSONString || tok->t != JSONString) {
+		werrstr("invalid challenge");
 		return -1;
+	}
 
 	if((dn = jsonbyname(id, "value")) == nil)
 		return -1;
 	if(dn->t != JSONString) {
-		werrstr("key 'value' not a string");
+		werrstr("invalid identifier");
 		return -1;
 	}
 
@@ -684,7 +686,7 @@
 				werrstr("could not complete challenge: %r");
 		}
 		if(!matched)
-			sysfatal("no matching auth type");
+			sysfatal("no matching auth type: %r");
 		jsonfree(chals);
 		free(resp);
 	}