core icon indicating copy to clipboard operation
core copied to clipboard

owncloud users page ldap shows only first 120 users from LDAP

Open liska12 opened this issue 12 years ago • 29 comments

Hi, I have found that my OC installation shows only first 120 users from ldap based on their UID. On admin page in LDAP settings it shows correctly all 169 users and this value is changing depending on ldap db. When I had deleted a user with lower id from my openldap directory then next user with higher uid appeared on users page of admin interface. I installed another new instances of OC (5.0.14 and 6.0.2) and they were working as expected. I have found some wrong settings on ldap expert tab concerning uuid override and change them from auto to uid - I do not remember if I set this manually. Also I typed uid to internal username, it was blank before. Since that all users can login to OC but still only old users appeared on my users page. Only "old" users could login before this change.

This installation is upddated regularly since some 4.x version now to latest 6.0.2. OS: Debian Wheezy with all updates applied
Webserver: Apache 2.2 PHP: 5.4 Database: Mysql 5.5

In logs I can only find this error messages related to this problem ldap_search(): Partial search results returned: Sizelimit exceeded at /var/www/owncloud/apps/user_ldap/lib/ldap.php#141

liska12 avatar Apr 18 '14 08:04 liska12

@blizzz

karlitschek avatar Apr 18 '14 08:04 karlitschek

On admin page in LDAP settings it shows correctly all 169 users and this value is changing depending on ldap db.

This is a vague value on users that are actually available in ownCloud, because the existence of the configured display name attribute is not checked.

I installed another new instances of OC (5.0.14 and 6.0.2) and they were working as expected.

Is it correct: it fails on your production system with 6.0.2 but with a fresh install it works? Then it cannot be a programmatic mistake, but must be a configuration issue. In this case I would advise you to compare working and not-working configurations.

About the expert settings I assume you have read the explanations?

blizzz avatar Apr 22 '14 09:04 blizzz

