2 # Bootstrap Samba and run a number of tests against it.
3 # Copyright (C) 2005-2007 Jelmer Vernooij <jelmer@samba.org>
4 # Published under the GNU GPL, v3 or later.
6 # NOTE: Refer to the README for more details about the various testenvs,
7 # and tips about adding new testenvs.
14 use FindBin
qw($RealBin);
17 use File::Path 'remove_tree';
21 my ($self, $path, $env) = @_;
30 my $smbd_build_options = Samba::bindir_path($self, "smbd") . " --configfile=/dev/null -b|";
31 open(IN, $smbd_build_options) or die("Unable to run $smbd_build_options: $!");
40 # If we were not built with ADS support, pretend we were never even available
41 print "smbd does not have ADS support\n" unless $found_ads;
45 # return smb.conf parameters applicable to @path, based on the underlying
47 sub get_fs_specific_conf($$)
49 my ($self, $path) = @_;
51 my $stat_out = `stat --file-system $path` or return "";
53 if ($stat_out =~ m/Type:\s+btrfs/) {
54 $mods .= "streams_xattr btrfs";
58 return "vfs objects = $mods";
65 my ($classname, $SambaCtx, $bindir, $srcdir, $server_maxtime) = @_;
66 my $self = { vars => {},
67 SambaCtx => $SambaCtx,
70 server_maxtime => $server_maxtime
78 my ($self, $envvars) = @_;
80 if (defined($envvars->{CTDB_PREFIX})) {
81 $self->teardown_env_ctdb($envvars);
83 $self->teardown_env_samba($envvars);
89 sub teardown_env_samba($$)
91 my ($self, $envvars) = @_;
94 # This should cause smbd to terminate gracefully
95 close($envvars->{STDIN_PIPE});
97 my $smbdpid = $envvars->{SMBD_TL_PID};
98 my $nmbdpid = $envvars->{NMBD_TL_PID};
99 my $winbinddpid = $envvars->{WINBINDD_TL_PID};
100 my $samba_dcerpcdpid = $envvars->{SAMBA_DCERPCD_TL_PID};
102 # This should give it time to write out the gcov data
103 until ($count > 20) {
104 my $smbdchild = Samba::cleanup_child($smbdpid, "smbd");
105 my $nmbdchild = Samba::cleanup_child($nmbdpid, "nmbd");
106 my $winbinddchild = Samba::cleanup_child($winbinddpid, "winbindd");
107 my $samba_dcerpcdchild = Samba::cleanup_child(
108 $samba_dcerpcdpid, "samba-dcerpcd");
111 && $winbinddchild == -1
112 && $samba_dcerpcdpid == -1) {
120 kill(0, $smbdpid, $nmbdpid, $winbinddpid, $samba_dcerpcdpid) == 0) {
124 $self->stop_sig_term($smbdpid);
125 $self->stop_sig_term($nmbdpid);
126 $self->stop_sig_term($winbinddpid);
127 $self->stop_sig_term($samba_dcerpcdpid);
130 until ($count > 10) {
131 my $smbdchild = Samba::cleanup_child($smbdpid, "smbd");
132 my $nmbdchild = Samba::cleanup_child($nmbdpid, "nmbd");
133 my $winbinddchild = Samba::cleanup_child($winbinddpid, "winbindd");
134 my $samba_dcerpcdpid = Samba::cleanup_child(
135 $samba_dcerpcdpid, "samba-dcerpcd");
138 && $winbinddchild == -1
139 && $samba_dcerpcdpid == -1) {
147 kill(0, $smbdpid, $nmbdpid, $winbinddpid, $samba_dcerpcdpid) == 0) {
151 warn("timelimit process did not quit on SIGTERM, sending SIGKILL");
152 $self->stop_sig_kill($smbdpid);
153 $self->stop_sig_kill($nmbdpid);
154 $self->stop_sig_kill($winbinddpid);
155 $self->stop_sig_kill($samba_dcerpcdpid);
160 sub teardown_env_ctdb($$)
162 my ($self, $data) = @_;
164 if (defined($data->{SAMBA_NODES})) {
165 my $num_nodes = $data->{NUM_NODES};
166 my $nodes = $data->{SAMBA_NODES};
168 for (my $i = 0; $i < $num_nodes; $i++) {
169 if (defined($nodes->[$i])) {
170 $self->teardown_env_samba($nodes->[$i]);
175 close($data->{CTDB_STDIN_PIPE});
177 if (not defined($data->{SAMBA_NODES})) {
178 # Give waiting children time to exit
185 sub getlog_env_app($$$)
187 my ($self, $envvars, $name) = @_;
189 my $title = "$name LOG of: $envvars->{NETBIOSNAME}\n";
192 open(LOG, "<".$envvars->{$name."_TEST_LOG"});
194 seek(LOG, $envvars->{$name."_TEST_LOG_POS"}, SEEK_SET);
198 $envvars->{$name."_TEST_LOG_POS"} = tell(LOG);
201 return "" if $out eq $title;
208 my ($self, $envvars) = @_;
211 $ret .= $self->getlog_env_app($envvars, "SMBD");
212 $ret .= $self->getlog_env_app($envvars, "NMBD");
213 $ret .= $self->getlog_env_app($envvars, "WINBINDD");
220 my ($self, $envvars) = @_;
222 my $childpid = waitpid(-1, WNOHANG);
228 # Declare the environments Samba3 makes available.
229 # To be set up, they will be called as
230 # samba3->setup_$envname($self, $path, $dep_1_vars, $dep_2_vars, ...)
231 %Samba3::ENV_DEPS = (
232 # name => [dep_1, dep_2, ...],
235 nt4_dc_smb1_done => ["nt4_dc_smb1"],
236 nt4_dc_schannel => [],
240 fileserver_smb1 => [],
241 fileserver_smb1_done => ["fileserver_smb1"],
245 nt4_member => ["nt4_dc"],
247 ad_member => ["ad_dc", "fl2008r2dc", "fl2003dc"],
248 ad_member_rfc2307 => ["ad_dc_ntvfs"],
249 ad_member_idmap_rid => ["ad_dc"],
250 admem_idmap_autorid => ["ad_dc"],
251 ad_member_idmap_ad => ["fl2008r2dc"],
252 ad_member_fips => ["ad_dc_fips"],
253 ad_member_offlogon => ["ad_dc"],
254 ad_member_oneway => ["fl2000dc"],
255 ad_member_idmap_nss => ["ad_dc"],
256 ad_member_s3_join => ["vampire_dc"],
258 clusteredmember => ["ad_dc"],
261 %Samba3::ENV_DEPS_POST = ();
265 my ($self, $path, $more_conf, $domain, $server) = @_;
267 print "PROVISIONING NT4 DC...";
269 my $nt4_dc_options = "
274 raw NTLMv2 auth = yes
275 rpc start on demand helpers = false
277 CVE_2020_1472:warn_about_unused_debug_level = 3
278 server require schannel:schannel0\$ = no
279 server require schannel:schannel1\$ = no
280 server require schannel:schannel2\$ = no
281 server require schannel:schannel3\$ = no
282 server require schannel:schannel4\$ = no
283 server require schannel:schannel5\$ = no
284 server require schannel:schannel6\$ = no
285 server require schannel:schannel7\$ = no
286 server require schannel:schannel8\$ = no
287 server require schannel:schannel9\$ = no
288 server require schannel:schannel10\$ = no
289 server require schannel:schannel11\$ = no
290 server require schannel:torturetest\$ = no
292 server schannel require seal:schannel0\$ = no
293 server schannel require seal:schannel1\$ = no
294 server schannel require seal:schannel2\$ = no
295 server schannel require seal:schannel3\$ = no
296 server schannel require seal:schannel4\$ = no
297 server schannel require seal:schannel5\$ = no
298 server schannel require seal:schannel6\$ = no
299 server schannel require seal:schannel7\$ = no
300 server schannel require seal:schannel8\$ = no
301 server schannel require seal:schannel9\$ = no
302 server schannel require seal:schannel10\$ = no
303 server schannel require seal:schannel11\$ = no
304 server schannel require seal:torturetest\$ = no
306 vfs_default:VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS = no
308 fss: sequence timeout = 1
309 check parent directory delete on close = yes
312 if (defined($more_conf)) {
313 $nt4_dc_options = $nt4_dc_options . $more_conf;
315 if (!defined($domain)) {
316 $domain = "SAMBA-TEST";
318 if (!defined($server)) {
319 $server = "LOCALNT4DC2";
321 my $vars = $self->provision(
325 password => "localntdc2pass",
326 extra_options => $nt4_dc_options);
328 $vars or return undef;
330 if (not $self->check_or_start(
332 samba_dcerpcd => "yes",
339 $vars->{DOMSID} = $vars->{SAMSID};
340 $vars->{DC_SERVER} = $vars->{SERVER};
341 $vars->{DC_SERVER_IP} = $vars->{SERVER_IP};
342 $vars->{DC_SERVER_IPV6} = $vars->{SERVER_IPV6};
343 $vars->{DC_NETBIOSNAME} = $vars->{NETBIOSNAME};
344 $vars->{DC_USERNAME} = $vars->{USERNAME};
345 $vars->{DC_PASSWORD} = $vars->{PASSWORD};
350 sub setup_nt4_dc_smb1
352 my ($self, $path) = @_;
355 client min protocol = CORE
356 server min protocol = LANMAN1
358 return $self->setup_nt4_dc($path, $conf, "NT4SMB1", "LCLNT4DC2SMB1");
361 sub setup_nt4_dc_smb1_done
363 my ($self, $path, $dep_env) = @_;
364 return $self->return_alias_env($path, $dep_env);
367 sub setup_nt4_dc_schannel
369 my ($self, $path) = @_;
371 print "PROVISIONING NT4 DC WITH SERVER SCHANNEL ...";
378 server schannel = yes
379 # used to reproduce bug #12772
380 server max protocol = SMB2_02
383 my $vars = $self->provision(
385 domain => "NT4SCHANNEL",
386 server => "LOCALNT4DC9",
387 password => "localntdc9pass",
388 extra_options => $pdc_options);
390 $vars or return undef;
392 if (not $self->check_or_start(
400 $vars->{DOMSID} = $vars->{SAMSID};
401 $vars->{DC_SERVER} = $vars->{SERVER};
402 $vars->{DC_SERVER_IP} = $vars->{SERVER_IP};
403 $vars->{DC_SERVER_IPV6} = $vars->{SERVER_IPV6};
404 $vars->{DC_NETBIOSNAME} = $vars->{NETBIOSNAME};
405 $vars->{DC_USERNAME} = $vars->{USERNAME};
406 $vars->{DC_PASSWORD} = $vars->{PASSWORD};
413 my ($self, $prefix, $nt4_dc_vars) = @_;
417 print "PROVISIONING MEMBER...";
419 my $require_mutexes = "dbwrap_tdb_require_mutexes:* = yes";
420 if ($ENV{SELFTEST_DONT_REQUIRE_TDB_MUTEX_SUPPORT} // '' eq "1") {
421 $require_mutexes = "";
424 my $member_options = "
428 dbwrap_tdb_mutexes:* = yes
431 my $ret = $self->provision(
433 domain => $nt4_dc_vars->{DOMAIN},
434 server => "LOCALNT4MEMBER3",
435 password => "Lnt4member3p14",
436 extra_options_before_inject => $member_options);
438 $ret or return undef;
440 my $nmblookup = Samba::bindir_path($self, "nmblookup");
442 print "Waiting for the LOGON SERVER registration ...\n";
443 $rc = system("$nmblookup $ret->{CONFIGURATION} $ret->{DOMAIN}\#1c");
448 } while ($rc != 0 && $count < 10);
450 print "NMBD not reachable after 10 retries\n";
451 teardown_env($self, $ret);
455 my $net = Samba::bindir_path($self, "net");
456 # Add hosts file for name lookups
457 my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' ";
458 $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
459 $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" ";
460 $cmd .= "$net rpc join $ret->{CONFIGURATION} $nt4_dc_vars->{DOMAIN} member";
461 $cmd .= " -U$nt4_dc_vars->{USERNAME}\%$nt4_dc_vars->{PASSWORD}";
463 if (system($cmd) != 0) {
464 warn("Join failed\n$cmd");
468 # Add hosts file for name lookups
469 $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' ";
470 $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
471 $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" ";
472 $cmd .= "$net $ret->{CONFIGURATION} primarytrust dumpinfo | grep -q 'REDACTED SECRET VALUES'";
474 if (system($cmd) != 0) {
475 warn("check failed\n$cmd");
479 if (not $self->check_or_start(
487 $ret->{DOMSID} = $nt4_dc_vars->{DOMSID};
488 $ret->{DC_SERVER} = $nt4_dc_vars->{SERVER};
489 $ret->{DC_SERVER_IP} = $nt4_dc_vars->{SERVER_IP};
490 $ret->{DC_SERVER_IPV6} = $nt4_dc_vars->{SERVER_IPV6};
491 $ret->{DC_NETBIOSNAME} = $nt4_dc_vars->{NETBIOSNAME};
492 $ret->{DC_USERNAME} = $nt4_dc_vars->{USERNAME};
493 $ret->{DC_PASSWORD} = $nt4_dc_vars->{PASSWORD};
498 sub setup_clusteredmember
500 my ($self, $prefix, $dcvars) = @_;
506 print "PROVISIONING CLUSTEREDMEMBER...\n";
508 my $prefix_abs = abs_path($prefix);
509 mkdir($prefix_abs, 0777);
511 my $ctdb_data = $self->setup_ctdb($prefix);
513 if (not $ctdb_data) {
514 print "No ctdb data\n";
518 print "PROVISIONING CLUSTERED SAMBA...\n";
520 my $num_nodes = $ctdb_data->{NUM_NODES};
521 my $nodes = $ctdb_data->{CTDB_NODES};
523 # Enable cleanup of earlier nodes if a later node fails
524 $ctdb_data->{SAMBA_NODES} = \@retvals;
526 for (my $i = 0; $i < $num_nodes; $i++) {
527 my $node = $nodes->[$i];
528 my $socket = $node->{SOCKET_FILE};
529 my $server_name = $node->{SERVER_NAME};
530 my $pub_iface = $node->{SOCKET_WRAPPER_DEFAULT_IFACE};
531 my $node_prefix = $node->{NODE_PREFIX};
533 print "CTDB_BASE=${node_prefix}\n";
534 print "CTDB_SOCKET=${socket}\n";
536 my $require_mutexes = "dbwrap_tdb_require_mutexes:* = yes";
537 if ($ENV{SELFTEST_DONT_REQUIRE_TDB_MUTEX_SUPPORT} // '' eq "1") {
538 $require_mutexes = "" ;
541 my $member_options = "
543 workgroup = $dcvars->{DOMAIN}
544 realm = $dcvars->{REALM}
545 password server = $dcvars->{SERVER}
548 rpc start on demand helpers = false
549 rpcd witness:include node ips = yes
550 ctdbd socket = ${socket}
552 dbwrap_tdb_mutexes:* = yes
556 my $node_ret = $self->provision(
557 prefix => "$node_prefix",
558 domain => $dcvars->{DOMAIN},
559 server => "$server_name",
560 password => "clustermember8pass",
561 netbios_name => "CLUSTEREDMEMBER",
562 share_dir => "${prefix_abs}/shared",
563 extra_options => $member_options,
564 no_delete_prefix => 1);
566 print "Provision node $i failed\n";
567 teardown_env($self, $ctdb_data);
571 my $registry_share_template = "$node_ret->{SERVERCONFFILE}.registry_share_template";
572 unless (open(REGISTRYCONF, ">$registry_share_template")) {
573 warn("Unable to open $registry_share_template");
574 teardown_env($self, $node_ret);
575 teardown_env($self, $ctdb_data);
582 comment = smb username is [%U]
587 my $net = Samba::bindir_path($self, "net");
590 $cmd .= "UID_WRAPPER_ROOT=1 ";
591 $cmd .= "$net conf import $node_ret->{CONFIGURATION} ${registry_share_template}";
593 my $net_ret = system($cmd);
595 warn("net conf import failed: $net_ret\n$cmd");
596 teardown_env($self, $node_ret);
597 teardown_env($self, $ctdb_data);
601 my $nmblookup = Samba::bindir_path($self, "nmblookup");
603 print "Waiting for the LOGON SERVER registration ...\n";
604 $rc = system("$nmblookup $node_ret->{CONFIGURATION} " .
605 "$node_ret->{DOMAIN}\#1c");
610 } while ($rc != 0 && $count < 10);
613 print "NMBD not reachable after 10 retries\n";
614 teardown_env($self, $node_ret);
615 teardown_env($self, $ctdb_data);
619 push(@retvals, $node_ret);
622 $ret = {%$ctdb_data, %{$retvals[0]}};
626 $ctx->{krb5_conf} = "$prefix_abs/lib/krb5.conf";
627 $ctx->{domain} = $dcvars->{DOMAIN};
628 $ctx->{realm} = $dcvars->{REALM};
629 $ctx->{dnsname} = lc($dcvars->{REALM});
630 $ctx->{kdc_ipv4} = $dcvars->{SERVER_IP};
631 $ctx->{kdc_ipv6} = $dcvars->{SERVER_IPV6};
632 $ctx->{krb5_ccname} = "$prefix_abs/krb5cc_%{uid}";
633 Samba::mk_krb5_conf($ctx, "");
635 $ret->{KRB5_CONFIG} = $ctx->{krb5_conf};
637 my $net = Samba::bindir_path($self, "net");
638 my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' ";
639 $cmd .= "UID_WRAPPER_ROOT=1 ";
640 $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
641 $cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" ";
642 $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
643 $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" ";
644 $cmd .= "$net join $ret->{CONFIGURATION} $dcvars->{DOMAIN} member";
645 $cmd .= " -U$dcvars->{USERNAME}\%$dcvars->{PASSWORD}";
647 if (system($cmd) != 0) {
648 warn("Join failed\n$cmd");
649 teardown_env($self, $ret);
653 for (my $i=0; $i<@retvals; $i++) {
654 my $node_provision = $retvals[$i];
656 $ok = $self->check_or_start(
657 env_vars => $node_provision,
658 samba_dcerpcd => "yes",
661 child_cleanup => sub {
663 my $fh = $_->{STDIN_PIPE};
664 close($fh) if defined($fh);
667 teardown_env($self, $ret);
673 # Build a unclist for every share
675 unless (open(NODES, "<$ret->{CTDB_NODES_FILE}")) {
676 warn("Unable to open CTDB nodes file");
677 teardown_env($self, $ret);
684 my $conffile = $ret->{SERVERCONFFILE};
686 $cmd .= 'sed -n -e \'s|^\[\(.*\)\]$|\1|p\'';
687 $cmd .= " \"$conffile\"";
688 $cmd .= " | grep -vx 'global'";
693 warn("Listing shares failed\n$cmd");
694 teardown_env($self, $ret);
699 my $unclistdir = "${prefix_abs}/unclists";
700 mkdir($unclistdir, 0777);
701 foreach my $share (@shares) {
702 my $l = "${unclistdir}/${share}.txt";
703 unless (open(UNCLIST, ">${l}")) {
704 warn("Unable to open UNC list ${l}");
705 teardown_env($self, $ret);
708 foreach my $node (@nodes) {
709 print UNCLIST "//${node}/${share}\n";
714 $ret->{DOMSID} = $dcvars->{DOMSID};
715 $ret->{DC_SERVER} = $dcvars->{SERVER};
716 $ret->{DC_SERVER_IP} = $dcvars->{SERVER_IP};
717 $ret->{DC_SERVER_IPV6} = $dcvars->{SERVER_IPV6};
718 $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME};
719 $ret->{DC_USERNAME} = $dcvars->{USERNAME};
720 $ret->{DC_PASSWORD} = $dcvars->{PASSWORD};
721 $ret->{REALM} = $dcvars->{REALM};
722 $ret->{DOMAIN} = $dcvars->{DOMAIN};
727 sub provision_ad_member
735 $extra_member_options,
739 $sync_pw2keytab) = @_;
741 if (defined($offline_logon) && defined($no_nss_winbind)) {
742 warn ("Offline logon incompatible with no nss winbind\n");
746 my $prefix_abs = abs_path($prefix);
749 mkdir($prefix_abs, 0777);
751 my $share_dir="$prefix_abs/share";
752 push(@dirs, $share_dir);
754 my $substitution_path = "$share_dir/D_$dcvars->{DOMAIN}";
755 push(@dirs, $substitution_path);
757 $substitution_path = "$share_dir/D_$dcvars->{DOMAIN}/U_alice";
758 push(@dirs, $substitution_path);
760 $substitution_path = "$share_dir/D_$dcvars->{DOMAIN}/U_alice/G_domain users";
761 push(@dirs, $substitution_path);
763 # Using '/' as the winbind separator is a bad idea ...
764 $substitution_path = "$share_dir/D_$dcvars->{DOMAIN}/u_$dcvars->{DOMAIN}";
765 push(@dirs, $substitution_path);
767 $substitution_path = "$share_dir/D_$dcvars->{DOMAIN}/u_$dcvars->{DOMAIN}/alice";
768 push(@dirs, $substitution_path);
770 $substitution_path = "$share_dir/D_$dcvars->{DOMAIN}/u_$dcvars->{DOMAIN}/alice/g_$dcvars->{DOMAIN}";
771 push(@dirs, $substitution_path);
773 $substitution_path = "$share_dir/D_$dcvars->{DOMAIN}/u_$dcvars->{DOMAIN}/alice/g_$dcvars->{DOMAIN}/domain users";
774 push(@dirs, $substitution_path);
776 my $smbcacls_sharedir="$share_dir/smbcacls";
777 push(@dirs,$smbcacls_sharedir);
779 my $option_offline_logon = "no";
780 if (defined($offline_logon)) {
781 $option_offline_logon = "yes";
784 my $netbios_aliases = "";
785 if ($machine_account eq "LOCALADMEMBER") {
786 $netbios_aliases = "netbios aliases = foo bar";
789 unless (defined($extra_member_options)) {
790 $extra_member_options = "";
793 my $dns_and_netbios = "";
795 if (defined($sync_pw2keytab)) {
797 additional dns hostnames = host1.example.com host2.other.com
798 netbios aliases = NETBIOS1 NETBIOS2 NETBIOS3
801 sync machine password to keytab = \\
802 \"$prefix_abs/keytab0:account_name:machine_password\", \\
803 \"$prefix_abs/keytab0k:account_name:sync_kvno:machine_password:sync_etypes\", \\
804 \"$prefix_abs/keytab1:sync_spns:machine_password:sync_etypes\", \\
805 \"$prefix_abs/keytab1k:sync_spns:sync_kvno:machine_password:sync_etypes\", \\
806 \"$prefix_abs/keytab2:spn_prefixes=imap,smtp:additional_dns_hostnames:netbios_aliases:machine_password:sync_etypes\", \\
807 \"$prefix_abs/keytab2k:spn_prefixes=imap,smtp:additional_dns_hostnames:sync_kvno:machine_password:sync_etypes\", \\
808 \"$prefix_abs/keytab3:spns=wurst/brot\@$dcvars->{REALM}:machine_password:sync_etypes\", \\
809 \"$prefix_abs/keytab3k:spns=wurst/brot\@$dcvars->{REALM},wurst1/brot\@$dcvars->{REALM},wurst2/brot\@$dcvars->{REALM}:sync_kvno:machine_password:sync_etypes\"
813 my $member_options = "
815 workgroup = $dcvars->{DOMAIN}
816 realm = $dcvars->{REALM}
818 template homedir = /home/%D/%G/%U
819 auth event notification = true
820 password server = $dcvars->{SERVER}
821 winbind scan trusted domains = no
822 winbind offline logon = $option_offline_logon
824 allow dcerpc auth level connect:lsarpc = yes
825 dcesrv:max auth states = 8
826 rpc start on demand helpers = false
828 # Begin extra member options
829 $extra_member_options
830 # End extra member options
835 path = $share_dir/D_%D/U_%U/G_%G
839 path = $share_dir/D_%D/u_%u/g_%g
844 valid users = ADDOMAIN/%U
846 [sub_valid_users_domain]
850 [sub_valid_users_group]
852 valid users = \@$dcvars->{DOMAIN}/%G
856 valid users = $dcvars->{DOMAIN}/$dcvars->{DC_USERNAME}
860 valid users = \"\@$dcvars->{DOMAIN}/domain users\"
862 [valid_users_unix_group]
864 valid users = \"+$dcvars->{DOMAIN}/domain users\"
866 [valid_users_nis_group]
868 valid users = \"&$dcvars->{DOMAIN}/domain users\"
870 [valid_users_unix_nis_group]
872 valid users = \"+&$dcvars->{DOMAIN}/domain users\"
874 [valid_users_nis_unix_group]
876 valid users = \"&+$dcvars->{DOMAIN}/domain users\"
880 invalid users = $dcvars->{DOMAIN}/$dcvars->{DC_USERNAME}
882 [valid_and_invalid_users]
884 valid users = $dcvars->{DOMAIN}/$dcvars->{DC_USERNAME} $dcvars->{DOMAIN}/alice
885 invalid users = $dcvars->{DOMAIN}/$dcvars->{DC_USERNAME}
888 my $ret = $self->provision(
890 domain => $dcvars->{DOMAIN},
891 realm => $dcvars->{REALM},
892 server => $machine_account,
893 password => "loCalMemberPass",
894 extra_options => $member_options,
895 resolv_conf => $dcvars->{RESOLV_CONF});
897 $ret or return undef;
899 mkdir($_, 0777) foreach(@dirs);
901 $ret->{DOMAIN} = $dcvars->{DOMAIN};
902 $ret->{REALM} = $dcvars->{REALM};
903 $ret->{DOMSID} = $dcvars->{DOMSID};
907 $ctx->{krb5_conf} = "$prefix_abs/lib/krb5.conf";
908 $ctx->{domain} = $dcvars->{DOMAIN};
909 $ctx->{realm} = $dcvars->{REALM};
910 $ctx->{dnsname} = lc($dcvars->{REALM});
911 $ctx->{kdc_ipv4} = $dcvars->{SERVER_IP};
912 $ctx->{kdc_ipv6} = $dcvars->{SERVER_IPV6};
913 $ctx->{krb5_ccname} = "$prefix_abs/krb5cc_%{uid}";
914 Samba::mk_krb5_conf($ctx, "");
916 $ret->{KRB5_CONFIG} = $ctx->{krb5_conf};
918 if (defined($force_fips_mode)) {
919 $ret->{GNUTLS_FORCE_FIPS_MODE} = "1";
920 $ret->{OPENSSL_FORCE_FIPS_MODE} = "1";
923 my $net = Samba::bindir_path($self, "net");
924 # Add hosts file for name lookups
925 my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' ";
926 $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
927 if (defined($ret->{RESOLV_WRAPPER_CONF})) {
928 $cmd .= "RESOLV_WRAPPER_CONF=\"$ret->{RESOLV_WRAPPER_CONF}\" ";
930 $cmd .= "RESOLV_WRAPPER_HOSTS=\"$ret->{RESOLV_WRAPPER_HOSTS}\" ";
932 if (defined($force_fips_mode)) {
933 $cmd .= "GNUTLS_FORCE_FIPS_MODE=1 ";
934 $cmd .= "OPENSSL_FORCE_FIPS_MODE=1 ";
936 $cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" ";
937 $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
938 $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" ";
939 $cmd .= "$net join $ret->{CONFIGURATION}";
940 $cmd .= " -U$dcvars->{USERNAME}\%$dcvars->{PASSWORD} --use-kerberos=required";
942 if (system($cmd) != 0) {
943 warn("Join failed\n$cmd");
947 # We need world access to this share, as otherwise the domain
948 # administrator from the AD domain provided by Samba4 can't
949 # access the share for tests.
950 chmod 0777, "$prefix/share";
952 if (defined($offline_logon)) {
953 my $wbinfo = Samba::bindir_path($self, "wbinfo");
955 if (not $self->check_or_start(
957 winbindd => "yes")) {
961 # Fill samlogoncache for alice
962 $cmd = "NSS_WRAPPER_PASSWD='$ret->{NSS_WRAPPER_PASSWD}' ";
963 $cmd .= "NSS_WRAPPER_GROUP='$ret->{NSS_WRAPPER_GROUP}' ";
964 $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" ";
965 $cmd .= "$wbinfo --pam-logon=ADDOMAIN/alice%Secret007";
966 if (system($cmd) != 0) {
967 warn("Filling the cache failed\n$cmd");
971 $cmd = "NSS_WRAPPER_PASSWD='$ret->{NSS_WRAPPER_PASSWD}' ";
972 $cmd .= "NSS_WRAPPER_GROUP='$ret->{NSS_WRAPPER_GROUP}' ";
973 $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" ";
974 $cmd .= "$wbinfo --ccache-save=ADDOMAIN/alice%Secret007";
975 if (system($cmd) != 0) {
976 warn("Filling the cache failed\n$cmd");
980 # Fill samlogoncache for bob
981 $cmd = "NSS_WRAPPER_PASSWD='$ret->{NSS_WRAPPER_PASSWD}' ";
982 $cmd .= "NSS_WRAPPER_GROUP='$ret->{NSS_WRAPPER_GROUP}' ";
983 $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" ";
984 $cmd .= "$wbinfo --pam-logon=ADDOMAIN/bob%Secret007";
985 if (system($cmd) != 0) {
986 warn("Filling the cache failed\n$cmd");
990 $cmd = "NSS_WRAPPER_PASSWD='$ret->{NSS_WRAPPER_PASSWD}' ";
991 $cmd .= "NSS_WRAPPER_GROUP='$ret->{NSS_WRAPPER_GROUP}' ";
992 $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" ";
993 $cmd .= "$wbinfo --ccache-save=ADDOMAIN/bob%Secret007";
994 if (system($cmd) != 0) {
995 warn("Filling the cache failed\n$cmd");
999 # Set windindd offline
1000 my $smbcontrol = Samba::bindir_path($self, "smbcontrol");
1001 $cmd = "NSS_WRAPPER_PASSWD='$ret->{NSS_WRAPPER_PASSWD}' ";
1002 $cmd .= "NSS_WRAPPER_GROUP='$ret->{NSS_WRAPPER_GROUP}' ";
1003 $cmd .= "UID_WRAPPER_ROOT='1' ";
1004 $cmd .= "$smbcontrol $ret->{CONFIGURATION} winbindd offline";
1005 if (system($cmd) != 0) {
1006 warn("Setting winbindd offline failed\n$cmd");
1010 # Validate the offline cache
1011 $cmd = "NSS_WRAPPER_PASSWD='$ret->{NSS_WRAPPER_PASSWD}' ";
1012 $cmd .= "NSS_WRAPPER_GROUP='$ret->{NSS_WRAPPER_GROUP}' ";
1013 $cmd .= "UID_WRAPPER_ROOT='1' ";
1014 $cmd .= "$smbcontrol $ret->{CONFIGURATION} winbindd validate-cache";
1015 if (system($cmd) != 0) {
1016 warn("Validation of winbind credential cache failed\n$cmd");
1017 teardown_env($self, $ret);
1021 # Shut down winbindd
1022 teardown_env($self, $ret);
1024 ### Change SOCKET_WRAPPER_DIR so it can't connect to AD
1025 my $swrap_env = $ENV{SOCKET_WRAPPER_DIR};
1026 $ENV{SOCKET_WRAPPER_DIR} = "$prefix_abs";
1028 # Start winbindd in offline mode
1029 if (not $self->check_or_start(
1031 winbindd => "offline")) {
1035 # Set socket dir again
1036 $ENV{SOCKET_WRAPPER_DIR} = $swrap_env;
1039 if (defined($no_nss_winbind)) {
1040 $ret->{NSS_WRAPPER_MODULE_SO_PATH} = "";
1041 $ret->{NSS_WRAPPER_MODULE_FN_PREFIX} = "";
1044 if (not $self->check_or_start(
1046 samba_dcerpcd => "yes",
1054 $ret->{DC_SERVER} = $dcvars->{SERVER};
1055 $ret->{DC_SERVER_IP} = $dcvars->{SERVER_IP};
1056 $ret->{DC_SERVER_IPV6} = $dcvars->{SERVER_IPV6};
1057 $ret->{DC_SERVERCONFFILE} = $dcvars->{SERVERCONFFILE};
1058 $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME};
1059 $ret->{DC_USERNAME} = $dcvars->{USERNAME};
1060 $ret->{DC_PASSWORD} = $dcvars->{PASSWORD};
1061 $ret->{DOMAIN_ADMIN} = $dcvars->{DOMAIN_ADMIN};
1062 $ret->{DOMAIN_ADMIN_PASSWORD} = $dcvars->{DOMAIN_ADMIN_PASSWORD};
1063 $ret->{DOMAIN_USER} = $dcvars->{DOMAIN_USER};
1064 $ret->{DOMAIN_USER_PASSWORD} = $dcvars->{DOMAIN_USER_PASSWORD};
1067 $ret->{TRUST_F_BOTH_SERVER} = $trustvars_f->{SERVER};
1068 $ret->{TRUST_F_BOTH_SERVER_IP} = $trustvars_f->{SERVER_IP};
1069 $ret->{TRUST_F_BOTH_SERVER_IPV6} = $trustvars_f->{SERVER_IPV6};
1070 $ret->{TRUST_F_BOTH_NETBIOSNAME} = $trustvars_f->{NETBIOSNAME};
1071 $ret->{TRUST_F_BOTH_USERNAME} = $trustvars_f->{USERNAME};
1072 $ret->{TRUST_F_BOTH_PASSWORD} = $trustvars_f->{PASSWORD};
1073 $ret->{TRUST_F_BOTH_DOMAIN} = $trustvars_f->{DOMAIN};
1074 $ret->{TRUST_F_BOTH_REALM} = $trustvars_f->{REALM};
1077 $ret->{TRUST_E_BOTH_SERVER} = $trustvars_e->{SERVER};
1078 $ret->{TRUST_E_BOTH_SERVER_IP} = $trustvars_e->{SERVER_IP};
1079 $ret->{TRUST_E_BOTH_SERVER_IPV6} = $trustvars_e->{SERVER_IPV6};
1080 $ret->{TRUST_E_BOTH_NETBIOSNAME} = $trustvars_e->{NETBIOSNAME};
1081 $ret->{TRUST_E_BOTH_USERNAME} = $trustvars_e->{USERNAME};
1082 $ret->{TRUST_E_BOTH_PASSWORD} = $trustvars_e->{PASSWORD};
1083 $ret->{TRUST_E_BOTH_DOMAIN} = $trustvars_e->{DOMAIN};
1084 $ret->{TRUST_E_BOTH_REALM} = $trustvars_e->{REALM};
1097 # If we didn't build with ADS, pretend this env was never available
1098 if (not $self->have_ads()) {
1102 print "PROVISIONING AD MEMBER...";
1104 return $self->provision_ad_member($prefix,
1111 sub setup_ad_member_s3_join
1119 # If we didn't build with ADS, pretend this env was never available
1120 if (not $self->have_ads()) {
1124 print "PROVISIONING AD MEMBER...";
1126 return $self->provision_ad_member($prefix,
1133 sub setup_ad_member_rfc2307
1135 my ($self, $prefix, $dcvars) = @_;
1137 # If we didn't build with ADS, pretend this env was never available
1138 if (not $self->have_ads()) {
1142 print "PROVISIONING S3 AD MEMBER WITH idmap_rfc2307 config...";
1144 my $member_options = "
1146 workgroup = $dcvars->{DOMAIN}
1147 realm = $dcvars->{REALM}
1148 idmap cache time = 0
1149 idmap negative cache time = 0
1150 idmap config * : backend = autorid
1151 idmap config * : range = 1000000-1999999
1152 idmap config * : rangesize = 100000
1153 idmap config $dcvars->{DOMAIN} : backend = rfc2307
1154 idmap config $dcvars->{DOMAIN} : range = 2000000-2999999
1155 idmap config $dcvars->{DOMAIN} : ldap_server = ad
1156 idmap config $dcvars->{DOMAIN} : bind_path_user = ou=idmap,dc=samba,dc=example,dc=com
1157 idmap config $dcvars->{DOMAIN} : bind_path_group = ou=idmap,dc=samba,dc=example,dc=com
1159 password server = $dcvars->{SERVER}
1162 my $ret = $self->provision(
1164 domain => $dcvars->{DOMAIN},
1165 realm => $dcvars->{REALM},
1166 server => "RFC2307MEMBER",
1167 password => "loCalMemberPass",
1168 extra_options => $member_options,
1169 resolv_conf => $dcvars->{RESOLV_CONF});
1171 $ret or return undef;
1173 $ret->{DOMAIN} = $dcvars->{DOMAIN};
1174 $ret->{REALM} = $dcvars->{REALM};
1175 $ret->{DOMSID} = $dcvars->{DOMSID};
1178 my $prefix_abs = abs_path($prefix);
1180 $ctx->{krb5_conf} = "$prefix_abs/lib/krb5.conf";
1181 $ctx->{domain} = $dcvars->{DOMAIN};
1182 $ctx->{realm} = $dcvars->{REALM};
1183 $ctx->{dnsname} = lc($dcvars->{REALM});
1184 $ctx->{kdc_ipv4} = $dcvars->{SERVER_IP};
1185 $ctx->{kdc_ipv6} = $dcvars->{SERVER_IPV6};
1186 $ctx->{krb5_ccname} = "$prefix_abs/krb5cc_%{uid}";
1187 Samba::mk_krb5_conf($ctx, "");
1189 $ret->{KRB5_CONFIG} = $ctx->{krb5_conf};
1191 my $net = Samba::bindir_path($self, "net");
1192 # Add hosts file for name lookups
1193 my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' ";
1194 $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
1195 if (defined($ret->{RESOLV_WRAPPER_CONF})) {
1196 $cmd .= "RESOLV_WRAPPER_CONF=\"$ret->{RESOLV_WRAPPER_CONF}\" ";
1198 $cmd .= "RESOLV_WRAPPER_HOSTS=\"$ret->{RESOLV_WRAPPER_HOSTS}\" ";
1200 $cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" ";
1201 $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
1202 $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" ";
1203 $cmd .= "$net join $ret->{CONFIGURATION}";
1204 $cmd .= " -U$dcvars->{USERNAME}\%$dcvars->{PASSWORD}";
1206 if (system($cmd) != 0) {
1207 warn("Join failed\n$cmd");
1211 # We need world access to this share, as otherwise the domain
1212 # administrator from the AD domain provided by Samba4 can't
1213 # access the share for tests.
1214 chmod 0777, "$prefix/share";
1216 if (not $self->check_or_start(
1224 $ret->{DC_SERVER} = $dcvars->{SERVER};
1225 $ret->{DC_SERVER_IP} = $dcvars->{SERVER_IP};
1226 $ret->{DC_SERVER_IPV6} = $dcvars->{SERVER_IPV6};
1227 $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME};
1228 $ret->{DC_USERNAME} = $dcvars->{USERNAME};
1229 $ret->{DC_PASSWORD} = $dcvars->{PASSWORD};
1230 $ret->{DOMAIN_ADMIN} = $dcvars->{DOMAIN_ADMIN};
1231 $ret->{DOMAIN_ADMIN_PASSWORD} = $dcvars->{DOMAIN_ADMIN_PASSWORD};
1232 $ret->{DOMAIN_USER} = $dcvars->{DOMAIN_USER};
1233 $ret->{DOMAIN_USER_PASSWORD} = $dcvars->{DOMAIN_USER_PASSWORD};
1238 sub setup_admem_idmap_autorid
1240 my ($self, $prefix, $dcvars) = @_;
1242 # If we didn't build with ADS, pretend this env was never available
1243 if (not $self->have_ads()) {
1247 print "PROVISIONING S3 AD MEMBER WITH idmap_autorid config...";
1249 my $member_options = "
1251 workgroup = $dcvars->{DOMAIN}
1252 realm = $dcvars->{REALM}
1253 idmap config * : backend = autorid
1254 idmap config * : range = 1000000-19999999
1255 idmap config * : rangesize = 1000000
1257 # Prevent overriding the provisioned lib/krb5.conf which sets certain
1258 # values required for tests to succeed
1259 create krb5 conf = no
1262 my $ret = $self->provision(
1264 domain => $dcvars->{DOMAIN},
1265 realm => $dcvars->{REALM},
1266 server => "ADMEMAUTORID",
1267 password => "loCalMemberPass",
1268 extra_options => $member_options,
1269 resolv_conf => $dcvars->{RESOLV_CONF});
1271 $ret or return undef;
1273 $ret->{DOMAIN} = $dcvars->{DOMAIN};
1274 $ret->{REALM} = $dcvars->{REALM};
1275 $ret->{DOMSID} = $dcvars->{DOMSID};
1278 my $prefix_abs = abs_path($prefix);
1280 $ctx->{krb5_conf} = "$prefix_abs/lib/krb5.conf";
1281 $ctx->{domain} = $dcvars->{DOMAIN};
1282 $ctx->{realm} = $dcvars->{REALM};
1283 $ctx->{dnsname} = lc($dcvars->{REALM});
1284 $ctx->{kdc_ipv4} = $dcvars->{SERVER_IP};
1285 $ctx->{kdc_ipv6} = $dcvars->{SERVER_IPV6};
1286 $ctx->{krb5_ccname} = "$prefix_abs/krb5cc_%{uid}";
1287 Samba::mk_krb5_conf($ctx, "");
1289 $ret->{KRB5_CONFIG} = $ctx->{krb5_conf};
1291 my $net = Samba::bindir_path($self, "net");
1292 # Add hosts file for name lookups
1293 my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' ";
1294 $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
1295 if (defined($ret->{RESOLV_WRAPPER_CONF})) {
1296 $cmd .= "RESOLV_WRAPPER_CONF=\"$ret->{RESOLV_WRAPPER_CONF}\" ";
1298 $cmd .= "RESOLV_WRAPPER_HOSTS=\"$ret->{RESOLV_WRAPPER_HOSTS}\" ";
1300 $cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" ";
1301 $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
1302 $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" ";
1303 $cmd .= "$net join $ret->{CONFIGURATION}";
1304 $cmd .= " -U$dcvars->{USERNAME}\%$dcvars->{PASSWORD}";
1306 if (system($cmd) != 0) {
1307 warn("Join failed\n$cmd");
1311 # We need world access to this share, as otherwise the domain
1312 # administrator from the AD domain provided by Samba4 can't
1313 # access the share for tests.
1314 chmod 0777, "$prefix/share";
1316 if (not $self->check_or_start(
1324 $ret->{DC_SERVER} = $dcvars->{SERVER};
1325 $ret->{DC_SERVER_IP} = $dcvars->{SERVER_IP};
1326 $ret->{DC_SERVER_IPV6} = $dcvars->{SERVER_IPV6};
1327 $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME};
1328 $ret->{DC_USERNAME} = $dcvars->{USERNAME};
1329 $ret->{DC_PASSWORD} = $dcvars->{PASSWORD};
1330 $ret->{DOMAIN_ADMIN} = $dcvars->{DOMAIN_ADMIN};
1331 $ret->{DOMAIN_ADMIN_PASSWORD} = $dcvars->{DOMAIN_ADMIN_PASSWORD};
1332 $ret->{DOMAIN_USER} = $dcvars->{DOMAIN_USER};
1333 $ret->{DOMAIN_USER_PASSWORD} = $dcvars->{DOMAIN_USER_PASSWORD};
1338 sub setup_ad_member_idmap_rid
1340 my ($self, $prefix, $dcvars) = @_;
1342 # If we didn't build with ADS, pretend this env was never available
1343 if (not $self->have_ads()) {
1347 print "PROVISIONING S3 AD MEMBER WITH idmap_rid config...";
1349 my $member_options = "
1351 workgroup = $dcvars->{DOMAIN}
1352 realm = $dcvars->{REALM}
1353 idmap config * : backend = tdb
1354 idmap config * : range = 1000000-1999999
1355 idmap config $dcvars->{DOMAIN} : backend = rid
1356 idmap config $dcvars->{DOMAIN} : range = 2000000-2999999
1357 # Prevent overriding the provisioned lib/krb5.conf which sets certain
1358 # values required for tests to succeed
1359 create krb5 conf = no
1360 map to guest = bad user
1361 winbind expand groups = 10
1362 server signing = required
1365 my $ret = $self->provision(
1367 domain => $dcvars->{DOMAIN},
1368 realm => $dcvars->{REALM},
1369 server => "IDMAPRIDMEMBER",
1370 password => "loCalMemberPass",
1371 extra_options => $member_options,
1372 resolv_conf => $dcvars->{RESOLV_CONF});
1374 $ret or return undef;
1376 $ret->{DOMAIN} = $dcvars->{DOMAIN};
1377 $ret->{REALM} = $dcvars->{REALM};
1378 $ret->{DOMSID} = $dcvars->{DOMSID};
1381 my $prefix_abs = abs_path($prefix);
1383 $ctx->{krb5_conf} = "$prefix_abs/lib/krb5.conf";
1384 $ctx->{domain} = $dcvars->{DOMAIN};
1385 $ctx->{realm} = $dcvars->{REALM};
1386 $ctx->{dnsname} = lc($dcvars->{REALM});
1387 $ctx->{kdc_ipv4} = $dcvars->{SERVER_IP};
1388 $ctx->{kdc_ipv6} = $dcvars->{SERVER_IPV6};
1389 $ctx->{krb5_ccname} = "$prefix_abs/krb5cc_%{uid}";
1390 Samba::mk_krb5_conf($ctx, "");
1392 $ret->{KRB5_CONFIG} = $ctx->{krb5_conf};
1394 my $net = Samba::bindir_path($self, "net");
1395 # Add hosts file for name lookups
1396 my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' ";
1397 $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
1398 if (defined($ret->{RESOLV_WRAPPER_CONF})) {
1399 $cmd .= "RESOLV_WRAPPER_CONF=\"$ret->{RESOLV_WRAPPER_CONF}\" ";
1401 $cmd .= "RESOLV_WRAPPER_HOSTS=\"$ret->{RESOLV_WRAPPER_HOSTS}\" ";
1403 $cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" ";
1404 $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
1405 $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" ";
1406 $cmd .= "$net join $ret->{CONFIGURATION}";
1407 $cmd .= " -U$dcvars->{USERNAME}\%$dcvars->{PASSWORD}";
1409 if (system($cmd) != 0) {
1410 warn("Join failed\n$cmd");
1414 # We need world access to this share, as otherwise the domain
1415 # administrator from the AD domain provided by Samba4 can't
1416 # access the share for tests.
1417 chmod 0777, "$prefix/share";
1419 if (not $self->check_or_start(
1427 $ret->{DC_SERVER} = $dcvars->{SERVER};
1428 $ret->{DC_SERVER_IP} = $dcvars->{SERVER_IP};
1429 $ret->{DC_SERVER_IPV6} = $dcvars->{SERVER_IPV6};
1430 $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME};
1431 $ret->{DC_USERNAME} = $dcvars->{USERNAME};
1432 $ret->{DC_PASSWORD} = $dcvars->{PASSWORD};
1433 $ret->{DOMAIN_ADMIN} = $dcvars->{DOMAIN_ADMIN};
1434 $ret->{DOMAIN_ADMIN_PASSWORD} = $dcvars->{DOMAIN_ADMIN_PASSWORD};
1435 $ret->{DOMAIN_USER} = $dcvars->{DOMAIN_USER};
1436 $ret->{DOMAIN_USER_PASSWORD} = $dcvars->{DOMAIN_USER_PASSWORD};
1441 sub setup_ad_member_idmap_ad
1443 my ($self, $prefix, $dcvars) = @_;
1445 # If we didn't build with ADS, pretend this env was never available
1446 if (not $self->have_ads()) {
1450 print "PROVISIONING S3 AD MEMBER WITH idmap_ad config...";
1452 my $member_options = "
1454 workgroup = $dcvars->{DOMAIN}
1455 realm = $dcvars->{REALM}
1456 password server = $dcvars->{SERVER}
1457 idmap config * : backend = tdb
1458 idmap config * : range = 1000000-1999999
1459 idmap config $dcvars->{DOMAIN} : backend = ad
1460 idmap config $dcvars->{DOMAIN} : range = 2000000-2999999
1461 idmap config $dcvars->{DOMAIN} : unix_primary_group = yes
1462 idmap config $dcvars->{DOMAIN} : unix_nss_info = yes
1463 idmap config $dcvars->{DOMAIN} : deny ous = \"ou=sub,DC=samba2008r2,DC=example,DC=com\"
1464 idmap config $dcvars->{TRUST_DOMAIN} : backend = ad
1465 idmap config $dcvars->{TRUST_DOMAIN} : range = 2000000-2999999
1466 gensec_gssapi:requested_life_time = 5
1467 winbind scan trusted domains = yes
1468 winbind expand groups = 1
1471 my $ret = $self->provision(
1473 domain => $dcvars->{DOMAIN},
1474 realm => $dcvars->{REALM},
1475 server => "IDMAPADMEMBER",
1476 password => "loCalMemberPass",
1477 extra_options => $member_options,
1478 resolv_conf => $dcvars->{RESOLV_CONF});
1480 $ret or return undef;
1482 $ret->{DOMAIN} = $dcvars->{DOMAIN};
1483 $ret->{REALM} = $dcvars->{REALM};
1484 $ret->{DOMSID} = $dcvars->{DOMSID};
1487 my $prefix_abs = abs_path($prefix);
1489 $ctx->{krb5_conf} = "$prefix_abs/lib/krb5.conf";
1490 $ctx->{domain} = $dcvars->{DOMAIN};
1491 $ctx->{realm} = $dcvars->{REALM};
1492 $ctx->{dnsname} = lc($dcvars->{REALM});
1493 $ctx->{kdc_ipv4} = $dcvars->{SERVER_IP};
1494 $ctx->{kdc_ipv6} = $dcvars->{SERVER_IPV6};
1495 $ctx->{krb5_ccname} = "$prefix_abs/krb5cc_%{uid}";
1496 Samba::mk_krb5_conf($ctx, "");
1498 $ret->{KRB5_CONFIG} = $ctx->{krb5_conf};
1500 my $net = Samba::bindir_path($self, "net");
1501 # Add hosts file for name lookups
1502 my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' ";
1503 $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
1504 if (defined($ret->{RESOLV_WRAPPER_CONF})) {
1505 $cmd .= "RESOLV_WRAPPER_CONF=\"$ret->{RESOLV_WRAPPER_CONF}\" ";
1507 $cmd .= "RESOLV_WRAPPER_HOSTS=\"$ret->{RESOLV_WRAPPER_HOSTS}\" ";
1509 $cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" ";
1510 $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
1511 $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" ";
1512 $cmd .= "$net join $ret->{CONFIGURATION}";
1513 $cmd .= " -U$dcvars->{USERNAME}\%$dcvars->{PASSWORD}";
1515 if (system($cmd) != 0) {
1516 warn("Join failed\n$cmd");
1520 # We need world access to this share, as otherwise the domain
1521 # administrator from the AD domain provided by Samba4 can't
1522 # access the share for tests.
1523 chmod 0777, "$prefix/share";
1525 if (not $self->check_or_start(
1533 $ret->{DC_SERVER} = $dcvars->{SERVER};
1534 $ret->{DC_SERVER_IP} = $dcvars->{SERVER_IP};
1535 $ret->{DC_SERVER_IPV6} = $dcvars->{SERVER_IPV6};
1536 $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME};
1537 $ret->{DC_USERNAME} = $dcvars->{USERNAME};
1538 $ret->{DC_PASSWORD} = $dcvars->{PASSWORD};
1539 $ret->{DOMAIN_ADMIN} = $dcvars->{DOMAIN_ADMIN};
1540 $ret->{DOMAIN_ADMIN_PASSWORD} = $dcvars->{DOMAIN_ADMIN_PASSWORD};
1541 $ret->{DOMAIN_USER} = $dcvars->{DOMAIN_USER};
1542 $ret->{DOMAIN_USER_PASSWORD} = $dcvars->{DOMAIN_USER_PASSWORD};
1544 $ret->{TRUST_SERVER} = $dcvars->{TRUST_SERVER};
1545 $ret->{TRUST_USERNAME} = $dcvars->{TRUST_USERNAME};
1546 $ret->{TRUST_PASSWORD} = $dcvars->{TRUST_PASSWORD};
1547 $ret->{TRUST_DOMAIN} = $dcvars->{TRUST_DOMAIN};
1548 $ret->{TRUST_REALM} = $dcvars->{TRUST_REALM};
1549 $ret->{TRUST_DOMSID} = $dcvars->{TRUST_DOMSID};
1554 sub setup_ad_member_oneway
1556 my ($self, $prefix, $dcvars) = @_;
1558 # If we didn't build with ADS, pretend this env was never available
1559 if (not $self->have_ads()) {
1563 print "PROVISIONING S3 AD MEMBER WITH one-way trust...";
1565 my $member_options = "
1567 workgroup = $dcvars->{DOMAIN}
1568 realm = $dcvars->{REALM}
1569 password server = $dcvars->{SERVER}
1570 idmap config * : backend = tdb
1571 idmap config * : range = 1000000-1999999
1572 gensec_gssapi:requested_life_time = 5
1575 my $ret = $self->provision(
1577 domain => $dcvars->{DOMAIN},
1578 server => "S2KMEMBER",
1579 password => "loCalS2KMemberPass",
1580 extra_options => $member_options,
1581 resolv_conf => $dcvars->{RESOLV_CONF});
1583 $ret or return undef;
1585 $ret->{DOMAIN} = $dcvars->{DOMAIN};
1586 $ret->{REALM} = $dcvars->{REALM};
1587 $ret->{DOMSID} = $dcvars->{DOMSID};
1590 my $prefix_abs = abs_path($prefix);
1592 $ctx->{krb5_conf} = "$prefix_abs/lib/krb5.conf";
1593 $ctx->{domain} = $dcvars->{DOMAIN};
1594 $ctx->{realm} = $dcvars->{REALM};
1595 $ctx->{dnsname} = lc($dcvars->{REALM});
1596 $ctx->{kdc_ipv4} = $dcvars->{SERVER_IP};
1597 $ctx->{kdc_ipv6} = $dcvars->{SERVER_IPV6};
1598 $ctx->{krb5_ccname} = "$prefix_abs/krb5cc_%{uid}";
1599 Samba::mk_krb5_conf($ctx, "");
1601 $ret->{KRB5_CONFIG} = $ctx->{krb5_conf};
1603 my $net = Samba::bindir_path($self, "net");
1604 # Add hosts file for name lookups
1605 my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' ";
1606 $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
1607 if (defined($ret->{RESOLV_WRAPPER_CONF})) {
1608 $cmd .= "RESOLV_WRAPPER_CONF=\"$ret->{RESOLV_WRAPPER_CONF}\" ";
1610 $cmd .= "RESOLV_WRAPPER_HOSTS=\"$ret->{RESOLV_WRAPPER_HOSTS}\" ";
1612 $cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" ";
1613 $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
1614 $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" ";
1615 $cmd .= "$net join $ret->{CONFIGURATION}";
1616 $cmd .= " -U$dcvars->{USERNAME}\%$dcvars->{PASSWORD}";
1618 if (system($cmd) != 0) {
1619 warn("Join failed\n$cmd");
1623 if (not $self->check_or_start(
1625 winbindd => "yes")) {
1629 $ret->{DC_SERVER} = $dcvars->{SERVER};
1630 $ret->{DC_SERVER_IP} = $dcvars->{SERVER_IP};
1631 $ret->{DC_SERVER_IPV6} = $dcvars->{SERVER_IPV6};
1632 $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME};
1633 $ret->{DC_USERNAME} = $dcvars->{USERNAME};
1634 $ret->{DC_PASSWORD} = $dcvars->{PASSWORD};
1635 $ret->{DOMAIN_ADMIN} = $dcvars->{DOMAIN_ADMIN};
1636 $ret->{DOMAIN_ADMIN_PASSWORD} = $dcvars->{DOMAIN_ADMIN_PASSWORD};
1637 $ret->{DOMAIN_USER} = $dcvars->{DOMAIN_USER};
1638 $ret->{DOMAIN_USER_PASSWORD} = $dcvars->{DOMAIN_USER_PASSWORD};
1640 $ret->{TRUST_SERVER} = $dcvars->{TRUST_SERVER};
1641 $ret->{TRUST_USERNAME} = $dcvars->{TRUST_USERNAME};
1642 $ret->{TRUST_PASSWORD} = $dcvars->{TRUST_PASSWORD};
1643 $ret->{TRUST_DOMAIN} = $dcvars->{TRUST_DOMAIN};
1644 $ret->{TRUST_REALM} = $dcvars->{TRUST_REALM};
1645 $ret->{TRUST_DOMSID} = $dcvars->{TRUST_DOMSID};
1650 sub setup_ad_member_fips
1658 # If we didn't build with ADS, pretend this env was never available
1659 if (not $self->have_ads()) {
1663 print "PROVISIONING AD FIPS MEMBER...";
1665 return $self->provision_ad_member($prefix,
1674 sub setup_ad_member_offlogon
1682 # If we didn't build with ADS, pretend this env was never available
1683 if (not $self->have_ads()) {
1687 print "PROVISIONING AD MEMBER OFFLINE LOGON...";
1689 return $self->provision_ad_member($prefix,
1699 sub setup_ad_member_idmap_nss
1707 # If we didn't build with ADS, pretend this env was never available
1708 if (not $self->have_ads()) {
1712 print "PROVISIONING AD MEMBER WITHOUT NSS WINBIND WITH idmap_nss config...";
1714 my $extra_member_options = "
1715 # bob:x:65521:65531:localbob gecos:/:/bin/false
1716 # jane:x:65520:65531:localjane gecos:/:/bin/false
1717 # jackthemapper:x:65519:65531:localjackthemaper gecos:/:/bin/false
1718 # jacknomapper:x:65518:65531:localjacknomaper gecos:/:/bin/false
1719 idmap config $dcvars->{DOMAIN} : backend = nss
1720 idmap config $dcvars->{DOMAIN} : range = 65518-65521
1722 # Support SMB1 so that we can use posix_whoami().
1723 client min protocol = CORE
1724 server min protocol = LANMAN1
1726 username map = $prefix/lib/username.map
1729 my $ret = $self->provision_ad_member($prefix,
1734 $extra_member_options,
1740 open(USERMAP, ">$prefix/lib/username.map") or die("Unable to open $prefix/lib/username.map");
1742 !jacknomapper = \@jackthemappergroup
1743 !root = jacknomappergroup
1744 root = $dcvars->{DOMAIN}/root
1745 bob = $dcvars->{DOMAIN}/bob
1752 sub setup_simpleserver
1754 my ($self, $path) = @_;
1756 print "PROVISIONING simple server...";
1758 my $prefix_abs = abs_path($path);
1760 my $external_streams_depot="$prefix_abs/external_streams_depot";
1762 my $simpleserver_options_globals = "
1765 vfs objects = xattr_tdb streams_depot
1767 server smb encrypt = off
1768 allow trusted domains = no
1771 my $simpleserver_options = "
1773 path = $prefix_abs/share
1775 vfs objects = aio_pthread
1776 aio_pthread:aio open = yes
1777 smbd async dosmode = no
1779 [vfs_aio_pthread_async_dosmode_default1]
1780 path = $prefix_abs/share
1782 vfs objects = aio_pthread
1783 store dos attributes = yes
1784 aio_pthread:aio open = yes
1785 smbd async dosmode = yes
1787 [vfs_aio_pthread_async_dosmode_default2]
1788 path = $prefix_abs/share
1790 vfs objects = aio_pthread xattr_tdb
1791 store dos attributes = yes
1792 aio_pthread:aio open = yes
1793 smbd async dosmode = yes
1795 [async_dosmode_shadow_copy2]
1796 path = $prefix_abs/share
1798 vfs objects = shadow_copy2 xattr_tdb
1799 smbd async dosmode = yes
1802 path = $prefix_abs/share
1803 vfs objects = aio_fork
1805 vfs_aio_fork:erratic_testing_mode=yes
1808 path = $prefix_abs/share
1810 store dos attributes = yes
1811 hide files = /hidefile/
1812 hide dot files = yes
1815 path = $prefix_abs/share
1816 hide new files timeout = 5
1818 [external_streams_depot]
1819 path = $prefix_abs/share
1821 streams_depot:directory = $external_streams_depot
1824 my $vars = $self->provision(
1826 domain => "WORKGROUP",
1827 server => "LOCALSHARE4",
1828 password => "local4pass",
1829 extra_options_before_inject => $simpleserver_options_globals,
1830 extra_options => $simpleserver_options);
1832 $vars or return undef;
1834 remove_tree($external_streams_depot);
1835 mkdir($external_streams_depot, 0777);
1837 my $pam_service_dir = "$prefix_abs/pam_services";
1838 remove_tree($pam_service_dir);
1839 mkdir($pam_service_dir, 0777);
1840 my $pam_service_file = "$pam_service_dir/samba";
1841 my $pam_matrix_passdb = "$pam_service_dir/samba_pam_matrix_passdb";
1842 my $pam_matrix_so_path = Samba::pam_matrix_so_path($self);
1844 open(FILE, "> $pam_service_file");
1845 print FILE "auth required ${pam_matrix_so_path} passdb=${pam_matrix_passdb} verbose\n";
1846 print FILE "account required ${pam_matrix_so_path} passdb=${pam_matrix_passdb} verbose\n";
1849 my $tmpusername = $vars->{USERNAME};
1850 my $tmppassword = $vars->{PASSWORD};
1851 open(FILE, "> $pam_matrix_passdb");
1852 print FILE "$tmpusername:$tmppassword:samba";
1855 $vars->{PAM_WRAPPER} = "1";
1856 $vars->{PAM_WRAPPER_SERVICE_DIR} = $pam_service_dir;
1857 #$vars->{PAM_WRAPPER_DEBUGLEVEL} = "3";
1859 if (not $self->check_or_start(
1869 sub create_file_chmod($$)
1871 my ($name, $mode) = @_;
1874 unless (open($fh, '>', $name)) {
1875 warn("Unable to open $name");
1881 sub setup_fileserver
1883 my ($self, $path, $more_conf, $server) = @_;
1884 my $prefix_abs = abs_path($path);
1885 my $srcdir_abs = abs_path($self->{srcdir});
1887 print "PROVISIONING file server ...\n";
1891 mkdir($prefix_abs, 0777);
1893 my $usershare_dir="$prefix_abs/lib/usershare";
1895 my $share_dir="$prefix_abs/share";
1897 # Create share directory structure
1898 my $lower_case_share_dir="$share_dir/lower-case";
1899 push(@dirs, $lower_case_share_dir);
1901 my $lower_case_share_dir_30000="$share_dir/lower-case-30000";
1902 push(@dirs, $lower_case_share_dir_30000);
1904 my $dfree_share_dir="$share_dir/dfree";
1905 push(@dirs, $dfree_share_dir);
1906 push(@dirs, "$dfree_share_dir/subdir1");
1907 push(@dirs, "$dfree_share_dir/subdir2");
1908 push(@dirs, "$dfree_share_dir/subdir3");
1910 my $quotadir_dir="$share_dir/quota";
1911 push(@dirs, $quotadir_dir);
1913 my $valid_users_sharedir="$share_dir/valid_users";
1914 push(@dirs,$valid_users_sharedir);
1916 my $offline_sharedir="$share_dir/offline";
1917 push(@dirs,$offline_sharedir);
1919 my $force_user_valid_users_dir = "$share_dir/force_user_valid_users";
1920 push(@dirs, $force_user_valid_users_dir);
1922 my $tarmode_sharedir="$share_dir/tarmode";
1923 push(@dirs,$tarmode_sharedir);
1925 my $tarmode2_sharedir="$share_dir/tarmode2";
1926 push(@dirs,$tarmode2_sharedir);
1928 my $smbcacls_sharedir="$share_dir/smbcacls";
1929 push(@dirs,$smbcacls_sharedir);
1931 my $usershare_sharedir="$share_dir/usershares";
1932 push(@dirs,$usershare_sharedir);
1934 my $dropbox_sharedir="$share_dir/dropbox";
1935 push(@dirs,$dropbox_sharedir);
1937 my $bad_iconv_sharedir="$share_dir/bad_iconv";
1938 push(@dirs, $bad_iconv_sharedir);
1940 my $veto_sharedir="$share_dir/veto";
1941 push(@dirs,$veto_sharedir);
1943 my $virusfilter_sharedir="$share_dir/virusfilter";
1944 push(@dirs,$virusfilter_sharedir);
1946 my $delete_unwrite_sharedir="$share_dir/delete_unwrite";
1947 push(@dirs,$delete_unwrite_sharedir);
1948 push(@dirs, "$delete_unwrite_sharedir/delete_veto_yes");
1949 push(@dirs, "$delete_unwrite_sharedir/delete_veto_no");
1951 my $volume_serial_number_sharedir="$share_dir/volume_serial_number";
1952 push(@dirs, $volume_serial_number_sharedir);
1954 my $ip4 = Samba::get_ipv4_addr("FILESERVER");
1955 my $fileserver_options = "
1956 smb3 unix extensions = yes
1957 kernel change notify = yes
1958 spotlight backend = elasticsearch
1959 elasticsearch:address = $ip4
1960 elasticsearch:port = 8080
1961 elasticsearch:mappings = $srcdir_abs/source3/rpc_server/mdssvc/elasticsearch_mappings.json
1963 usershare path = $usershare_dir
1964 usershare max shares = 10
1965 usershare allow guests = yes
1966 usershare prefix allow list = $usershare_sharedir
1968 get quota command = $prefix_abs/getset_quota.py
1969 set quota command = $prefix_abs/getset_quota.py
1971 path = $tarmode_sharedir
1972 comment = tar test share
1973 xattr_tdb:file = $prefix_abs/tarmode-xattr.tdb
1975 path = $tarmode2_sharedir
1976 comment = tar test share
1977 xattr_tdb:file = $prefix_abs/tarmode2-xattr.tdb
1987 path = $lower_case_share_dir
1988 comment = smb username is [%U]
1989 case sensitive = True
1990 default case = lower
1992 short preserve case = no
1994 path = $lower_case_share_dir_30000
1995 comment = smb username is [%U]
1996 case sensitive = True
1997 default case = lower
1999 short preserve case = no
2001 path = $dfree_share_dir
2002 comment = smb username is [%U]
2003 dfree command = $srcdir_abs/testprogs/blackbox/dfree.sh
2004 [valid-users-access]
2005 path = $valid_users_sharedir
2006 valid users = +userdup
2008 path = $offline_sharedir
2009 vfs objects = offline
2011 # BUG: https://bugzilla.samba.org/show_bug.cgi?id=9878
2012 # RH BUG: https://bugzilla.redhat.com/show_bug.cgi?id=1077651
2013 [force_user_valid_users]
2014 path = $force_user_valid_users_dir
2015 comment = force user with valid users combination test share
2016 valid users = +force_user
2017 force user = force_user
2018 force group = everyone
2019 write list = force_user
2023 comment = ignore system acls
2024 acl_xattr:ignore system acls = yes
2027 comment = inherit owner
2031 comment = inherit only unix owner
2032 inherit owner = unix only
2033 acl_xattr:ignore system acls = yes
2034 # BUG: https://bugzilla.samba.org/show_bug.cgi?id=13690
2037 comment = force group test
2038 # force group = everyone
2042 comment = smb username is [%U]
2044 force create mode = 0664
2045 vfs objects = dirsort
2048 path = $dropbox_sharedir
2049 comment = smb username is [%U]
2054 path = $bad_iconv_sharedir
2055 comment = smb username is [%U]
2058 [veto_files_nodelete]
2059 path = $veto_sharedir
2062 veto files = /veto_name*/
2063 delete veto files = no
2066 path = $veto_sharedir
2068 veto files = /veto_name*/
2069 delete veto files = yes
2071 [delete_veto_files_only]
2072 path = $veto_sharedir
2073 delete veto files = yes
2075 [veto_files_nohidden]
2076 path = $veto_sharedir
2080 path = $veto_sharedir
2081 veto files = /veto_name*/../user1/user1file/../user2/user2file/../+group1/group1file/../+group2/group2file
2083 [delete_yes_unwrite]
2085 path = $delete_unwrite_sharedir
2086 hide unwriteable files = yes
2087 delete veto files = yes
2091 path = $delete_unwrite_sharedir
2092 hide unwriteable files = yes
2093 delete veto files = no
2096 path = $virusfilter_sharedir
2097 vfs objects = acl_xattr virusfilter
2098 virusfilter:scanner = dummy
2099 virusfilter:min file size = 0
2100 virusfilter:infected files = *infected*
2101 virusfilter:infected file action = rename
2102 virusfilter:scan on close = yes
2103 vfs_default:VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS = no
2105 [volumeserialnumber]
2106 path = $volume_serial_number_sharedir
2107 volume serial number = 0xdeadbeef
2111 vfs objects = acl_xattr
2112 acl_xattr:security_acl_name = user.hackme
2117 vfs objects = acl_xattr fake_acls xattr_tdb streams_depot time_audit full_audit io_uring
2121 comment = Home directories
2126 if (defined($more_conf)) {
2127 $fileserver_options = $fileserver_options . $more_conf;
2129 if (!defined($server)) {
2130 $server = "FILESERVER";
2133 my $vars = $self->provision(
2135 domain => "WORKGROUP",
2137 password => "fileserver",
2138 extra_options => $fileserver_options);
2140 $vars or return undef;
2142 mkdir("$prefix_abs/lib", 0755);
2143 remove_tree($usershare_dir);
2144 mkdir($usershare_dir, 01770);
2146 if (not $self->check_or_start(
2154 mkdir($_, 0777) foreach(@dirs);
2156 ## Create case sensitive lower case share dir
2157 foreach my $file ('a'..'z') {
2158 my $full_path = $lower_case_share_dir . '/' . $file;
2159 open my $fh, '>', $full_path;
2160 # Add some content to file
2161 print $fh $full_path;
2165 for (my $file = 1; $file < 51; ++$file) {
2166 my $full_path = $lower_case_share_dir . '/' . $file;
2167 open my $fh, '>', $full_path;
2168 # Add some content to file
2169 print $fh $full_path;
2173 # Create content for 30000 share
2174 foreach my $file ('a'..'z') {
2175 my $full_path = $lower_case_share_dir_30000 . '/' . $file;
2176 open my $fh, '>', $full_path;
2177 # Add some content to file
2178 print $fh $full_path;
2182 for (my $file = 1; $file < 30001; ++$file) {
2183 my $full_path = $lower_case_share_dir_30000 . '/' . $file;
2184 open my $fh, '>', $full_path;
2185 # Add some content to file
2186 print $fh $full_path;
2191 ## create a listable file in valid_users_share
2193 create_file_chmod("$valid_users_sharedir/foo", 0644) or return undef;
2196 ## create a valid utf8 filename which is invalid as a CP850 conversion
2198 create_file_chmod("$bad_iconv_sharedir/\xED\x9F\xBF", 0644) or return undef;
2201 ## create unwritable files inside inside the delete unwrite veto share dirs.
2203 unlink("$delete_unwrite_sharedir/delete_veto_yes/file_444");
2204 create_file_chmod("$delete_unwrite_sharedir/delete_veto_yes/file_444", 0444) or return undef;
2205 unlink("$delete_unwrite_sharedir/delete_veto_no/file_444");
2206 create_file_chmod("$delete_unwrite_sharedir/delete_veto_no/file_444", 0444) or return undef;
2211 sub setup_fileserver_smb1
2213 my ($self, $path) = @_;
2214 my $prefix_abs = abs_path($path);
2217 client min protocol = CORE
2218 server min protocol = LANMAN1
2219 check parent directory delete on close = yes
2222 path = $prefix_abs/share
2223 hide new files timeout = 5
2225 path = $prefix_abs/share
2227 vfs objects = aio_pthread
2228 aio_pthread:aio open = yes
2229 smbd async dosmode = no
2231 [vfs_aio_pthread_async_dosmode_default1]
2232 path = $prefix_abs/share
2234 vfs objects = aio_pthread
2235 store dos attributes = yes
2236 aio_pthread:aio open = yes
2237 smbd async dosmode = yes
2239 [vfs_aio_pthread_async_dosmode_default2]
2240 path = $prefix_abs/share
2242 vfs objects = aio_pthread xattr_tdb
2243 store dos attributes = yes
2244 aio_pthread:aio open = yes
2245 smbd async dosmode = yes
2248 path = $prefix_abs/share
2249 vfs objects = aio_fork
2251 vfs_aio_fork:erratic_testing_mode=yes
2253 return $self->setup_fileserver($path, $conf, "FILESERVERSMB1");
2256 sub setup_fileserver_smb1_done
2258 my ($self, $path, $dep_env) = @_;
2259 return $self->return_alias_env($path, $dep_env);
2264 my ($self, $prefix) = @_;
2266 # If we didn't build with ADS, pretend this env was never available
2267 if (not $self->have_ads()) {
2271 print "PROVISIONING server with security=ads...";
2273 my $ktest_options = "
2275 realm = ktest.samba.example.com
2277 server signing = required
2278 server min protocol = SMB3_00
2279 client max protocol = SMB3
2281 # This disables NTLM auth against the local SAM, which
2282 # we use can then test this setting by.
2283 ntlm auth = disabled
2285 idmap config * : backend = autorid
2286 idmap config * : range = 1000000-1999999
2287 idmap config * : rangesize = 100000
2290 my $ret = $self->provision(
2293 server => "LOCALKTEST6",
2294 password => "localktest6pass",
2295 extra_options => $ktest_options);
2297 $ret or return undef;
2300 my $prefix_abs = abs_path($prefix);
2302 $ctx->{krb5_conf} = "$prefix_abs/lib/krb5.conf";
2303 $ctx->{domain} = "KTEST";
2304 $ctx->{realm} = "KTEST.SAMBA.EXAMPLE.COM";
2305 $ctx->{dnsname} = lc($ctx->{realm});
2306 $ctx->{kdc_ipv4} = "0.0.0.0";
2307 $ctx->{kdc_ipv6} = "::";
2308 $ctx->{krb5_ccname} = "$prefix_abs/krb5cc_%{uid}";
2309 Samba::mk_krb5_conf($ctx, "");
2311 $ret->{KRB5_CONFIG} = $ctx->{krb5_conf};
2313 #This is the secrets.tdb created by 'net ads join' from Samba3 to a
2314 #Samba4 DC with the same parameters as are being used here. The
2315 #domain SID is S-1-5-21-1071277805-689288055-3486227160
2316 $ret->{SAMSID} = "S-1-5-21-1911091480-1468226576-2729736297";
2317 $ret->{DOMSID} = "S-1-5-21-1071277805-689288055-3486227160";
2319 system("cp $self->{srcdir}/source3/selftest/ktest-secrets.tdb $prefix/private/secrets.tdb");
2320 chmod 0600, "$prefix/private/secrets.tdb";
2322 #Make sure there's no old ntdb file.
2323 system("rm -f $prefix/private/secrets.ntdb");
2325 #This uses a pre-calculated krb5 credentials cache, obtained by running Samba4 with:
2326 # "--option=kdc:service ticket lifetime=239232" "--option=kdc:user ticket lifetime=239232" "--option=kdc:renewal lifetime=239232"
2328 #and having in krb5.conf:
2329 # ticket_lifetime = 799718400
2330 # renew_lifetime = 799718400
2332 # The commands for the -2 keytab where were:
2333 # kinit administrator@KTEST.SAMBA.EXAMPLE.COM
2334 # kvno host/localktest6@KTEST.SAMBA.EXAMPLE.COM
2335 # kvno cifs/localktest6@KTEST.SAMBA.EXAMPLE.COM
2336 # kvno host/LOCALKTEST6@KTEST.SAMBA.EXAMPLE.COM
2337 # kvno cifs/LOCALKTEST6@KTEST.SAMBA.EXAMPLE.COM
2339 # and then for the -3 keytab, I did
2341 # net changetrustpw; kdestroy and the same again.
2343 # This creates a credential cache with a very long lifetime (2036 at
2344 # at 2011-04), and shows that running 'net changetrustpw' does not
2345 # break existing logins (for the secrets.tdb method at least).
2348 $ret->{KRB5_CCACHE}="FILE:$prefix/krb5_ccache";
2350 system("cp $self->{srcdir}/source3/selftest/ktest-krb5_ccache-2 $prefix/krb5_ccache-2");
2351 chmod 0600, "$prefix/krb5_ccache-2";
2353 system("cp $self->{srcdir}/source3/selftest/ktest-krb5_ccache-3 $prefix/krb5_ccache-3");
2354 chmod 0600, "$prefix/krb5_ccache-3";
2356 # We need world access to this share, as otherwise the domain
2357 # administrator from the AD domain provided by ktest can't
2358 # access the share for tests.
2359 chmod 0777, "$prefix/share";
2361 if (not $self->check_or_start(
2364 winbindd => "offline",
2371 sub setup_maptoguest
2373 my ($self, $path) = @_;
2374 my $prefix_abs = abs_path($path);
2375 my $libdir="$prefix_abs/lib";
2376 my $share_dir="$prefix_abs/share";
2377 my $errorinjectconf="$libdir/error_inject.conf";
2379 print "PROVISIONING maptoguest...";
2383 map to guest = bad user
2385 server min protocol = LANMAN1
2387 [force_user_error_inject]
2389 vfs objects = acl_xattr fake_acls xattr_tdb error_inject
2391 include = $errorinjectconf
2394 my $vars = $self->provision(
2396 domain => "WORKGROUP",
2397 server => "maptoguest",
2398 password => "maptoguestpass",
2399 extra_options => $options);
2401 $vars or return undef;
2403 if (not $self->check_or_start(
2414 sub stop_sig_term($$) {
2415 my ($self, $pid) = @_;
2416 kill("USR1", $pid) or kill("ALRM", $pid) or warn("Unable to kill $pid: $!");
2419 sub stop_sig_kill($$) {
2420 my ($self, $pid) = @_;
2421 kill("ALRM", $pid) or warn("Unable to kill $pid: $!");
2426 my ($env_vars, $app, $pid) = @_;
2428 open(PID, ">$env_vars->{PIDDIR}/timelimit.$app.pid");
2435 my ($env_vars, $app) = @_;
2437 open(PID, "<$env_vars->{PIDDIR}/timelimit.$app.pid");
2443 # builds up the cmd args to run an s3 binary (i.e. smbd, nmbd, etc)
2446 my ($self, $binary, $env_vars, $options, $valgrind, $dont_log_stdout) = @_;
2449 if (defined($options)) {
2450 @optargs = split(/ /, $options);
2452 my @preargs = (Samba::bindir_path($self, "timelimit"), $self->{server_maxtime});
2454 if (defined($valgrind)) {
2455 @preargs = split(/ /, $valgrind);
2457 my @args = ("-F", "--no-process-group",
2458 "--configfile=$env_vars->{SERVERCONFFILE}",
2459 "-l", $env_vars->{LOGDIR});
2461 if (not defined($dont_log_stdout)) {
2462 push(@args, "--debug-stdout");
2464 return (@preargs, $binary, @args, @optargs);
2467 sub check_or_start($$) {
2468 my ($self, %args) = @_;
2469 my $env_vars = $args{env_vars};
2470 my $nmbd = $args{nmbd} // "no";
2471 my $winbindd = $args{winbindd} // "no";
2472 my $smbd = $args{smbd} // "no";
2473 my $samba_dcerpcd = $args{samba_dcerpcd} // "no";
2474 my $child_cleanup = $args{child_cleanup};
2478 # use a pipe for stdin in the child processes. This allows
2479 # those processes to monitor the pipe for EOF to ensure they
2480 # exit when the test script exits
2481 pipe($STDIN_READER, $env_vars->{STDIN_PIPE});
2483 my $binary = Samba::bindir_path($self, "samba-dcerpcd");
2484 my @full_cmd = $self->make_bin_cmd(
2487 $ENV{SAMBA_DCERPCD_OPTIONS},
2488 $ENV{SAMBA_DCERPCD_VALGRIND},
2489 $ENV{SAMBA_DCERPCD_DONT_LOG_STDOUT});
2490 push(@full_cmd, '--libexec-rpcds');
2492 my $samba_dcerpcd_envs = Samba::get_env_for_process(
2493 "samba_dcerpcd", $env_vars);
2495 # fork and exec() samba_dcerpcd in the child process
2497 NAME => "samba_dcerpcd",
2498 BINARY_PATH => $binary,
2499 FULL_CMD => [ @full_cmd ],
2500 LOG_FILE => $env_vars->{SAMBA_DCERPCD_TEST_LOG},
2501 PCAP_FILE => "env-$ENV{ENVNAME}-samba_dcerpcd",
2502 ENV_VARS => $samba_dcerpcd_envs,
2504 if ($samba_dcerpcd ne "yes") {
2505 $daemon_ctx->{SKIP_DAEMON} = 1;
2508 my $pid = Samba::fork_and_exec(
2509 $self, $env_vars, $daemon_ctx, $STDIN_READER, $child_cleanup);
2511 $env_vars->{SAMBA_DCERPCD_TL_PID} = $pid;
2512 write_pid($env_vars, "samba_dcerpcd", $pid);
2514 $binary = Samba::bindir_path($self, "nmbd");
2515 @full_cmd = $self->make_bin_cmd($binary, $env_vars,
2516 $ENV{NMBD_OPTIONS}, $ENV{NMBD_VALGRIND},
2517 $ENV{NMBD_DONT_LOG_STDOUT});
2518 my $nmbd_envs = Samba::get_env_for_process("nmbd", $env_vars);
2519 delete $nmbd_envs->{RESOLV_WRAPPER_CONF};
2520 delete $nmbd_envs->{RESOLV_WRAPPER_HOSTS};
2522 # fork and exec() nmbd in the child process
2525 BINARY_PATH => $binary,
2526 FULL_CMD => [ @full_cmd ],
2527 LOG_FILE => $env_vars->{NMBD_TEST_LOG},
2528 PCAP_FILE => "env-$ENV{ENVNAME}-nmbd",
2529 ENV_VARS => $nmbd_envs,
2531 if ($nmbd ne "yes") {
2532 $daemon_ctx->{SKIP_DAEMON} = 1;
2534 $pid = Samba::fork_and_exec(
2535 $self, $env_vars, $daemon_ctx, $STDIN_READER, $child_cleanup);
2537 $env_vars->{NMBD_TL_PID} = $pid;
2538 write_pid($env_vars, "nmbd", $pid);
2540 $binary = Samba::bindir_path($self, "winbindd");
2541 @full_cmd = $self->make_bin_cmd($binary, $env_vars,
2542 $ENV{WINBINDD_OPTIONS},
2543 $ENV{WINBINDD_VALGRIND},
2544 $ENV{WINBINDD_DONT_LOG_STDOUT});
2546 # fork and exec() winbindd in the child process
2549 BINARY_PATH => $binary,
2550 FULL_CMD => [ @full_cmd ],
2551 LOG_FILE => $env_vars->{WINBINDD_TEST_LOG},
2552 PCAP_FILE => "env-$ENV{ENVNAME}-winbindd",
2554 if ($winbindd ne "yes" and $winbindd ne "offline") {
2555 $daemon_ctx->{SKIP_DAEMON} = 1;
2558 $pid = Samba::fork_and_exec(
2559 $self, $env_vars, $daemon_ctx, $STDIN_READER, $child_cleanup);
2561 $env_vars->{WINBINDD_TL_PID} = $pid;
2562 write_pid($env_vars, "winbindd", $pid);
2564 $binary = Samba::bindir_path($self, "smbd");
2565 @full_cmd = $self->make_bin_cmd($binary, $env_vars,
2566 $ENV{SMBD_OPTIONS}, $ENV{SMBD_VALGRIND},
2567 $ENV{SMBD_DONT_LOG_STDOUT});
2569 # fork and exec() smbd in the child process
2572 BINARY_PATH => $binary,
2573 FULL_CMD => [ @full_cmd ],
2574 LOG_FILE => $env_vars->{SMBD_TEST_LOG},
2575 PCAP_FILE => "env-$ENV{ENVNAME}-smbd",
2577 if ($smbd ne "yes") {
2578 $daemon_ctx->{SKIP_DAEMON} = 1;
2581 $pid = Samba::fork_and_exec(
2582 $self, $env_vars, $daemon_ctx, $STDIN_READER, $child_cleanup);
2584 $env_vars->{SMBD_TL_PID} = $pid;
2585 write_pid($env_vars, "smbd", $pid);
2587 # close the parent's read-end of the pipe
2588 close($STDIN_READER);
2590 return $self->wait_for_start($env_vars,
2597 sub createuser($$$$$)
2599 my ($self, $username, $password, $conffile, $env) = @_;
2600 my $cmd = "UID_WRAPPER_ROOT=1 " . Samba::bindir_path($self, "smbpasswd")." -c $conffile -L -s -a $username > /dev/null";
2603 while(my($var, $val) = each %$env) {
2604 $cmd = "$var=\"$val\" $cmd";
2607 unless (open(PWD, "|$cmd")) {
2608 warn("Unable to set password for $username account\n$cmd");
2611 print PWD "$password\n$password\n";
2612 unless (close(PWD)) {
2613 warn("Unable to set password for $username account\n$cmd");
2620 my ($self, %args) = @_;
2622 my $prefix = $args{prefix};
2623 my $domain = $args{domain};
2624 my $realm = $args{realm};
2625 my $server = $args{server};
2626 my $password = $args{password};
2627 my $extra_options_before_inject = $args{extra_options_before_inject} // "";
2628 my $extra_options = $args{extra_options} // "";
2629 my $resolv_conf = $args{resolv_conf};
2630 my $no_delete_prefix= $args{no_delete_prefix};
2631 my $netbios_name = $args{netbios_name} // $server;
2632 my $server_log_level = $ENV{SERVER_LOG_LEVEL} || 1;
2635 ## setup the various environment variables we need
2638 my $samsid = Samba::random_domain_sid();
2639 my $swiface = Samba::get_interface($server);
2641 my %createuser_env = ();
2642 my $server_ip = Samba::get_ipv4_addr($server);
2643 my $server_ipv6 = Samba::get_ipv6_addr($server);
2645 if (defined($realm)) {
2646 $dns_domain = lc($realm);
2648 $dns_domain = "samba.example.com";
2651 my $unix_name = ($ENV{USER} or $ENV{LOGNAME} or `PATH=/usr/ucb:$ENV{PATH} whoami`);
2654 my $unix_gids_str = $);
2655 my @unix_gids = split(" ", $unix_gids_str);
2657 my $prefix_abs = abs_path($prefix);
2658 my $bindir_abs = abs_path($self->{bindir});
2662 my $shrdir=$args{share_dir} // "$prefix_abs/share";
2663 push(@dirs,$shrdir);
2665 my $libdir="$prefix_abs/lib";
2666 push(@dirs,$libdir);
2668 my $piddir="$prefix_abs/pid";
2669 push(@dirs,$piddir);
2671 my $privatedir="$prefix_abs/private";
2672 push(@dirs,$privatedir);
2674 my $cachedir = "$prefix_abs/cachedir";
2675 push(@dirs, $cachedir);
2677 my $binddnsdir = "$prefix_abs/bind-dns";
2678 push(@dirs, $binddnsdir);
2680 my $lockdir="$prefix_abs/lockdir";
2681 push(@dirs,$lockdir);
2683 my $eventlogdir="$prefix_abs/lockdir/eventlog";
2684 push(@dirs,$eventlogdir);
2686 my $logdir="$prefix_abs/logs";
2687 push(@dirs,$logdir);
2689 my $driver32dir="$shrdir/W32X86";
2690 push(@dirs,$driver32dir);
2692 my $driver64dir="$shrdir/x64";
2693 push(@dirs,$driver64dir);
2695 my $driver40dir="$shrdir/WIN40";
2696 push(@dirs,$driver40dir);
2698 my $ro_shrdir="$shrdir/root-tmp";
2699 push(@dirs,$ro_shrdir);
2701 my $noperm_shrdir="$shrdir/noperm-tmp";
2702 push(@dirs,$noperm_shrdir);
2704 my $msdfs_shrdir="$shrdir/msdfsshare";
2705 push(@dirs,$msdfs_shrdir);
2707 my $msdfs_shrdir2="$shrdir/msdfsshare2";
2708 push(@dirs,$msdfs_shrdir2);
2710 my $msdfs_pathname_share="$shrdir/msdfs_pathname_share";
2711 push(@dirs,$msdfs_pathname_share);
2713 my $non_msdfs_pathname_share="$shrdir/non_msdfs_pathname_share";
2714 push(@dirs,$non_msdfs_pathname_share);
2716 my $msdfs_deeppath="$msdfs_shrdir/deeppath";
2717 push(@dirs,$msdfs_deeppath);
2719 my $smbcacls_sharedir_dfs="$shrdir/smbcacls_sharedir_dfs";
2720 push(@dirs,$smbcacls_sharedir_dfs);
2722 my $smbcacls_share="$shrdir/smbcacls_share";
2723 push(@dirs,$smbcacls_share);
2725 my $smbcacls_share_testdir="$shrdir/smbcacls_share/smbcacls";
2726 push(@dirs,$smbcacls_share_testdir);
2728 my $badnames_shrdir="$shrdir/badnames";
2729 push(@dirs,$badnames_shrdir);
2731 my $lease1_shrdir="$shrdir/dynamic";
2732 push(@dirs,$lease1_shrdir);
2734 my $manglenames_shrdir="$shrdir/manglenames";
2735 push(@dirs,$manglenames_shrdir);
2737 my $widelinks_shrdir="$shrdir/widelinks";
2738 push(@dirs,$widelinks_shrdir);
2740 my $widelinks_linkdir="$shrdir/widelinks_foo";
2741 push(@dirs,$widelinks_linkdir);
2743 my $fsrvp_shrdir="$shrdir/fsrvp";
2744 push(@dirs,$fsrvp_shrdir);
2746 my $shadow_tstdir="$shrdir/shadow";
2747 push(@dirs,$shadow_tstdir);
2748 my $shadow_mntdir="$shadow_tstdir/mount";
2749 push(@dirs,$shadow_mntdir);
2750 my $shadow_basedir="$shadow_mntdir/base";
2751 push(@dirs,$shadow_basedir);
2752 my $shadow_shrdir="$shadow_basedir/share";
2753 push(@dirs,$shadow_shrdir);
2755 my $nosymlinks_shrdir="$shrdir/nosymlinks";
2756 push(@dirs,$nosymlinks_shrdir);
2758 my $local_symlinks_shrdir="$shrdir/local_symlinks";
2759 push(@dirs,$local_symlinks_shrdir);
2761 my $worm_shrdir="$shrdir/worm";
2762 push(@dirs,$worm_shrdir);
2764 my $fruit_resource_stream_shrdir="$shrdir/fruit_resource_stream";
2765 push(@dirs,$fruit_resource_stream_shrdir);
2767 my $smbget_sharedir="$shrdir/smbget";
2768 push(@dirs, $smbget_sharedir);
2770 my $recycle_shrdir="$shrdir/recycle";
2771 push(@dirs,$recycle_shrdir);
2773 my $fakedircreatetimes_shrdir="$shrdir/fakedircreatetimes";
2774 push(@dirs,$fakedircreatetimes_shrdir);
2776 # this gets autocreated by winbindd
2777 my $wbsockdir="$prefix_abs/wbsock";
2779 my $nmbdsockdir="$prefix_abs/nmbd";
2780 unlink($nmbdsockdir);
2783 ## create the test directory layout
2785 die ("prefix_abs = ''") if $prefix_abs eq "";
2786 die ("prefix_abs = '/'") if $prefix_abs eq "/";
2788 mkdir($prefix_abs, 0777);
2789 print "CREATE TEST ENVIRONMENT IN '$prefix'...";
2790 if (not defined($no_delete_prefix) or not $no_delete_prefix) {
2791 system("rm -rf $prefix_abs/*");
2793 mkdir($_, 0777) foreach(@dirs);
2795 my $fs_specific_conf = $self->get_fs_specific_conf($shrdir);
2798 ## lockdir and piddir must be 0755
2800 chmod 0755, $lockdir;
2801 chmod 0755, $piddir;
2805 ## Create a directory without permissions to enter
2807 chmod 0000, $noperm_shrdir;
2810 ## create ro and msdfs share layout
2813 chmod 0755, $ro_shrdir;
2815 create_file_chmod("$ro_shrdir/readable_file", 0644) or return undef;
2816 create_file_chmod("$ro_shrdir/unreadable_file", 0600) or return undef;
2818 create_file_chmod("$ro_shrdir/msdfs-target", 0600) or return undef;
2819 symlink "msdfs:$server_ip\\ro-tmp,$server_ipv6\\ro-tmp",
2820 "$msdfs_shrdir/msdfs-src1";
2821 symlink "msdfs:$server_ipv6\\ro-tmp", "$msdfs_shrdir/deeppath/msdfs-src2";
2822 symlink "msdfs:$server_ip\\smbcacls_sharedir_dfs,$server_ipv6\\smbcacls_sharedir_dfs",
2823 "$msdfs_shrdir/smbcacls_sharedir_dfs";
2825 symlink "msdfs:$server_ip\\msdfs-share2,$server_ipv6\\msdfs-share2", "$msdfs_shrdir/dfshop1";
2826 symlink "msdfs:$server_ip\\tmp,$server_ipv6\\tmp", "$msdfs_shrdir2/dfshop2";
2828 ## create bad names in $badnames_shrdir
2830 ## (An invalid name, would be mangled to 8.3).
2831 create_file_chmod("$badnames_shrdir/\340|\231\216\377\177",
2832 0600) or return undef;
2834 ## (A bad name, would not be mangled to 8.3).
2835 create_file_chmod("$badnames_shrdir/\240\276\346\327\377\177",
2836 0666) or return undef;
2838 ## (A bad good name).
2839 create_file_chmod("$badnames_shrdir/blank.txt",
2840 0666) or return undef;
2843 ## create mangleable directory names in $manglenames_shrdir
2845 my $manglename_target = "$manglenames_shrdir/foo:bar";
2846 mkdir($manglename_target, 0777);
2849 ## create symlinks for widelinks tests.
2851 my $widelinks_target = "$widelinks_linkdir/target";
2852 create_file_chmod("$widelinks_target", 0666) or return undef;
2855 ## This link should get an error
2857 symlink "$widelinks_target", "$widelinks_shrdir/source";
2859 ## This link should be allowed
2861 symlink "$widelinks_shrdir", "$widelinks_shrdir/dot";
2863 my $conffile="$libdir/server.conf";
2864 my $dfqconffile="$libdir/dfq.conf";
2865 my $errorinjectconf="$libdir/error_inject.conf";
2866 my $delayinjectconf="$libdir/delay_inject.conf";
2867 my $globalinjectconf="$libdir/global_inject.conf";
2868 my $aliceconfdir="$libdir";
2869 my $aliceconffile="$libdir/alice.conf";
2871 my $nss_wrapper_pl = "$ENV{PERL} $self->{srcdir}/third_party/nss_wrapper/nss_wrapper.pl";
2872 my $nss_wrapper_passwd = "$privatedir/passwd";
2873 my $nss_wrapper_group = "$privatedir/group";
2874 my $nss_wrapper_hosts = "$ENV{SELFTEST_PREFIX}/hosts";
2875 my $dns_host_file = "$ENV{SELFTEST_PREFIX}/dns_host_file";
2877 my $mod_printer_pl = "$ENV{PERL} $self->{srcdir}/source3/script/tests/printing/modprinter.pl";
2879 my $fake_snap_pl = "$ENV{PERL} $self->{srcdir}/source3/script/tests/fake_snap.pl";
2881 my @eventlog_list = ("dns server", "application");
2884 ## calculate uids and gids
2887 my ($max_uid, $max_gid);
2888 my ($uid_nobody, $uid_root, $uid_pdbtest, $uid_pdbtest2, $uid_userdup);
2889 my ($uid_pdbtest_wkn);
2891 my ($uid_force_user);
2892 my ($gid_nobody, $gid_nogroup, $gid_root, $gid_domusers, $gid_domadmins);
2893 my ($gid_userdup, $gid_everyone);
2894 my ($gid_force_user);
2895 my ($gid_jackthemapper);
2896 my ($gid_jacknomapper);
2903 my ($uid_slashuser);
2905 my ($uid_localjane);
2906 my ($uid_localjackthemapper);
2907 my ($uid_localjacknomapper);
2909 if ($unix_uid < 0xffff - 13) {
2912 $max_uid = $unix_uid;
2915 $uid_root = $max_uid - 1;
2916 $uid_nobody = $max_uid - 2;
2917 $uid_pdbtest = $max_uid - 3;
2918 $uid_pdbtest2 = $max_uid - 4;
2919 $uid_userdup = $max_uid - 5;
2920 $uid_pdbtest_wkn = $max_uid - 6;
2921 $uid_force_user = $max_uid - 7;
2922 $uid_smbget = $max_uid - 8;
2923 $uid_user1 = $max_uid - 9;
2924 $uid_user2 = $max_uid - 10;
2925 $uid_gooduser = $max_uid - 11;
2926 $uid_eviluser = $max_uid - 12;
2927 $uid_slashuser = $max_uid - 13;
2928 $uid_localbob = $max_uid - 14;
2929 $uid_localjane = $max_uid - 15;
2930 $uid_localjackthemapper = $max_uid - 16;
2931 $uid_localjacknomapper = $max_uid - 17;
2933 if ($unix_gids[0] < 0xffff - 8) {
2936 $max_gid = $unix_gids[0];
2939 $gid_nobody = $max_gid - 1;
2940 $gid_nogroup = $max_gid - 2;
2941 $gid_root = $max_gid - 3;
2942 $gid_domusers = $max_gid - 4;
2943 $gid_domadmins = $max_gid - 5;
2944 $gid_userdup = $max_gid - 6;
2945 $gid_everyone = $max_gid - 7;
2946 $gid_force_user = $max_gid - 8;
2947 $gid_jackthemapper = $max_gid - 9;
2948 $gid_jacknomapper = $max_gid - 10;
2949 $gid_group1 = $max_gid - 11;
2950 $gid_group2 = $max_gid - 12;
2956 unless (open(CONF, ">$conffile")) {
2957 warn("Unable to open $conffile");
2961 my $interfaces = Samba::get_interfaces_config($server);
2965 dcesrv:fuzz directory = $cachedir/fuzz
2966 netbios name = $netbios_name
2967 interfaces = $interfaces
2968 bind interfaces only = yes
2969 panic action = cd $self->{srcdir} && $self->{srcdir}/selftest/gdb_backtrace %d %\$(MAKE_TEST_BINARY)
2970 smbd:suicide mode = yes
2971 smbd:FSCTL_SMBTORTURE = yes
2972 smbd:validate_oplock_types = yes
2974 client min protocol = SMB2_02
2975 server min protocol = SMB2_02
2977 server multi channel support = yes
2981 private dir = $privatedir
2982 binddns dir = $binddnsdir
2983 pid directory = $piddir
2984 lock directory = $lockdir
2985 log file = $logdir/log.\%m
2986 log level = $server_log_level
2987 winbind debug traceid = yes
2991 debug syslog format = always
2992 debug hires timestamp = yes
2994 state directory = $lockdir
2995 cache directory = $lockdir
2997 passdb backend = tdbsam
3001 add user script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action add --name %u --gid $gid_nogroup
3002 add group script = $nss_wrapper_pl --group_path $nss_wrapper_group --type group --action add --name %g
3003 add machine script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action add --name %u --gid $gid_nogroup
3004 add user to group script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type member --action add --member %u --name %g --group_path $nss_wrapper_group
3005 delete user script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action delete --name %u
3006 delete group script = $nss_wrapper_pl --group_path $nss_wrapper_group --type group --action delete --name %g
3007 delete user from group script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type member --action delete --member %u --name %g --group_path $nss_wrapper_group
3009 addprinter command = $mod_printer_pl -a -s $conffile --
3010 deleteprinter command = $mod_printer_pl -d -s $conffile --
3012 eventlog list = application \"dns server\"
3015 kernel change notify = no
3019 printcap name = /dev/null
3021 winbindd socket directory = $wbsockdir
3022 nmbd:socket dir = $nmbdsockdir
3023 idmap config * : range = 100000-200000
3024 winbind enum users = yes
3025 winbind enum groups = yes
3026 winbind separator = /
3027 include system krb5 conf = no
3029 # min receivefile size = 4000
3033 smbd:sharedelay = 100000
3034 smbd:writetimeupdatedelay = 500000
3038 store dos attributes = yes
3044 vfs objects = acl_xattr fake_acls xattr_tdb streams_depot time_audit full_audit
3046 full_audit:syslog = no
3047 full_audit:success = none
3048 full_audit:failure = none
3051 print command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb print %p %s
3052 lpq command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lpq %p
3053 lp rm command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lprm %p %j
3054 lp pause command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lppause %p %j
3055 lp resume command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lpresume %p %j
3056 queue pause command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb queuepause %p
3057 queue resume command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb queueresume %p
3059 print notify backchannel = yes
3061 ncalrpc dir = $prefix_abs/ncalrpc
3063 # The samba3.blackbox.smbclient_s3 test uses this to test that
3064 # sending messages works, and that the %m sub works.
3065 message command = mv %s $shrdir/message.%m
3067 # fsrvp server requires registry shares
3068 registry shares = yes
3070 # Used by RPC SRVSVC tests
3071 add share command = $bindir_abs/smbaddshare
3072 change share command = $bindir_abs/smbchangeshare
3073 delete share command = $bindir_abs/smbdeleteshare
3075 # fruit:copyfile is a global option
3076 fruit:copyfile = yes
3078 #this does not mean that we use non-secure test env,
3079 #it just means we ALLOW one to be configured.
3080 allow insecure wide links = yes
3082 # Begin extra options before global inject
3083 $extra_options_before_inject
3084 # End extra options befoore global inject
3086 include = $globalinjectconf
3088 # Begin extra options
3092 #Include user defined custom parameters if set
3095 if (defined($ENV{INCLUDE_CUSTOM_CONF})) {
3096 print CONF "\t$ENV{INCLUDE_CUSTOM_CONF}\n";
3101 path = $smbcacls_share
3102 comment = smb username is [%U]
3105 [smbcacls_sharedir_dfs]
3106 path = $smbcacls_sharedir_dfs
3107 comment = smb username is [%U]
3110 comment = smb username is [%U]
3113 comment = Load dirsort module
3114 vfs objects = dirsort acl_xattr fake_acls xattr_tdb streams_depot
3117 comment = encrypt smb username is [%U]
3118 server smb encrypt = required
3119 vfs objects = dirsort
3129 force user = $unix_name
3131 [forceuser_unixonly]
3132 comment = force a user with unix user SID and group SID
3134 force user = pdbtest
3136 [forceuser_wkngroup]
3137 comment = force a user with well-known group SID
3139 force user = pdbtest_wkn
3143 force group = nogroup
3149 path = $noperm_shrdir
3155 write list = $unix_name
3158 valid users = $unix_name
3159 access based share enum = yes
3161 path = $msdfs_shrdir
3163 msdfs shuffle referrals = yes
3166 path = $msdfs_shrdir
3171 path = $msdfs_shrdir2
3174 [msdfs-pathname-share]
3175 path = $msdfs_pathname_share
3178 [non-msdfs-pathname-share]
3179 path = $non_msdfs_pathname_share
3184 hide unreadable = yes
3187 case sensitive = yes
3190 hide unwriteable files = yes
3193 kernel share modes = no
3207 default devmode = no
3211 print command = $self->{srcdir}/source3/script/tests/printing/printing_var_exp_lpr_cmd.sh \"Windows user: %U\" \"UNIX user: %u\" \"Domain: %D\"
3218 comment = smb username is [%U]
3220 nfs4acl_xattr:version = 40
3221 vfs objects = nfs4acl_xattr xattr_tdb
3223 [nfs4acl_special_40]
3225 comment = smb username is [%U]
3227 nfs4acl_xattr:version = 40
3228 vfs objects = nfs4acl_xattr xattr_tdb
3232 comment = smb username is [%U]
3234 vfs objects = nfs4acl_xattr xattr_tdb
3238 comment = smb username is [%U]
3239 vfs objects = nfs4acl_xattr xattr_tdb
3241 nfs4acl_xattr:encoding = xdr
3242 nfs4acl_xattr:version = 40
3246 comment = smb username is [%U]
3247 vfs objects = nfs4acl_xattr xattr_tdb
3249 nfs4acl_xattr:encoding = xdr
3250 nfs4acl_xattr:version = 41
3254 comment = smb username is [%U]
3255 vfs objects = nfs4acl_xattr xattr_tdb
3257 nfs4acl_xattr:encoding = nfs
3258 nfs4acl_xattr:version = 40
3259 nfs4acl_xattr:xattr_name = security.nfs4acl_xdr
3263 comment = smb username is [%U]
3264 vfs objects = nfs4acl_xattr xattr_tdb
3266 nfs4acl_xattr:encoding = nfs
3267 nfs4acl_xattr:version = 41
3268 nfs4acl_xattr:xattr_name = security.nfs4acl_xdr
3272 comment = smb username is [%U]
3274 force create mode = 777
3277 comment = smb username is [%U]
3279 force create mode = 0
3280 directory mask = 0777
3281 force directory mode = 0
3282 vfs objects = xattr_tdb streams_depot
3284 vfs objects = fake_acls xattr_tdb streams_depot time_audit full_audit
3286 directory mask = 07777
3301 vfs objects = catia fruit streams_xattr acl_xattr xattr_tdb
3302 fruit:resource = file
3303 fruit:metadata = netatalk
3304 fruit:locking = netatalk
3305 fruit:encoding = native
3306 fruit:veto_appledouble = no
3310 # This is used by vfs.fruit tests that require real fs xattr
3311 vfs objects = catia fruit streams_xattr acl_xattr
3312 fruit:resource = file
3313 fruit:metadata = netatalk
3314 fruit:locking = netatalk
3315 fruit:encoding = native
3316 fruit:veto_appledouble = no
3318 [vfs_fruit_metadata_stream]
3320 vfs objects = fruit streams_xattr acl_xattr xattr_tdb
3321 fruit:resource = file
3322 fruit:metadata = stream
3323 fruit:veto_appledouble = no
3325 [vfs_fruit_stream_depot]
3327 vfs objects = fruit streams_depot acl_xattr xattr_tdb
3328 fruit:resource = stream
3329 fruit:metadata = stream
3330 fruit:veto_appledouble = no
3334 vfs objects = streams_xattr acl_xattr xattr_tdb
3336 [vfs_wo_fruit_stream_depot]
3338 vfs objects = streams_depot acl_xattr xattr_tdb
3340 [vfs_fruit_timemachine]
3342 vfs objects = fruit streams_xattr acl_xattr xattr_tdb
3343 fruit:resource = file
3344 fruit:metadata = stream
3345 fruit:time machine = yes
3346 fruit:time machine max size = 32K
3348 [vfs_fruit_wipe_intentionally_left_blank_rfork]
3350 vfs objects = fruit streams_xattr acl_xattr xattr_tdb
3351 fruit:resource = file
3352 fruit:metadata = stream
3353 fruit:wipe_intentionally_left_blank_rfork = true
3354 fruit:delete_empty_adfiles = false
3355 fruit:veto_appledouble = no
3357 [vfs_fruit_delete_empty_adfiles]
3359 vfs objects = fruit streams_xattr acl_xattr xattr_tdb
3360 fruit:resource = file
3361 fruit:metadata = stream
3362 fruit:wipe_intentionally_left_blank_rfork = true
3363 fruit:delete_empty_adfiles = true
3364 fruit:veto_appledouble = no
3366 [vfs_fruit_zero_fileid]
3368 vfs objects = fruit streams_xattr acl_xattr xattr_tdb
3369 fruit:resource = file
3370 fruit:metadata = stream
3371 fruit:zero_file_id=yes
3372 fruit:validate_afpinfo = no
3374 [fruit_resource_stream]
3375 path = $fruit_resource_stream_shrdir
3376 vfs objects = fruit streams_xattr acl_xattr xattr_tdb
3377 fruit:resource = stream
3378 fruit:metadata = stream
3381 path = $badnames_shrdir
3385 path = $manglenames_shrdir
3389 path = $shrdir/dynamic/%t
3391 root preexec = mkdir %P
3394 path = $widelinks_shrdir
3399 path = $fsrvp_shrdir
3400 comment = fake snapshots using rsync
3401 vfs objects = shell_snap shadow_copy2
3402 shell_snap:check path command = $fake_snap_pl --check
3403 shell_snap:create command = $fake_snap_pl --create
3404 shell_snap:delete command = $fake_snap_pl --delete
3405 # a relative path here fails, the snapshot dir is no longer found
3406 shadow:snapdir = $fsrvp_shrdir/.snapshots
3409 path = $shadow_shrdir
3410 comment = previous versions snapshots under mount point
3411 vfs objects = shadow_copy2
3412 shadow:mountpoint = $shadow_mntdir
3415 path = $shadow_shrdir
3416 comment = previous versions snapshots outside mount point
3417 vfs objects = shadow_copy2
3418 shadow:mountpoint = $shadow_mntdir
3419 shadow:snapdir = $shadow_tstdir/.snapshots
3422 path = $shadow_shrdir
3423 comment = previous versions with subvolume snapshots, snapshots under base dir
3424 vfs objects = shadow_copy2
3425 shadow:mountpoint = $shadow_mntdir
3426 shadow:basedir = $shadow_basedir
3427 shadow:snapdir = $shadow_basedir/.snapshots
3430 path = $shadow_shrdir
3431 comment = previous versions with subvolume snapshots, snapshots outside mount point
3432 vfs objects = shadow_copy2
3433 shadow:mountpoint = $shadow_mntdir
3434 shadow:basedir = $shadow_basedir
3435 shadow:snapdir = $shadow_tstdir/.snapshots
3438 path = $shadow_shrdir
3439 comment = previous versions at volume root snapshots under mount point
3440 vfs objects = shadow_copy2
3441 shadow:mountpoint = $shadow_shrdir
3444 path = $shadow_shrdir
3445 comment = previous versions at volume root snapshots outside mount point
3446 vfs objects = shadow_copy2
3447 shadow:mountpoint = $shadow_shrdir
3448 shadow:snapdir = $shadow_tstdir/.snapshots
3451 path = $shadow_shrdir
3452 comment = previous versions snapshots everywhere
3453 vfs objects = shadow_copy2
3454 shadow:mountpoint = $shadow_mntdir
3455 shadow:snapdirseverywhere = yes
3458 path = $shadow_shrdir
3459 comment = previous versions using snapsharepath
3460 vfs objects = shadow_copy2
3461 shadow:mountpoint = $shadow_mntdir
3462 shadow:snapdir = $shadow_tstdir/.snapshots
3463 shadow:snapsharepath = share
3466 comment = Testing shadow:format with default option
3467 vfs object = shadow_copy2
3468 path = $shadow_shrdir
3471 shadow:mountpoint = $shadow_mntdir
3472 shadow:basedir = $shadow_basedir
3473 shadow:snapdir = $shadow_basedir/.snapshots
3474 shadow:format = \@GMT-%Y.%m.%d-%H.%M.%S
3477 comment = Testing shadow:format with only date component
3478 vfs object = shadow_copy2
3479 path = $shadow_shrdir
3482 shadow:mountpoint = $shadow_mntdir
3483 shadow:basedir = $shadow_basedir
3484 shadow:snapdir = $shadow_basedir/.snapshots
3485 shadow:format = \@GMT-%Y-%m-%d
3488 comment = Testing shadow:format with some hardcoded prefix
3489 vfs object = shadow_copy2
3490 path = $shadow_shrdir
3493 shadow:mountpoint = $shadow_mntdir
3494 shadow:basedir = $shadow_basedir
3495 shadow:snapdir = $shadow_basedir/.snapshots
3496 shadow:format = snap\@GMT-%Y.%m.%d-%H.%M.%S
3499 comment = Testing shadow:format with modified format
3500 vfs object = shadow_copy2
3501 path = $shadow_shrdir
3504 shadow:mountpoint = $shadow_mntdir
3505 shadow:basedir = $shadow_basedir
3506 shadow:snapdir = $shadow_basedir/.snapshots
3507 shadow:format = \@GMT-%Y.%m.%d-%H_%M_%S-snap
3510 comment = Testing shadow:snapprefix regex
3511 vfs object = shadow_copy2
3512 path = $shadow_shrdir
3515 shadow:mountpoint = $shadow_mntdir
3516 shadow:basedir = $shadow_basedir
3517 shadow:snapdir = $shadow_basedir/.snapshots
3518 shadow:snapprefix = \^s[a-z]*p\$
3519 shadow:format = _GMT-%Y.%m.%d-%H.%M.%S
3522 comment = Testing shadow:snapprefix with delim regex
3523 vfs object = shadow_copy2
3524 path = $shadow_shrdir
3527 shadow:mountpoint = $shadow_mntdir
3528 shadow:basedir = $shadow_basedir
3529 shadow:snapdir = $shadow_basedir/.snapshots
3530 shadow:delimiter = \@GMT
3531 shadow:snapprefix = [a-z]*
3532 shadow:format = \@GMT-%Y.%m.%d-%H.%M.%S
3535 path = $shadow_shrdir
3536 comment = previous versions with wide links allowed
3537 vfs objects = shadow_copy2
3538 shadow:mountpoint = $shadow_mntdir
3542 path = $shadow_tstdir
3543 comment = previous versions snapshots under mount point
3544 vfs objects = shadow_copy2 streams_xattr
3545 shadow:mountpoint = $shadow_tstdir
3546 shadow:fixinodes = yes
3547 smbd async dosmode = yes
3550 path = $shadow_shrdir
3551 comment = previous versions with streams_depot
3552 vfs objects = streams_depot shadow_copy2
3555 path = $shrdir/dfree
3556 vfs objects = acl_xattr fake_acls xattr_tdb fake_dfq
3557 admin users = $unix_name
3558 include = $dfqconffile
3560 path = $shrdir/dfree
3561 vfs objects = acl_xattr fake_acls xattr_tdb fake_dfq
3562 admin users = $unix_name
3563 include = $dfqconffile
3564 dfree cache time = 60
3566 path = $shrdir/dfree
3567 vfs objects = acl_xattr fake_acls xattr_tdb fake_dfq
3569 include = $dfqconffile
3571 path = $shrdir/quota
3572 admin users = $unix_name
3574 [acl_xattr_ign_sysacl_posix]
3576 acl_xattr:ignore system acls = yes
3577 acl_xattr:default acl style = posix
3578 [acl_xattr_ign_sysacl_windows]
3580 acl_xattr:ignore system acls = yes
3581 acl_xattr:default acl style = windows
3585 mangled names = illegal
3589 path = $nosymlinks_shrdir
3590 follow symlinks = no
3591 [nosymlinks_smb1allow]
3593 follow symlinks = yes
3597 path = $local_symlinks_shrdir
3598 follow symlinks = yes
3604 worm:grace_period = 1
3605 comment = vfs_worm with 1s grace_period
3609 kernel oplocks = yes
3610 vfs objects = streams_xattr xattr_tdb
3614 vfs objects = streams_xattr xattr_tdb
3616 [streams_xattr_nostrict]
3619 vfs objects = streams_xattr xattr_tdb
3623 vfs objects = acl_xattr streams_xattr fake_acls xattr_tdb
3624 acl_xattr:ignore system acls = yes
3625 acl_xattr:security_acl_name = user.acl
3626 xattr_tdb:ignore_user_xattr = yes
3630 smbd:find async delay usec = 10000
3633 vfs objects = error_inject
3634 include = $errorinjectconf
3638 vfs objects = delay_inject
3639 kernel share modes = no
3642 include = $delayinjectconf
3646 vfs objects = delay_inject
3647 delay_inject:pread_send = 2000
3648 delay_inject:pwrite_send = 2000
3652 vfs objects = delay_inject
3653 delay_inject:brl_lock_windows = 90
3654 delay_inject:brl_lock_windows_use_timer = yes
3658 vfs objects = delay_inject
3659 delay_inject:brl_lock_windows = 90
3660 delay_inject:brl_lock_windows_use_timer = no
3663 path = $prefix_abs/share
3664 delete readonly = yes
3667 path = $prefix_abs/share
3669 server smb encrypt = desired
3672 path = $prefix_abs/share
3674 server smb encrypt = off
3678 honor change notify privilege = yes
3680 [acls_non_canonical]
3682 acl flag inherited canonicalization = no
3684 [full_audit_success_bad_name]
3686 full_audit:success = badname
3688 [full_audit_fail_bad_name]
3690 full_audit:failure = badname
3694 server addresses = $server_ipv6
3697 path = $smbget_sharedir
3698 comment = smb username is [%U]
3702 path = $recycle_shrdir
3703 vfs objects = recycle
3704 recycle : repository = .trash
3705 recycle : exclude = *.tmp
3706 recycle : directory_mode = 755
3708 [fakedircreatetimes]
3710 path = $fakedircreatetimes_shrdir
3711 fake directory create times = yes
3714 path = $smbget_sharedir
3715 comment = smb username is [%U]
3718 include = $aliceconfdir/%U.conf
3723 my $net = Samba::bindir_path($self, "net");
3725 $cmd .= "UID_WRAPPER_ROOT=1 ";
3726 $cmd .= "SMB_CONF_PATH=\"$conffile\" ";
3727 $cmd .= "$net setlocalsid $samsid";
3729 my $net_ret = system($cmd);
3730 if ($net_ret != 0) {
3731 warn("net setlocalsid failed: $net_ret\n$cmd");
3735 unless (open(ERRORCONF, ">$errorinjectconf")) {
3736 warn("Unable to open $errorinjectconf");
3741 unless (open(DELAYCONF, ">$delayinjectconf")) {
3742 warn("Unable to open $delayinjectconf");
3747 unless (open(DFQCONF, ">$dfqconffile")) {
3748 warn("Unable to open $dfqconffile");
3753 unless (open(DELAYCONF, ">$globalinjectconf")) {
3754 warn("Unable to open $globalinjectconf");
3759 unless (open(ALICECONF, ">$aliceconffile")) {
3760 warn("Unable to open $aliceconffile");
3767 comment = smb username is [%U]
3773 ## create a test account
3776 unless (open(PASSWD, ">$nss_wrapper_passwd")) {
3777 warn("Unable to open $nss_wrapper_passwd");
3780 print PASSWD "nobody:x:$uid_nobody:$gid_nobody:nobody gecos:$prefix_abs:/bin/false
3781 $unix_name:x:$unix_uid:$unix_gids[0]:$unix_name gecos:$prefix_abs:/bin/false
3782 pdbtest:x:$uid_pdbtest:$gid_nogroup:pdbtest gecos:$prefix_abs:/bin/false
3783 pdbtest2:x:$uid_pdbtest2:$gid_nogroup:pdbtest gecos:$prefix_abs:/bin/false
3784 userdup:x:$uid_userdup:$gid_userdup:userdup gecos:$prefix_abs:/bin/false
3785 pdbtest_wkn:x:$uid_pdbtest_wkn:$gid_everyone:pdbtest_wkn gecos:$prefix_abs:/bin/false
3786 force_user:x:$uid_force_user:$gid_force_user:force user gecos:$prefix_abs:/bin/false
3787 smbget_user:x:$uid_smbget:$gid_domusers:smbget_user gecos:$prefix_abs:/bin/false
3788 user1:x:$uid_user1:$gid_nogroup:user1 gecos:$prefix_abs:/bin/false
3789 user2:x:$uid_user2:$gid_nogroup:user2 gecos:$prefix_abs:/bin/false
3790 gooduser:x:$uid_gooduser:$gid_domusers:gooduser gecos:$prefix_abs:/bin/false
3791 eviluser:x:$uid_eviluser:$gid_domusers:eviluser gecos::/bin/false
3792 slashuser:x:$uid_slashuser:$gid_domusers:slashuser gecos:/:/bin/false
3793 bob:x:$uid_localbob:$gid_domusers:localbob gecos:/:/bin/false
3794 jane:x:$uid_localjane:$gid_domusers:localjane gecos:/:/bin/false
3795 jackthemapper:x:$uid_localjackthemapper:$gid_domusers:localjackthemaper gecos:/:/bin/false
3796 jacknomapper:x:$uid_localjacknomapper:$gid_domusers:localjacknomaper gecos:/:/bin/false
3798 if ($unix_uid != 0) {
3799 print PASSWD "root:x:$uid_root:$gid_root:root gecos:$prefix_abs:/bin/false
3804 unless (open(GROUP, ">$nss_wrapper_group")) {
3805 warn("Unable to open $nss_wrapper_group");
3808 print GROUP "nobody:x:$gid_nobody:
3809 nogroup:x:$gid_nogroup:nobody
3810 $unix_name-group:x:$unix_gids[0]:
3811 domusers:X:$gid_domusers:
3812 domadmins:X:$gid_domadmins:
3813 userdup:x:$gid_userdup:$unix_name
3814 everyone:x:$gid_everyone:
3815 force_user:x:$gid_force_user:
3816 jackthemappergroup:x:$gid_jackthemapper:jackthemapper
3817 jacknomappergroup:x:$gid_jacknomapper:jacknomapper
3818 group1:x:$gid_group1:user1
3819 group2:x:$gid_group2:user2
3821 if ($unix_gids[0] != 0) {
3822 print GROUP "root:x:$gid_root:
3829 my $hostname = lc($server);
3830 unless (open(HOSTS, ">>$nss_wrapper_hosts")) {
3831 warn("Unable to open $nss_wrapper_hosts");
3834 print HOSTS "${server_ip} ${hostname}.${dns_domain} ${hostname}\n";
3835 print HOSTS "${server_ipv6} ${hostname}.${dns_domain} ${hostname}\n";
3838 $resolv_conf = "$privatedir/no_resolv.conf" unless defined($resolv_conf);
3840 foreach my $evlog (@eventlog_list) {
3841 my $evlogtdb = "$eventlogdir/$evlog.tdb";
3842 open(EVENTLOG, ">$evlogtdb") or die("Unable to open $evlogtdb");
3846 $createuser_env{NSS_WRAPPER_PASSWD} = $nss_wrapper_passwd;
3847 $createuser_env{NSS_WRAPPER_GROUP} = $nss_wrapper_group;
3848 $createuser_env{NSS_WRAPPER_HOSTS} = $nss_wrapper_hosts;
3849 $createuser_env{NSS_WRAPPER_HOSTNAME} = "${hostname}.${dns_domain}";
3850 if ($ENV{SAMBA_DNS_FAKING}) {
3851 $createuser_env{RESOLV_WRAPPER_HOSTS} = $dns_host_file;
3853 $createuser_env{RESOLV_WRAPPER_CONF} = $resolv_conf;
3855 $createuser_env{RESOLV_CONF} = $resolv_conf;
3857 createuser($self, $unix_name, $password, $conffile, \%createuser_env) || die("Unable to create user");
3858 createuser($self, "force_user", $password, $conffile, \%createuser_env) || die("Unable to create force_user");
3859 createuser($self, "smbget_user", $password, $conffile, \%createuser_env) || die("Unable to create smbget_user");
3860 createuser($self, "user1", $password, $conffile, \%createuser_env) || die("Unable to create user1");
3861 createuser($self, "user2", $password, $conffile, \%createuser_env) || die("Unable to create user2");
3862 createuser($self, "gooduser", $password, $conffile, \%createuser_env) || die("Unable to create gooduser");
3863 createuser($self, "eviluser", $password, $conffile, \%createuser_env) || die("Unable to create eviluser");
3864 createuser($self, "slashuser", $password, $conffile, \%createuser_env) || die("Unable to create slashuser");
3865 createuser($self, "jackthemapper", "mApsEcrEt", $conffile, \%createuser_env) || die("Unable to create jackthemapper");
3866 createuser($self, "jacknomapper", "nOmApsEcrEt", $conffile, \%createuser_env) || die("Unable to create jacknomapper");
3868 open(DNS_UPDATE_LIST, ">$prefix/dns_update_list") or die("Unable to open $$prefix/dns_update_list");
3869 print DNS_UPDATE_LIST "A $server. $server_ip\n";
3870 print DNS_UPDATE_LIST "AAAA $server. $server_ipv6\n";
3871 close(DNS_UPDATE_LIST);
3875 $ret{SERVER_IP} = $server_ip;
3876 $ret{SERVER_IPV6} = $server_ipv6;
3877 $ret{SAMBA_DCERPCD_TEST_LOG} = "$prefix/samba_dcerpcd_test.log";
3878 $ret{SAMBA_DCERPCD_LOG_POS} = 0;
3879 $ret{NMBD_TEST_LOG} = "$prefix/nmbd_test.log";
3880 $ret{NMBD_TEST_LOG_POS} = 0;
3881 $ret{WINBINDD_TEST_LOG} = "$prefix/winbindd_test.log";
3882 $ret{WINBINDD_TEST_LOG_POS} = 0;
3883 $ret{SMBD_TEST_LOG} = "$prefix/smbd_test.log";
3884 $ret{SMBD_TEST_LOG_POS} = 0;
3885 $ret{SERVERCONFFILE} = $conffile;
3886 $ret{TESTENV_DIR} = $prefix_abs;
3887 $ret{CONFIGURATION} ="--configfile=$conffile";
3888 $ret{LOCK_DIR} = $lockdir;
3889 $ret{SERVER} = $server;
3890 $ret{USERNAME} = $unix_name;
3891 $ret{USERID} = $unix_uid;
3892 $ret{DOMAIN} = $domain;
3893 $ret{SAMSID} = $samsid;
3894 $ret{NETBIOSNAME} = $netbios_name;
3895 $ret{PASSWORD} = $password;
3896 $ret{PIDDIR} = $piddir;
3897 $ret{SELFTEST_WINBINDD_SOCKET_DIR} = $wbsockdir;
3898 $ret{NMBD_SOCKET_DIR} = $nmbdsockdir;
3899 $ret{SOCKET_WRAPPER_DEFAULT_IFACE} = $swiface;
3900 $ret{NSS_WRAPPER_PASSWD} = $nss_wrapper_passwd;
3901 $ret{NSS_WRAPPER_GROUP} = $nss_wrapper_group;
3902 $ret{NSS_WRAPPER_HOSTS} = $nss_wrapper_hosts;
3903 $ret{NSS_WRAPPER_HOSTNAME} = "${hostname}.${dns_domain}";
3904 $ret{NSS_WRAPPER_MODULE_SO_PATH} = Samba::nss_wrapper_winbind_so_path($self);
3905 $ret{NSS_WRAPPER_MODULE_FN_PREFIX} = "winbind";
3906 if ($ENV{SAMBA_DNS_FAKING}) {
3907 $ret{RESOLV_WRAPPER_HOSTS} = $dns_host_file;
3909 $ret{RESOLV_WRAPPER_CONF} = $resolv_conf;
3911 $ret{RESOLV_CONF} = $resolv_conf;
3912 $ret{LOCAL_PATH} = "$shrdir";
3913 $ret{LOGDIR} = $logdir;
3916 # Avoid hitting system krb5.conf -
3917 # An env that needs Kerberos will reset this to the real
3920 $ret{KRB5_CONFIG} = abs_path($prefix) . "/no_krb5.conf";
3922 # Define KRB5CCNAME for each environment we set up
3923 $ret{KRB5_CCACHE} = abs_path($prefix) . "/krb5ccache";
3924 $ENV{KRB5CCNAME} = $ret{KRB5_CCACHE};
3929 sub wait_for_start($$$$$)
3931 my ($self, $envvars, $nmbd, $winbindd, $smbd, $samba_dcerpcd) = @_;
3936 if ($samba_dcerpcd eq "yes") {
3938 my $rpcclient = Samba::bindir_path($self, "rpcclient");
3940 print "checking for samba_dcerpcd\n";
3943 $ret = system("UID_WRAPPER_ROOT=1 $rpcclient $envvars->{CONFIGURATION} ncalrpc: -c epmmap");
3949 } while ($ret != 0 && $count < 10);
3952 print "samba_dcerpcd not reachable after 10 retries\n";
3953 teardown_env($self, $envvars);
3958 if ($nmbd eq "yes") {
3961 # give time for nbt server to register its names
3962 print "checking for nmbd\n";
3964 # This will return quickly when things are up, but be slow if we need to wait for (eg) SSL init
3965 my $nmblookup = Samba::bindir_path($self, "nmblookup");
3968 $ret = system("$nmblookup $envvars->{CONFIGURATION} $envvars->{SERVER}");
3972 system("$nmblookup $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} __SAMBA__");
3973 system("$nmblookup $envvars->{CONFIGURATION} __SAMBA__");
3974 system("$nmblookup $envvars->{CONFIGURATION} -U 10.255.255.255 __SAMBA__");
3975 system("$nmblookup $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} $envvars->{SERVER}");
3978 } while ($ret != 0 && $count < 10);
3980 print "NMBD not reachable after 10 retries\n";
3981 teardown_env($self, $envvars);
3986 if ($winbindd eq "yes" or $winbindd eq "offline") {
3987 print "checking for winbindd\n";
3989 $cmd = "SELFTEST_WINBINDD_SOCKET_DIR='$envvars->{SELFTEST_WINBINDD_SOCKET_DIR}' ";
3990 $cmd .= "NSS_WRAPPER_PASSWD='$envvars->{NSS_WRAPPER_PASSWD}' ";
3991 $cmd .= "NSS_WRAPPER_GROUP='$envvars->{NSS_WRAPPER_GROUP}' ";
3992 if ($winbindd eq "yes") {
3993 $cmd .= Samba::bindir_path($self, "wbinfo") . " --ping-dc";
3994 } elsif ($winbindd eq "offline") {
3995 $cmd .= Samba::bindir_path($self, "wbinfo") . " --ping";
3999 $ret = system($cmd);
4004 } while ($ret != 0 && $count < 20);
4006 print "WINBINDD not reachable after 20 seconds\n";
4007 teardown_env($self, $envvars);
4012 if ($smbd eq "yes") {
4013 # make sure smbd is also up set
4014 print "wait for smbd\n";
4018 if (defined($envvars->{GNUTLS_FORCE_FIPS_MODE})) {
4019 # We don't have NTLM in FIPS mode, so lets use
4020 # smbcontrol instead of smbclient.
4021 $cmd = Samba::bindir_path($self, "smbcontrol");
4022 $cmd .= " $envvars->{CONFIGURATION}";
4023 $cmd .= " smbd ping";
4025 # This uses NTLM which is not available in FIPS
4026 $cmd = "NSS_WRAPPER_HOSTS='$envvars->{NSS_WRAPPER_HOSTS}' ";
4027 $cmd .= Samba::bindir_path($self, "smbclient");
4028 $cmd .= " $envvars->{CONFIGURATION}";
4029 $cmd .= " -L $envvars->{SERVER}";
4031 $cmd .= " -I $envvars->{SERVER_IP}";
4036 $ret = system($cmd);
4041 } while ($ret != 0 && $count < 20);
4043 print "SMBD failed to start up in a reasonable time (20sec)\n";
4044 teardown_env($self, $envvars);
4049 # Ensure we have domain users mapped.
4050 $netcmd = "NSS_WRAPPER_PASSWD='$envvars->{NSS_WRAPPER_PASSWD}' ";
4051 $netcmd .= "NSS_WRAPPER_GROUP='$envvars->{NSS_WRAPPER_GROUP}' ";
4052 $netcmd .= "UID_WRAPPER_ROOT='1' ";
4053 $netcmd .= Samba::bindir_path($self, "net") ." $envvars->{CONFIGURATION} ";
4055 $cmd = $netcmd . "groupmap add rid=513 unixgroup=domusers type=domain";
4056 $ret = system($cmd);
4058 print("\"$cmd\" failed\n");
4062 $cmd = $netcmd . "groupmap add rid=512 unixgroup=domadmins type=domain";
4063 $ret = system($cmd);
4065 print("\"$cmd\" failed\n");
4069 $cmd = $netcmd . "groupmap add sid=S-1-1-0 unixgroup=everyone type=builtin";
4070 $ret = system($cmd);
4072 print("\"$cmd\" failed\n");
4076 $cmd = $netcmd . "groupmap add unixgroup=group1 type=domain";
4077 $ret = system($cmd);
4079 print("\"$cmd\" failed\n");
4083 $cmd = $netcmd . "groupmap add unixgroup=group2 type=domain";
4084 $ret = system($cmd);
4086 print("\"$cmd\" failed\n");
4090 # note: creating builtin groups requires winbindd for the
4092 my $create_builtin_users = "no";
4093 if ($winbindd eq "yes") {
4094 $cmd = "SELFTEST_WINBINDD_SOCKET_DIR='$envvars->{SELFTEST_WINBINDD_SOCKET_DIR}' ";
4095 $cmd .= "NSS_WRAPPER_PASSWD='$envvars->{NSS_WRAPPER_PASSWD}' ";
4096 $cmd .= "NSS_WRAPPER_GROUP='$envvars->{NSS_WRAPPER_GROUP}' ";
4097 $cmd .= Samba::bindir_path($self, "wbinfo") . " --sid-to-gid=S-1-5-32-545";
4098 my $wbinfo_out = qx($cmd 2>&1);
4100 # wbinfo doesn't give us a better error code then
4101 # WBC_ERR_DOMAIN_NOT_FOUND, but at least that's
4102 # different then WBC_ERR_WINBIND_NOT_AVAILABLE
4103 if ($wbinfo_out !~ /WBC_ERR_DOMAIN_NOT_FOUND/) {
4104 print("Failed to run \"wbinfo --sid-to-gid=S-1-5-32-545\": $wbinfo_out");
4105 teardown_env($self, $envvars);
4108 $create_builtin_users = "yes";
4111 if ($create_builtin_users eq "yes") {
4112 $cmd = "SELFTEST_WINBINDD_SOCKET_DIR='$envvars->{SELFTEST_WINBINDD_SOCKET_DIR}' ";
4113 $cmd .= "NSS_WRAPPER_PASSWD='$envvars->{NSS_WRAPPER_PASSWD}' ";
4114 $cmd .= "NSS_WRAPPER_GROUP='$envvars->{NSS_WRAPPER_GROUP}' ";
4115 $cmd .= Samba::bindir_path($self, "net") . " $envvars->{CONFIGURATION} ";
4116 $cmd .= "sam createbuiltingroup Users";
4117 $ret = system($cmd);
4119 print "Failed to create BUILTIN\\Users group\n";
4120 teardown_env($self, $envvars);
4124 $cmd = Samba::bindir_path($self, "net") . " $envvars->{CONFIGURATION} ";
4125 $cmd .= "cache del IDMAP/SID2XID/S-1-5-32-545";
4128 $cmd = "SELFTEST_WINBINDD_SOCKET_DIR='$envvars->{SELFTEST_WINBINDD_SOCKET_DIR}' ";
4129 $cmd .= "NSS_WRAPPER_PASSWD='$envvars->{NSS_WRAPPER_PASSWD}' ";
4130 $cmd .= "NSS_WRAPPER_GROUP='$envvars->{NSS_WRAPPER_GROUP}' ";
4131 $cmd .= Samba::bindir_path($self, "wbinfo") . " --sid-to-gid=S-1-5-32-545";
4132 $ret = system($cmd);
4134 print "Missing \"BUILTIN\\Users\", did net sam createbuiltingroup Users fail?\n";
4135 teardown_env($self, $envvars);
4140 print $self->getlog_env($envvars);
4146 ## provision and start of ctdb
4150 my ($self, $prefix) = @_;
4153 my $data = $self->provision_ctdb($prefix, $num_nodes);
4154 $data or return undef;
4156 my $rc = $self->check_or_start_ctdb($data);
4158 print("check_or_start_ctdb() failed\n");
4162 $rc = $self->wait_for_start_ctdb($data);
4164 print "Cluster startup failed\n";
4171 sub provision_ctdb($$$$)
4173 my ($self, $prefix, $num_nodes) = @_;
4176 print "PROVISIONING CTDB...\n";
4178 my $prefix_abs = abs_path($prefix);
4181 # check / create directories:
4183 die ("prefix_abs = ''") if $prefix_abs eq "";
4184 die ("prefix_abs = '/'") if $prefix_abs eq "/";
4186 mkdir ($prefix_abs, 0777);
4188 print "CREATE CTDB TEST ENVIRONMENT in '$prefix_abs'...\n";
4189 system("rm -rf $prefix_abs/*");
4195 for (my $i = 0; $i < $num_nodes; $i++) {
4197 my $server_name = "ctdb${i}";
4198 my $pub_iface = Samba::get_interface($server_name);
4199 my $ip = Samba::get_ipv4_addr($server_name);
4201 $node{NODE_NUMBER} = "$i";
4202 $node{SERVER_NAME} = "$server_name";
4203 $node{SOCKET_WRAPPER_DEFAULT_IFACE} = "$pub_iface";
4206 push(@nodes, \%node);
4212 my $nodes_file = "$prefix/nodes.in";
4213 unless (open(NODES, ">$nodes_file")) {
4214 warn("Unable to open nodesfile '$nodes_file'");
4217 for (my $i = 0; $i < $num_nodes; $i++) {
4218 my $ip = $nodes[$i]->{IP};
4219 print NODES "${ip}\n";
4224 # local_daemons.sh setup
4226 # Socket wrapper setup is done by selftest.pl, so don't use
4227 # the CTDB-specific setup
4230 $cmd .= "ctdb/tests/local_daemons.sh " . $prefix_abs . " setup";
4231 $cmd .= " -n " . $num_nodes;
4232 $cmd .= " -N " . $nodes_file;
4233 # CTDB should not attempt to manage public addresses -
4234 # clients should just connect to CTDB private addresses
4235 $cmd .= " -P " . "/dev/null";
4237 my $ret = system($cmd);
4239 print("\"$cmd\" failed\n");
4244 # Unix domain socket and node directory for each daemon
4246 for (my $i = 0; $i < $num_nodes; $i++) {
4247 my ($cmd, $ret, $out);
4249 my $cmd_prefix = "ctdb/tests/local_daemons.sh ${prefix_abs}";
4255 $cmd = "${cmd_prefix} print-socket ${i}";
4260 print("\"$cmd\" failed\n");
4264 $nodes[$i]->{SOCKET_FILE} = "$out";
4270 $cmd = "${cmd_prefix} onnode ${i} 'echo \$CTDB_BASE'";
4275 print("\"$cmd\" failed\n");
4279 $nodes[$i]->{NODE_PREFIX} = "$out";
4284 $ret{CTDB_PREFIX} = "$prefix";
4285 $ret{NUM_NODES} = $num_nodes;
4286 $ret{CTDB_NODES} = \@nodes;
4287 $ret{CTDB_NODES_FILE} = $nodes_file;
4289 for (my $i = 0; $i < $num_nodes; $i++) {
4290 my $node = $nodes[$i];
4291 my $socket = $node->{SOCKET_FILE};
4292 my $server_name = $node->{SERVER_NAME};
4293 my $node_prefix = $node->{NODE_PREFIX};
4294 my $ip = $node->{IP};
4296 $ret{"CTDB_BASE_NODE${i}"} = $node_prefix;
4297 $ret{"CTDB_SOCKET_NODE${i}"} = $socket;
4298 $ret{"CTDB_SERVER_NAME_NODE${i}"} = $server_name;
4299 $ret{"CTDB_IFACE_IP_NODE${i}"} = $ip;
4302 $ret{CTDB_BASE} = $ret{CTDB_BASE_NODE0};
4303 $ret{CTDB_SOCKET} = $ret{CTDB_SOCKET_NODE0};
4304 $ret{CTDB_SERVER_NAME} = $ret{CTDB_SERVER_NAME_NODE0};
4305 $ret{CTDB_IFACE_IP} = $ret{CTDB_IFACE_IP_NODE0};
4310 sub check_or_start_ctdb($$) {
4311 my ($self, $data) = @_;
4313 my $prefix = $data->{CTDB_PREFIX};
4314 my $num_nodes = $data->{NUM_NODES};
4315 my $nodes = $data->{CTDB_NODES};
4318 # Share a single stdin pipe for all nodes
4319 pipe($STDIN_READER, $data->{CTDB_STDIN_PIPE});
4321 for (my $i = 0; $i < $num_nodes; $i++) {
4322 my $node = $nodes->[$i];
4324 $node->{STDIN_PIPE} = $data->{CTDB_STDIN_PIPE};
4326 my $cmd = "ctdb/tests/local_daemons.sh";
4327 my @full_cmd = ("$cmd", "$prefix", "start", "$i");
4330 BINARY_PATH => $cmd,
4331 FULL_CMD => [ @full_cmd ],
4333 LOG_FILE => "/dev/null",
4337 print "STARTING CTDBD (node ${i})\n";
4339 # This does magic with $STDIN_READER, so use it
4340 my $ret = Samba::fork_and_exec($self,
4346 print("\"$cmd\" failed\n");
4347 teardown_env_ctdb($self, $data);
4352 close($STDIN_READER);
4357 sub wait_for_start_ctdb($$)
4359 my ($self, $data) = @_;
4361 my $prefix = $data->{CTDB_PREFIX};
4363 print "Wait for ctdbd...\n";
4365 my $ctdb = Samba::bindir_path($self, "ctdb");
4367 $cmd .= "ctdb/tests/local_daemons.sh ${prefix} onnode all";
4368 $cmd .= " ${ctdb} nodestatus all 2>&1";
4371 my $wait_seconds = 60;
4374 until ($count > $wait_seconds) {
4378 print "\ncluster became healthy\n";
4381 print "Waiting for CTDB...\n";
4386 if ($count > $wait_seconds) {
4387 print "\nGiving up to wait for CTDB...\n";
4389 print "CTDB log:\n";
4390 $cmd = "ctdb/tests/local_daemons.sh ${prefix} print-log all >&2";
4392 teardown_env_ctdb($self, $data);
4396 print "\nCTDB initialized\n";