Author Topic: 0.9.5 : can't add contact to ldap addressbook // solved  (Read 4334 times)

Offline electronico

  • Newbie
  • *
  • Posts: 3
0.9.5 : can't add contact to ldap addressbook // solved
« on: November 02, 2013, 05:20:28 PM »
Hi all,

rc : 0.9.5 installed from source
os : Linux serveur 3.8.0-32-generic #47~precise1-Ubuntu SMP Wed Oct 2 16:19:35 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Specific user 'ldap' as been created in ldap to allow read/write access to this addressbook.
The add user works as expected in command line.

Here are the roundcube ldap log during this error :
Code: [Select]
Nov  3 07:28:40 serveur roundcube: C: Connect [10.10.20.1:389] [Annuaire]
Nov  3 07:28:40 serveur roundcube: S: OK
Nov  3 07:28:40 serveur roundcube: C: Bind [dn: CN=ldap,CN=Users,DC=domain,DC=lan] [pass: My_secret_password]
Nov  3 07:28:40 serveur roundcube: S: OK
Nov  3 07:28:40 serveur roundcube: C: Search [(&(&(mail=*))(|(mail=bla@bla.nc)))][dn: OU=annuaire,DC=DOMAIN,DC=LAN]
Nov  3 07:28:40 serveur roundcube: S: 0 record(s)
Nov  3 07:28:40 serveur roundcube: C: Add [dn: =,OU=annuaire,DC=DOMAIN,DC=LAN]: Array#012(#012    [cn] => rc rc#012    [givenname] => rc#012    [sn] => rc#012    [mail] => bla@bla.fr#012    [objectClass] => #012)
Nov  3 07:28:40 serveur roundcube: S: Invalid syntax
Nov  3 07:28:40 serveur roundcube: C: Close
It seems to be because of :
Code: [Select]
roundcube: C: Add [dn: =,OU=annuaire,DC=DOMAIN,DC=LAN]where is this =, written ?
Thanks in advance for your time & lights
Nicolas
« Last Edit: November 03, 2013, 01:22:49 PM by electronico »

Offline dmrc

  • Newbie
  • *
  • Posts: 8
Re: 0.9.5 : can't add contact to ldap addressbook
« Reply #1 on: November 02, 2013, 06:45:25 PM »

ldapsearch -x -LLL -H 'ldap://domain.lan:389' -b 'OU=annuaire,DC=DOMAIN,DC=LAN' -D 'CN=ldap,CN=Users,DC=domain,DC=lan' -w My_secret_password

?
---------------------------------------------------------------

modify.ldif

Code: [Select]
dn: cn=client1,OU=annuaire,DC=DOMAIN,DC=LAN
changetype: add
objectClass: inetOrgPerson
cn: client1
sn: client1
mail: test@some.org

ldapmodify -x -H 'ldap://domain.lan:389' -f ./modify.ldif -D 'CN=ldap,CN=Users,DC=domain,DC=lan' -w My_secret_password

?

Offline electronico

  • Newbie
  • *
  • Posts: 3
Re: 0.9.5 : can't add contact to ldap addressbook
« Reply #2 on: November 03, 2013, 02:58:00 AM »
Hi, thanks for your answer.

Yes ldap command line queries to add a user are OK on the addressbook :
Code: [Select]
ldapmodify -x -H 'ldap://domain.lan:389' -f ldap_test1 -D 'CN=ldap,CN=Users,DC=domain,DC=lan' -w My_secret_passwordldap_test1:
Code: [Select]
dn: cn=client1,OU=annuaire,DC=DOMAIN,DC=LAN
changetype: add
objectClass: Contact
cn: client1
sn: client1
mail: test@some.org
->
Code: [Select]
adding new entry "cn=client1,OU=annuaire,DC=DOMAIN,DC=LAN"
Code: [Select]
ldapsearch -LLL -H ldap://localhost:389 -b 'ou=annuaire,dc=domain,dc=lan' -D 'DOMAIN\ldap' -w 'My_secret_password->
Code: [Select]
dn: CN=test_user,OU=annuaire,DC=domain,DC=lan
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: contact
cn: test_user
instanceType: 4
whenCreated: 20131102202659.0Z
uSNCreated: 5577
name: test_user
objectGUID:: fdwJ36N1g0mU4JZaMOM08Q==
objectCategory: CN=Person,CN=Schema,CN=Configuration,DC=domain,DC=lan
mail: me@here.org
sn: test
whenChanged: 20131102202807.0Z
givenName: test_user
uSNChanged: 5584
distinguishedName: CN=test_user,OU=annuaire,DC=domain,DC=lan

