URL: https://github.com/SSSD/sssd/pull/222
Author: pbrezina
 Title: #222: ipa_s2n_get_acct_info_send: provide correct req_input name
Action: opened

PR body:
"""
To avoid crash.

Resolves:
https://pagure.io/SSSD/sssd/issue/3358
"""

To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/222/head:pr222
git checkout pr222
From ffde4dcdfc0a57f63c8c9f06e2dff7a11fbba3d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrez...@redhat.com>
Date: Wed, 29 Mar 2017 13:28:49 +0200
Subject: [PATCH 1/2] configure: fix typo
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Reviewed-by: Lukáš Slebodník <lsleb...@redhat.com>
---
 src/external/libhttp_parser.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/external/libhttp_parser.m4 b/src/external/libhttp_parser.m4
index 504bdf0..3a5ef0d 100644
--- a/src/external/libhttp_parser.m4
+++ b/src/external/libhttp_parser.m4
@@ -17,6 +17,6 @@ AS_IF([test x"$found_http_parser" != xyes],
                       ],
                       [-L$sss_extra_libdir -lhttp_parser_strict])],
         [AC_MSG_ERROR([
-You must have the header file http_parse.h installed to build sssd
+You must have the header file http_parser.h installed to build sssd
 with secrets responder. If you want to build sssd without secret responder
 then specify --without-secrets when running configure.])])])

From 4b337e7b5cb661522b479fbf3d94522ada5db2b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrez...@redhat.com>
Date: Mon, 3 Apr 2017 12:09:44 +0200
Subject: [PATCH 2/2] ipa_s2n_get_acct_info_send: provide correct req_input
 name

To avoid crash.

Resolves:
https://pagure.io/SSSD/sssd/issue/3358
---
 src/providers/ipa/ipa_s2n_exop.c | 37 +++++++++++++++++++++++++++++++++----
 1 file changed, 33 insertions(+), 4 deletions(-)

diff --git a/src/providers/ipa/ipa_s2n_exop.c b/src/providers/ipa/ipa_s2n_exop.c
index 8a3391b..0685e58 100644
--- a/src/providers/ipa/ipa_s2n_exop.c
+++ b/src/providers/ipa/ipa_s2n_exop.c
@@ -1054,6 +1054,33 @@ static const char *ipa_s2n_reqtype2str(enum request_types request_type)
     return "Unknown request type";
 }
 
+static const char *ipa_s2n_reqinp2str(TALLOC_CTX *mem_ctx,
+                                      struct req_input *req_input)
+{
+    const char *str;
+
+    switch (req_input->type) {
+    case REQ_INP_NAME:
+        str = talloc_strdup(mem_ctx, req_input->inp.name);
+        break;
+    case REQ_INP_SECID:
+        str = talloc_strdup(mem_ctx, req_input->inp.secid);
+        break;
+    case REQ_INP_CERT:
+        str = talloc_strdup(mem_ctx, req_input->inp.cert);
+        break;
+    case REQ_INP_ID:
+        str = talloc_asprintf(mem_ctx, "%u", req_input->inp.id);
+        break;
+    }
+
+    if (str == NULL) {
+        DEBUG(SSSDBG_CRIT_FAILURE, "Out of memory!\n");
+    }
+
+    return str;
+}
+
 struct ipa_s2n_get_list_state {
     struct tevent_context *ev;
     struct ipa_id_ctx *ipa_ctx;
@@ -1410,6 +1437,7 @@ struct tevent_req *ipa_s2n_get_acct_info_send(TALLOC_CTX *mem_ctx,
     struct tevent_req *req;
     struct tevent_req *subreq;
     struct berval *bv_req = NULL;
+    const char *input;
     int ret = EFAULT;
     bool is_v1 = false;
 
@@ -1454,10 +1482,11 @@ struct tevent_req *ipa_s2n_get_acct_info_send(TALLOC_CTX *mem_ctx,
         goto fail;
     }
 
-    DEBUG(SSSDBG_TRACE_FUNC, "Sending request_type: [%s] for trust user [%s] "
-                            "to IPA server\n",
-                            ipa_s2n_reqtype2str(state->request_type),
-                            req_input->inp.name);
+    input = ipa_s2n_reqinp2str(state, req_input);
+    DEBUG(SSSDBG_TRACE_FUNC, "Sending request_type: [%s] for trust user "
+          "[%s] to IPA server\n", ipa_s2n_reqtype2str(state->request_type),
+          input);
+    talloc_zfree(input);
 
     subreq = ipa_s2n_exop_send(state, state->ev, state->sh, is_v1,
                                state->exop_timeout, bv_req);
_______________________________________________
sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org
To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org

Reply via email to