Roundcube Community Forum

News and Announcements => General Discussion => Topic started by: Dmitry42 on July 10, 2023, 04:15:16 AM

Title: LDAP Addressbook problem after upgrade from 1.6.1 to 1.6.2
Post by: Dmitry42 on July 10, 2023, 04:15:16 AM
I can't filter my addressbook when it opened - it show me all.
For example I want addressbook only with mailgroups:

Quote
$config['ldap_public'] = [
'test' => [
                       'name' => 'test',
                        'hosts' => ['1.1.1.1'],
                        'base_dn' => 'OU=1, OU=2,OU=3, DC=4, DC=local',
                        'bind_dn' => 'USER',
                        'bind_pass' => 'PASSWD',
                        'writable' => false,
                        'ldap_version' => 3,
                        'network_timeout' => 10,
                        'user_specific' => false,
                        'scope' => 'sub',
                        'search_fields'   => ['displayname','mail'],
                        'fieldmap' => [
                                        'name'        => 'displayname',
                                        'email'       => 'mail'
                                        ],
                        'sort' => 'displayname',
                        'scope' => 'sub',
                        'filter' => '(objectCategory=group)',
                        'fuzzy_search' => true
                        ]
];


when I open it - I see users, computers.

log

Quote

Jul 10 11:10:05 mail roundcube: <a03e1p5q> C: Connect [ldap://1.1.1.1:389]
Jul 10 11:10:05 mail roundcube: <a03e1p5q> S: OK
Jul 10 11:10:05 mail roundcube: <a03e1p5q> C: Bind [dn: USER]
Jul 10 11:10:05 mail roundcube: <a03e1p5q> S: OK
Jul 10 11:10:05 mail roundcube: <a03e1p5q> C: Search base dn: [OU=1, OU=2,OU=3, DC=4, DC=local] scope with filter [(objectclass=*)]
Jul 10 11:10:05 mail roundcube: <a03e1p5q> Using function ldap_search on scope sub ($ns_function is ldap_search)
Jul 10 11:10:05 mail roundcube: <a03e1p5q> C: (Without VLV) Setting a filter of (objectclass=*)
Jul 10 11:10:05 mail roundcube: <a03e1p5q> Executing search with return attributes: array (
Jul 10 11:10:05 mail roundcube:   0 => 'displayname',
Jul 10 11:10:05 mail roundcube:   1 => 'mail',
Jul 10 11:10:05 mail roundcube:   2 => 'objectClass',
Jul 10 11:10:05 mail roundcube: )
Jul 10 11:10:05 mail roundcube: <a03e1p5q> S: 13 record(s) found


what I do wrong ? I use Active Directory as LDAP server
Title: Re: LDAP Addressbook problem after upgrade from 1.6.1 to 1.6.2
Post by: Dmitry42 on July 10, 2023, 05:29:48 AM
I just try simple 'filter' => '(mail=*@domain.com)', and its not work too.


Title: Re: LDAP Addressbook problem after upgrade from 1.6.1 to 1.6.2
Post by: alec on July 11, 2023, 03:36:07 AM
I created a ticket https://github.com/roundcube/roundcubemail/issues/9061, a fix should be available today.
Title: Re: LDAP Addressbook problem after upgrade from 1.6.1 to 1.6.2
Post by: Dmitry42 on July 11, 2023, 12:53:32 PM
Thank you!

FIX working fine!
Title: Re: LDAP Addressbook problem after upgrade from 1.6.1 to 1.6.2
Post by: Dmitry42 on July 12, 2023, 06:11:36 AM
all work fine but sometime I see in log:

Quote
Jul 12 13:02:45 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:02:45 mail roundcube: PHP Notice:  Undefined index: groups in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:02:45 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630

its happen when user open address book with Groups from AD (for adddressbook only with users - no errors)

log looks like (I open GROUPS after open USERS and after again open GROUPS):
Quote
root@mail:~# tail -f /var/log/syslog |grep roundcube
Jul 12 13:07:15 mail roundcube: <qampuosu> C: Connect [ldap://1.1.1.1:389]
Jul 12 13:07:15 mail roundcube: <qampuosu> S: OK
Jul 12 13:07:15 mail roundcube: <qampuosu> C: Bind [dn: USER@DOMAIN]
Jul 12 13:07:15 mail roundcube: <qampuosu> S: OK
Jul 12 13:07:15 mail roundcube: <qampuosu> C: Search base dn: [OU=1,OU=2,DC=3,DC=local] scope with filter [(&(objectCategory=group)(mail=*@DOMAIN.COM))]
Jul 12 13:07:15 mail roundcube: <qampuosu> Using function ldap_search on scope sub ($ns_function is ldap_search)
Jul 12 13:07:15 mail roundcube: <qampuosu> C: (Without VLV) Setting a filter of (&(objectCategory=group)(mail=*@DOMAIN.COM))
Jul 12 13:07:15 mail roundcube: <qampuosu> Executing search with return attributes: array (
Jul 12 13:07:15 mail roundcube:   0 => 'cn',
Jul 12 13:07:15 mail roundcube:   1 => 'mail',
Jul 12 13:07:15 mail roundcube:   2 => 'objectClass',
Jul 12 13:07:15 mail roundcube: )
Jul 12 13:07:15 mail roundcube: <qampuosu> S: 7 record(s) found
Jul 12 13:07:15 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Undefined index: groups in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Undefined index: groups in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Undefined index: groups in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Undefined index: groups in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Undefined index: groups in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Undefined index: groups in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Undefined index: groups in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:15 mail roundcube: <qampuosu> C: Connect [ldap://1.1.1.1:389]
Jul 12 13:07:15 mail roundcube: <qampuosu> S: OK
Jul 12 13:07:15 mail roundcube: <qampuosu> C: Bind [dn: USER@DOMAIN]
Jul 12 13:07:15 mail roundcube: <qampuosu> S: OK
Jul 12 13:07:15 mail roundcube: <qampuosu> C: Search base dn: [OU=1,OU=2,DC=3,DC=local] scope with filter [(&(!(useraccountcontrol:1.2.840.113556.1.4.803:=2))(samaccountType=805306368)(mail=*@DOMAIN.COM))]
Jul 12 13:07:15 mail roundcube: <qampuosu> Using function ldap_search on scope sub ($ns_function is ldap_search)
Jul 12 13:07:15 mail roundcube: <qampuosu> C: (Without VLV) Setting a filter of (&(!(useraccountcontrol:1.2.840.113556.1.4.803:=2))(samaccountType=805306368)(mail=*@DOMAIN.COM))
Jul 12 13:07:15 mail roundcube: <qampuosu> Executing search with return attributes: array (
Jul 12 13:07:15 mail roundcube:   0 => 'displayname',
Jul 12 13:07:15 mail roundcube:   1 => 'mail',
Jul 12 13:07:15 mail roundcube:   2 => 'objectClass',
Jul 12 13:07:15 mail roundcube: )
Jul 12 13:07:15 mail roundcube: <qampuosu> S: 352 record(s) found
Jul 12 13:07:16 mail roundcube: <qampuosu> C: Connect [ldap://1.1.1.1:389]
Jul 12 13:07:16 mail roundcube: <qampuosu> S: OK
Jul 12 13:07:16 mail roundcube: <qampuosu> C: Bind [dn: USER@DOMAIN]
Jul 12 13:07:16 mail roundcube: <qampuosu> S: OK
Jul 12 13:07:16 mail roundcube: <qampuosu> C: Search base dn: [OU=1,OU=2,DC=3,DC=local] scope with filter [(&(objectCategory=group)(mail=*@DOMAIN.COM))]
Jul 12 13:07:16 mail roundcube: <qampuosu> Using function ldap_search on scope sub ($ns_function is ldap_search)
Jul 12 13:07:16 mail roundcube: <qampuosu> C: (Without VLV) Setting a filter of (&(objectCategory=group)(mail=*@DOMAIN.COM))
Jul 12 13:07:16 mail roundcube: <qampuosu> Executing search with return attributes: array (
Jul 12 13:07:16 mail roundcube:   0 => 'cn',
Jul 12 13:07:16 mail roundcube:   1 => 'mail',
Jul 12 13:07:16 mail roundcube:   2 => 'objectClass',
Jul 12 13:07:16 mail roundcube: )
Jul 12 13:07:16 mail roundcube: <qampuosu> S: 7 record(s) found
Jul 12 13:07:16 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Undefined index: groups in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Undefined index: groups in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Undefined index: groups in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Undefined index: groups in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Undefined index: groups in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Undefined index: groups in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Undefined index: groups in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630
Jul 12 13:07:16 mail roundcube: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/webmail/program/lib/Roundcube/rcube_ldap.php on line 1630



and one analog error not for this case:

QuoteJul 12 13:54:20 mail roundcube: PHP Notice:  Undefined index: charset in /var/www/html/webmail/program/lib/Roundcube/rcube_imap.php on line 2456
Title: Re: LDAP Addressbook problem after upgrade from 1.6.1 to 1.6.2
Post by: alec on July 12, 2023, 12:49:37 PM
I'll fix the warnings, but you probably miss 'name_attr' property in 'groups' config.
Title: Re: LDAP Addressbook problem after upgrade from 1.6.1 to 1.6.2
Post by: Dmitry42 on July 12, 2023, 01:35:12 PM
Yes, not probably - im sure I miss it )))
I read default conf, but not clear understand section with 'groups'.

Now I use LDAP conf like this (from RC 1.5.3):

Quote
$config['ldap_public'] = [
  'ldap_users' => [
                        'name'                  => 'COMPANY USERS',
                        'hosts'                 => ['1.1.1.1'],
                        'sizelimit'             => 1000,
                        'use_tls'               => false,
                        'user_specific'         => false,
                        'base_dn'               => 'OU=1,OU=2,DC=3,DC=local',
                        'bind_dn'               => 'LDAP_USER',
                        'bind_pass'             => 'LDAP_PASSWD',
                        'writable'              => false,
                        'ldap_version'          => 3,
                        'search_fields'         =>['displayname','mail'],
                        'fieldmap'              => [
                                                        'name'  => 'displayname',
                                                        'email' => 'mail'
                        ],
                        'sort'                  => 'displayname',
                        'scope'                 => 'sub',
                        'filter'                => '(&(!(useraccountcontrol:1.2.840.113556.1.4.803:=2))(samaccountType=805306368)(mail=*@domain.com))',  // not blocked users with email.
                        'fuzzy_search'          => true,
                        'vlv'                   => false,
                        'vlv_search'            => false
        ],
  'ldap_groups' => [
                        'name'                  => 'MAILGROUPS',
                        'hosts'                 => ['1.1.1.1'],
                        'sizelimit'             => 1000,
                        'use_tls'               => false,
                        'user_specific'         => false,
                        'base_dn'               => 'OU=1,OU=2,DC=3,DC=local',
                        'bind_dn'               => 'LDAP_USER',
                        'bind_pass'             => 'LDAP_PASSWD',
                        'writable'              => false,
                        'ldap_version'          => 3,
                        'search_fields'         => ['cn','mail'],
                        'fieldmap'              => [
                                                        'name'  => 'cn',
                                                        'email' => 'mail'
                        ],
                        'sort'                  => 'cn',
                        'scope'                 => 'sub',
                        'filter'                => '(&(objectCategory=group)(mail=*@domain.com))', // groups with email
                        'fuzzy_search'          => true,
                        'vlv'                   => false,
                        'vlv_search'            => false
        ]
];


I must use "groups" in my case ?
Title: Re: LDAP Addressbook problem after upgrade from 1.6.1 to 1.6.2
Post by: Dmitry42 on July 13, 2023, 01:22:21 AM
I try
Quote
.........
//                        'fieldmap'            => [
//                                                      'name'  => 'cn',
//                                                      'email' => 'mail'
//                        ],
                        'name_attr'             => 'cn',
                        'email_attr'            => 'mail',

......

but its not work (screenshot)  and still the same errors in log.

Im little bit confused  :)
Title: Re: LDAP Addressbook problem after upgrade from 1.6.1 to 1.6.2
Post by: alec on July 13, 2023, 05:38:55 AM
Ok, I didn't think of a use-case where you don't use 'groups' property at all. You rather return groups for contacts list. So, you can ignore my comment. I fixed the warnings in git.
Title: Re: LDAP Addressbook problem after upgrade from 1.6.1 to 1.6.2
Post by: Dmitry42 on July 13, 2023, 06:59:54 AM
ok!
Thank you!