Abraham Ingersoll wrote:
>
> I'm just finishing ''Introduction to C'' at UCLA, so with that
> disclaimer, it appears that qmail-ldap-20010501 will build a bad search
> filter if control/ldapobjectclass exists, and thus, catchall addresses
> will fail to 'catch.'
Yes, you are right. There is a bug.
> Here's some debug output (DEBUGLEVEL=255) showing the bad search filter:
>
> delivery 1:
> failure:
> mailaddr:
> [EMAIL PROTECTED]/
>
>ldapfilter:_'(&(objectclass=qmailUser)(|([EMAIL PROTECTED])([EMAIL PROTECTED])))'/
> ldap_lookup:_init_successful,_bind_successful/
>
>ldap_lookup:_search_for_(&(objectclass=qmailUser)(|([EMAIL PROTECTED])([EMAIL PROTECTED])))_succeeded/
> ldap_lookup:_Too_many_(less)_entries_found_(0)/
>
>retry_with_filter_'(&(objectclass=qmailUser)(|([EMAIL PROTECTED])([EMAIL PROTECTED]))'/
> ldap_lookup:_init_successful,_bind_successful/
>
>ldap_lookup:_search_for_(&(objectclass=qmailUser)(|([EMAIL PROTECTED])([EMAIL PROTECTED]))_failed_(Bad_search_filter)/
>
> ^^^ (see end of above line)
>
> I think this should fix the prob:
>
> --- qmail-lspawn.c Sun May 13 12:14:40 2001
> +++ ../qmail-ldap-1.03/qmail-lspawn.c Sun May 13 12:11:14 2001
> @@ -427,7 +427,11 @@
> if (!stralloc_cats(&filter,"=")) _exit(QLX_NOMEM);
> if (!stralloc_cats(&filter,LDAP_CATCH_ALL)) _exit(QLX_NOMEM);
> if (!stralloc_catb(&filter,r+at, i-at)) _exit(QLX_NOMEM);
> - if (!stralloc_cats(&filter,"))")) _exit(QLX_NOMEM);
> + if (qldap_objectclass.len) {
> + if (!stralloc_cats(&filter,")))")) _exit(QLX_NOMEM);
> + } else {
> + if (!stralloc_cats(&filter,"))")) _exit(QLX_NOMEM);
> + }
> if (!stralloc_0(&filter)) _exit(QLX_NOMEM);
>
> debug(16, "retry with filter '%s'\n", filter.s);
Your fix would work but is not pure enough, for reference the right fix
looks like this:
$ cvs diff -u -r1.60 qmail-lspawn.c
Index: qmail-lspawn.c
===================================================================
RCS file: /usr/home/opi/CVS/qmail-ldap/qmail-lspawn.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- qmail-lspawn.c 2001/04/19 14:57:11 1.60
+++ qmail-lspawn.c 2001/05/14 08:33:36 1.61
@@ -428,6 +428,9 @@
if (!stralloc_cats(&filter,LDAP_CATCH_ALL)) _exit(QLX_NOMEM);
if (!stralloc_catb(&filter,r+at, i-at)) _exit(QLX_NOMEM);
if (!stralloc_cats(&filter,"))")) _exit(QLX_NOMEM);
+ if ( qldap_objectclass.len ) {
+ if (!stralloc_cats(&filter,")")) _exit(QLX_NOMEM);
+ }
if (!stralloc_0(&filter)) _exit(QLX_NOMEM);
debug(16, "retry with filter '%s'\n", filter.s);
Instead of having if-else we simply add another bracket if we are using
objectclass. This make the code easier to read.
> Another random issue I noticed --
>
> To get qmail-ldap to re-read control/ldapobjectclass, you have to send a
> SIGHUP to qmail-lspawn. I *thought* whatever signal you sent to qmail-send
> would get forwarded, per se, to it's child processes, but perhaps I'm
> wrong. Am I missing something, or is qmail-send not properly forwarding
> signals to qmail-lspawn ?
This is no bug actually. Reason is qmail-lspawn is just started by
qmail-send, it is not being forked.
--
Andre