Yes, exactly. I installed that two versions from scratch and they were showing all users. I made afterward those changes which allowed all users to be able to login. I`ve red the explanations and I believe it is correct now. Anyway I found another user with lesser uid (31) who is not on users page. All missing users have a row in mysql table oc_ldap_user_mapping - this is why I think it is some problem in the OC.

liska12 avatar Apr 22 '14 11:04 liska12

Just a note to my previous message. I have found a user with home directory named by uuid: uid=example,ou=example,dc=com | 7c3965b6-7694-1032-9bca-a393d3adbc6c | 7c3965b6-7694-1032-9bca-a393d3adbc6c

liska12 avatar Apr 24 '14 10:04 liska12

What is the output from

sudo -u www-data ./occ user:report

? For both the existing install and the working one. You may need to adjust the user to which you web server is running as. (Run it from withing the owncloud root directory)

blizzz avatar Apr 24 '14 10:04 blizzz

Existing installation: +-------------------------+----+ | User Report | | +-------------------------+----+ | OC_User_Database | 2 | | OCA\user_ldap\USER_LDAP | 0 | | | | | total users | 2 | | | | | user directories | 45 | +-------------------------+----+

Working installation: +-------------------------+-----+ | User Report | | +-------------------------+-----+ | OC_User_Database | 3 | | OCA\user_ldap\USER_LDAP | 164 | | | | | total users | 167 | | | | | user directories | 5 | +-------------------------+-----+

I checked again all the LDAP settings and only difference is that I have checked LDAP username in login filter of existing installation. When I uncheck it than configuration turns to not OK. On working installation it does not matter if checked or unchecked, it is still possible to login.

On admin page log I can see: Error PHP ldap_search(): Partial search results returned: Sizelimit exceeded at /var/www/owncloud/apps/user_ldap/lib/ldap.php#141 2014-04-24T11:10:13+00:00 Error user_ldap Connection could not be established 2014-04-24T11:10:13+00:00 Error user_ldap Connection could not be established 2014-04-24T11:10:13+00:00 Error user_ldap Connection could not be established

Nothing else has appeared in apache error logs.

liska12 avatar Apr 24 '14 11:04 liska12

Now, this was not expected.

The full owncloud log is in data/, could you paste it as well?

And could you get the LDAP settings right from the database? for both existing and working installation? They are in table oc_appconfig with appid = 'user_ldap'

blizzz avatar Apr 24 '14 11:04 blizzz

Log is too big because of some exception, but this is the part where i tried twice to uncheck it

{"app":"webdav","message":"Exception: Sabre_DAV_Exception_NotFound: File with name aktualni could not be located","level":4,"time":"2014-04
-24T11:07:52+00:00"}
{"app":"PHP","message":"ldap_search(): Partial search results returned: Sizelimit exceeded at \/var\/www\/owncloud\/apps\/user_ldap\/lib\/l
dap.php#141","level":3,"time":"2014-04-24T11:07:59+00:00"}
{"app":"PHP","message":"ldap_search(): Partial search results returned: Sizelimit exceeded at \/var\/www\/owncloud\/apps\/user_ldap\/lib\/l
dap.php#141","level":3,"time":"2014-04-24T11:07:59+00:00"}
{"app":"webdav","message":"Exception: Sabre_DAV_Exception_NotFound: File with name aktualni could not be located","level":4,"time":"2014-04
-24T11:08:51+00:00"}
{"app":"PHP","message":"ldap_search(): Partial search results returned: Sizelimit exceeded at \/var\/www\/owncloud\/apps\/user_ldap\/lib\/l
dap.php#141","level":3,"time":"2014-04-24T11:09:22+00:00"}
{"app":"PHP","message":"ldap_search(): Partial search results returned: Sizelimit exceeded at \/var\/www\/owncloud\/apps\/user_ldap\/lib\/l
dap.php#141","level":3,"time":"2014-04-24T11:09:22+00:00"}
{"app":"webdav","message":"Exception: Sabre_DAV_Exception_NotFound: File with name aktualni could not be located","level":4,"time":"2014-04
-24T11:09:24+00:00"}
{"app":"PHP","message":"ldap_search(): Partial search results returned: Sizelimit exceeded at \/var\/www\/owncloud\/apps\/user_ldap\/lib\/l
dap.php#141","level":3,"time":"2014-04-24T11:09:24+00:00"}
{"app":"user_ldap","message":"Connection could not be established","level":3,"time":"2014-04-24T11:09:25+00:00"}
{"app":"user_ldap","message":"Connection could not be established","level":3,"time":"2014-04-24T11:09:25+00:00"}
{"app":"user_ldap","message":"Connection could not be established","level":3,"time":"2014-04-24T11:09:27+00:00"}
{"app":"user_ldap","message":"Connection could not be established","level":3,"time":"2014-04-24T11:09:28+00:00"}
{"app":"user_ldap","message":"Connection could not be established","level":3,"time":"2014-04-24T11:09:28+00:00"}
{"app":"user_ldap","message":"Connection could not be established","level":3,"time":"2014-04-24T11:09:28+00:00"}
{"app":"user_ldap","message":"Connection could not be established","level":3,"time":"2014-04-24T11:09:28+00:00"}
{"app":"user_ldap","message":"Connection could not be established","level":3,"time":"2014-04-24T11:09:28+00:00"}
{"app":"PHP","message":"ldap_search(): Partial search results returned: Sizelimit exceeded at \/var\/www\/owncloud\/apps\/user_ldap\/lib\/l
dap.php#141","level":3,"time":"2014-04-24T11:09:28+00:00"}
{"app":"webdav","message":"Exception: Sabre_DAV_Exception_NotFound: File with name aktualni could not be located","level":4,"time":"2014-04
-24T11:10:00+00:00"}
{"app":"PHP","message":"ldap_search(): Partial search results returned: Sizelimit exceeded at \/var\/www\/owncloud\/apps\/user_ldap\/lib\/l
dap.php#141","level":3,"time":"2014-04-24T11:10:11+00:00"}
{"app":"user_ldap","message":"Connection could not be established","level":3,"time":"2014-04-24T11:10:11+00:00"}
{"app":"user_ldap","message":"Connection could not be established","level":3,"time":"2014-04-24T11:10:11+00:00"}
{"app":"user_ldap","message":"Connection could not be established","level":3,"time":"2014-04-24T11:10:12+00:00"}
{"app":"user_ldap","message":"Connection could not be established","level":3,"time":"2014-04-24T11:10:12+00:00"}
{"app":"user_ldap","message":"Connection could not be established","level":3,"time":"2014-04-24T11:10:12+00:00"}
{"app":"user_ldap","message":"Connection could not be established","level":3,"time":"2014-04-24T11:10:13+00:00"}
{"app":"user_ldap","message":"Connection could not be established","level":3,"time":"2014-04-24T11:10:13+00:00"}
{"app":"PHP","message":"ldap_search(): Partial search results returned: Sizelimit exceeded at \/var\/www\/owncloud\/apps\/user_ldap\/lib\/l
dap.php#141","level":3,"time":"2014-04-24T11:10:13+00:00"}
{"app":"webdav","message":"Exception: Sabre_DAV_Exception_NotFound: File with name aktualni could not be located","level":4,"time":"2014-04
-24T11:10:33+00:00"}

Ok, this is quite different output although it is the same on admin page of both installations.

mysql> select * from oc_appconfig where appid like 'user_ldap';
+-----------+-----------------------------------+---------------------------------------------------------------+
| appid     | configkey                         | configvalue                                                   |
+-----------+-----------------------------------+---------------------------------------------------------------+
| user_ldap | installed_version                 | 0.4.1                                                         |
| user_ldap | types                             | authentication                                                |
| user_ldap | enabled                           | yes                                                           |
| user_ldap | ldap_host                         | 192.168.80.195                                                |
| user_ldap | ldap_port                         | 389                                                           |
| user_ldap | ldap_dn                           | cn=admin,dc=ucl,dc=cas,dc=cz                                  |
| user_ldap | ldap_agent_password               | XXX                                                  |
| user_ldap | ldap_base                         | dc=ucl,dc=cas,dc=cz                                           |
| user_ldap | ldap_base_users                   | ou=Users,dc=ucl,dc=cas,dc=cz                                  |
| user_ldap | ldap_base_groups                  | ou=Groups,dc=ucl,dc=cas,dc=cz                                 |
| user_ldap | ldap_userlist_filter              | (|(objectclass=inetOrgPerson))                                |
| user_ldap | ldap_login_filter                 | (&(|(objectclass=inetOrgPerson))(uid=%uid))                   |
| user_ldap | ldap_group_filter                 | (&(|(objectclass=posixGroup)(objectclass=sambaGroupMapping))) |
| user_ldap | ldap_display_name                 | uid                                                           |
| user_ldap | ldap_tls                          | 0                                                             |
| user_ldap | ldap_nocase                       | 0                                                             |
| user_ldap | ldap_quota_def                    |                                                               |
| user_ldap | ldap_quota_attr                   |                                                               |
| user_ldap | ldap_email_attr                   | mail                                                          |
| user_ldap | ldap_group_member_assoc_attribute | memberUid                                                     |
| user_ldap | ldap_group_display_name           | cn                                                            |
| user_ldap | bgjUpdateGroupsLastRun            | 1365614356                                                    |
| user_ldap | ldap_backup_host                  | 192.168.80.196                                                |
| user_ldap | ldap_uuid_attribute               | entryuuid                                                     |
| user_ldap | ldap_backup_port                  | 389                                                           |
| user_ldap | ldap_turn_off_cert_check          | 0                                                             |
| user_ldap | ldap_cache_ttl                    | 600                                                           |
| user_ldap | ldap_override_main_server         | 0                                                             |
| user_ldap | ldap_configuration_active         | 1                                                             |
| user_ldap | ldap_attributes_for_user_search   |                                                               |
| user_ldap | ldap_attributes_for_group_search  |                                                               |
| user_ldap | home_folder_naming_rule           |                                                               |
| user_ldap | ldap_uuid_user_attribute          | entryuuid                                                     |
| user_ldap | ldap_uuid_group_attribute         | entryuuid                                                     |
| user_ldap | ldap_expert_uuid_user_attr        | uid                                                           |
| user_ldap | ldap_expert_uuid_group_attr       | uid                                                           |
| user_ldap | ldap_userfilter_objectclass       | inetOrgPerson                                                 |
| user_ldap | ldap_userfilter_groups            |                                                               |
| user_ldap | ldap_user_filter_mode             | 0                                                             |
| user_ldap | ldap_group_filter_mode            | 0                                                             |
| user_ldap | ldap_groupfilter_objectclass      | sambaGroupMapping                                             |
| user_ldap | ldap_groupfilter_groups           |                                                               |
| user_ldap | ldap_login_filter_mode            | 0                                                             |
| user_ldap | ldap_loginfilter_email            | 0                                                             |
| user_ldap | ldap_loginfilter_username         | 1                                                             |
| user_ldap | ldap_loginfilter_attributes       |                                                               |
| user_ldap | has_memberof_filter_support       |                                                               |
| user_ldap | ldap_expert_username_attr         | uid                                                           |
| user_ldap | last_jpegPhoto_lookup             | 0                                                             |
+-----------+-----------------------------------+---------------------------------------------------------------+
49 rows in set (0.01 sec)

And this one is from working installation

mysql> select * from oc_appconfig where appid like 'user_ldap';
+-----------+-----------------------------------+---------------------------------------------------------------+
| appid     | configkey                         | configvalue                                                   |
+-----------+-----------------------------------+---------------------------------------------------------------+
| user_ldap | enabled                           | yes                                                           | 
| user_ldap | has_memberof_filter_support       |                                                               | 
| user_ldap | home_folder_naming_rule           |                                                               | 
| user_ldap | installed_version                 | 0.4.1                                                         | 
| user_ldap | last_jpegPhoto_lookup             | 0                                                             | 
| user_ldap | ldap_agent_password               | XXX                                                  | 
| user_ldap | ldap_attributes_for_group_search  |                                                               | 
| user_ldap | ldap_attributes_for_user_search   |                                                               | 
| user_ldap | ldap_backup_host                  | 192.168.80.196                                                | 
| user_ldap | ldap_backup_port                  | 389                                                           | 
| user_ldap | ldap_base                         | dc=ucl,dc=cas,dc=cz                                           | 
| user_ldap | ldap_base_groups                  | ou=Groups,dc=ucl,dc=cas,dc=cz
                                | 
| user_ldap | ldap_base_users                   | ou=Users,dc=ucl,dc=cas,dc=cz                                  | 
| user_ldap | ldap_cache_ttl                    | 600                                                           | 
| user_ldap | ldap_configuration_active         | 1                                                             | 
| user_ldap | ldap_display_name                 | uid                                                           | 
| user_ldap | ldap_dn                           | cn=admin,dc=ucl,dc=cas,dc=cz                                  | 
| user_ldap | ldap_email_attr                   | mail                                                          | 
| user_ldap | ldap_expert_username_attr         | uid                                                           | 
| user_ldap | ldap_expert_uuid_group_attr       | uid                                                           | 
| user_ldap | ldap_expert_uuid_user_attr        | uid                                                           | 
| user_ldap | ldap_group_display_name           | cn                                                            | 
| user_ldap | ldap_group_filter                 | (&(|(objectclass=posixGroup)(objectclass=sambaGroupMapping))) | 
| user_ldap | ldap_group_filter_mode            | 0                                                             | 
| user_ldap | ldap_group_member_assoc_attribute | memberUid                                                     | 
| user_ldap | ldap_groupfilter_groups           |                                                               | 
| user_ldap | ldap_groupfilter_objectclass      | sambaGroupMapping                                             | 
| user_ldap | ldap_host                         | 192.168.80.195                                                | 
| user_ldap | ldap_login_filter                 | (&(|(objectclass=inetOrgPerson))(|(uid=%uid)(|(uid=%uid))))   | 
| user_ldap | ldap_login_filter_mode            | 0                                                             | 
| user_ldap | ldap_loginfilter_attributes       | uid                                                           | 
| user_ldap | ldap_loginfilter_email            | 0                                                             | 
| user_ldap | ldap_loginfilter_username         | 1                                                             | 
| user_ldap | ldap_nocase                       | 0                                                             | 
| user_ldap | ldap_override_main_server         | 0                                                             | 
| user_ldap | ldap_port                         | 389                                                           | 
| user_ldap | ldap_quota_attr                   |                                                               | 
| user_ldap | ldap_quota_def                    |                                                               | 
| user_ldap | ldap_tls                          | 0                                                             | 
| user_ldap | ldap_turn_off_cert_check          | 0                                                             | 
| user_ldap | ldap_user_filter_mode             | 0                                                             | 
| user_ldap | ldap_userfilter_groups            |                                                               | 
| user_ldap | ldap_userfilter_objectclass       | inetOrgPerson                                                 | 
| user_ldap | ldap_userlist_filter              | (|(objectclass=inetOrgPerson))                                | 
| user_ldap | types                             | authentication                                                | 
+-----------+-----------------------------------+---------------------------------------------------------------+
45 rows in set (0.00 sec)

liska12 avatar Apr 24 '14 11:04 liska12

The configurations are actually not much different. The existing one has three entries (ldap_uuid_attribute, ldap_uuid_user_attribute, ldap_uuid_group_attribute) that are not used anymore in this form. I see I need to do some clean up about them, but that does not cause any conflicts.

The rest seems pretty identical, except for the login filter, where the uid=%uid part is doubled, but that does not have any bad effects neither.

Now, if everything is basically identical, how can it reproduce two different results? That does not make any sense.

blizzz avatar Apr 24 '14 14:04 blizzz

Oh, wait, forget about ldap_uuid_user_attribute, ldap_uuid_group_attribute, they are not extinct in fact. If you remove those lines in the database for your existing installation, will it work?

blizzz avatar Apr 24 '14 14:04 blizzz

Or even better, leave the entries and please try this patch:

diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 0fd1063..1fcbea8 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -1124,12 +1124,12 @@ class Access extends LDAPUtility {
                        $uuidOverride = $this->connection->ldapExpertUUIDGroupAttr;
                }

-               if(($this->connection->$uuidAttr !== 'auto') && !$force) {
+               if(!empty($uuidOverride) && !$force) {
+                       $this->connection->$uuidAttr = $uuidOverride;
                        return true;
                }

-               if(!empty($uuidOverride) && !$force) {
-                       $this->connection->$uuidAttr = $uuidOverride;
+               if(($this->connection->$uuidAttr !== 'auto') && !$force) {
                        return true;
                }

blizzz avatar Apr 24 '14 14:04 blizzz

Hi, thanks a lot for your help, but I had a problem patching that file. patch apps/user_ldap/lib/access.php < ~/patch_ldap patching file apps/user_ldap/lib/access.php Hunk #1 FAILED at 1124. 1 out of 1 hunk FAILED -- saving rejects to file apps/user_ldap/lib/access.php.rej I tried to manually change those two functions, but I don`t see any improvement, in logs I can see

