This code is failing with the below errors. The reason for trying to put this 
logic in place is due to the 20 character limitation with AD and sAMAccountName 
attribute. The uid in the error report below has 22 characters and thus fails. 
I was hoping to put this code in place so if I receive any uids greater than 20 
characters I trim it to 20. If the uid is 20 or less it is left alone.
 
****** CODE ******
#lsc.syncoptions.user.sAMAccountName.create_value = 
srcBean.getAttributeValueById("uid")   this works but has the 20 character 
limit
lsc.syncoptions.user.sAMAccountName.create_value = \
    if (srcBean.getAttributeValueById("uid").length() > 19) { \
        uid_value = srcBean.getAttributeValueById("uid").substring(0,19); \
    } else { \
        uid_value = srcBean.getAttributeValueById("uid"); \
    } \
    uid_value
 
 
****** ERROR ******
 
Nov 03 21:17:43 - DEBUG - In entry "cn=miguelricardohernan,cn=Users":  
Attribute "givenName" will not be written to the destination
Nov 03 21:17:43 - ERROR - Error while adding entry 
cn=miguelricardohernan,cn=Users in directory :javax.naming.NamingException: 
[LDAP: error code 80 - 00000523: SysErr: DSID-031A1202, problem 22 (Invalid 
argument), data 0
^@]; remaining name 'cn=miguelricardohernan,cn=Users'
Nov 03 21:17:43 - ERROR - Error while synchronizing ID 
cn=miguelricardohernan,cn=Users: java.lang.Exception: Technical problem while 
applying modifications to directory
Nov 03 21:17:43 - DEBUG - java.lang.Exception: Technical problem while applying 
modifications to directory
java.lang.Exception: Technical problem while applying modifications to directory
        at 
org.lsc.AbstractSynchronize.synchronize2Ldap(AbstractSynchronize.java:399) 
[lsc-core-1.2.1.jar:na]
        at org.lsc.SimpleSynchronize.launchTask(SimpleSynchronize.java:272) 
[lsc-core-1.2.1.jar:na]
        at org.lsc.SimpleSynchronize.launch(SimpleSynchronize.java:155) 
[lsc-core-1.2.1.jar:na]
        at org.lsc.Launcher.run(Launcher.java:151) [lsc-core-1.2.1.jar:na]
        at org.lsc.Launcher.main(Launcher.java:123) [lsc-core-1.2.1.jar:na]

-----Original Message-----
From: Clément OUDOT [mailto:[email protected]] 
Sent: Thursday, November 03, 2011 12:35 PM
To: Rohler, Brian L
Cc: [email protected]
Subject: Re: [lsc-users] LDAP: error code 53 - 00002077

Le 3 novembre 2011 17:03, Rohler, Brian L <[email protected]> a écrit :
> Can I put code around the entry in the syncopations section taking just the 
> first 20 characters?
>
> On Nov 3, 2011, at 11:57 AM, "Clément OUDOT" <[email protected]> wrote:
>
>> Le 3 novembre 2011 16:17, Rohler, Brian L <[email protected]> a écrit :
>>> I ran into a small problem where one of my users has a uid that is 22 
>>> characters in length and I received the [LDAP: error code 80 - 00000523] 
>>> error. I looked up the error and its:
>>>
>>> Active Directory has a limitation of 20 characters for the user account 
>>> name; for example, uid or cn. If you create a user with more than 20 
>>> character
>>>
>>> Is there a way around this other than shortening the users uid name?

Use the substring method :

srcBean.getAttributeValueById("uid").substring(0,19).
_______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org

lsc-users mailing list
[email protected]
http://lists.lsc-project.org/listinfo/lsc-users

Reply via email to