From: Tim Beale Date: Mon, 26 Nov 2018 01:28:59 +0000 (+1300) Subject: selftest: Make testenv NTVFS usage match --use-ntvfs X-Git-Tag: tdb-1.3.17~641 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bfb138e9be6e28cce88c4ef2221cc5712e0593a1;p=thirdparty%2Fsamba.git selftest: Make testenv NTVFS usage match --use-ntvfs Regardless of whether the testenv uses --use-ntvfs as part of its provision options, the s4 testenvs all default to using the NTVFS file server. It's not particularly obvious that this is happening. The new restore DCS (restoredc, renamedc, labdc) were all using NTVFS unintentionally. The problem is the s4 testenvs default to using services '-s3fs +smb". provision_ad_dc() explicitly overrides this to use s3fs again (technically it ends up with both in its smb.conf and just uses whatever comes last). This patch changes the testenv setup to check for the presence of the '--use-ntvfs' option and to set the 'server services' config option appropriately. This way, the provision command and the smb.conf options should always line up, with respect to NTVFS. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676 Signed-off-by: Tim Beale Reviewed-by: Andrew Bartlett --- diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index b453d1c022f..7fa323451cd 100755 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -592,6 +592,16 @@ sub provision_raw_prepare($$$$$$$$$$$$) return $ctx; } +sub has_option +{ + my ($self, $keyword, @options_list) = @_; + + # convert the options-list to a hash-map for easy keyword lookup + my %options_dict = map { $_ => 1 } @options_list; + + return exists $options_dict{$keyword}; +} + # # Step1 creates the basic configuration # @@ -616,6 +626,13 @@ sub provision_raw_step1($$) my $crlfile = "$ctx->{tlsdir}/crl.pem"; $crlfile = "" unless -e ${crlfile}; + # work out which file server to use. Default to source3 smbd (s3fs), + # unless the source4 NTVFS (smb) file server has been specified + my $services = "-smb +s3fs"; + if ($self->has_option("--use-ntvfs", @{$ctx->{provision_options}})) { + $services = "+smb -s3fs"; + } + print CONFFILE " [global] netbios name = $ctx->{netbiosname} @@ -639,7 +656,7 @@ sub provision_raw_step1($$) panic action = $RealBin/gdb_backtrace \%d wins support = yes server role = $ctx->{server_role} - server services = +echo +smb -s3fs + server services = +echo $services dcerpc endpoint servers = +winreg +srvsvc notify:inotify = false ldb:nosync = true @@ -1901,7 +1918,6 @@ sub provision_ad_dc($$$$$$) $password_hash_gpg_key_ids = "" unless defined($config_h->{HAVE_GPGME}); my $extra_smbconf_options = " - server services = -smb +s3fs xattr_tdb:file = $prefix_abs/statedir/xattr.tdb dbwrap_tdb_mutexes:* = yes