1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

selftest: Always set up a resolv.conf and use it in samba_dnsupdate

This allows samba_dnsupdate to be tested without resolv_wrapper.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett 2016-06-10 15:43:37 +12:00 committed by Garming Sam
parent f5aaa1ea31
commit ba22d29144
3 changed files with 10 additions and 7 deletions

View File

@ -835,6 +835,7 @@ my @exported_envvars = (
"LOCAL_PATH",
"DNS_FORWARDER1",
"DNS_FORWARDER2",
"RESOLV_CONF",
# nss_wrapper
"NSS_WRAPPER_PASSWD",

View File

@ -437,9 +437,10 @@ sub provision_raw_prepare($$$$$$$$$$$)
$ctx->{dns_host_file} = "$ENV{SELFTEST_PREFIX}/dns_host_file";
$ctx->{samba_dnsupdate} = "$ENV{SRCDIR_ABS}/source4/scripting/bin/samba_dnsupdate -s $ctx->{smb_conf} --all-interfaces --use-file=$ctx->{dns_host_file}";
} else {
$ctx->{resolv_conf} = "$ctx->{etcdir}/resolv.conf";
$ctx->{samba_dnsupdate} = "$ENV{SRCDIR_ABS}/source4/scripting/bin/samba_dnsupdate -s $ctx->{smb_conf} --all-interfaces";
$ctx->{samba_dnsupdate} = "$ENV{SRCDIR_ABS}/source4/scripting/bin/samba_dnsupdate -s $ctx->{smb_conf} --all-interfaces";
$ctx->{use_resolv_wrapper} = 1;
}
$ctx->{resolv_conf} = "$ctx->{etcdir}/resolv.conf";
$ctx->{tlsdir} = "$ctx->{privatedir}/tls";
@ -463,7 +464,7 @@ sub provision_raw_prepare($$$$$$$$$$$)
push (@provision_options, "NSS_WRAPPER_GROUP=\"$ctx->{nsswrap_group}\"");
push (@provision_options, "NSS_WRAPPER_HOSTS=\"$ctx->{nsswrap_hosts}\"");
push (@provision_options, "NSS_WRAPPER_HOSTNAME=\"$ctx->{nsswrap_hostname}\"");
if (defined($ctx->{resolv_conf})) {
if (defined($ctx->{use_resolv_wrapper})) {
push (@provision_options, "RESOLV_WRAPPER_CONF=\"$ctx->{resolv_conf}\"");
} else {
push (@provision_options, "RESOLV_WRAPPER_HOSTS=\"$ctx->{dns_host_file}\"");
@ -687,11 +688,12 @@ nogroup:x:65534:nobody
LOCAL_PATH => $ctx->{share},
UID_RFC2307TEST => $uid_rfc2307test,
GID_RFC2307TEST => $gid_rfc2307test,
SERVER_ROLE => $ctx->{server_role}
SERVER_ROLE => $ctx->{server_role},
RESOLV_CONF => $ctx->{resolv_conf}
};
if (defined($ctx->{resolv_conf})) {
$ret->{RESOLV_WRAPPER_CONF} = $ctx->{resolv_conf};
if (defined($ctx->{use_resolv_wrapper})) {
$ret->{RESOLV_WRAPPER_CONF} = $ctx->{resolv_conf};
} else {
$ret->{RESOLV_WRAPPER_HOSTS} = $ctx->{dns_host_file};
}

View File

@ -238,7 +238,7 @@ def hostname_match(h1, h2):
return h1.lower().rstrip('.') == h2.lower().rstrip('.')
def check_one_dns_name(name, name_type, d=None):
resolv_conf = os.getenv('RESOLV_WRAPPER_CONF')
resolv_conf = os.getenv('RESOLV_CONF')
if not resolv_conf:
resolv_conf = '/etc/resolv.conf'
resolver = dns.resolver.Resolver(filename=resolv_conf, configure=True)