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

Nicolas de Bari Embriz Garcia Rojas <[email protected]> Sat, 17 Mar 2012 00:05:15 +0000
Newsgroups gmane.mail.qmail.ldap
Message-ID <CAG+iRUmzhepkg=ASrFWUeDB4+GeuUBQ6ktxRmiAz9bTDgKJbgQ@mail.gmail.com>
Hi, thanks for the reply, I applied the patch and it is working now.

Changing a little the topic, I modified  qmail-qmqpc.c  for supporting
multiple qmpqc servers ( one server per line in DIR/qmqpservers/0),
but would like to know your feed back about it.

the patch: http://qmail-ldap-smtpauthuser.googlecode.com/svn/trunk/qmail-qmqpc-servers_on_cmd_line.c

Original:
---
  if ( argv[1] ) {
    char temp[IPFMT];
    if (!stralloc_copys(&servers,argv[1])) nomem();
    dns_init(0);
    switch (dns_ip(&ia,&servers)) {
      case DNS_HARD: die_perm();
      case DNS_SOFT: die_temp();
      case DNS_MEM: nomem();
    }

    temp[ip_fmt(temp,&ia.ix[0].ip)]=0;
    if (!stralloc_copys(&servers, temp)) nomem();
    if (!stralloc_0(&servers)) nomem();
  }
---

Replaced with this:

---
  if ( argv[1] ) {
    getmess();
    i = 1;
    while (argv[i])
      doit(argv[i++]);
  }
---

thanks in advance.


On Fri, Mar 16, 2012 at 10:39 PM, Claudio Jeker <[email protected]> wrote:
> 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;



-- 
> nbari