Tuesday, June 23, 2009

LDAP and ObjectClass

After AS Upgrade to 10.1.2.3.0 adding an a new object class does not get automatically included when the user is updated.
I introduced a new objectclass for self password validation and updating it would result with an error as below



This affected old users in the system but new users were not.

By making a ldapsearch on the user , it is found that the objectclass "passwordvalidation" is not found.
Note: passwordvalidation is an objectclass that is custom created and not available by default.

$ ldapsearch -v -h server01 -p 389 -D "cn=orcladmin" -w "welcome1" -s sub -b "dc=oracle,dc=com"  "uid=testuser" "objectclass=*"
objectclass=top
objectclass=person
objectclass=organizationalPerson
objectclass=inetOrgPerson
objectclass=orcluser
objectclass=orcluserv2
objectclass=customuserclass

So I had to add it manually for all the users.

I did a quick fix what came in my mind , not sure if there are other ways to workaround it.

$ ldapsearch -v -h server01 -p 389 -D "cn=orcladmin" -w "welcome1" -s sub -b "cn=users,dc=oracle,dc=com" "uid=*" dn > 1.txt
$ sed 's/ //g' 1.txt > 11.txt ( to remove space in the DN )

$ for i in `cat 11.txt`
  do
  echo $i
  echo "objectclass=passwordvalidation"
  echo 
  done > 111.txt

$ ldapmodify -c -h server01 -p 389 -D "cn=orcladmin" -w "welcome1" -f 111.txt > 1111.txt


ldapsearch for the same user

$ ldapsearch -v -h server01 -p 389 -D "cn=orcladmin" -w "welcome1" -s sub -b "dc=oracle,dc=com"  "uid=testuser" "objectclass=*"
objectclass=top
objectclass=person
objectclass=organizationalPerson
objectclass=inetOrgPerson
objectclass=orcluser
objectclass=orcluserv2
objectclass=customuserclass
objectclass=passwordvalidation


The error is no more and I was able to modify the user profile without any issues.

Popular Posts