]> git.samba.org - samba.git/commitdiff
selftest: Always set up a resolv.conf and use it in samba_dnsupdate
authorAndrew Bartlett <abartlet@samba.org>
Fri, 10 Jun 2016 03:43:37 +0000 (15:43 +1200)
committerGarming Sam <garming@samba.org>
Thu, 16 Jun 2016 02:40:14 +0000 (04:40 +0200)
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>
selftest/selftest.pl
selftest/target/Samba4.pm
source4/scripting/bin/samba_dnsupdate

index 7b4d4decb0863fc827dfe37bbe56e5622f7459c6..528aa9c7d47dd76f47bc6b238ba9a52396fa3394 100755 (executable)
@@ -835,6 +835,7 @@ my @exported_envvars = (
        "LOCAL_PATH",
        "DNS_FORWARDER1",
        "DNS_FORWARDER2",
+       "RESOLV_CONF",
 
        # nss_wrapper
        "NSS_WRAPPER_PASSWD",
index 4387c8a13f4d74c943dc22d8df92ec13f2ca959d..184b9492e123de4166df5ad2668cf038093d13db 100755 (executable)
@@ -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};
        }
index 6565b5aef5be2b52a9f5ee872ff0f90e5061c855..16265f639fdfd3f63c2d12193da38384876839b2 100755 (executable)
@@ -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)