summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2010-06-10 13:03:21 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-06-14 16:54:31 -0400
commitf519b2ed74ca000b80c77dfccfe9a5caffb0010a (patch)
tree5aa8d89080062333b4e0ee6b77f3d7f784e58299
parent095a719ae079ce5f8c28440e358df963eeec0618 (diff)
downloadsssd-f519b2ed74ca000b80c77dfccfe9a5caffb0010a.tar.gz
sssd-f519b2ed74ca000b80c77dfccfe9a5caffb0010a.tar.bz2
sssd-f519b2ed74ca000b80c77dfccfe9a5caffb0010a.zip
Don't segfault if ldap_access_filter is unspecified
https://fedorahosted.org/sssd/ticket/539
-rw-r--r--src/providers/ldap/ldap_init.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/providers/ldap/ldap_init.c b/src/providers/ldap/ldap_init.c
index 7059905c..d6d5b1e3 100644
--- a/src/providers/ldap/ldap_init.c
+++ b/src/providers/ldap/ldap_init.c
@@ -232,19 +232,20 @@ int sssm_ldap_access_init(struct be_ctx *bectx,
"but no ldap_access_filter configured. "
"All domain users will be denied access.\n"));
}
-
- if (filter[0] == '(') {
- /* This filter is wrapped in parentheses.
- * Pass it as-is to the openldap libraries.
- */
- access_ctx->filter = filter;
- }
else {
- /* Add parentheses around the filter */
- access_ctx->filter = talloc_asprintf(access_ctx, "(%s)", filter);
- if (access_ctx->filter == NULL) {
- ret = ENOMEM;
- goto done;
+ if (filter[0] == '(') {
+ /* This filter is wrapped in parentheses.
+ * Pass it as-is to the openldap libraries.
+ */
+ access_ctx->filter = filter;
+ }
+ else {
+ /* Add parentheses around the filter */
+ access_ctx->filter = talloc_asprintf(access_ctx, "(%s)", filter);
+ if (access_ctx->filter == NULL) {
+ ret = ENOMEM;
+ goto done;
+ }
}
}