[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: script MySQL ldap DONE, and some questions



At this point, since you're not using back-sql any more,
because you insist in using a rdbms that is not supported
(I don't want to restart the old story that the interested
readers can find in the archives), I note that your question
has very little to do with OpenLDAP software usage; it rather
addresses the general LDAP problem of how to name entries.

I suggest you move to a more specific list; let me
however spend my two cents on your problem: first of all,
nobody ever stated that the "cn" must be the naming attribute.
I assume your entries in your rdbms that generally describe
people have a unique key, or some combination of values that
must be unique. Then, you can use those values to name your
entries.  E.g., if your email is unique, then why don't you
use "mail" as naming attribute?  If you want the name to
appear as naming attribute, you may use

cn=Francisco Javier Otero
Manresa+mail=admin@mathisa.minbas.cu,ou=Mathisa,o=minbas,c=cu

(note that in the ldif you produced, the "cn" value in the
DN is different from that in the entry, so slapd will reject
your entry).

But, in my opinion, your problem is quite different: don't you
realize that the two entries you're addressing really are
one single entry with two mail addresses, and that the solution
you used in the rdbms to account for these two addresses was
really bad, i.e. to duplicate the rest of the values creating
two rows?  I suggest you carefully redesign your rdbms before
you generate the ldif, and try to handle multiple-valued attrs
in a more appropriate manner.

p.

> 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.......


-- 
Pierangelo Masarati
mailto:pierangelo.masarati@sys-net.it