From: Frédéric Marchal Date: Thu, 3 Feb 2011 14:02:18 +0000 (+0000) Subject: Fix a problem with the attributes passed to ldap_search X-Git-Tag: v2.3.2~74 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0bfbafc0f561d3ce2147c4e70a01197dac842445;p=thirdparty%2Fsarg.git Fix a problem with the attributes passed to ldap_search The attributes list passed to ldap_search must be terminated by a NULL pointer. That wasn't the case in sarg and was likely responsible for a segfault. It should be fixed now. --- diff --git a/usertab.c b/usertab.c index add4432..4bbd9cc 100644 --- a/usertab.c +++ b/usertab.c @@ -190,7 +190,7 @@ static void get_ldap_name(const char *userlogin,char *mappedname,int namelen) int i; int slen; int rc; - char *attrs[1]; + char *attrs[2]; searched_in_cache = search_in_cache(userlogin); if (searched_in_cache!=NULL) { @@ -226,6 +226,7 @@ static void get_ldap_name(const char *userlogin,char *mappedname,int namelen) /* Search record(s) in LDAP base */ attrs[0]=LDAPTargetAttr; + attrs[1]=NULL; rc= ldap_search_ext_s(ldap_handle, LDAPBaseSearch, LDAP_SCOPE_SUBTREE, filtersearch, attrs, 0, NULL, NULL, NULL, -1, &result); if (rc != LDAP_SUCCESS) { debuga(_("LDAP search failed: %s\n"), ldap_err2string(rc));