From ef4c757a0c89348c5960f45c3047e221ae353c09 Mon Sep 17 00:00:00 2001 From: Uri Simchoni Date: Sat, 24 Oct 2015 00:41:23 +0300 Subject: [PATCH 1/3] selftest: Avoid system krb5.conf in testenv provisioning Some provisioning commands don't necessarily need a krb5.conf, but they still must cause samba's Kerberos libraries to avoid looking at the system krb5.conf, as this file may not be understood by samba's Kerberos libs and fail the env provisioning. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11576 Signed-off-by: Uri Simchoni Reviewed-by: Andrew Bartlett (cherry picked from commit 63c891938a2d3e1c222898d6dea5c640822b0191) --- selftest/target/Samba4.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index 83b4e74..26d9c00 100755 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -550,6 +550,7 @@ sub provision_raw_prepare($$$$$$$$$$) $ctx->{smb_conf_extra_options} = ""; my @provision_options = (); + push (@provision_options, "KRB5_CONFIG=\"$ctx->{krb5_config}\""); push (@provision_options, "NSS_WRAPPER_PASSWD=\"$ctx->{nsswrap_passwd}\""); push (@provision_options, "NSS_WRAPPER_GROUP=\"$ctx->{nsswrap_group}\""); push (@provision_options, "NSS_WRAPPER_HOSTS=\"$ctx->{nsswrap_hosts}\""); -- 2.4.3 From 05742675e431595d57f6a4280242a8c3fac71f24 Mon Sep 17 00:00:00 2001 From: Uri Simchoni Date: Sun, 25 Oct 2015 15:02:17 +0200 Subject: [PATCH 2/3] selftest: Avoid system krb5.conf in some test envs that don't use kerberos Some test envs don't use kerberos (e.g. nt4_dc). However, the client tools are built with Kerberos support and may get upset if hitting a krb5.conf file they don't understand. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11576 Signed-off-by: Uri Simchoni Reviewed-by: Andrew Bartlett (cherry picked from commit 8d3106b1a4d9da5bf8b127fa70a77076d3dfeca8) --- selftest/target/Samba3.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index c95631f..ac8bfb7 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -173,6 +173,13 @@ sub setup_env($$$) return $self->{vars}->{$envname}; } + # + # Avoid hitting system krb5.conf - + # An env that needs Kerberos will reset this to the real + # value. + # + $ENV{KRB5_CONFIG} = "$path/no_krb5.conf"; + if ($envname eq "s3dc") { return $self->setup_s3dc("$path/s3dc"); } elsif ($envname eq "simpleserver") { @@ -1362,6 +1369,13 @@ domadmins:X:$gid_domadmins: $ret{LOCAL_PATH} = "$shrdir"; $ret{LOGDIR} = $logdir; + # + # Avoid hitting system krb5.conf - + # An env that needs Kerberos will reset this to the real + # value. + # + $ret{KRB5_CONFIG} = abs_path($prefix) . "/no_krb5.conf"; + return \%ret; } -- 2.4.3 From 11c6f71e7f0342b72cccf3fefeed139839e3134b Mon Sep 17 00:00:00 2001 From: Uri Simchoni Date: Mon, 26 Oct 2015 07:38:08 +0200 Subject: [PATCH 3/3] selftest: Avoid system krb5.conf in "none" test env Some torture tests do not perform Kerberos activity and do not run against a server (hence the "none" test env), but do create a krb5 context, and that causes the Kerberos libs to read krb5.conf and choke if they don't understand it. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11576 Signed-off-by: Uri Simchoni Reviewed-by: Andrew Bartlett (cherry picked from commit f9d6be3b749313a03e9097d848ce078f19197a0a) --- selftest/selftest.pl | 5 +---- selftest/target/Samba4.pm | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/selftest/selftest.pl b/selftest/selftest.pl index 96687ea..1d5826d 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -805,9 +805,7 @@ sub setup_env($$) $option = "client" if $option eq ""; - if ($envname eq "none") { - $testenv_vars = {}; - } elsif (defined(get_running_env($envname))) { + if (defined(get_running_env($envname))) { $testenv_vars = get_running_env($envname); if (not $testenv_vars->{target}->check_env($testenv_vars)) { print $testenv_vars->{target}->getlog_env($testenv_vars); @@ -875,7 +873,6 @@ sub getlog_env($) sub check_env($) { my ($envname) = @_; - return 1 if ($envname eq "none"); my $env = get_running_env($envname); return $env->{target}->check_env($env); } diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index 26d9c00..ab31248 100755 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -1743,8 +1743,11 @@ sub getlog_env($$) sub check_env($$) { my ($self, $envvars) = @_; + my $samba_pid = $envvars->{SAMBA_PID}; - my $childpid = Samba::cleanup_child($envvars->{SAMBA_PID}, "samba"); + return 1 if $samba_pid == -1; + + my $childpid = Samba::cleanup_child($samba_pid, "samba"); return ($childpid == 0); } @@ -1813,6 +1816,8 @@ sub setup_env($$$) } return $target3->setup_admember_rfc2307("$path/s3member_rfc2307", $self->{vars}->{dc}, 34); + } elsif ($envname eq "none") { + return $self->setup_none("$path/none"); } else { return "UNKNOWN"; } @@ -2128,4 +2133,14 @@ sub setup_plugin_s4_dc($$) return $env; } +sub setup_none($$) +{ + my ($self, $path) = @_; + + my $ret = { + KRB5_CONFIG => abs_path($path) . "/no_krb5.conf", + SAMBA_PID => -1, + } +} + 1; -- 2.4.3