[SSSD] [PATCH] IPA: Check connection validity explicitly

Jakub Hrozek jhrozek at redhat.com
Thu Oct 1 11:41:07 UTC 2015


Hi,

the attached patch (hopefully) fixes
https://fedorahosted.org/sssd/ticket/2810

(gdb) bt
#0  0x00007f9e8dde21d7 in ipa_get_ad_acct_send (ar=0x7f9e9cc2ff80, override_attrs=0x0, be_req=<optimized out>, ipa_ctx=<optimized out>, ev=0x7f9e9cbf0670, mem_ctx=<optimized out>)
    at src/providers/ipa/ipa_subdomains_id.c:648
#1  ipa_srv_ad_acct_lookup_step (req=req at entry=0x7f9e9cc81860) at src/providers/ipa/ipa_subdomains_id.c:1426
#2  0x00007f9e8dde2fbd in ipa_srv_ad_acct_send (ar=<optimized out>, override_attrs=<optimized out>, be_req=0x7f9e9ec9c400, ipa_ctx=0x7f9e9cc1c300, ev=0x7f9e9cbf0670, mem_ctx=<optimized out>)
    at src/providers/ipa/ipa_subdomains_id.c:1406
#3  ipa_subdomain_account_get_original_step (req=req at entry=0x7f9e9cc69c60, ar=<optimized out>) at src/providers/ipa/ipa_subdomains_id.c:277
#4  0x00007f9e8dde35d1 in ipa_subdomain_account_got_override (subreq=0x0) at src/providers/ipa/ipa_subdomains_id.c:254
#5  0x00007f9e8dde9f9a in ipa_get_ad_override_done (subreq=0x0) at src/providers/ipa/ipa_views.c:414
#6  0x00007f9e8d4f49b5 in generic_ext_search_handler (subreq=0x0, opts=<optimized out>) at src/providers/ldap/sdap_async.c:1662
#7  0x00007f9e8d4f6592 in sdap_get_generic_op_finished (op=<optimized out>, reply=<optimized out>, error=<optimized out>, pvt=<optimized out>) at src/providers/ldap/sdap_async.c:1546
#8  0x00007f9e8d4f599d in sdap_process_message (ev=<optimized out>, sh=<optimized out>, msg=0x7f9e9dc833e0) at src/providers/ldap/sdap_async.c:352
#9  sdap_process_result (ev=<optimized out>, pvt=<optimized out>) at src/providers/ldap/sdap_async.c:196
#10 0x00007f9e9825e30b in epoll_event_loop_once () from /lib64/libtevent.so.0
#11 0x00007f9e9825c7d7 in std_event_loop_once () from /lib64/libtevent.so.0
#12 0x00007f9e98258fbd in _tevent_loop_once () from /lib64/libtevent.so.0
#13 0x00007f9e9825915b in tevent_common_loop_wait () from /lib64/libtevent.so.0
#14 0x00007f9e9825c777 in std_event_loop_wait () from /lib64/libtevent.so.0
#15 0x00007f9e9bb92853 in server_loop (main_ctx=0x7f9e9cbf1ac0) at src/util/server.c:668
#16 0x00007f9e9c407d52 in main (argc=8, argv=<optimized out>) at src/providers/data_provider_be.c:3005
(gdb) p clist
$1 = (struct sdap_id_conn_ctx **) 0x7f9e9dc89ba0
(gdb) p clist[0]
$2 = (struct sdap_id_conn_ctx *) 0x7f9e9cc72ee0
(gdb) p clist[1]
$3 = (struct sdap_id_conn_ctx *) 0x0
(gdb) 

I don't have a good idea how to reproduce except simulate the failure in
gdb, sorry... at least I verified that after setting the context to NULL:
        (gdb) set clist[1] = 0
the request runs to completion and SSSD doesn't crash anymore. So I think
we should just add a check..

I tried to set the AD server offline and do some lookups, but the context
was always initialized for me..
-------------- next part --------------
>From 49015ae0853cb7445d4dabf44fc5fa785c632932 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Thu, 1 Oct 2015 13:13:05 +0200
Subject: [PATCH] IPA: Check connection validity explicitly

https://fedorahosted.org/sssd/ticket/2810

In the case the AD server was marked as offline during the connection
request, the GC sdap connection would be set to NULL and we'd end up
dereferencing the NULL pointer.
---
 src/providers/ipa/ipa_subdomains_id.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/providers/ipa/ipa_subdomains_id.c b/src/providers/ipa/ipa_subdomains_id.c
index 8f13608bcfd2f17c27fcba7f087e1a27086a2a1c..32cb6b179bd894dbe6a139fc721b606d99ae4112 100644
--- a/src/providers/ipa/ipa_subdomains_id.c
+++ b/src/providers/ipa/ipa_subdomains_id.c
@@ -645,7 +645,13 @@ ipa_get_ad_acct_send(TALLOC_CTX *mem_ctx,
             ret = ENOMEM;
             goto fail;
         }
-        clist[1]->ignore_mark_offline = true;
+
+        /* We need to check the connection validity, if AD went offline during
+         * the request, the connection would be set to NULL
+         */
+        if (clist[1] != NULL) {
+            clist[1]->ignore_mark_offline = true;
+        }
         break;
     default:
         clist = talloc_zero_array(req, struct sdap_id_conn_ctx *, 2);
-- 
2.4.3



More information about the sssd-devel mailing list