1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

selftest: always explicitly use RESOLV_CONF

By default point RESOLV_CONF to a non-existing file and
use the per environment RESOLV_CONF explicitly where needed.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Stefan Metzmacher 2019-10-30 18:17:36 +01:00 committed by Andreas Schneider
parent 8133c5787b
commit 678651a73b
4 changed files with 19 additions and 0 deletions

View File

@ -686,6 +686,9 @@ if ($opt_quick) {
}
$ENV{SELFTEST_MAXTIME} = $torture_maxtime;
my $selftest_resolv_conf_path = "$tmpdir_abs/selftest.resolv.conf";
$ENV{RESOLV_CONF} = "${selftest_resolv_conf_path}.global";
my $selftest_krbt_ccache_path = "$tmpdir_abs/selftest.krb5_ccache";
$ENV{KRB5CCNAME} = "FILE:${selftest_krbt_ccache_path}.global";
@ -823,6 +826,7 @@ sub setup_env($$)
delete $ENV{SOCKET_WRAPPER_DEFAULT_IFACE};
delete $ENV{SMB_CONF_PATH};
$ENV{RESOLV_CONF} = "${selftest_resolv_conf_path}.${envname}/ignore";
$ENV{KRB5CCNAME} = "FILE:${selftest_krbt_ccache_path}.${envname}/ignore";
if (defined(get_running_env($envname))) {

View File

@ -113,6 +113,7 @@ sub setup_env($$$)
# Avoid hitting system krb5.conf -
# An env that needs Kerberos will reset this to the real value.
$ENV{KRB5_CONFIG} = "$path/no_krb5.conf";
$ENV{RESOLV_CONF} = "$path/no_resolv.conf";
my $setup_name = $ENV_TARGETS{$envname}."::setup_".$envname;
my $setup_sub = \&$setup_name;

View File

@ -721,6 +721,7 @@ sub setup_ad_member
} else {
$cmd .= "RESOLV_WRAPPER_HOSTS=\"$ret->{RESOLV_WRAPPER_HOSTS}\" ";
}
$cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" ";
$cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
$cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" ";
$cmd .= "$net join $ret->{CONFIGURATION}";
@ -844,6 +845,7 @@ sub setup_ad_member_rfc2307
} else {
$cmd .= "RESOLV_WRAPPER_HOSTS=\"$ret->{RESOLV_WRAPPER_HOSTS}\" ";
}
$cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" ";
$cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
$cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" ";
$cmd .= "$net join $ret->{CONFIGURATION}";
@ -942,6 +944,7 @@ sub setup_ad_member_idmap_rid
} else {
$cmd .= "RESOLV_WRAPPER_HOSTS=\"$ret->{RESOLV_WRAPPER_HOSTS}\" ";
}
$cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" ";
$cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
$cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" ";
$cmd .= "$net join $ret->{CONFIGURATION}";
@ -1039,6 +1042,7 @@ sub setup_ad_member_idmap_ad
} else {
$cmd .= "RESOLV_WRAPPER_HOSTS=\"$ret->{RESOLV_WRAPPER_HOSTS}\" ";
}
$cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" ";
$cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
$cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" ";
$cmd .= "$net join $ret->{CONFIGURATION}";
@ -2759,6 +2763,7 @@ force_user:x:$gid_force_user:
} else {
$createuser_env{RESOLV_WRAPPER_CONF} = $resolv_conf;
}
$createuser_env{RESOLV_CONF} = $resolv_conf;
createuser($self, $unix_name, $password, $conffile, \%createuser_env) || die("Unable to create user");
createuser($self, "force_user", $password, $conffile, \%createuser_env) || die("Unable to create force_user");
@ -2810,6 +2815,7 @@ force_user:x:$gid_force_user:
} else {
$ret{RESOLV_WRAPPER_CONF} = $resolv_conf;
}
$ret{RESOLV_CONF} = $resolv_conf;
$ret{LOCAL_PATH} = "$shrdir";
$ret{LOGDIR} = $logdir;

View File

@ -888,6 +888,7 @@ sub provision_raw_step2($$$)
my $testallowed_account = "testallowed";
my $samba_tool_cmd = "";
$samba_tool_cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" ";
$samba_tool_cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
$samba_tool_cmd .= "KRB5CCNAME=\"$ret->{KRB5_CCACHE}\" ";
$samba_tool_cmd .= Samba::bindir_path($self, "samba-tool")
@ -898,6 +899,7 @@ sub provision_raw_step2($$$)
}
my $ldbmodify = "";
$ldbmodify .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" ";
$ldbmodify .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
$ldbmodify .= "KRB5CCNAME=\"$ret->{KRB5_CCACHE}\" ";
$ldbmodify .= Samba::bindir_path($self, "ldbmodify");
@ -931,6 +933,7 @@ servicePrincipalName: host/testallowed
close(LDIF);
$samba_tool_cmd = "";
$samba_tool_cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" ";
$samba_tool_cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
$samba_tool_cmd .= "KRB5CCNAME=\"$ret->{KRB5_CCACHE}\" ";
$samba_tool_cmd .= Samba::bindir_path($self, "samba-tool")
@ -951,6 +954,7 @@ userPrincipalName: testdenied_upn\@$ctx->{realm}.upn
close(LDIF);
$samba_tool_cmd = "";
$samba_tool_cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" ";
$samba_tool_cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
$samba_tool_cmd .= "KRB5CCNAME=\"$ret->{KRB5_CCACHE}\" ";
$samba_tool_cmd .= Samba::bindir_path($self, "samba-tool")
@ -973,6 +977,7 @@ servicePrincipalName: http/testupnspn.$ctx->{dnsname}
close(LDIF);
$samba_tool_cmd = "";
$samba_tool_cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" ";
$samba_tool_cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
$samba_tool_cmd .= "KRB5CCNAME=\"$ret->{KRB5_CCACHE}\" ";
$samba_tool_cmd .= Samba::bindir_path($self, "samba-tool")
@ -988,6 +993,7 @@ servicePrincipalName: http/testupnspn.$ctx->{dnsname}
foreach my $user_account (@{$user_account_array}) {
my $samba_tool_cmd = "";
$samba_tool_cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" ";
$samba_tool_cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
$samba_tool_cmd .= "KRB5CCNAME=\"$ret->{KRB5_CCACHE}\" ";
$samba_tool_cmd .= Samba::bindir_path($self, "samba-tool")
@ -1042,6 +1048,7 @@ servicePrincipalName: http/testupnspn.$ctx->{dnsname}
# Change the userPrincipalName for jane
$ldbmodify = "";
$ldbmodify .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" ";
$ldbmodify .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
$ldbmodify .= "KRB5CCNAME=\"$ret->{KRB5_CCACHE}\" ";
$ldbmodify .= Samba::bindir_path($self, "ldbmodify");
@ -2773,6 +2780,7 @@ sub create_backup
} else {
$cmd_env .= "RESOLV_WRAPPER_HOSTS=\"$env->{RESOLV_WRAPPER_HOSTS}\" ";
}
$cmd_env .= "RESOLV_CONF=\"$env->{RESOLV_CONF}\" ";
# Note: use the backupfrom-DC's krb5.conf to do the backup
$cmd_env .= " KRB5_CONFIG=\"$dcvars->{KRB5_CONFIG}\" ";
$cmd_env .= "KRB5CCNAME=\"$env->{KRB5_CCACHE}\" ";