From 956be4d8b143acb29fcc33b9ae0ad03abc0391ff Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 13 Sep 2014 22:46:48 +1000 Subject: [PATCH] Add sanity check for clients sending auth without having completed subscription --- src/stratifier.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/stratifier.c b/src/stratifier.c index 8fbfe6e4..bda81e22 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -1471,6 +1471,10 @@ static json_t *parse_authorise(stratum_instance_t *client, json_t *params_val, j *err_val = json_string("params missing array entries"); goto out; } + if (unlikely(!client->useragent)) { + *err_val = json_string("Failed subscription"); + goto out; + } buf = json_string_value(json_array_get(params_val, 0)); if (!buf) { *err_val = json_string("Invalid workername parameter");