Skip to content

Meta data missing the username when querying for an ldap user via the provisioning api #15084

Closed

Description

@jnfrmarks

Steps to reproduce

  1. Install owncloud
  2. configure ldap
  3. query for an ldap user using the provisioning api

Expected behaviour

Expect all data to be returned

Actual behaviour

The "Users" field is missing the username

jennifer@ubuntu-14-client:~/smash-box/lib/oc-tests$ curl http://<user>:<pw>@x.x.x.x/owncloud/ocs/v1.php/cloud/users
<?xml version="1.0"?>
<ocs>
 <meta>
  <status>ok</status>
  <statuscode>100</statuscode>
  <message/>
 </meta>
 <data>
  <users>
   <element>aaliyah_oconnell_II</element>
   <element>abagail_kuhic</element>
   <element>abagail_kuhlman_III</element>
   <element>abagail_runolfsdottir</element>
   <element>at_admin</element>
   <element>user1</element>
   <element>user2</element>
   <element>user3</element>
  </users>
 </data>
</ocs>
jennifer@ubuntu-14-client:~/smash-box/lib/oc-tests$ curl http://<user>:<pw>@x.x.x.x/owncloud/ocs/v1.php/cloud/users?search=user1
<?xml version="1.0"?>
<ocs>
 <meta>
  <status>ok</status>
  <statuscode>100</statuscode>
  <message/>
 </meta>
 <data>
  <users>
   <element>user1</element>
  </users>
 </data>
</ocs>
jennifer@ubuntu-14-client:~/smash-box/lib/oc-tests$ curl http://<user>:<pw>@x.x.x.x/owncloud/ocs/v1.php/cloud/users?search=abagail_kuhic
<?xml version="1.0"?>
<ocs>
 <meta>
  <status>ok</status>
  <statuscode>100</statuscode>
  <message/>
 </meta>
 <data>
  <users/>               
 </data>
</ocs>
jennifer@ubuntu-14-client:~/smas-hbox/lib/oc-tests$


Server configuration

Ubuntu 14.04
PHP 5.5.9
MySQL DB

ownCloud Enterprise Edition 8.1 pre alpha (daily) Build:2015-03-19T03:27:00+00:00 fe8002a

Activity

  1. added this to the milestone on Mar 21, 2015
  2. jnfrmarks commented on Mar 26, 2015

    @jnfrmarks
    Author

    LDAP users can have a space in their names; ownCloud does not support spaces in usernames so the space gets converted to an underscore. When we search for the ldap user with a space in the name, we need to remove the underscore to find the user.

    I have validated that this works now as expected; closing this as not an issue

  3. jnfrmarks commented on Mar 26, 2015

    @jnfrmarks
    Author

    @PVince81

    In discussing my solution with Vincent, he had some feedback/questions on the solution so I am reopening this.

  4. PVince81 commented on Mar 26, 2015

    @PVince81
    Contributor

    From what I understood the problem is about user names that have spaces in them.

    As an API consumer, I should be able to pass a user name with space to the "search" argument and get the correct results. So we need to put a fix/workaround either in the provisioning API, or fix the LDAP search code properly retrieve such users (or do the "iterate over the list" workaround there).

  5. PVince81 commented on Mar 26, 2015

    @PVince81
    Contributor

    @blizzz what do you think ?

  6. PVince81 commented on Mar 26, 2015

    @PVince81
    Contributor

    Here was the workaround proposed by @jnfrmarks in pyocclient owncloud/pyocclient#85 but I think it's not the right place to do it. (but that code illustrates a possible workaround that we could put in the server code)

  7. PVince81 commented on Mar 27, 2015

    @PVince81
    Contributor
  8. blizzz commented on Mar 30, 2015

    @blizzz
    Contributor

    Spaces in user names (and other characters) are not allowed.

    The issue here is that the configured LDAP attribute, that user names are derived from, contains those. However, you cannot rely that the attribute value will be exactly the user name. Forbidden characters are one thing, name collisions the other (a string will be added). You should not do any assumptions upon the username.

    I would rather say that you replace the underscores before doing the search, or to look for the exact attribute value. The downside there is that if many search terms are provided (seperated by underscores) this is split up and compared individually against the search attributes. The purpose was to allow a flexible search against first and last names without knowledge about the internal structure of LDAP attribute values. This may very well turn out in many results in this case.

    Frankly speaking, using the display name is a bad way to use as internal username attribute, because it often is user changeable and thus not necessarily unique. I understand the general purpose here is having a test setup, but it is probably better to revise the setup and use uid/samaccountname for the internal username. Theoretically, white spaces are allowed there as well, but they should be avoided. As this is what you usually login against, whitespaces and special characters are practically not used.

  9. modified the milestones: , on May 6, 2015
  10. PVince81 commented on Sep 21, 2015

    @PVince81
    Contributor

    @blizzz how to move forward ?

  11. 3 remaining items

  12. blizzz commented on Oct 2, 2015

    @blizzz
    Contributor

    @cmonteroluque please leave a comment when changing severity towards high (or critical) so close to the deadline in order to have us notified and able to plan accordingly…

  13. blizzz commented on Oct 6, 2015

    @blizzz
    Contributor

    Fix is here: #19600

  14. MorrisJobke commented on Oct 13, 2015

    @MorrisJobke
    Contributor

    The fixing PR was moved to 9.0 #19600 (comment)

    Moving this too

  15. modified the milestones: , on Oct 13, 2015
  16. ghost added this to the milestone on Feb 24, 2016
  17. ghost removed this from the milestone on Feb 24, 2016
  18. lock commented on Aug 5, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  19. locked as resolved and limited conversation to collaborators on Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions