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

Migration Tools: possible modification ? Re: dn and search on special caracters (+,;..)



You're right, I just need to escape + signs in the DN but not in the cn
attribute.
I've inserted code in migation tools scripts to do this automatically
(escaping + signs, example for whois++ service en TP++ protocol):

Here's what I've done:

migrate_protocols.pl

sub dump_protocol
{
        local($HANDLE, $name, $number, @aliases) = @_;
        $namedn=$name;
        if ($namedn =~ /\+/)
                {$namedn =~ s/\+/\\+/g;}

        print $HANDLE "dn: cn=$namedn,$NAMINGCONTEXT\n";


migrate_services.pl

        $servicenamedn=$servicename;
        if ($servicenamedn =~ /\+/)
                {
                $servicenamedn =~ s/\+/\\+/g;}

        print $HANDLE "dn:
cn=$servicenamedn+ipServiceProtocol=$proto,$NAMINGCONTEXT\n";


hope this would help others.

Thanks.


Pierangelo Masarati wrote:
> 
> Jehan PROCACCIA wrote:
> 
> > I have well understand that I must escape special caracters in dn as it
> > was said previously in this list:
> >
> > "
> > Andrew Williams wrote:
> > >
> > > "cn=whois+++ipServiceProtocol=tcp,ou=Services,dc=vsinj,dc=net"
> > > ldap_add: Invalid DN syntax
> > >         additional info: invalid DN
> >
> > + is a special character for defining multi-attribute RDNs. You have
> > to escape it with \. See RFC2253:
> > "
> >
> > but now that I have escaped them, the \ keeps appearing when I browse
> > the entries, even when I run searchs:
> >
> > example, here's my original ldif:
> >
> > dn: cn=whois\+\+\+ipServiceProtocol=tcp,ou=Services,dc=int-evry,dc=fr
> > objectClass: ipService
> > objectClass: top
> > ipServicePort: 63
> > ipServiceProtocol: tcp
> > cn: whois\+\+
> > description: IP service 63 (whois\+\+)
> 
> This dn is wrong: it should read
> 
> dn: cn=whois\+\++ipServiceProtocol=tcp,ou=Services,dc=int-evry,dc=fr
> 
> that is, the '+' before ipServiceProtocol must not be escaped.
> Moreover, while you need to escape '+' in dn, you don't
> in attribute 'cn' (I think, at least); as a result you can search
> it normally.
> So your entry should be:
> 
> dn: cn=whois\+\++ipServiceProtocol=tcp,ou=Services,dc=int-evry,dc=fr
> objectClass: ipService
> objectClass: top
> ipServicePort: 63
> ipServiceProtocol: tcp
> cn: whois++
> description: IP service 63 (whois++)
> 
> Please correct me if I'm wrong.
> 
> Pierangelo.
> 
> --
> Dr. Pierangelo Masarati               | voice: +39 02 2399 8309
> Dip. Ing. Aerospaziale                | fax:   +39 02 2399 8334
> Politecnico di Milano                 | mailto:masarati@aero.polimi.it
> via La Masa 34, 20156 Milano, Italy   | http://www.aero.polimi.it/~masarati

-- 
Jehan Procaccia
Institut National des Telecommunications| Email:
Jehan.Procaccia@int-evry.fr 
MCI, Moyens Communs Informatiques	| Tel  : +33 (0) 160764436 
9 rue Charles Fourier 91011 Evry France | Fax  : +33 (0) 160764321