dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From b4063b2d3f1c700aa074f71d5db501e1bdfd6d2a Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose@redhat.com>
Date: Wed, 24 Oct 2018 17:27:21 +0200
Subject: [PATCH] ifp: fix typo causing a crash in FindByNameAndCertificate

Due to a typo in the recent refactoring the InfoPipe crashes in the
FindByNameAndCertificate request.

Additionally a state variable in set to the expected value.

Related to https://pagure.io/SSSD/sssd/issue/3863

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
---
 src/responder/ifp/ifp_users.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/responder/ifp/ifp_users.c b/src/responder/ifp/ifp_users.c
index dd44afcc45df5c29e3a9926bf42cd416e3445d77..5dd34d68808fa0230d77de1fd3805b5971cb9aa6 100644
--- a/src/responder/ifp/ifp_users.c
+++ b/src/responder/ifp/ifp_users.c
@@ -584,6 +584,12 @@ ifp_users_find_by_name_and_cert_send(TALLOC_CTX *mem_ctx,
     }
 
     if (!SBUS_REQ_STRING_IS_EMPTY(pem_cert)) {
+        state->pem_cert = talloc_strdup(state, pem_cert);
+        if (state->pem_cert == NULL) {
+            ret = ENOMEM;
+            goto done;
+        }
+
         ret = sss_cert_pem_to_derb64(state, pem_cert, &state->derb64);
         if (ret != EOK) {
             DEBUG(SSSDBG_OP_FAILURE, "sss_cert_pem_to_derb64 failed.\n");
@@ -741,7 +747,7 @@ static void ifp_users_find_by_name_and_cert_done(struct tevent_req *subreq)
         return;
     }
 
-    ret = ifp_users_list_by_cert_step(req);
+    ret = ifp_users_find_by_name_and_cert_step(req);
     if (ret == EOK) {
         tevent_req_done(req);
     } else if (ret != EAGAIN) {
-- 
2.14.4