From f519b2ed74ca000b80c77dfccfe9a5caffb0010a Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Thu, 10 Jun 2010 13:03:21 -0400 Subject: Don't segfault if ldap_access_filter is unspecified https://fedorahosted.org/sssd/ticket/539 --- src/providers/ldap/ldap_init.c | 25 +++++++++++++------------ 1 file 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; + } } } -- cgit