mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
selftest: {offlinebackupdc,restoredc,customdc} are disconnected from other environments
These restore copies of others and better use their own resolv.conf and use '--use-samba-tool --no-credentials' for samba_dnsupdate in order to avoid talking to the real environments. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
parent
c5e478216f
commit
0bc9987049
@ -2848,7 +2848,7 @@ sub restore_backup_file
|
||||
sub prepare_dc_testenv
|
||||
{
|
||||
my ($self, $prefix, $dcname, $domain, $realm,
|
||||
$password, $conf_options) = @_;
|
||||
$password, $conf_options, $dnsupdate_options) = @_;
|
||||
|
||||
my $ctx = $self->provision_raw_prepare($prefix, "domain controller",
|
||||
$dcname,
|
||||
@ -2869,6 +2869,10 @@ sub prepare_dc_testenv
|
||||
push(@{$ctx->{directories}}, "$ctx->{share}");
|
||||
push(@{$ctx->{directories}}, "$ctx->{share}/test1");
|
||||
|
||||
if (defined($dnsupdate_options)) {
|
||||
$ctx->{samba_dnsupdate} .= $dnsupdate_options;
|
||||
}
|
||||
|
||||
$ctx->{smb_conf_extra_options} = "
|
||||
$conf_options
|
||||
max xmit = 32K
|
||||
@ -2919,12 +2923,14 @@ sub setup_restoredc
|
||||
server min protocol = SMB2
|
||||
client min protocol = SMB2
|
||||
prefork children = 1";
|
||||
my $dnsupdate_options = " --use-samba-tool --no-credentials";
|
||||
|
||||
my ($env, $ctx) = $self->prepare_dc_testenv($prefix, "restoredc",
|
||||
$dcvars->{DOMAIN},
|
||||
$dcvars->{REALM},
|
||||
$dcvars->{PASSWORD},
|
||||
$extra_conf);
|
||||
$extra_conf,
|
||||
$dnsupdate_options);
|
||||
|
||||
# create a backup of the 'backupfromdc'
|
||||
my $backupdir = File::Temp->newdir();
|
||||
@ -2945,6 +2951,16 @@ sub setup_restoredc
|
||||
return undef;
|
||||
}
|
||||
|
||||
#
|
||||
# As we create a the same domain as a clone
|
||||
# we need a separate resolv.conf!
|
||||
#
|
||||
$ctx->{resolv_conf} = "$ctx->{etcdir}/resolv.conf";
|
||||
$ctx->{dns_ipv4} = $ctx->{ipv4};
|
||||
$ctx->{dns_ipv6} = $ctx->{ipv6};
|
||||
Samba::mk_resolv_conf($ctx);
|
||||
$env->{RESOLV_CONF} = $ctx->{resolv_conf};
|
||||
|
||||
# start samba for the restored DC
|
||||
if (not defined($self->check_or_start($env))) {
|
||||
return undef;
|
||||
@ -3010,11 +3026,14 @@ sub setup_offlinebackupdc
|
||||
my ($self, $prefix, $dcvars) = @_;
|
||||
print "Preparing OFFLINE BACKUP DC...\n";
|
||||
my $extra_conf = "prefork children = 1";
|
||||
my $dnsupdate_options = " --use-samba-tool --no-credentials";
|
||||
|
||||
my ($env, $ctx) = $self->prepare_dc_testenv($prefix, "offlinebackupdc",
|
||||
$dcvars->{DOMAIN},
|
||||
$dcvars->{REALM},
|
||||
$dcvars->{PASSWORD}, $extra_conf);
|
||||
$dcvars->{PASSWORD},
|
||||
$extra_conf,
|
||||
$dnsupdate_options);
|
||||
|
||||
# create an offline backup of the 'backupfromdc' target
|
||||
my $backupdir = File::Temp->newdir();
|
||||
@ -3035,6 +3054,16 @@ sub setup_offlinebackupdc
|
||||
return undef;
|
||||
}
|
||||
|
||||
#
|
||||
# As we create a the same domain as a clone
|
||||
# we need a separate resolv.conf!
|
||||
#
|
||||
$ctx->{resolv_conf} = "$ctx->{etcdir}/resolv.conf";
|
||||
$ctx->{dns_ipv4} = $ctx->{ipv4};
|
||||
$ctx->{dns_ipv6} = $ctx->{ipv6};
|
||||
Samba::mk_resolv_conf($ctx);
|
||||
$env->{RESOLV_CONF} = $ctx->{resolv_conf};
|
||||
|
||||
# re-create the testenv's krb5.conf (the restore may have overwritten it)
|
||||
Samba::mk_krb5_conf($ctx);
|
||||
|
||||
@ -3157,6 +3186,7 @@ sub setup_customdc
|
||||
my $dc_name = "customdc";
|
||||
my $password = "locDCpass1";
|
||||
my $backup_file = $ENV{'BACKUP_FILE'};
|
||||
my $dnsupdate_options = " --use-samba-tool --no-credentials";
|
||||
|
||||
# user must specify a backup file to restore via an ENV variable, i.e.
|
||||
# BACKUP_FILE=backup-blah.tar.bz2 SELFTEST_TESTENV=customdc make testenv
|
||||
@ -3174,7 +3204,8 @@ sub setup_customdc
|
||||
|
||||
# create a placeholder directory and smb.conf, as well as the env vars.
|
||||
my ($env, $ctx) = $self->prepare_dc_testenv($prefix, $dc_name,
|
||||
$domain, $realm, $password, "");
|
||||
$domain, $realm, $password, "",
|
||||
$dnsupdate_options);
|
||||
|
||||
# restore the specified backup file to populate the testenv
|
||||
my $restore_dir = abs_path($prefix);
|
||||
@ -3185,6 +3216,16 @@ sub setup_customdc
|
||||
return undef;
|
||||
}
|
||||
|
||||
#
|
||||
# As we create a the same domain as a clone
|
||||
# we need a separate resolv.conf!
|
||||
#
|
||||
$ctx->{resolv_conf} = "$ctx->{etcdir}/resolv.conf";
|
||||
$ctx->{dns_ipv4} = $ctx->{ipv4};
|
||||
$ctx->{dns_ipv6} = $ctx->{ipv6};
|
||||
Samba::mk_resolv_conf($ctx);
|
||||
$env->{RESOLV_CONF} = $ctx->{resolv_conf};
|
||||
|
||||
# Change the admin password to the testenv default, just in case it's
|
||||
# different, or in case this was a --no-secrets backup
|
||||
my $samba_tool = Samba::bindir_path($self, "samba-tool");
|
||||
|
Loading…
Reference in New Issue
Block a user