summaryrefslogtreecommitdiffstats
path: root/src/util/usertools.c
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2012-06-20 15:48:20 -0400
committerStephen Gallagher <sgallagh@redhat.com>2012-06-21 17:03:02 -0400
commit4b0b0bc3f9c4966b9f1a7433803a37c36fcaf285 (patch)
tree7ab010e8d036f6c81844109de7a7fc1774bff5a1 /src/util/usertools.c
parent3b1386e5ad510eb29d826a53113324af2c096e26 (diff)
downloadsssd-4b0b0bc3f9c4966b9f1a7433803a37c36fcaf285.tar.gz
sssd-4b0b0bc3f9c4966b9f1a7433803a37c36fcaf285.tar.xz
sssd-4b0b0bc3f9c4966b9f1a7433803a37c36fcaf285.zip
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
Diffstat (limited to 'src/util/usertools.c')
-rw-r--r--src/util/usertools.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/util/usertools.c b/src/util/usertools.c
index a3d210e36..3b23b6a7e 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;
}