6 =head1 ldif to contagged
10 ldif2contagged.pl < exported.addressbook.from.thunderbird.mozilla.ldif
14 for i in *;do ldapadd -w mypass -x -D "cn=Manager,dc=example,dc=com" -f $i -H ldap://ldap.server.example.com ;done
16 for i in *;do echo $i;ldapmodify -w mypass -x -D "cn=Manager,dc=example,dc=com" -f $i -H ldap://ldap.server.example.com ;done
18 =head1 modification made to contagged
21 contagged/inc/lang/en.php :
22 -$lang['country'] = 'Land';
23 +$lang['country'] = 'Country';
27 contagged/inc/fields.php
28 # added departement field, country
29 # street remapped to street
31 + 'department' => 'ou', // aka. unit
33 - 'street' => 'postalAddress',
34 + 'street' => 'street',
39 =head1 modification made to ldap schemas
42 # to get longer country name (ie usa, canada instead of ca, us)
44 attributetype ( 2.5.4.6 NAME ( 'c' 'countryName' )
45 DESC 'RFC2256: ISO-3166 country 2-letter code'
46 - SUP name SINGLE-VALUE )
47 + EQUALITY caseIgnoreMatch
48 + SUBSTR caseIgnoreSubstringsMatch
49 + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} )
52 # to get phones numbers with extensions, free writing
54 attributetype ( 2.5.4.20 NAME 'telephoneNumber'
55 - DESC 'RFC2256: Telephone Number'
56 - EQUALITY telephoneNumberMatch
57 - SUBSTR telephoneNumberSubstringsMatch
58 - SYNTAX 1.3.6.1.4.1.1466.115.121.1.50{32} )
59 + DESC 'RFC2256: Telephone Number'
60 + EQUALITY caseIgnoreMatch
61 + SUBSTR caseIgnoreSubstringsMatch
62 + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
65 # add country to persons
67 objectclass ( 2.5.6.7 NAME 'organizationalPerson'
68 DESC 'RFC2256: an organizational person'
70 MAY ( title $ x121Address $ registeredAddress $ destinationIndicator $
71 preferredDeliveryMethod $ telexNumber $ teletexTerminalIdentifier $
72 telephoneNumber $ internationaliSDNNumber $
73 facsimileTelephoneNumber $ street $ postOfficeBox $ postalCode $
74 - postalAddress $ physicalDeliveryOfficeName $ ou $ st $ l ) )
75 + postalAddress $ physicalDeliveryOfficeName $ ou $ st $ l $ c ) )
80 # to get phones numbers with extensions, free writing
82 attributetype ( 0.9.2342.19200300.100.1.20
83 - DESC 'RFC1274: home telephone number'
84 - NAME ( 'homePhone' 'homeTelephoneNumber' )
85 - EQUALITY telephoneNumberMatch
86 - SUBSTR telephoneNumberSubstringsMatch
87 - SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )
88 + NAME ( 'homePhone' 'homeTelephoneNumber' )
89 + DESC 'RFC1274: home telephone number'
90 + EQUALITY caseIgnoreMatch
91 + SUBSTR caseIgnoreSubstringsMatch
92 + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
99 Copyright (c) 2004-2006 8D Technologies, Xavier Renaut
100 xavier blob ldif2contagged at pecos blob 8d blod com
103 This program is free software; you can redistribute it and/or
104 modify it under the terms of the GNU Lesser General Public
105 License as published by the Free Software Foundation; either
106 version 2.1 of the License, or (at your option) any later version.
108 This program is distributed in the hope that it will be useful,
109 but WITHOUT ANY WARRANTY; without even the implied warranty of
110 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
111 Lesser General Public License for more details.
113 You should have received a copy of the GNU Lesser General Public
114 License along with this program; if not, write to the Free Software
115 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
120 my $uid="1186058859";
137 next if /^objectclass: (top|person|mozillaAbPersonAlpha)/;
138 next if /^modifytimestamp/;
148 if ($cn_surname ne ""){push @data,"sn: $cn_surname\n" }
149 else {push @data,"sn: $mail_surname\n" }
152 print "\b\b\b\b$count";
153 my $file="$dir/$uid";
154 open (C,">$file") || die "cant open $file : $!";
168 # s/^(\w+)::/$1:/; # used for the accents
170 if (/sn: (\S+)/){ $sn=$1;$sn_found=1;}
171 if (/cn:.*\b(\w+?)\b.*?\s*$/i) { $cn_surname=$1;}
172 if (/mail: (\S+)@/i) { $mail_surname=$1;}
175 #s/^(company:\s*\w{30})\w+\s*$/$1\n/;
176 #s/^(\w+:\s*\w{30})[\w=]+\s*$/$1\n/; #there is no garbage, comment it
177 s/dn:\s*(.*)$/dn: uid=$uid,ou=centraladdressbook,dc=8d,dc=com\nuid: $uid/;
180 s/^mozillaSecondEmail/mail/;
181 s/^mozillaCustom1/description/;
184 s/^mozillaWorkUrl/labeledURI/;
185 if (s/^mozillaWorkStreet2::? /, /)
188 #foreach (@data) {if (s/street .*/
191 if (/^street:/){chomp}
200 print " entries created in $dir/\n";