Error   PHP ldap_search(): Partial search results returned: Sizelimit exceeded at /var/www/owncloud/apps/user_ldap/lib/ldap.php#141 2014-04-25T06:27:42+00:00
Error   PHP ldap_search(): Partial search results returned: Sizelimit exceeded at /var/www/owncloud/apps/user_ldap/lib/ldap.php#141 2014-04-25T06:27:39+00:00
Error   PHP ldap_search(): Partial search results returned: Sizelimit exceeded at /var/www/owncloud/apps/user_ldap/lib/ldap.php#141 2014-04-25T06:27:39+00:00

Output of that occ script is still the same, no ldap users. When I uncheck the ldap username, it turns to not ok.

liska12 avatar Apr 25 '14 06:04 liska12

And now I put the old acces.php back and deleted those two lines from mysql. Unfortunatelly, no change as well. In logs is just that line from my previous message.

liska12 avatar Apr 25 '14 06:04 liska12

Likely the changes since 6.0.2 were too much, I did the patch against current stable6 branch.

I will try to reproduce this.

blizzz avatar Apr 25 '14 15:04 blizzz

different (unrelated) question/heads-up: are you sure your groups do have the uid attribute?

blizzz avatar Apr 25 '14 15:04 blizzz

No, you're right, this does not change anything. Actually you can ignore the mentioned entries.

