1 |
filippocarletti |
1.1 |
diff -Nur -x '*.orig' -x '*.rej' e-smith-ldap-5.2.0/root/var/service/ldap/convert_ldif mezzanine_patched_e-smith-ldap-5.2.0/root/var/service/ldap/convert_ldif |
2 |
|
|
--- e-smith-ldap-5.2.0/root/var/service/ldap/convert_ldif 2010-06-04 00:17:22.000000000 +0200 |
3 |
|
|
+++ mezzanine_patched_e-smith-ldap-5.2.0/root/var/service/ldap/convert_ldif 2010-06-04 00:17:20.000000000 +0200 |
4 |
|
|
@@ -7,14 +7,14 @@ |
5 |
|
|
use Net::LDAP::LDIF; |
6 |
|
|
use esmith::util; |
7 |
|
|
|
8 |
|
|
-my $old = shift; |
9 |
|
|
-my $new = shift; |
10 |
|
|
+my $olddomain = shift; |
11 |
|
|
+my $newdomain = shift; |
12 |
|
|
|
13 |
|
|
my $ldif = Net::LDAP::LDIF->new( "/dev/stdin", "r", onerror => 'undef' ); |
14 |
|
|
my $writer = Net::LDAP::LDIF->new("/dev/stdout", "w", onerror => 'undef' ); |
15 |
|
|
|
16 |
|
|
-$new = esmith::util::ldapBase($new); |
17 |
|
|
-$old = esmith::util::ldapBase($old); |
18 |
|
|
+my $new = esmith::util::ldapBase($newdomain); |
19 |
|
|
+my $old = esmith::util::ldapBase($olddomain); |
20 |
|
|
|
21 |
|
|
while( not $ldif->eof()) |
22 |
|
|
{ |
23 |
|
|
@@ -48,6 +48,16 @@ |
24 |
|
|
} |
25 |
|
|
# do any other object transformations |
26 |
|
|
|
27 |
|
|
+ # Update the mail attributes |
28 |
|
|
+ if ($entry->exists('mail')){ |
29 |
|
|
+ my @newmails = (); |
30 |
|
|
+ foreach ($entry->get_value('mail')){ |
31 |
|
|
+ $_ =~ s/\@$olddomain$/\@$newdomain/; |
32 |
|
|
+ push (@newmails,$_); |
33 |
|
|
+ } |
34 |
|
|
+ $entry->replace(mail => [ @newmails ]); |
35 |
|
|
+ } |
36 |
|
|
+ |
37 |
|
|
# Update basedb suffix |
38 |
|
|
$dn =~ s/$old$/$new/; |
39 |
|
|
$entry->dn($dn); |