diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2010-06-10 13:03:21 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-06-14 16:54:31 -0400 |
commit | f519b2ed74ca000b80c77dfccfe9a5caffb0010a (patch) | |
tree | 5aa8d89080062333b4e0ee6b77f3d7f784e58299 /src | |
parent | 095a719ae079ce5f8c28440e358df963eeec0618 (diff) | |
download | sssd-f519b2ed74ca000b80c77dfccfe9a5caffb0010a.tar.gz sssd-f519b2ed74ca000b80c77dfccfe9a5caffb0010a.tar.xz sssd-f519b2ed74ca000b80c77dfccfe9a5caffb0010a.zip |
Don't segfault if ldap_access_filter is unspecified
https://fedorahosted.org/sssd/ticket/539
Diffstat (limited to 'src')
-rw-r--r-- | src/providers/ldap/ldap_init.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/providers/ldap/ldap_init.c b/src/providers/ldap/ldap_init.c index 7059905c1..d6d5b1e37 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; + } } } |