summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shopify.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/shopify.c b/shopify.c
index f75b8ac..2bc239c 100644
--- a/shopify.c
+++ b/shopify.c
@@ -146,16 +146,18 @@ bool shopify_valid(struct MHD_Connection *conn, const char *url,
free(query);
if (strcmp(url, redir_url))
return true;
- char *state = ((struct shopify_param *)bsearch(&(struct shopify_param)
- { "state" }, *params, nparams,
- sizeof(struct shopify_param), keycmp))->val;
int nsessions = 0;
while (sessions[nsessions].shop)
nsessions++;
qsort(sessions, nsessions, sizeof(struct session), keycmp);
- struct session *session = bsearch(&(struct session){ shop }, sessions,
- nsessions, sizeof(struct session), keycmp);
- if (strcmp(state, session->nonce)) {
+ if (strcmp(((struct shopify_param *)bsearch(&(struct shopify_param)
+ { "state" }, *params, nparams,
+ sizeof(struct shopify_param),
+ keycmp))->val,
+ ((struct session *)bsearch(&(struct session)
+ { shop }, sessions, nsessions,
+ sizeof(struct session),
+ keycmp))->nonce)) {
clear(*params);
return false;
}