[SSSD] [PATCH] Fix segfault when ID-mapping an entry without a SID

Jakub Hrozek jhrozek at redhat.com
Tue Oct 9 17:10:02 UTC 2012


I accidentally enabled ID mapping for an IPA domain and saw this crash.
-------------- next part --------------
>From 2857c783a1c46adbf9048e2dfdc2f9944a0e8f1e Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Tue, 9 Oct 2012 18:03:24 +0200
Subject: [PATCH] Fix segfault when ID-mapping an entry without a SID

If there was no SID attribute, then we would have detected it by
checking the number of values of an element. We would however happily
return EOK in that case and save garbage into the sid_str.

This was causing segfault when the entry was supposed to be ID-mapped by
had no SID.
---
 src/providers/ldap/ldap_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c
index 6484556bdbdc542dfe7596e605c46f5edd4cb534..da5786fbf2acb89d3ffecfe2af1a4e035423bf4d 100644
--- a/src/providers/ldap/ldap_common.c
+++ b/src/providers/ldap/ldap_common.c
@@ -1491,7 +1491,7 @@ sdap_attrs_get_sid_str(TALLOC_CTX *mem_ctx,
         DEBUG(SSSDBG_MINOR_FAILURE,
               ("No [%s] attribute while id-mapping. [%d][%s]\n",
                sid_attr, el->num_values, strerror(ret)));
-        return ret;
+        return ENOENT;
     }
 
     err = sss_idmap_bin_sid_to_sid(idmap_ctx->map,
-- 
1.7.11.4



More information about the sssd-devel mailing list