dn: CN=client1,OU=annuaire,DC=domain,DC=lan
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: contact
cn: client1
sn: client1
instanceType: 4
whenCreated: 20131103073317.0Z
whenChanged: 20131103073317.0Z
uSNCreated: 6009
uSNChanged: 6009
name: client1
objectGUID:: wCwjtMvn8k269Ki7QguHAQ==
objectCategory: CN=Person,CN=Schema,CN=Configuration,DC=domain,DC=lan
mail: test@some.org
distinguishedName: CN=client1,OU=annuaire,DC=domain,DC=lan

dn: OU=annuaire,DC=domain,DC=lan
objectClass: top
objectClass: organizationalUnit
ou: annuaire
instanceType: 4
whenCreated: 20131102010843.0Z
uSNCreated: 5425
name: annuaire
objectGUID:: AYMpvUK1dkGeNAp2Di9qNw==
objectCategory: CN=Organizational-Unit,CN=Schema,CN=Configuration,DC=domain,DC=lan
whenChanged: 20131102202356.0Z
uSNChanged: 5576
distinguishedName: OU=annuaire,DC=domain,DC=lan

The problem is in the Roundcube code when I want to add a new user it gives :
Code: [Select]
Nov  3 18:42:09 serveur roundcube: C: Add [dn: =,OU=annuaire,DC=DOMAIN,DC=LAN]: Array#012(#012    [cn] => client2 client2#012    [givenname] => client2#012    [sn] => client2#012    [mail] => client2@here.com#012    [objectClass] => #012)
Nov  3 18:42:09 serveur roundcube: S: Invalid syntax
Nov  3 18:42:09 serveur roundcube: C: Close
C: Add [dn: =,OU=annuaire,DC=DOMAIN,DC=LAN] bold/underligned characters are the problem but I don't know where to find these in Roundcube code...

This is really a bug in code.
Nicolas

Offline alec

  • Hero Member
  • *****
  • Posts: 1,160
Re: [bug] 0.9.5 : can't add contact to ldap addressbook
« Reply #3 on: November 03, 2013, 03:27:29 AM »
It looks like you didn't configure LDAP_rdn attribute in addressbook configuration (ldap_public).

Offline dmrc

  • Newbie
  • *
  • Posts: 8
Re: [bug] 0.9.5 : can't add contact to ldap addressbook
« Reply #4 on: November 03, 2013, 03:47:29 AM »
config/main.inc.php

Code: [Select]
$rcmail_config['ldap_public']['rcaprivate'] = array(
  ...
  'user_specific'                  => true,
  'writable'                          => true,
  'LDAP_Object_Classes'   => array('top', 'inetOrgPerson'),
  'LDAP_rdn'                       => 'cn',
  'required_fields'                => array('cn', 'sn', 'mail'),
  'search_fields'                  => array('mail', 'cn'),
  ...

Offline electronico

  • Newbie
  • *
  • Posts: 3
Re: [bug] 0.9.5 : can't add contact to ldap addressbook
« Reply #5 on: November 03, 2013, 01:22:06 PM »
Thanks dmrc and Alec,
Turned out that I didn't have :
Code: [Select]
  'LDAP_Object_Classes' => array('top', 'inetOrgPerson'),
  'LDAP_rdn'       => 'cn',
:-[
All is OK now, please excuse me for this unusefull post.
Nicolas