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

There is a method call 'filter_objectclass' on version
qmail-ldap-1.03-20060201.patch the one is called after filtering by
(uid/mail) and properly builds the ldap query.

but on version qmail-ldap-1.03-20120221.patch

The filter_objectclass has been replaced with this one:

int
filter_start(stralloc *filter)
{
  if (!stralloc_copys(filter, ""))
    return 0;
  if (objectclass.s != (char *)0 && objectclass.len != 0) {
    /* (&(objectclass=...)%searchfilter%) */
    if (!stralloc_copys(filter, "(&(") ||
        !stralloc_cats(filter, LDAP_OBJECTCLASS) ||
        !stralloc_cats(filter, "=") ||
        !stralloc_cat(filter, &objectclass) ||
        !stralloc_cats(filter, ")"))
      return 0;
  }
  return 1;
}

But for an unknown reason it is not  appending  the : /*
(&(objectclass=...)%searchfilter%) */ in my case
(&(objectClass=qmailUser) that is why I am getting:

qmail-ldaplookup: fatal: qldap_filter: unspecified error

since the ldap query is malformed :
Searching ldap for:
(|(mail=t...@ejemplo.org)(mailAlternateAddress=t...@ejemplo.org)))

The correct query (using /var/qmail/control/ldapobjectclass) should be
something like:

(&(objectClass=qmailUser)(|(mail=t...@ejemplo.org)(mailAlternateAddress=t...@ejemplo.org)))




