Issue #197 has been updated by Samuel Tran.

Jonathan Clarke wrote:
> Actually, a much simpler approach to this is just to store the unescaped DN. 
> There is a method, 
> "unescapeValue()":http://java.sun.com/javase/6/docs/api/javax/naming/ldap/Rdn.html#unescapeValue(java.lang.String)
>  for this, in the Rdn class.
> 
> Thus, all comparaison ignore any escapes. The apply() method in JndiServices 
> uses provided DNs to instantiate LdapName objects, which will escape values 
> again.
> 
> Proposed patch attached.

Got the source code of 1.2 using SVN. I was able to build the vanilla flavor 
successfully.
Applied the patch and tried to build but failed with the following error 
messages:


Running org.lsc.beans.BeanComparatorTest                                        
                                                                                
 
12:33:48.675 [main] DEBUG org.lsc.beans.BeanComparator - In entry "something":  
List of attributes considered for writing in destination: [sn, cn]              
 
12:33:48.675 [main] DEBUG org.lsc.beans.BeanComparator - In entry "something":  
Attribute "sn" is in FORCE status                                               
 
12:33:48.675 [main] DEBUG org.lsc.beans.BeanComparator - In entry "something":  
Attribute "sn" will not be written to the destination                           
 
12:33:48.675 [main] DEBUG org.lsc.beans.BeanComparator - In entry "something":  
Attribute "cn" is in FORCE status
12:33:48.675 [main] DEBUG org.lsc.beans.BeanComparator - In entry "something":  
Adding attribute "cn" with values [real cn]
12:33:48.676 [main] DEBUG org.lsc.beans.BeanComparator - In entry "something":  
List of attributes considered for writing in destination: [sn, cn]
12:33:48.676 [main] DEBUG org.lsc.beans.BeanComparator - In entry "something":  
Attribute "sn" is in FORCE status
12:33:48.676 [main] DEBUG org.lsc.beans.BeanComparator - In entry "something":  
Attribute "sn" will not be written to the destination
12:33:48.676 [main] DEBUG org.lsc.beans.BeanComparator - In entry "something":  
Attribute "cn" is in FORCE status
12:33:48.676 [main] DEBUG org.lsc.beans.BeanComparator - In entry "something":  
Replacing attribute "cn": source values are [real cn], old values were [old 
cn], new values are [real cn]
Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.024 sec <<< 
FAILURE!
Running org.lsc.jndi.ScriptableJndiServicesTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 sec
Running org.lsc.utils.directory.LDAPTest
12:33:48.701 [main] INFO  org.lsc.jndi.JndiServices - Connecting to LDAP server 
ldap://localhost:33389/ anonymously
12:33:48.726 [main] INFO  org.lsc.jndi.JndiServices - Connecting to LDAP server 
ldap://localhost:33389/ as cn=Directory Manager
12:33:48.734 [main] INFO  org.lsc.jndi.JndiServices - Connecting to LDAP server 
ldap://localhost:33389/dc=lsc-project,dc=org as cn=Directory Manager
12:33:48.745 [main] ERROR org.lsc.jndi.JndiServices - Too many entries returned 
(base: "", filter: "cn=CN0001")
12:33:48.745 [main] INFO  org.lsc.jndi.JndiServices - Connecting to LDAP server 
ldap://no.such.host:33389/ anonymously
12:33:48.747 [main] INFO  org.lsc.jndi.JndiServices - Connecting to LDAP server 
ldap://localhost:33389/dc=lsc-project,dc=com as cn=Directory Manager
12:33:48.750 [main] ERROR org.lsc.jndi.JndiServices - Error while looking for 
cn=CN0001 in : javax.naming.NameNotFoundException: [LDAP: error code 32 - The 
entry dc=lsc-project,dc=com specified as the search base does not exist in the 
Directory Server]; remaining name ''
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.051 sec
Running org.lsc.jndi.JndiServicesTest
12:33:48.925 [main] ERROR org.lsc.jndi.JndiServices - Error while modifying 
entry ou=People in directory :javax.naming.OperationNotSupportedException: 
[LDAP: error code 53 - Entry ou=People,dc=lsc-project,dc=org cannot be modified 
because the modification attempted to update attribute creatorsName which is 
defined as NO-USER-MODIFICATION in the server schema]; remaining name 
'ou=People'
12:33:48.926 [main] DEBUG org.lsc.jndi.JndiServicesTest - Counting all the 
directory entries ...
12:33:48.927 [main] DEBUG org.lsc.jndi.JndiServicesTest - 
key=ou=Groups,dc=lsc-project,dc=org, value=organizationalUnit
12:33:48.928 [main] DEBUG org.lsc.jndi.JndiServicesTest - 
key=ou=People,dc=lsc-project,dc=org, value=organizationalUnit
12:33:48.928 [main] DEBUG org.lsc.jndi.JndiServicesTest - key=ou=Test 
Data,dc=lsc-project,dc=org, value=organizationalUnit
12:33:48.928 [main] DEBUG org.lsc.jndi.JndiServicesTest -  Final count : 3
Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.177 sec

Results :

Tests in error:
 testCalculateModificationType(org.lsc.beans.BeanComparatorTest)

Tests run: 57, Failures: 0, Errors: 1, Skipped: 0

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.

Please refer to /usr/local/src/lsc-core-v1.2-branch/target/surefire-reports for 
the individual test results.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11 seconds
[INFO] Finished at: Mon May 03 12:33:49 EDT 2010
[INFO] Final Memory: 20M/49M
[INFO] ------------------------------------------------------------------------
----------------------------------------
Bug #197: Problem with DN that has a # sign
http://tools.lsc-project.org/issues/show/197

Author: Samuel Tran
Status: New
Priority: High
Assigned to: Sébastien Bahloul
Category: Core
Target version: 1.2.0


I have installed LSC 1.2 using the snapshot lsc-core-1.2-SNAPSHOT-dist.tar.gz 
from 04/14/2010 on CentOS Linux 5.4.
I want to synchronize two OpenLDAP Directories: the source directory is 
OpenLDAP 2.3.x and the destination is OpenLDAP 2.4.x.

Some DNs in the source directory have a # sign, e.g:

dn: cn=Elevator#2,ou=Subscribers,dc=example,dc=com
objectClass: inetOrgPerson
givenName: Elevator
uid: Elevator#2
cn: Elevator#2
sn: #2

My LSC synchronization is as follows:
lsc.syncoptions.MySyncTask = 
org.lsc.beans.syncoptions.PropertiesBasedSyncOptions
lsc.syncoptions.MySyncTask.default.action = F

When I first ran lsc, it created all the DNs in the destination directory. Then 
I ran it again. Even though no changes were made in the source directory, it 
tries to rename the DNs with a # sign. For instance it tries to rename 
'cn=Elevator#2,ou=Subscribers,dc=example,dc=com'; here is the ouput of the lcs 
run:

Apr 15 15:10:28 - WARN  - WARNING: updating the RDN of the entry will cancel 
other modifications! Relaunch synchronization to complete update.
Apr 15 15:10:28 - INFO  - # Renaming entry cn=Elevator\#2,ou=TelecomAssets for 
MySyncTask
dn: cn=Elevator\#2,ou=TelecomAssets,dc=example,dc=com
changetype: modrdn
newrdn: ou=TelecomAssets
deleteoldrdn: 1
newsuperior: cn=Elevator\#2

Then I ran lsc for a third time, the DN was not renamed and I still got the 
same error message.
I guess lsc is escaping the # sign with a backslash, which is causing that 
problem.

Thanks for your help.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://tools.lsc-project.org/my/account
_______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org

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

Reply via email to