This means I cannot reproduce this misbehavior. Makes it even more miraculous.

Could you please set the log level to Everything (Admin settings), empty/move the previous log file, retry and post the shiny new log?

blizzz avatar Apr 25 '14 16:04 blizzz

It is possible that this problem is lasting for longer time. I stumbled upon this problem because some new users asked for an access. Anyway, groups have gidNumber not uid, but still I can see the correct number of groups on admin page and all are shown on users page. Other interesting thing is that there are all users visible in share dialog when setting a share of a file. I found this expert setting on OC forum when I tried to solve my problem.

liska12 avatar Apr 25 '14 16:04 liska12

Would you like to give a try with 6.0.3? Currently it's a release candidate, so not yet for production systems, but testers are welcome :) Maybe it's fixed meanhwile… http://mailman.owncloud.org/pipermail/testpilots/2014-April/000133.html

blizzz avatar Apr 25 '14 16:04 blizzz

Hi, I have installed that new version, but unfortunatelly nothing has changed. Still the same error on admin page and missing users as well;(

liska12 avatar Apr 28 '14 18:04 liska12

Well something has changed, here is the output of occ command

+-------------------------+-----+
| User Report             |     |
+-------------------------+-----+
| OC_User_Database        | 2   |
| OCA\user_ldap\USER_LDAP | 163 |
|                         |     |
| total users             | 165 |
|                         |     |
| user directories        | 46  |
+-------------------------+-----+

liska12 avatar Apr 28 '14 18:04 liska12