On Fri, Mar 16, 2012 at 6:21 PM, Nicolas de Bari Embriz Garcia Rojas
<nb...@unixmexico.org> wrote:
> There is something else missing, I am sure, that it is not an issue
> with the ldap entries. this is the full ldap I am using for testing,
> as you can notice it as only 1 user:
>
> ---
> dn: dc=lab,dc=inbox,dc=im
> dc: lab
> objectClass: top
> objectClass: domain
> objectClass: domainRelatedObject
> associatedDomain: lab.inbox.im
>
> dn: ou=vusers,dc=lab,dc=inbox,dc=im
> objectClass: top
> objectClass: organizationalUnit
> ou: vusers
> description: vusers
> structuralObjectClass: organizationalUnit
>
> dn: ou=ejemplo.org,ou=vusers,dc=lab,dc=inbox,dc=im
> objectClass: top
> objectClass: organizationalUnit
> ou: ejemplo.org
> description: ejemplo.org
> structuralObjectClass: organizationalUnit
>
> dn: uid=t...@ejemplo.org,ou=ejemplo.org,ou=vusers,dc=lab,dc=inbox,dc=im
> objectClass: top
> objectClass: person
> objectClass: iimOrgPerson
> objectClass: qmailUser
> uid: t...@ejemplo.org
> cn: test
> sn: test
> mail: t...@ejemplo.org
> mailMessageStore: ejemplo.org/test
> accountStatus: active
> smtpThrottle: 7
> mailQuotaSize: 2147483648
> mailQuotaCount: 0
> ---
>
> the only "Found 4 entries" that I see when running ./qmail-ldaplookup
> -m test are
> uid: t...@ejemplo.org
> cn: test
> sn: test
> mail: t...@ejemplo.org
>
> when running ./qmail-ldaplookup -m t...@ejemplo.org (the right way
> full email with @) on versions qmail-ldap-1.03-20060201.patch works
> fine, by returning the ldiff  but  on qmail-ldap-1.03-20120221.patch
> Id does not returns nothing.
>
> If the ldifs where wrong, the qmail-ldaplooup would fail also with
> versions < qmail-ldap-1.03-20120221.patch
>
> regards.
>
>
> On Fri, Mar 16, 2012 at 5:53 PM,  <ismail.yeni...@surgate.com> wrote:
>> Hi
>> -- orijinal mesaj --
>>>Found 4 entries:
>>>Uh-oh: multiple entries found but should >be unique!
>>
>> I think something wrong with your ldap records. This error occurs usually 
>> when you define the same mail/mailalternate address for the different user.
>> Please check your ldap entries.
>> -ismail
>> On Fri, Mar 16, 2012 at 3:26 PM, Ismail YENIGUL
>> <ismail.yeni...@surgate.com> wrote:
>>> Hi Nicolas,
>>>
>>> I am also using  qmail-ldap-1.03-20120221.patch without extra patch (just
>>> small fix about auth_dovecot sent by Claudio)
>>> It does not report any error for qmail-ldaplookup.  Are you applying
>>> domainalias patch to qmail-ldap-1.03-20120221.patch?
>>> This patch is already exist in qmail-ldap-1.03-20120221.patch
>>>
>>> Can you please do following and tell the result:
>>>
>>> 1. Apply only qmail-ldap-1.03-20120221.patch and just type make without
>>> setup check
>>> 2. run ./qmail-ldaplookup -m  test
>>>
>>>
>>>
>>>
>>> Ismail YENIGUL
>>> Team Leader / Takım Lideri
>>> SurGATE Labs
>>> Phone :+90 216-4709423 | Mobile:+90 533 747 36 65
>>> SurGATE: West Coast Labs Premium Anti-Spam Certificated
>>> Twitter: http://www.twitter.com/surgate
>>> Blog: http://www.surgate.com/blog
>>>
>>> On 16.03.2012 17:15, Nicolas de Bari Embriz Garcia Rojas wrote:
>>>>
>>>> Hi, sorry for the confusion, I mean qmail-ldap-1.03-20120221.patch.
>>>>
>>>> Also I do not think it is an issue with the control/ldap settings
>>>> since with the past versions<  20120221 the qmail-ldaplookup  works
>>>> fine, I think something is missing/broken on qldap-filter.c.
>>>>
>>>> What I am doing for testing (FreeBSD 9 amd64) is compiling the base of
>>>> qmail-ldap-1.03-20060201.patch plus this patches:
>>>>
>>>> domain alias
>>>> http://kristof.bajnok.hu/qmail/qldap-domainalias.patch (domain alias)
>>>>
>>>> multiple qmqpc servers (for ezml lists)
>>>>
>>>> http://code.google.com/p/qmail-ldap-smtpauthuser/source/browse/trunk/qmail-qmqpc-servers_on_cmd_line.c
>>>>
>>>> SRS support
>>>>
>>>> http://code.google.com/p/qmail-ldap-smtpauthuser/source/browse/trunk/qmail-ldap-1.03-20060201-SRS.patch
>>>>
>>>> my conf-cc looks like this:
>>>> cc -O2 -pipe -DLDAP_DEPRECATED -fno-strict-aliasing
>>>>
>>>> and conf-ld
>>>> cc -s  -rpath=/usr/lib:/usr/local/lib
>>>>
>>>> So far, version qmail-ldap-1.03-20060201 works fine with all this
>>>> patches, but now when trying to 'upgrade'/compile/test  version
>>>> qmail-ldap-1.03-20120221.patch using/sharing the same
>>>> /var/qmail/control, qmail-ldaplookup does not work.
>>>>
>>>> Using only qmail-ldap-1.03-20120221.patch (no extra patches) compiles
>>>> fine but qmail-ldaplook fails again, doing a little debug/diff between
>>>> versions (2012 vs 2006)  I notice that qldap-filter.c on version 2012
>>>> change considerable and this is because the implementation of the
>>>> 'domainalias'  patch:
>>>>
>>>> http://kristof.bajnok.hu/qmail/qldap-domainalias.patch
>>>>
>>>> I think that the implementation of the domain alias patch to the core
>>>> (for avoiding the -DDOMAIN_ALIAS) on version
>>>> qmail-ldap-1.03-20120221.patch is causing problems.
>>>>
>>>> The ldiff that I use is something like:
>>>>
>>>> dn: uid=t...@ejemplo.org,ou=ejemplo.org,ou=vusers,dc=inbox,dc=im
>>>> objectClass: top
>>>> objectClass: person
>>>> objectClass: inetOrgPerson
>>>> objectClass: qmailUser
>>>> uid: t...@ejemplo.org
>>>> cn: test
>>>> sn: test
>>>> mail: t...@ejemplo.org
>>>> mailMessageStore: ejemplo.org/test
>>>> accountStatus: active
>>>> smtpThrottle: 7
>>>> mailQuotaSize: 2147483648
>>>> userPassword: {SSHA}bRfoHmTRZTXyVywVdunoncu9jWWx32G2
>>>> mailQuotaCount: 0
>>>>
>>>>
>>>> PS. On either version qmail-ldap-1.03-20120221.patch or
>>>> qmail-ldap-1.03-20060201-SRS.patch I edit the Makefile and modify the
>>>> auto_uids.c with something like this:
>>>>
>>>> auto_uids.c:
>>>>   mv auto_uids.c.tmp auto_uids.c
>>>>
>>>> where auto_uids.c has this:
>>>>
>>>> /* These values are hard-coded here, which looks bad until you *
>>>>  * realise that they're hard-coded in ${PORTSDIR}/?IDs anyway. */
>>>> /* $FreeBSD: ports/mail/qmail/files/patch-auto_uids-c-dist,v 1.1
>>>> 2011/07/18 20:55:29 garga Exp $ */
>>>> int auto_uida = 81;
>>>> int auto_uidd = 82;
>>>> int auto_uidl = 83;
>>>> int auto_uido = 0;
>>>> int auto_uidp = 84;
>>>> int auto_uidq = 85;
>>>> int auto_uidr = 86;
>>>> int auto_uids = 87;
>>>> int auto_gidq = 82;
>>>> int auto_gidn = 81;
>>>>
>>>>
>>>> On Fri, Mar 16, 2012 at 2:05 PM, Ismail YENIGUL
>>>> <ismail.yeni...@surgate.com>  wrote:
>>>>>
>>>>> Hi Nicolas,
>>>>>
>>>>> First of all new patch is qmail-ldap-1.03-20120221.patch not
>>>>> qmail-ldap-1.03-20060201.patch
>>>>> I compiled both patch on FreeBSD&  Linux without any problem.
>>>>>
>>>>> Can you please post here exact output and ldap ldiff about
>>>>> dom...@ejemplo.org
>>>>> Did you verify that control/ldap* settings are correct?
>>>>>
>>>>>
>>>>> Thanks
>>>>>
>>>>> Ismail YENIGUL
>>>>> Team Leader / Takım Lideri
>>>>> SurGATE Labs
>>>>> Phone :+90 216-4709423 | Mobile:+90 533 747 36 65
>>>>> SurGATE: West Coast Labs Premium Anti-Spam Certificated
>>>>> Twitter: http://www.twitter.com/surgate
>>>>> Blog: http://www.surgate.com/blog
>>>>>
>>>>>
>>>>> On 15.03.2012 15:41, Nicolas de Bari Embriz Garcia Rojas wrote:
>>>>>>
>>>>>> Hi, after compiling qmail with the new patch qmail-ldap-1.03-20060201,
>>>>>> (freebsd) something seems to be broken on qldap-filter.c
>>>>>>
>>>>>> when trying to run /var/qmail/bin/qmail-ldaplookup -m dom...@ejemplo.org
>>>>>>
>>>>>> I get qmail-ldaplookup: fatal: qldap_filter: unspecified error
>>>>>>
>>>>>> Any idea of how to fix this?
>>>>>>
>>>>>> regards.
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>>
>>
>>
>>
>> --
>>> nbari
>>
>
>
>
> --
>> nbari



-- 
> nbari

Reply via email to