From: Andrew Bartlett Date: Fri, 10 Jun 2016 03:43:37 +0000 (+1200) Subject: selftest: Always set up a resolv.conf and use it in samba_dnsupdate X-Git-Tag: tdb-1.3.10~838 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ba22d291446aefbae8a02346e5b7edbc9265dc4a;p=thirdparty%2Fsamba.git 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 Reviewed-by: Garming Sam --- diff --git a/selftest/selftest.pl b/selftest/selftest.pl index 7b4d4decb08..528aa9c7d47 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -835,6 +835,7 @@ my @exported_envvars = ( "LOCAL_PATH", "DNS_FORWARDER1", "DNS_FORWARDER2", + "RESOLV_CONF", # nss_wrapper "NSS_WRAPPER_PASSWD", diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index 4387c8a13f4..184b9492e12 100755 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -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}; } diff --git a/source4/scripting/bin/samba_dnsupdate b/source4/scripting/bin/samba_dnsupdate index 6565b5aef5b..16265f639fd 100755 --- a/source4/scripting/bin/samba_dnsupdate +++ b/source4/scripting/bin/samba_dnsupdate @@ -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)