Discussion:
problem with moddn
John Von Essen
2004-08-06 01:36:49 UTC
Permalink
I have data in OpenLDAP like this:

dn: uid=ejones,ou=trad,ou=students,ou=people,o=domain.com
cn: Ed Jones
givenName: Ed
sn: Jones
and so on...

I want to change the ou's in the DN.

dn: uid=ejones,ou=trad,ou=students,ou=people,o=domain.com

gets changed to

dn: uid=ejones,ou=faculty,ou=people,o=domain.com

I created the following ldif file and executed ldapmodify -D "XXX" -w
XXX -x -v -f file.ldif

dn: uid=ejones,ou=trad,ou=students,ou=people,o=domain.com
changetype: moddn
newrdn: uid=ejones,ou=faculty,ou=people,o=domain.com

I get the error:
ldap_initialize( <DEFAULT> )
modifying rdn of entry
"uid=ejones,ou=trad,ou=students,ou=people,o=domain.com"
new RDN: "uid=ejones,ou=Staff,ou=People,o=eastern.edu " (do not
keep existing values)
modrdn completed
ldap_rename: Invalid DN syntax (34)
additional info: invalid new RDN

I have tried changing newrdn to newdn?! But that just causes more
errors:
ldap_initialize( <DEFAULT> )
ldapmodify: expecting "newrdn:" but saw "newdn:" (line 3 of entry
"uid=ejones,ou=trad,ou=students,ou=people,o=domain.com")

Could someone point me in the right direction here? Thanks
-John
Howard Chu
2004-08-06 05:20:57 UTC
Permalink
Post by John Von Essen
dn: uid=ejones,ou=trad,ou=students,ou=people,o=domain.com
cn: Ed Jones
givenName: Ed
sn: Jones
and so on...
I want to change the ou's in the DN.
dn: uid=ejones,ou=trad,ou=students,ou=people,o=domain.com
gets changed to
dn: uid=ejones,ou=faculty,ou=people,o=domain.com
I created the following ldif file and executed ldapmodify -D "XXX" -w
XXX -x -v -f file.ldif
dn: uid=ejones,ou=trad,ou=students,ou=people,o=domain.com
changetype: moddn
newrdn: uid=ejones,ou=faculty,ou=people,o=domain.com
ldap_initialize( <DEFAULT> )
modifying rdn of entry
"uid=ejones,ou=trad,ou=students,ou=people,o=domain.com"
new RDN: "uid=ejones,ou=Staff,ou=People,o=eastern.edu " (do not
keep existing values)
modrdn completed
ldap_rename: Invalid DN syntax (34)
additional info: invalid new RDN
ldap_initialize( <DEFAULT> )
ldapmodify: expecting "newrdn:" but saw "newdn:" (line 3 of entry
"uid=ejones,ou=trad,ou=students,ou=people,o=domain.com")
Could someone point me in the right direction here? Thanks
-John
Use ldapmodrdn instead?

"newrdn" means what it says - the value is supposed to be an RDN. You
can't put a full DN in there. You want "newSuperior" for your purpose.
--
-- Howard Chu
Chief Architect, Symas Corp. Director, Highland Sun
http://www.symas.com http://highlandsun.com/hyc
Symas: Premier OpenSource Development and Support
John Von Essen
2004-08-07 15:12:30 UTC
Permalink
Okay, I figured out the syntax for making a dn change that went beyond
the left most part:

# ldif
dn: uid=ejones,ou=trad,ou=students,ou=people,o=domain.com
changetype: moddn
newrdn: uid=ejones
deleteoldrdn: 1
newSuperior: ou=staff,ou=people,o=eastern.edu


-John
Post by Howard Chu
Post by John Von Essen
dn: uid=ejones,ou=trad,ou=students,ou=people,o=domain.com
cn: Ed Jones
givenName: Ed
sn: Jones
and so on...
I want to change the ou's in the DN.
dn: uid=ejones,ou=trad,ou=students,ou=people,o=domain.com
gets changed to
dn: uid=ejones,ou=faculty,ou=people,o=domain.com
I created the following ldif file and executed ldapmodify -D "XXX" -w
XXX -x -v -f file.ldif
dn: uid=ejones,ou=trad,ou=students,ou=people,o=domain.com
changetype: moddn
newrdn: uid=ejones,ou=faculty,ou=people,o=domain.com
ldap_initialize( <DEFAULT> )
modifying rdn of entry
"uid=ejones,ou=trad,ou=students,ou=people,o=domain.com"
new RDN: "uid=ejones,ou=Staff,ou=People,o=eastern.edu " (do
not keep existing values)
modrdn completed
ldap_rename: Invalid DN syntax (34)
additional info: invalid new RDN
ldap_initialize( <DEFAULT> )
ldapmodify: expecting "newrdn:" but saw "newdn:" (line 3 of entry
"uid=ejones,ou=trad,ou=students,ou=people,o=domain.com")
Could someone point me in the right direction here? Thanks
-John
Use ldapmodrdn instead?
"newrdn" means what it says - the value is supposed to be an RDN. You
can't put a full DN in there. You want "newSuperior" for your purpose.
--
-- Howard Chu
Chief Architect, Symas Corp. Director, Highland Sun
http://www.symas.com http://highlandsun.com/hyc
Symas: Premier OpenSource Development and Support
John Von Essen (***@essenz.com)
President, Essenz Consulting (www.essenz.com)
Phone: (800) 248-1736
Fax: (800) 852-3387

Loading...