]> mj.ucw.cz Git - subauth.git/blobdiff - pam/pam_subauth.c
Apache: Bugfix in *.load
[subauth.git] / pam / pam_subauth.c
index d6d0f88e5bcc86fea80d12f3b47bfc48aefeae43..2cb32b3e9dc45264bf523d4beb145aca81571aea 100644 (file)
@@ -83,9 +83,10 @@ static struct json_node *run_command(struct context *ctx, struct json_node *requ
   struct fastbuf rp_fb;
   fbbuf_init_read(&rp_fb, rp_buf, rp_len, 0);
 
+  struct json_node *reply = NULL;
   TRANS_TRY
     {
-      ctx->reply = json_parse(ctx->json, &rp_fb);
+      reply = json_parse(ctx->json, &rp_fb);
     }
   TRANS_CATCH(x)
     {
@@ -93,12 +94,14 @@ static struct json_node *run_command(struct context *ctx, struct json_node *requ
     }
   TRANS_END;
 
-  if (ctx->reply->type != JSON_OBJECT)
+  if (reply->type != JSON_OBJECT)
     {
       pam_syslog(ctx->pamh, LOG_ERR, "Malformed reply: Top-level node is not an object");
       goto fail3;
     }
 
+  ctx->reply = reply;
+
 fail3:
   free(rp_buf);
 fail2: