Hi dear ldap gurus, hehehe
after a long time studying ldap and mysql, "specially" back-sql (didn't
work for mysql databases)
i wrote a perl script to write my entire users table to an ldiff and then
add this one to openldap server.
Questions:
This are my fields in users table
Nombre
Apellido1
Apellido2 correo
Empresa
Nombre= Name
Apellido1= surname
Apellido2= Like a 2nd surname
correo=email
Empresa=company
I have a problem, my sql database have users that have the same name,
surname, 2nd surname, but the email isn't the same, and the company is the same,
Example
Nombre
Apellido1
Apellido2
correo
Empresa
Francisco
Otero
Manresa francis@mathisa.minbas.cu
Mathisa
Francisco Otero Manresa admin@mathisa.minbas.cu Mathisa
i have an script called empresas.pl:
it goes to the sql database and select all from empresa
field.
and then it writes all that in an ldiff called empresas.ldif
that ldif contents a match from Empresa Field to OU: Example
dn: ou=Mathisa,o=minbas,c=cu
objectclass: top objectclass: organizationalUnit ou: Mathisa i do an ldapadd .... empresas.ldif to create the OUs in
the ldap server
i have other script called sql2ldap.pl
it goes to the sql database and select all from Nombre, Apellido1,
Apellido2, correo and empresa
and writes all to an ldiff called bd.ldif
the ldif contentes a match like this
Nombre -----------------------------> cn
Apellido 1 Apellido 2 --------> sn
Empresa --------------------------> ou
correo -----------------------------> mail
and my ldif i like this
dn: cn=Francisco Javier Otero
Manresa,ou=Mathisa,o=minbas,c=cu
objectclass: top objectclass: inetOrgPerson cn: Francisco Javier sn: Otero Manresa ou: Mathisa mail: admin@mathisa.minbas.cu
dn: cn=Francisco Javier Otero
Manresa,ou=Mathisa,o=minbas,c=cu
objectclass: top objectclass: inetOrgPerson cn: Francisco Javier sn: Otero Manresa ou: Emp. de Materiales Higienicos Sanitarios MATHISA mail: francisco@mathisa.minbas.cu As all can see i have the same CN and i want to add the 2 entries
What to do?
2nd Question
When i add an ldif to the ldap server where does ldapadd put the entries?
a file?
P.D Sorry about the big mail.......
|