mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
selftest: make/use a copy of GNUPGHOME
That makes it possible to run tests from a read only source tree.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14628
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 86343125a5
)
This commit is contained in:
parent
81b36b389c
commit
c1a4cb97d1
@ -313,7 +313,6 @@ $ENV{PREFIX} = $prefix;
|
||||
$ENV{PREFIX_ABS} = $prefix_abs;
|
||||
$ENV{SRCDIR} = $srcdir;
|
||||
$ENV{SRCDIR_ABS} = $srcdir_abs;
|
||||
$ENV{GNUPGHOME} = "$srcdir_abs/selftest/gnupg";
|
||||
$ENV{BINDIR} = $bindir_abs;
|
||||
|
||||
my $tls_enabled = not $opt_quick;
|
||||
@ -667,6 +666,9 @@ $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";
|
||||
|
||||
my $selftest_gnupghome_path = "$tmpdir_abs/selftest.no.gnupg";
|
||||
$ENV{GNUPGHOME} = "${selftest_gnupghome_path}.global";
|
||||
|
||||
my @available = ();
|
||||
foreach my $fn (@testlists) {
|
||||
foreach (read_testlist($fn)) {
|
||||
@ -803,6 +805,7 @@ sub setup_env($$)
|
||||
|
||||
$ENV{RESOLV_CONF} = "${selftest_resolv_conf_path}.${envname}/ignore";
|
||||
$ENV{KRB5CCNAME} = "FILE:${selftest_krbt_ccache_path}.${envname}/ignore";
|
||||
$ENV{GNUPGHOME} = "${selftest_gnupghome_path}.${envname}/ignore";
|
||||
|
||||
if (defined(get_running_env($envname))) {
|
||||
$testenv_vars = get_running_env($envname);
|
||||
|
@ -280,6 +280,30 @@ EOF
|
||||
umask $oldumask;
|
||||
}
|
||||
|
||||
sub copy_gnupg_home($)
|
||||
{
|
||||
my ($ctx) = @_;
|
||||
|
||||
my $gnupg_srcdir = "$ENV{SRCDIR_ABS}/selftest/gnupg";
|
||||
my @files = (
|
||||
"gpg.conf",
|
||||
"pubring.gpg",
|
||||
"secring.gpg",
|
||||
"trustdb.gpg",
|
||||
);
|
||||
|
||||
my $oldumask = umask;
|
||||
umask 0077;
|
||||
mkdir($ctx->{gnupghome}, 0777);
|
||||
umask 0177;
|
||||
foreach my $file (@files) {
|
||||
my $srcfile = "${gnupg_srcdir}/${file}";
|
||||
my $dstfile = "$ctx->{gnupghome}/${file}";
|
||||
copy_file_content(${srcfile}, ${dstfile});
|
||||
}
|
||||
umask $oldumask;
|
||||
}
|
||||
|
||||
sub mk_krb5_conf($$)
|
||||
{
|
||||
my ($ctx) = @_;
|
||||
@ -682,6 +706,7 @@ sub get_env_for_process
|
||||
RESOLV_CONF => $env_vars->{RESOLV_CONF},
|
||||
KRB5_CONFIG => $env_vars->{KRB5_CONFIG},
|
||||
KRB5CCNAME => "$env_vars->{KRB5_CCACHE}.$proc_name",
|
||||
GNUPGHOME => $env_vars->{GNUPGHOME},
|
||||
SELFTEST_WINBINDD_SOCKET_DIR => $env_vars->{SELFTEST_WINBINDD_SOCKET_DIR},
|
||||
NMBD_SOCKET_DIR => $env_vars->{NMBD_SOCKET_DIR},
|
||||
NSS_WRAPPER_PASSWD => $env_vars->{NSS_WRAPPER_PASSWD},
|
||||
@ -867,6 +892,7 @@ my @exported_envvars = (
|
||||
# misc stuff
|
||||
"KRB5_CONFIG",
|
||||
"KRB5CCNAME",
|
||||
"GNUPGHOME",
|
||||
"SELFTEST_WINBINDD_SOCKET_DIR",
|
||||
"NMBD_SOCKET_DIR",
|
||||
"LOCAL_PATH",
|
||||
|
@ -396,6 +396,7 @@ sub get_cmd_env_vars
|
||||
"OPENSSL_FORCE_FIPS_MODE",
|
||||
"KRB5_CONFIG",
|
||||
"KRB5_CCACHE",
|
||||
"GNUPGHOME",
|
||||
);
|
||||
|
||||
my $localenv = undef;
|
||||
@ -420,6 +421,7 @@ sub get_cmd_env_vars
|
||||
$cmd_env .= "KRB5_CONFIG=\"$localenv->{KRB5_CONFIG}\" ";
|
||||
$cmd_env .= "KRB5CCNAME=\"$localenv->{KRB5_CCACHE}\" ";
|
||||
$cmd_env .= "RESOLV_CONF=\"$localenv->{RESOLV_CONF}\" ";
|
||||
$cmd_env .= "GNUPGHOME=\"$localenv->{GNUPGHOME}\" ";
|
||||
|
||||
return $cmd_env;
|
||||
}
|
||||
@ -589,6 +591,7 @@ sub provision_raw_prepare($$$$$$$$$$$$$$)
|
||||
$ctx->{krb5_conf} = "$ctx->{etcdir}/krb5.conf";
|
||||
$ctx->{krb5_ccache} = "$prefix_abs/krb5_ccache";
|
||||
$ctx->{mitkdc_conf} = "$ctx->{etcdir}/mitkdc.conf";
|
||||
$ctx->{gnupghome} = "$prefix_abs/gnupg";
|
||||
$ctx->{privatedir} = "$prefix_abs/private";
|
||||
$ctx->{binddnsdir} = "$prefix_abs/bind-dns";
|
||||
$ctx->{ncalrpcdir} = "$prefix_abs/ncalrpc";
|
||||
@ -632,6 +635,7 @@ sub provision_raw_prepare($$$$$$$$$$$$$$)
|
||||
$ctx->{smb_conf_extra_options} = "";
|
||||
|
||||
my @provision_options = ();
|
||||
push (@provision_options, "GNUPGHOME=\"$ctx->{gnupghome}\"");
|
||||
push (@provision_options, "KRB5_CONFIG=\"$ctx->{krb5_conf}\"");
|
||||
push (@provision_options, "KRB5CCNAME=\"$ctx->{krb5_ccache}\"");
|
||||
push (@provision_options, "NSS_WRAPPER_PASSWD=\"$ctx->{nsswrap_passwd}\"");
|
||||
@ -724,6 +728,7 @@ sub provision_raw_step1($$)
|
||||
return undef;
|
||||
}
|
||||
|
||||
Samba::copy_gnupg_home($ctx);
|
||||
Samba::prepare_keyblobs($ctx);
|
||||
my $crlfile = "$ctx->{tlsdir}/crl.pem";
|
||||
$crlfile = "" unless -e ${crlfile};
|
||||
@ -867,6 +872,7 @@ nogroup:x:65534:nobody
|
||||
# Note that we have SERVER_X and DC_SERVER_X variables (which have the same
|
||||
# value initially). In a 2 DC setup, $DC_SERVER_X will always be the PDC.
|
||||
my $ret = {
|
||||
GNUPGHOME => $ctx->{gnupghome},
|
||||
KRB5_CONFIG => $ctx->{krb5_conf},
|
||||
KRB5_CCACHE => $ctx->{krb5_ccache},
|
||||
MITKDC_CONFIG => $ctx->{mitkdc_conf},
|
||||
|
Loading…
Reference in New Issue
Block a user