Re: Re: qmail-ldaplookup: fatal: qldap_filter: unspecified error

Claudio Jeker <[email protected]> Fri, 16 Mar 2012 23:39:36 +0100
Newsgroups gmane.mail.qmail.ldap
Message-ID <[email protected]>
On Fri, Mar 16, 2012 at 08:26:55PM +0000, Nicolas de Bari Embriz Garcia Rojas wrote:
> I think I have found the problem. but need some help fixing the code
> 
> For some reason the qldap-filter.c is not adding the
> /var/qmail/control/ldapobjectclass
> 

... thanks for the detailed report. I was able to verify it and the
attached diff should fix this problem.

-- 
:wq Claudio

Index: qldap-filter.c
===================================================================
RCS file: /home/cvs-djbware/CVS/qmail-ldap/qldap-filter.c,v
retrieving revision 1.10
diff -u -p -r1.10 qldap-filter.c
--- qldap-filter.c	10 Nov 2009 22:46:06 -0000	1.10
+++ qldap-filter.c	16 Mar 2012 23:37:23 -0000
@@ -107,7 +107,7 @@ filter_uid(char *uid)
 		return 0;
 
 	if (!filter_start(&filter)  ||
-	    !stralloc_copys(&filter,"(") ||
+	    !stralloc_cats(&filter,"(") ||
 	    !stralloc_cats(&filter, LDAP_UID) ||
 	    !stralloc_cats(&filter, "=") ||
 	    !filter_escape(&filter, uid, str_len(uid)) ||
@@ -179,7 +179,6 @@ filter_mail(char *mail, int *done)
 		}
 		extcnt--;
 #else
-#error XXX XXX 
 		/* basic qmail-ldap behavior test for [email protected] and
 		   [email protected] */
 		ext = 0;
@@ -193,7 +192,7 @@ filter_mail(char *mail, int *done)
 			/* build the search string for the email address */
 			/* mail address */
 			if (!filter_start(&filter) ||
-			    !stralloc_copys(&filter, "(|(") ||
+			    !stralloc_cats(&filter, "(|(") ||
 			    !stralloc_cats(&filter, LDAP_MAIL) ||
 			    !stralloc_cats(&filter, "="))
 				return 0;
Index: qmail-ldaplookup.c
===================================================================
RCS file: /home/cvs-djbware/CVS/qmail-ldap/qmail-ldaplookup.c,v
retrieving revision 1.39
diff -u -p -r1.39 qmail-ldaplookup.c
--- qmail-ldaplookup.c	10 Nov 2009 22:43:06 -0000	1.39
+++ qmail-ldaplookup.c	16 Mar 2012 23:37:23 -0000
@@ -223,12 +223,12 @@ int main(int argc, char **argv)
 		switch (mode) {
 		case mail:
 			f = filter_mail(value, &done);
-			if (value == 0)
+			if (f == 0)
 				strerr_die2sys(1, FATAL, "building filter: ");
 			break;
 		case uid:
 			f = filter_uid(value);
-			if (value == 0)
+			if (f == 0)
 				strerr_die2sys(1, FATAL, "building filter: ");
 			done = 1;
 			break;