The recent fixes for per-domain parsing can cause a segfault in
the netgroup processing if the domain isn't set to NULL when it's
parsed as "any domain".

Fixes https://fedorahosted.org/sssd/ticket/1383
From bfc3cac224d6db6bced620c18e3785f7e228cd0d Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgall...@redhat.com>
Date: Wed, 20 Jun 2012 15:48:20 -0400
Subject: [PATCH] UTILS: Fix segfault due to sss_parse_name_for_domains

The recent fixes for per-domain parsing can cause a segfault in
the netgroup processing if the domain isn't set to NULL when it's
parsed as "any domain".

https://fedorahosted.org/sssd/ticket/1383
---
 src/util/usertools.c |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/util/usertools.c b/src/util/usertools.c
index a3d210e36645c331e180729b734264462f30e05a..3b23b6a7e8e80c41e7177498f322d3a2e0c8fcbf 100644
--- a/src/util/usertools.c
+++ b/src/util/usertools.c
@@ -292,19 +292,22 @@ int sss_parse_name_for_domains(TALLOC_CTX *memctx,
         rname = only_name;
     }
 
-    if (rdomain != NULL)
-        *domain = talloc_steal(memctx, rdomain);
-    if (rname != NULL)
-        *name = talloc_steal(memctx, rname);
-
-    talloc_free(tmp_ctx);
-
     if (rdomain == NULL && rname == NULL) {
         DEBUG(SSSDBG_TRACE_FUNC,
               ("name '%s' did not match any domain's expression\n", orig));
         return EINVAL;
     }
 
+    if (domain != NULL) {
+        *domain = talloc_steal(memctx, rdomain);
+    }
+
+    if (name != NULL) {
+        *name = talloc_steal(memctx, rname);
+    }
+
+    talloc_free(tmp_ctx);
+
     return EOK;
 }
 
-- 
1.7.10.2

Attachment: signature.asc
Description: This is a digitally signed message part

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

Reply via email to