There's a regression in the IPA ID provider that caused all ID
operations except for initgroups to segfault.
From c7a390f0af7dbcf2e90b1e8b165b109154c8a47f Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhro...@redhat.com>
Date: Thu, 24 Nov 2011 14:39:40 +0100
Subject: [PATCH] Fix segfault in IPA ID provider

---
 src/providers/ipa/ipa_id.c       |    2 +-
 src/providers/ldap/ldap_common.h |    1 +
 src/providers/ldap/ldap_id.c     |   14 ++++++++++++--
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/providers/ipa/ipa_id.c b/src/providers/ipa/ipa_id.c
index 
14a344f2a49a6ff63a975068689929620cdc6700..a014c9f2095298e375e96c2bc39e7b5c98dee879
 100644
--- a/src/providers/ipa/ipa_id.c
+++ b/src/providers/ipa/ipa_id.c
@@ -80,7 +80,7 @@ void ipa_account_info_handler(struct be_req *breq)
     case BE_REQ_USER: /* user */
     case BE_REQ_GROUP: /* group */
     case BE_REQ_INITGROUPS: /* init groups for user */
-        return sdap_account_info_handler(breq);
+        return sdap_handle_account_info(breq, ctx);
 
     case BE_REQ_NETGROUP:
         if (ar->filter_type != BE_FILTER_NAME) {
diff --git a/src/providers/ldap/ldap_common.h b/src/providers/ldap/ldap_common.h
index 
2c77846e94443d6e41bc85533751355a50f9b8e4..e937cf2cd194eafc56915e2d2b88f7a5fe5e1c98
 100644
--- a/src/providers/ldap/ldap_common.h
+++ b/src/providers/ldap/ldap_common.h
@@ -71,6 +71,7 @@ struct sdap_auth_ctx {
 void sdap_check_online(struct be_req *breq);
 /* id */
 void sdap_account_info_handler(struct be_req *breq);
+void sdap_handle_account_info(struct be_req *breq, struct sdap_id_ctx *ctx);
 int sdap_id_setup_tasks(struct sdap_id_ctx *ctx);
 
 /* auth */
diff --git a/src/providers/ldap/ldap_id.c b/src/providers/ldap/ldap_id.c
index 
b8e9563bda3053217c223f1352bd3474613cbc2f..dcc9f2200c0fe5df974dd620a2527fafe102542e
 100644
--- a/src/providers/ldap/ldap_id.c
+++ b/src/providers/ldap/ldap_id.c
@@ -732,17 +732,27 @@ static void sdap_account_info_users_done(struct 
tevent_req *req);
 static void sdap_account_info_groups_done(struct tevent_req *req);
 static void sdap_account_info_initgr_done(struct tevent_req *req);
 static void sdap_account_info_netgroups_done(struct tevent_req *req);
+void sdap_handle_account_info(struct be_req *breq, struct sdap_id_ctx *ctx);
 
 void sdap_account_info_handler(struct be_req *breq)
 {
     struct sdap_id_ctx *ctx;
+
+    ctx = talloc_get_type(breq->be_ctx->bet_info[BET_ID].pvt_bet_data, struct 
sdap_id_ctx);
+    if (!ctx) {
+        DEBUG(SSSDBG_CRIT_FAILURE, ("Could not get sdap ctx\n"));
+        return sdap_handler_done(breq, DP_ERR_FATAL, ENOMEM, "Out of memory");
+    }
+    sdap_handle_account_info(breq, ctx);
+}
+
+void sdap_handle_account_info(struct be_req *breq, struct sdap_id_ctx *ctx)
+{
     struct be_acct_req *ar;
     struct tevent_req *req;
     const char *err = "Unknown Error";
     int ret = EOK;
 
-    ctx = talloc_get_type(breq->be_ctx->bet_info[BET_ID].pvt_bet_data, struct 
sdap_id_ctx);
-
     if (be_is_offline(ctx->be)) {
         return sdap_handler_done(breq, DP_ERR_OFFLINE, EAGAIN, "Offline");
     }
-- 
1.7.7.3

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to