Bug 991800 - Cannot add users from API using a principal name (user@domain) format when using an open ldap domain
Summary: Cannot add users from API using a principal name (user@domain) format when us...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: 3.3.0
Assignee: Yair Zaslavsky
QA Contact: Ondra Machacek
URL:
Whiteboard: infra
Depends On:
Blocks: 1019461
TreeView+ depends on / blocked
 
Reported: 2013-08-04 12:58 UTC by Yair Zaslavsky
Modified: 2016-02-10 19:43 UTC (History)
9 users (show)

Fixed In Version: is11
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
oVirt Team: Infra
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 17794 0 None None None Never

Description Yair Zaslavsky 2013-08-04 12:58:41 UTC
Description of problem:

Let's say domain example.com is open ldap domain which was added to the system using manage-domains.

The administrator would like to add users via REST API.

In the first attempt the administrator passes the user in principal name format of user@domain - this fails (succeeds in other providers such as AD, IPA, RHDS)

curl -k -X POST -H "Accept: application/xml" -H "Content-Type:
application/xml" -H "Filter: $filter"\
  -d
  "<user><domain><name>example.com</name></domain><user_name>user0</user_name><roles/></user>"
  \
   -u $U https://rhevm.example.com:443/api/users

However, passing with only username, does work -

curl -k -X POST -H "Accept: application/xml" -H "Content-Type:
application/xml" -H "Filter: $filter"\
  -d
  "<user><domain><name>example.com</name></domain><user_name>user0</user_name><roles/></user>"
  \
  -u $U https://rhevm.example.com:443/api/users

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Yair Zaslavsky 2013-08-04 13:30:46 UTC
LdapQueryMetadataFactoryImpl.setOpenLdap is the problematic method -

In our code we have diffrentiation between "get user by name" query and "get user by principal name" query - in AD and IPA there are differences in the LDAP queries.

RHDS has no differences in the ldap query to be run, so there is a special utility class that is used to take the principal name (if passed by the API user) and split it to user  and domain part (for example - yair will be split to "yair" and "example.com"), the user part will be then used with the filter which is the same as the one for "get user by name".

Open ldap does not come with UPN support "out of the box" as can be seen in the file - /etc/openldap/schema/inetorgperson.ldif which defines the users part of the schema.

Although may be changed/extended - I would recommend we go for the RHDS-like approach here (for "get user by principal name" use the utility class that splits the "user@domain" to "user" and "domain").

Comment 3 Ondra Machacek 2013-08-07 13:26:46 UTC
I also have same problem with RHDS.

Comment 4 Yair Zaslavsky 2013-08-07 18:10:17 UTC
Actually, the change should be done at ADSyntaxChecker -

From code review upstream - 
ESTAPI uses a query like "ADUSER: allnames=whatever" when searching the user that will be added. This query isn't translated into LDAP using the maps in LdapQueryMetadataFactoryImpl, but using ADSyntaxChecker, and there isn't any provision there to remove the @example.com part from the user name (the *LdapQueryFormatter class isn't used there).

Comment 6 Ondra Machacek 2013-08-26 12:09:28 UTC
curl -k -X POST -H "Accept: application/xml" -H "Content-Type: application/xml"
-d "<user><domain><name>example.com</name></domain><user_name>user0</user_name><roles/></user>"
-u $U $URL/users

User is successfully added to system. Verified on is11.

Comment 7 Itamar Heim 2014-01-21 22:27:51 UTC
Closing - RHEV 3.3 Released

Comment 8 Itamar Heim 2014-01-21 22:27:54 UTC
Closing - RHEV 3.3 Released

Comment 9 Itamar Heim 2014-01-21 22:30:47 UTC
Closing - RHEV 3.3 Released


Note You need to log in before you can comment on or make changes to this bug.