From b71f85ec315be591d2a964be6c2a23b0d0f6e632 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Tue, 16 Jan 2018 10:35:37 +0100 Subject: [PATCH] stratum: show reason of auth failure --- util.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/util.cpp b/util.cpp index 152093d..3141305 100644 --- a/util.cpp +++ b/util.cpp @@ -1354,7 +1354,11 @@ bool stratum_authorize(struct stratum_ctx *sctx, const char *user, const char *p if (!res_val || json_is_false(res_val) || (err_val && !json_is_null(err_val))) { - applog(LOG_ERR, "Stratum authentication failed"); + if (err_val && json_is_array(err_val)) { + const char* reason = json_string_value(json_array_get(err_val, 1)); + applog(LOG_ERR, "Stratum authentication failed (%s)", reason); + } + else applog(LOG_ERR, "Stratum authentication failed"); goto out; }