1 |
slords |
1.1 |
diff -up e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update.rename_old_record_fix2 e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update |
2 |
|
|
--- e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update.rename_old_record_fix2 2010-09-25 15:17:08.000000000 -0600 |
3 |
|
|
+++ e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update 2010-09-25 15:18:23.000000000 -0600 |
4 |
|
|
@@ -325,8 +325,16 @@ foreach my $dn (keys %$updates) |
5 |
|
|
if ($code == 32) |
6 |
|
|
{ |
7 |
|
|
my ($newdn, $newbase) = split /,/, $dn, 2; |
8 |
|
|
+ |
9 |
|
|
+ # Ensure key entry exist in old record before renaming |
10 |
|
|
+ $result = $ldap->modify( "$oldfilter,$oldsearchbase", replace => { split('=', $newdn) } ); |
11 |
|
|
+ warn "failed to rename old entry $oldfilter,$oldsearchbase: ", $result->error if $result->code; |
12 |
|
|
+ |
13 |
|
|
+ # Move old record to new location |
14 |
|
|
$result = $ldap->moddn( "$oldfilter,$oldsearchbase", newrdn => $newdn, newsuperior => $newbase, deleteoldrdn => 1 ); |
15 |
|
|
warn "failed to rename old entry $oldfilter,$oldsearchbase: ", $result->error if $result->code; |
16 |
|
|
+ |
17 |
|
|
+ # Set things up as if we had found the new entry |
18 |
|
|
$code = $oldresult->code; |
19 |
|
|
@objectClass = $oldresult->entry(0)->get_value('objectClass'); |
20 |
|
|
} |