diff options
author | Andrew Bartlett <abartlet@samba.org> | 2020-07-27 11:37:29 +1200 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2020-08-06 13:32:29 +0000 |
commit | bb08c9b1f0897bd76e2df78aef4a5ad4576578ab (patch) | |
tree | 09af3a6babb859881f83cd4e4d06ecb5d692b511 /selftest | |
parent | b3d08729d1b29574d7d9ea3e5e93cb92796ad2e8 (diff) | |
download | samba-bb08c9b1f0897bd76e2df78aef4a5ad4576578ab.tar.gz |
dbcheck: Allow a dangling forward link outside our known NCs
If we do not have the NC of the target object we can not be really sure
that the object is redundent and so we want to keep it for now
and not (as happened until now) break the dbcheck run made during the
replication stage of a "samba-tool domain backup rename".
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14450
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit 05228c4e07013c0e6f78f1330b3b787271282ca8)
Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-11-test): Thu Aug 6 13:32:29 UTC 2020 on sn-devel-184
Diffstat (limited to 'selftest')
-rwxr-xr-x | selftest/target/Samba4.pm | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index 195e9b88044..a599099c59d 100755 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -2813,6 +2813,45 @@ sub setup_backupfromdc $self->setup_namespaces($env, $upn_array, $spn_array); + # Set up a dangling forward link to an expunged object + # + # We need this to ensure that the "samba-tool domain backup rename" + # that is part of the creation of the labdc environment can + # cope with this situation on the source DC. + + if (not $self->write_ldb_file("$env->{PRIVATEDIR}/sam.ldb", " +dn: ou=linktest,dc=backupdom,dc=samba,dc=example,dc=com +objectclass: organizationalUnit +- + +dn: cn=linkto,ou=linktest,dc=backupdom,dc=samba,dc=example,dc=com +objectclass: msExchConfigurationContainer +- + +dn: cn=linkfrom,ou=linktest,dc=backupdom,dc=samba,dc=example,dc=com +objectclass: msExchConfigurationContainer +addressBookRoots: cn=linkto,ou=linktest,dc=backupdom,dc=samba,dc=example,dc=com +- + +")) { + return undef; + } + my $ldbdel = Samba::bindir_path($self, "ldbdel"); + my $cmd = "$ldbdel -H $env->{PRIVATEDIR}/sam.ldb cn=linkto,ou=linktest,dc=backupdom,dc=samba,dc=example,dc=com"; + + unless(system($cmd) == 0) { + warn("Failed to delete link target: \n$cmd"); + return undef; + } + + # Expunge will ensure that linkto is totally wiped from the DB + my $samba_tool = Samba::bindir_path($self, "samba-tool"); + $cmd = "$samba_tool domain tombstones expunge --tombstone-lifetime=0 $env->{CONFIGURATION}"; + + unless(system($cmd) == 0) { + warn("Failed to expunge link target: \n$cmd"); + return undef; + } return $env; } |