PUBLIC - Liferay Portal Community Edition

LDAP Export Fails on jobTitle, and default User creation.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 5.1.2, 5.2.3
  • Fix Version/s: 6.0.0 Preview
  • Component/s: None
  • Labels:
    None
  • Environment:
    Tomcat 5.5.27, OpenDS 1.2.0
    Tomcat 5.5.27, ApacheDS 1.0.2
  • Branch Version/s:
    5.1.x, 5.2.x
  • Backported to Branch:
    Committed
  • Similar Issues:
    Show 5 results 
  • Liferay Contributor's Agreement:
    Accept

Description

If the setting ldap.user.mappings specifies a value for jobTitle= then LDAP Export fails in the following scenarios:

Whilst creating the default user and default admin during CheckCompany logic, if you are starting Liferay with an empty database, after it creates tables and populates them.
When the contact is created, if you are creating a user and don't specify a job title.
When the contact is created during import of an existing user from LDAP, either on a schedule, or during initial logon - because the user is immediately re-exported - which isn't ideal.

You'll likely see one of the following errors:

javax.naming.directory.InvalidAttributeValueException: LDAP: error code 21 - title: value #0 invalid per syntax

javax.naming.directory.InvalidAttributeValueException: [LDAP: error code 21 - Entry "xxxxxxxx" contains a value "" for attribute title that is invalid according to the syntax for that attribute: The operation attempted to assign a zero-length value to an attribute with the directory string syntax

  1. LDAP_jobTitle.patch
    22/Jun/09 3:13 AM
    4 kB
    Jason Reast-Jones
  2. LPS-3786.diff
    29/Jun/09 12:35 PM
    2 kB
    Amos Fong

Activity

Hide
Jason Reast-Jones added a comment - - Restricted to

Attached is my patch to resolve issues:

1. Default User should not be exported to LDAP.
2. jobTitle export will not attempt to export a blank jobTitle.
3. If you are genuinely replacing the jobTitle with a blank the jobTItle LDAP attribute is actually removed rather than set to a zero length string (which is invalid according to the LDAP schema).

The changes were generated against source for 5.2.3, but I've checked this against trunk and I believe they are still valid. Since I'm working on a copy of source from our own SVN you might notice odd revision numbers in the patch file, hopefully that isn't going to cause an issue.

Jason

Show
Jason Reast-Jones added a comment - - Restricted to Attached is my patch to resolve issues: 1. Default User should not be exported to LDAP. 2. jobTitle export will not attempt to export a blank jobTitle. 3. If you are genuinely replacing the jobTitle with a blank the jobTItle LDAP attribute is actually removed rather than set to a zero length string (which is invalid according to the LDAP schema). The changes were generated against source for 5.2.3, but I've checked this against trunk and I believe they are still valid. Since I'm working on a copy of source from our own SVN you might notice odd revision numbers in the patch file, hopefully that isn't going to cause an issue. Jason
Hide
Amos Fong added a comment - - edited

Hi Jason,

First of all, Thanks for your contributions!

1. Has been fixed by LPS-3636

2. Your patch threw some exceptions for me when trying to export a blank job title. Instead I used DirContext.REPLACE_ATTRIBUTE with no value which just deletes the value instead the entire attribute. I've attached a patch I've tested with openDS and Apache DS. Can you see if this works for you as well?

http://java.sun.com/j2se/1.4.2/docs/api/javax/naming/directory/DirContext.html#REPLACE_ATTRIBUTE

Show
Amos Fong added a comment - - edited Hi Jason, First of all, Thanks for your contributions! 1. Has been fixed by LPS-3636 2. Your patch threw some exceptions for me when trying to export a blank job title. Instead I used DirContext.REPLACE_ATTRIBUTE with no value which just deletes the value instead the entire attribute. I've attached a patch I've tested with openDS and Apache DS. Can you see if this works for you as well? http://java.sun.com/j2se/1.4.2/docs/api/javax/naming/directory/DirContext.html#REPLACE_ATTRIBUTE
Hide
Amos Fong added a comment -

Committed fix

Show
Amos Fong added a comment - Committed fix

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: