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.
10 use FindBin
qw($RealBin);
17 my $smbd_build_options = Samba::bindir_path($self, "smbd") . " -b|";
18 open(IN, $smbd_build_options) or die("Unable to run $smbd_build_options: $!");
27 # If we were not built with ADS support, pretend we were never even available
28 print "smbd does not have ADS support\n" unless $found_ads;
32 # return smb.conf parameters applicable to @path, based on the underlying
34 sub get_fs_specific_conf($$)
36 my ($self, $path) = @_;
38 my $stat_out = `stat --file-system $path` or return "";
40 if ($stat_out =~ m/Type:\s+btrfs/) {
45 return "vfs objects = $mods";
52 my ($classname, $bindir, $binary_mapping, $srcdir, $server_maxtime) = @_;
53 my $self = { vars => {},
55 binary_mapping => $binary_mapping,
57 server_maxtime => $server_maxtime
65 my ($self, $envvars) = @_;
68 # This should cause smbd to terminate gracefully
69 close($envvars->{STDIN_PIPE});
71 my $smbdpid = $envvars->{SMBD_TL_PID};
72 my $nmbdpid = $envvars->{NMBD_TL_PID};
73 my $winbinddpid = $envvars->{WINBINDD_TL_PID};
75 # This should give it time to write out the gcov data
77 my $smbdchild = Samba::cleanup_child($smbdpid, "smbd");
78 my $nmbdchild = Samba::cleanup_child($nmbdpid, "nmbd");
79 my $winbinddchild = Samba::cleanup_child($winbinddpid, "winbindd");
82 && $winbinddchild == -1) {
89 if ($count <= 20 && kill(0, $smbdpid, $nmbdpid, $winbinddpid) == 0) {
93 $self->stop_sig_term($smbdpid);
94 $self->stop_sig_term($nmbdpid);
95 $self->stop_sig_term($winbinddpid);
99 my $smbdchild = Samba::cleanup_child($smbdpid, "smbd");
100 my $nmbdchild = Samba::cleanup_child($nmbdpid, "nmbd");
101 my $winbinddchild = Samba::cleanup_child($winbinddpid, "winbindd");
104 && $winbinddchild == -1) {
111 if ($count <= 10 && kill(0, $smbdpid, $nmbdpid, $winbinddpid) == 0) {
115 warn("timelimit process did not quit on SIGTERM, sending SIGKILL");
116 $self->stop_sig_kill($smbdpid);
117 $self->stop_sig_kill($nmbdpid);
118 $self->stop_sig_kill($winbinddpid);
123 sub getlog_env_app($$$)
125 my ($self, $envvars, $name) = @_;
127 my $title = "$name LOG of: $envvars->{NETBIOSNAME}\n";
130 open(LOG, "<".$envvars->{$name."_TEST_LOG"});
132 seek(LOG, $envvars->{$name."_TEST_LOG_POS"}, SEEK_SET);
136 $envvars->{$name."_TEST_LOG_POS"} = tell(LOG);
139 return "" if $out eq $title;
146 my ($self, $envvars) = @_;
149 $ret .= $self->getlog_env_app($envvars, "SMBD");
150 $ret .= $self->getlog_env_app($envvars, "NMBD");
151 $ret .= $self->getlog_env_app($envvars, "WINBINDD");
158 my ($self, $envvars) = @_;
160 my $childpid = waitpid(-1, WNOHANG);
168 my ($self, $envname, $path) = @_;
170 $ENV{ENVNAME} = $envname;
172 if (defined($self->{vars}->{$envname})) {
173 return $self->{vars}->{$envname};
176 if ($envname eq "s3dc") {
177 return $self->setup_s3dc("$path/s3dc");
178 } elsif ($envname eq "simpleserver") {
179 return $self->setup_simpleserver("$path/simpleserver");
180 } elsif ($envname eq "maptoguest") {
181 return $self->setup_maptoguest("$path/maptoguest");
182 } elsif ($envname eq "ktest") {
183 return $self->setup_ktest("$path/ktest");
184 } elsif ($envname eq "member") {
185 if (not defined($self->{vars}->{s3dc})) {
186 if (not defined($self->setup_s3dc("$path/s3dc"))) {
190 return $self->setup_member("$path/member", $self->{vars}->{s3dc});
198 my ($self, $path) = @_;
200 print "PROVISIONING S3DC...";
207 rpc_server:epmapper = external
208 rpc_server:spoolss = external
209 rpc_server:lsarpc = external
210 rpc_server:samr = external
211 rpc_server:netlogon = external
212 rpc_server:register_embedded_np = yes
214 rpc_daemon:epmd = fork
215 rpc_daemon:spoolssd = fork
216 rpc_daemon:lsasd = fork
219 my $vars = $self->provision($path,
224 $vars or return undef;
226 if (not $self->check_or_start($vars, "yes", "yes", "yes")) {
230 $vars->{DC_SERVER} = $vars->{SERVER};
231 $vars->{DC_SERVER_IP} = $vars->{SERVER_IP};
232 $vars->{DC_SERVER_IPV6} = $vars->{SERVER_IPV6};
233 $vars->{DC_NETBIOSNAME} = $vars->{NETBIOSNAME};
234 $vars->{DC_USERNAME} = $vars->{USERNAME};
235 $vars->{DC_PASSWORD} = $vars->{PASSWORD};
237 $self->{vars}->{s3dc} = $vars;
242 sub setup_member($$$)
244 my ($self, $prefix, $s3dcvars) = @_;
248 print "PROVISIONING MEMBER...";
250 my $member_options = "
253 dbwrap_tdb_mutexes:* = yes
255 my $ret = $self->provision($prefix,
260 $ret or return undef;
262 my $nmblookup = Samba::bindir_path($self, "nmblookup");
264 print "Waiting for the LOGON SERVER registration ...\n";
265 $rc = system("$nmblookup $ret->{CONFIGURATION} $ret->{DOMAIN}\#1c");
270 } while ($rc != 0 && $count < 10);
272 print "NMBD not reachable after 10 retries\n";
273 teardown_env($self, $ret);
277 my $net = Samba::bindir_path($self, "net");
279 $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
280 $cmd .= "$net join $ret->{CONFIGURATION} $s3dcvars->{DOMAIN} member";
281 $cmd .= " -U$s3dcvars->{USERNAME}\%$s3dcvars->{PASSWORD}";
283 if (system($cmd) != 0) {
284 warn("Join failed\n$cmd");
288 if (not $self->check_or_start($ret, "yes", "yes", "yes")) {
292 $ret->{DC_SERVER} = $s3dcvars->{SERVER};
293 $ret->{DC_SERVER_IP} = $s3dcvars->{SERVER_IP};
294 $ret->{DC_SERVER_IPV6} = $s3dcvars->{SERVER_IPV6};
295 $ret->{DC_NETBIOSNAME} = $s3dcvars->{NETBIOSNAME};
296 $ret->{DC_USERNAME} = $s3dcvars->{USERNAME};
297 $ret->{DC_PASSWORD} = $s3dcvars->{PASSWORD};
302 sub setup_admember($$$$)
304 my ($self, $prefix, $dcvars) = @_;
306 # If we didn't build with ADS, pretend this env was never available
307 if (not $self->have_ads()) {
311 print "PROVISIONING S3 AD MEMBER...";
313 my $member_options = "
316 workgroup = $dcvars->{DOMAIN}
317 realm = $dcvars->{REALM}
320 my $ret = $self->provision($prefix,
324 $dcvars->{SERVER_IP},
325 $dcvars->{SERVER_IPV6});
327 $ret or return undef;
330 $ret->{DOMAIN} = $dcvars->{DOMAIN};
331 $ret->{REALM} = $dcvars->{REALM};
334 my $prefix_abs = abs_path($prefix);
336 $ctx->{krb5_conf} = "$prefix_abs/lib/krb5.conf";
337 $ctx->{domain} = $dcvars->{DOMAIN};
338 $ctx->{realm} = $dcvars->{REALM};
339 $ctx->{dnsname} = lc($dcvars->{REALM});
340 $ctx->{kdc_ipv4} = $dcvars->{SERVER_IP};
341 $ctx->{kdc_ipv6} = $dcvars->{SERVER_IPV6};
342 Samba::mk_krb5_conf($ctx, "");
344 $ret->{KRB5_CONFIG} = $ctx->{krb5_conf};
346 my $net = Samba::bindir_path($self, "net");
348 $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
349 if (defined($ret->{RESOLV_WRAPPER_CONF})) {
350 $cmd .= "RESOLV_WRAPPER_CONF=\"$ret->{RESOLV_WRAPPER_CONF}\" ";
352 $cmd .= "RESOLV_WRAPPER_HOSTS=\"$ret->{RESOLV_WRAPPER_HOSTS}\" ";
354 $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
355 $cmd .= "$net join $ret->{CONFIGURATION}";
356 $cmd .= " -U$dcvars->{USERNAME}\%$dcvars->{PASSWORD}";
358 if (system($cmd) != 0) {
359 warn("Join failed\n$cmd");
363 # We need world access to this share, as otherwise the domain
364 # administrator from the AD domain provided by Samba4 can't
365 # access the share for tests.
366 chmod 0777, "$prefix/share";
368 if (not $self->check_or_start($ret, "yes", "yes", "yes")) {
372 $ret->{DC_SERVER} = $dcvars->{SERVER};
373 $ret->{DC_SERVER_IP} = $dcvars->{SERVER_IP};
374 $ret->{DC_SERVER_IPV6} = $dcvars->{SERVER_IPV6};
375 $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME};
376 $ret->{DC_USERNAME} = $dcvars->{USERNAME};
377 $ret->{DC_PASSWORD} = $dcvars->{PASSWORD};
379 # Special case, this is called from Samba4.pm but needs to use the Samba3 check_env and get_log_env
380 $ret->{target} = $self;
385 sub setup_admember_rfc2307($$$$)
387 my ($self, $prefix, $dcvars) = @_;
389 # If we didn't build with ADS, pretend this env was never available
390 if (not $self->have_ads()) {
394 print "PROVISIONING S3 AD MEMBER WITH idmap_rfc2307 config...";
396 my $member_options = "
399 workgroup = $dcvars->{DOMAIN}
400 realm = $dcvars->{REALM}
401 idmap config $dcvars->{DOMAIN} : backend = rfc2307
402 idmap config $dcvars->{DOMAIN} : range = 2000000-2999999
403 idmap config $dcvars->{DOMAIN} : ldap_server = ad
404 idmap config $dcvars->{DOMAIN} : bind_path_user = ou=idmap,dc=samba,dc=example,dc=com
405 idmap config $dcvars->{DOMAIN} : bind_path_group = ou=idmap,dc=samba,dc=example,dc=com
408 my $ret = $self->provision($prefix,
412 $dcvars->{SERVER_IP},
413 $dcvars->{SERVER_IPV6});
415 $ret or return undef;
418 $ret->{DOMAIN} = $dcvars->{DOMAIN};
419 $ret->{REALM} = $dcvars->{REALM};
422 my $prefix_abs = abs_path($prefix);
424 $ctx->{krb5_conf} = "$prefix_abs/lib/krb5.conf";
425 $ctx->{domain} = $dcvars->{DOMAIN};
426 $ctx->{realm} = $dcvars->{REALM};
427 $ctx->{dnsname} = lc($dcvars->{REALM});
428 $ctx->{kdc_ipv4} = $dcvars->{SERVER_IP};
429 $ctx->{kdc_ipv6} = $dcvars->{SERVER_IPV6};
430 Samba::mk_krb5_conf($ctx, "");
432 $ret->{KRB5_CONFIG} = $ctx->{krb5_conf};
434 my $net = Samba::bindir_path($self, "net");
436 $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
437 if (defined($ret->{RESOLV_WRAPPER_CONF})) {
438 $cmd .= "RESOLV_WRAPPER_CONF=\"$ret->{RESOLV_WRAPPER_CONF}\" ";
440 $cmd .= "RESOLV_WRAPPER_HOSTS=\"$ret->{RESOLV_WRAPPER_HOSTS}\" ";
442 $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
443 $cmd .= "$net join $ret->{CONFIGURATION}";
444 $cmd .= " -U$dcvars->{USERNAME}\%$dcvars->{PASSWORD}";
446 if (system($cmd) != 0) {
447 warn("Join failed\n$cmd");
451 # We need world access to this share, as otherwise the domain
452 # administrator from the AD domain provided by Samba4 can't
453 # access the share for tests.
454 chmod 0777, "$prefix/share";
456 if (not $self->check_or_start($ret, "yes", "yes", "yes")) {
460 $ret->{DC_SERVER} = $dcvars->{SERVER};
461 $ret->{DC_SERVER_IP} = $dcvars->{SERVER_IP};
462 $ret->{DC_SERVER_IPV6} = $dcvars->{SERVER_IPV6};
463 $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME};
464 $ret->{DC_USERNAME} = $dcvars->{USERNAME};
465 $ret->{DC_PASSWORD} = $dcvars->{PASSWORD};
467 # Special case, this is called from Samba4.pm but needs to use the Samba3 check_env and get_log_env
468 $ret->{target} = $self;
473 sub setup_simpleserver($$)
475 my ($self, $path) = @_;
477 print "PROVISIONING server with security=share...";
479 my $prefix_abs = abs_path($path);
481 my $simpleserver_options = "
483 vfs objects = xattr_tdb streams_depot
486 path = $prefix_abs/share
487 vfs objects = aio_fork
489 vfs_aio_fork:erratic_testing_mode=yes
492 my $vars = $self->provision($path,
495 $simpleserver_options);
497 $vars or return undef;
499 if (not $self->check_or_start($vars, "yes", "no", "yes")) {
503 $self->{vars}->{simpleserver} = $vars;
510 my ($self, $prefix) = @_;
512 # If we didn't build with ADS, pretend this env was never available
513 if (not $self->have_ads()) {
517 print "PROVISIONING server with security=ads...";
519 my $ktest_options = "
521 realm = ktest.samba.example.com
523 username map = $prefix/lib/username.map
524 server signing = required
527 my $ret = $self->provision($prefix,
532 $ret or return undef;
535 my $prefix_abs = abs_path($prefix);
537 $ctx->{krb5_conf} = "$prefix_abs/lib/krb5.conf";
538 $ctx->{domain} = "KTEST";
539 $ctx->{realm} = "KTEST.SAMBA.EXAMPLE.COM";
540 $ctx->{dnsname} = lc($ctx->{realm});
541 $ctx->{kdc_ipv4} = "0.0.0.0";
542 $ctx->{kdc_ipv6} = "::";
543 Samba::mk_krb5_conf($ctx, "");
545 $ret->{KRB5_CONFIG} = $ctx->{krb5_conf};
547 open(USERMAP, ">$prefix/lib/username.map") or die("Unable to open $prefix/lib/username.map");
549 $ret->{USERNAME} = KTEST\\Administrator
553 #This is the secrets.tdb created by 'net ads join' from Samba3 to a
554 #Samba4 DC with the same parameters as are being used here. The
555 #domain SID is S-1-5-21-1071277805-689288055-3486227160
557 system("cp $self->{srcdir}/source3/selftest/ktest-secrets.tdb $prefix/private/secrets.tdb");
558 chmod 0600, "$prefix/private/secrets.tdb";
560 #Make sure there's no old ntdb file.
561 system("rm -f $prefix/private/secrets.ntdb");
563 #This uses a pre-calculated krb5 credentials cache, obtained by running Samba4 with:
564 # "--option=kdc:service ticket lifetime=239232" "--option=kdc:user ticket lifetime=239232" "--option=kdc:renewal lifetime=239232"
566 #and having in krb5.conf:
567 # ticket_lifetime = 799718400
568 # renew_lifetime = 799718400
570 # The commands for the -2 keytab where were:
571 # kinit administrator@KTEST.SAMBA.EXAMPLE.COM
572 # kvno host/localktest6@KTEST.SAMBA.EXAMPLE.COM
573 # kvno cifs/localktest6@KTEST.SAMBA.EXAMPLE.COM
574 # kvno host/LOCALKTEST6@KTEST.SAMBA.EXAMPLE.COM
575 # kvno cifs/LOCALKTEST6@KTEST.SAMBA.EXAMPLE.COM
577 # and then for the -3 keytab, I did
579 # net changetrustpw; kdestroy and the same again.
581 # This creates a credential cache with a very long lifetime (2036 at
582 # at 2011-04), and shows that running 'net changetrustpw' does not
583 # break existing logins (for the secrets.tdb method at least).
586 $ret->{KRB5_CCACHE}="FILE:$prefix/krb5_ccache";
588 system("cp $self->{srcdir}/source3/selftest/ktest-krb5_ccache-2 $prefix/krb5_ccache-2");
589 chmod 0600, "$prefix/krb5_ccache-2";
591 system("cp $self->{srcdir}/source3/selftest/ktest-krb5_ccache-3 $prefix/krb5_ccache-3");
592 chmod 0600, "$prefix/krb5_ccache-3";
594 # We need world access to this share, as otherwise the domain
595 # administrator from the AD domain provided by ktest can't
596 # access the share for tests.
597 chmod 0777, "$prefix/share";
599 if (not $self->check_or_start($ret, "yes", "no", "yes")) {
605 sub setup_maptoguest($$)
607 my ($self, $path) = @_;
609 print "PROVISIONING maptoguest...";
612 map to guest = bad user
615 my $vars = $self->provision($path,
620 $vars or return undef;
622 if (not $self->check_or_start($vars, "yes", "no", "yes")) {
626 $self->{vars}->{s3maptoguest} = $vars;
631 sub stop_sig_term($$) {
632 my ($self, $pid) = @_;
633 kill("USR1", $pid) or kill("ALRM", $pid) or warn("Unable to kill $pid: $!");
636 sub stop_sig_kill($$) {
637 my ($self, $pid) = @_;
638 kill("ALRM", $pid) or warn("Unable to kill $pid: $!");
643 my ($env_vars, $app, $pid) = @_;
645 open(PID, ">$env_vars->{PIDDIR}/timelimit.$app.pid");
652 my ($env_vars, $app) = @_;
654 open(PID, "<$env_vars->{PIDDIR}/timelimit.$app.pid");
660 sub check_or_start($$$$$) {
661 my ($self, $env_vars, $nmbd, $winbindd, $smbd) = @_;
663 # use a pipe for stdin in the child processes. This allows
664 # those processes to monitor the pipe for EOF to ensure they
665 # exit when the test script exits
666 pipe(STDIN_READER, $env_vars->{STDIN_PIPE});
668 unlink($env_vars->{NMBD_TEST_LOG});
669 print "STARTING NMBD...";
672 open STDOUT, ">$env_vars->{NMBD_TEST_LOG}";
673 open STDERR, '>&STDOUT';
675 SocketWrapper::set_default_iface($env_vars->{SOCKET_WRAPPER_DEFAULT_IFACE});
677 $ENV{KRB5_CONFIG} = $env_vars->{KRB5_CONFIG};
678 $ENV{SELFTEST_WINBINDD_SOCKET_DIR} = $env_vars->{SELFTEST_WINBINDD_SOCKET_DIR};
679 $ENV{NMBD_SOCKET_DIR} = $env_vars->{NMBD_SOCKET_DIR};
681 $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
682 $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
683 $ENV{NSS_WRAPPER_HOSTS} = $env_vars->{NSS_WRAPPER_HOSTS};
684 $ENV{NSS_WRAPPER_HOSTNAME} = $env_vars->{NSS_WRAPPER_HOSTNAME};
685 $ENV{NSS_WRAPPER_MODULE_SO_PATH} = $env_vars->{NSS_WRAPPER_MODULE_SO_PATH};
686 $ENV{NSS_WRAPPER_MODULE_FN_PREFIX} = $env_vars->{NSS_WRAPPER_MODULE_FN_PREFIX};
688 $ENV{ENVNAME} = "$ENV{ENVNAME}.nmbd";
690 if ($nmbd ne "yes") {
691 $SIG{USR1} = $SIG{ALRM} = $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub {
693 print("Skip nmbd received signal $signame");
696 sleep($self->{server_maxtime});
700 $ENV{MAKE_TEST_BINARY} = Samba::bindir_path($self, "nmbd");
701 my @optargs = ("-d0");
702 if (defined($ENV{NMBD_OPTIONS})) {
703 @optargs = split(/ /, $ENV{NMBD_OPTIONS});
705 my @preargs = (Samba::bindir_path($self, "timelimit"), $self->{server_maxtime});
706 if(defined($ENV{NMBD_VALGRIND})) {
707 @preargs = split(/ /, $ENV{NMBD_VALGRIND});
709 my @args = ("-F", "--no-process-group",
710 "-s", $env_vars->{SERVERCONFFILE},
711 "-l", $env_vars->{LOGDIR});
712 if (not defined($ENV{NMBD_DONT_LOG_STDOUT})) {
713 push(@args, "--log-stdout");
716 close($env_vars->{STDIN_PIPE});
717 open STDIN, ">&", \*STDIN_READER or die "can't dup STDIN_READER to STDIN: $!";
719 exec(@preargs, $ENV{MAKE_TEST_BINARY}, @args, @optargs)
720 or die("Unable to start $ENV{MAKE_TEST_BINARY}: $!");
722 $env_vars->{NMBD_TL_PID} = $pid;
723 write_pid($env_vars, "nmbd", $pid);
726 unlink($env_vars->{WINBINDD_TEST_LOG});
727 print "STARTING WINBINDD...";
730 open STDOUT, ">$env_vars->{WINBINDD_TEST_LOG}";
731 open STDERR, '>&STDOUT';
733 SocketWrapper::set_default_iface($env_vars->{SOCKET_WRAPPER_DEFAULT_IFACE});
735 $ENV{KRB5_CONFIG} = $env_vars->{KRB5_CONFIG};
736 $ENV{SELFTEST_WINBINDD_SOCKET_DIR} = $env_vars->{SELFTEST_WINBINDD_SOCKET_DIR};
737 $ENV{NMBD_SOCKET_DIR} = $env_vars->{NMBD_SOCKET_DIR};
739 $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
740 $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
741 $ENV{NSS_WRAPPER_HOSTS} = $env_vars->{NSS_WRAPPER_HOSTS};
742 $ENV{NSS_WRAPPER_HOSTNAME} = $env_vars->{NSS_WRAPPER_HOSTNAME};
743 $ENV{NSS_WRAPPER_MODULE_SO_PATH} = $env_vars->{NSS_WRAPPER_MODULE_SO_PATH};
744 $ENV{NSS_WRAPPER_MODULE_FN_PREFIX} = $env_vars->{NSS_WRAPPER_MODULE_FN_PREFIX};
745 if (defined($env_vars->{RESOLV_WRAPPER_CONF})) {
746 $ENV{RESOLV_WRAPPER_CONF} = $env_vars->{RESOLV_WRAPPER_CONF};
748 $ENV{RESOLV_WRAPPER_HOSTS} = $env_vars->{RESOLV_WRAPPER_HOSTS};
751 $ENV{ENVNAME} = "$ENV{ENVNAME}.winbindd";
753 if ($winbindd ne "yes") {
754 $SIG{USR1} = $SIG{ALRM} = $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub {
756 print("Skip winbindd received signal $signame");
759 sleep($self->{server_maxtime});
763 $ENV{MAKE_TEST_BINARY} = Samba::bindir_path($self, "winbindd");
764 my @optargs = ("-d0");
765 if (defined($ENV{WINBINDD_OPTIONS})) {
766 @optargs = split(/ /, $ENV{WINBINDD_OPTIONS});
768 my @preargs = (Samba::bindir_path($self, "timelimit"), $self->{server_maxtime});
769 if(defined($ENV{WINBINDD_VALGRIND})) {
770 @preargs = split(/ /, $ENV{WINBINDD_VALGRIND});
772 my @args = ("-F", "--no-process-group",
773 "-s", $env_vars->{SERVERCONFFILE},
774 "-l", $env_vars->{LOGDIR});
775 if (not defined($ENV{WINBINDD_DONT_LOG_STDOUT})) {
776 push(@args, "--stdout");
779 close($env_vars->{STDIN_PIPE});
780 open STDIN, ">&", \*STDIN_READER or die "can't dup STDIN_READER to STDIN: $!";
782 exec(@preargs, $ENV{MAKE_TEST_BINARY}, @args, @optargs)
783 or die("Unable to start $ENV{MAKE_TEST_BINARY}: $!");
785 $env_vars->{WINBINDD_TL_PID} = $pid;
786 write_pid($env_vars, "winbindd", $pid);
789 unlink($env_vars->{SMBD_TEST_LOG});
790 print "STARTING SMBD...";
793 open STDOUT, ">$env_vars->{SMBD_TEST_LOG}";
794 open STDERR, '>&STDOUT';
796 SocketWrapper::set_default_iface($env_vars->{SOCKET_WRAPPER_DEFAULT_IFACE});
798 $ENV{KRB5_CONFIG} = $env_vars->{KRB5_CONFIG};
799 $ENV{SELFTEST_WINBINDD_SOCKET_DIR} = $env_vars->{SELFTEST_WINBINDD_SOCKET_DIR};
800 $ENV{NMBD_SOCKET_DIR} = $env_vars->{NMBD_SOCKET_DIR};
802 $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
803 $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
804 $ENV{NSS_WRAPPER_HOSTS} = $env_vars->{NSS_WRAPPER_HOSTS};
805 $ENV{NSS_WRAPPER_HOSTNAME} = $env_vars->{NSS_WRAPPER_HOSTNAME};
806 $ENV{NSS_WRAPPER_MODULE_SO_PATH} = $env_vars->{NSS_WRAPPER_MODULE_SO_PATH};
807 $ENV{NSS_WRAPPER_MODULE_FN_PREFIX} = $env_vars->{NSS_WRAPPER_MODULE_FN_PREFIX};
808 if (defined($env_vars->{RESOLV_WRAPPER_CONF})) {
809 $ENV{RESOLV_WRAPPER_CONF} = $env_vars->{RESOLV_WRAPPER_CONF};
811 $ENV{RESOLV_WRAPPER_HOSTS} = $env_vars->{RESOLV_WRAPPER_HOSTS};
814 $ENV{ENVNAME} = "$ENV{ENVNAME}.smbd";
816 if ($smbd ne "yes") {
817 $SIG{USR1} = $SIG{ALRM} = $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub {
819 print("Skip smbd received signal $signame");
822 sleep($self->{server_maxtime});
826 $ENV{MAKE_TEST_BINARY} = Samba::bindir_path($self, "smbd");
827 my @optargs = ("-d0");
828 if (defined($ENV{SMBD_OPTIONS})) {
829 @optargs = split(/ /, $ENV{SMBD_OPTIONS});
831 my @preargs = (Samba::bindir_path($self, "timelimit"), $self->{server_maxtime});
832 if(defined($ENV{SMBD_VALGRIND})) {
833 @preargs = split(/ /,$ENV{SMBD_VALGRIND});
835 my @args = ("-F", "--no-process-group",
836 "-s", $env_vars->{SERVERCONFFILE},
837 "-l", $env_vars->{LOGDIR});
838 if (not defined($ENV{SMBD_DONT_LOG_STDOUT})) {
839 push(@args, "--log-stdout");
842 close($env_vars->{STDIN_PIPE});
843 open STDIN, ">&", \*STDIN_READER or die "can't dup STDIN_READER to STDIN: $!";
845 exec(@preargs, $ENV{MAKE_TEST_BINARY}, @args, @optargs)
846 or die("Unable to start $ENV{MAKE_TEST_BINARY}: $!");
848 $env_vars->{SMBD_TL_PID} = $pid;
849 write_pid($env_vars, "smbd", $pid);
854 return $self->wait_for_start($env_vars, $nmbd, $winbindd, $smbd);
857 sub provision($$$$$$$$)
859 my ($self, $prefix, $server, $password, $extra_options, $dc_server_ip, $dc_server_ipv6, $no_delete_prefix) = @_;
862 ## setup the various environment variables we need
865 my $swiface = Samba::get_interface($server);
867 my $server_ip = "127.0.0.$swiface";
868 my $server_ipv6 = sprintf("fd00:0000:0000:0000:0000:0000:5357:5f%02x", $swiface);
869 my $domain = "SAMBA-TEST";
871 my $unix_name = ($ENV{USER} or $ENV{LOGNAME} or `PATH=/usr/ucb:$ENV{PATH} whoami`);
874 my $unix_gids_str = $);
875 my @unix_gids = split(" ", $unix_gids_str);
877 my $prefix_abs = abs_path($prefix);
878 my $bindir_abs = abs_path($self->{bindir});
882 my $shrdir="$prefix_abs/share";
885 my $libdir="$prefix_abs/lib";
888 my $piddir="$prefix_abs/pid";
891 my $privatedir="$prefix_abs/private";
892 push(@dirs,$privatedir);
894 my $lockdir="$prefix_abs/lockdir";
895 push(@dirs,$lockdir);
897 my $eventlogdir="$prefix_abs/lockdir/eventlog";
898 push(@dirs,$eventlogdir);
900 my $logdir="$prefix_abs/logs";
903 my $driver32dir="$shrdir/W32X86";
904 push(@dirs,$driver32dir);
906 my $driver64dir="$shrdir/x64";
907 push(@dirs,$driver64dir);
909 my $driver40dir="$shrdir/WIN40";
910 push(@dirs,$driver40dir);
912 my $ro_shrdir="$shrdir/root-tmp";
913 push(@dirs,$ro_shrdir);
915 my $msdfs_shrdir="$shrdir/msdfsshare";
916 push(@dirs,$msdfs_shrdir);
918 my $msdfs_deeppath="$msdfs_shrdir/deeppath";
919 push(@dirs,$msdfs_deeppath);
921 my $badnames_shrdir="$shrdir/badnames";
922 push(@dirs,$badnames_shrdir);
924 my $lease1_shrdir="$shrdir/SMB2_10";
925 push(@dirs,$lease1_shrdir);
927 my $lease2_shrdir="$shrdir/SMB3_00";
928 push(@dirs,$lease2_shrdir);
930 # this gets autocreated by winbindd
931 my $wbsockdir="$prefix_abs/winbindd";
932 my $wbsockprivdir="$lockdir/winbindd_privileged";
934 my $nmbdsockdir="$prefix_abs/nmbd";
935 unlink($nmbdsockdir);
938 ## create the test directory layout
940 die ("prefix_abs = ''") if $prefix_abs eq "";
941 die ("prefix_abs = '/'") if $prefix_abs eq "/";
943 mkdir($prefix_abs, 0777);
944 print "CREATE TEST ENVIRONMENT IN '$prefix'...";
945 if (not defined($no_delete_prefix) or not $no_delete_prefix) {
946 system("rm -rf $prefix_abs/*");
948 mkdir($_, 0777) foreach(@dirs);
950 my $fs_specific_conf = $self->get_fs_specific_conf($shrdir);
953 ## lockdir and piddir must be 0755
955 chmod 0755, $lockdir;
960 ## create ro and msdfs share layout
963 chmod 0755, $ro_shrdir;
964 my $unreadable_file = "$ro_shrdir/unreadable_file";
965 unless (open(UNREADABLE_FILE, ">$unreadable_file")) {
966 warn("Unable to open $unreadable_file");
969 close(UNREADABLE_FILE);
970 chmod 0600, $unreadable_file;
972 my $msdfs_target = "$ro_shrdir/msdfs-target";
973 unless (open(MSDFS_TARGET, ">$msdfs_target")) {
974 warn("Unable to open $msdfs_target");
978 chmod 0666, $msdfs_target;
979 symlink "msdfs:$server_ip\\ro-tmp", "$msdfs_shrdir/msdfs-src1";
980 symlink "msdfs:$server_ipv6\\ro-tmp", "$msdfs_shrdir/deeppath/msdfs-src2";
983 ## create bad names in $badnames_shrdir
985 ## (An invalid name, would be mangled to 8.3).
986 my $badname_target = "$badnames_shrdir/\340|\231\216\377\177";
987 unless (open(BADNAME_TARGET, ">$badname_target")) {
988 warn("Unable to open $badname_target");
991 close(BADNAME_TARGET);
992 chmod 0666, $badname_target;
994 ## (A bad name, would not be mangled to 8.3).
995 my $badname_target = "$badnames_shrdir/\240\276\346\327\377\177";
996 unless (open(BADNAME_TARGET, ">$badname_target")) {
997 warn("Unable to open $badname_target");
1000 close(BADNAME_TARGET);
1001 chmod 0666, $badname_target;
1003 ## (A bad good name).
1004 my $badname_target = "$badnames_shrdir/blank.txt";
1005 unless (open(BADNAME_TARGET, ">$badname_target")) {
1006 warn("Unable to open $badname_target");
1009 close(BADNAME_TARGET);
1010 chmod 0666, $badname_target;
1012 my $conffile="$libdir/server.conf";
1014 my $nss_wrapper_pl = "$ENV{PERL} $self->{srcdir}/lib/nss_wrapper/nss_wrapper.pl";
1015 my $nss_wrapper_passwd = "$privatedir/passwd";
1016 my $nss_wrapper_group = "$privatedir/group";
1017 my $nss_wrapper_hosts = "$ENV{SELFTEST_PREFIX}/hosts";
1018 my $resolv_conf = "$privatedir/resolv.conf";
1019 my $dns_host_file = "$$ENV{SELFTEST_PREFIX}/dns_host_file";
1021 my $mod_printer_pl = "$ENV{PERL} $self->{srcdir}/source3/script/tests/printing/modprinter.pl";
1023 my @eventlog_list = ("dns server", "application");
1026 ## calculate uids and gids
1029 my ($max_uid, $max_gid);
1030 my ($uid_nobody, $uid_root, $uid_pdbtest, $uid_pdbtest2);
1031 my ($gid_nobody, $gid_nogroup, $gid_root, $gid_domusers, $gid_domadmins);
1033 if ($unix_uid < 0xffff - 4) {
1036 $max_uid = $unix_uid;
1039 $uid_root = $max_uid - 1;
1040 $uid_nobody = $max_uid - 2;
1041 $uid_pdbtest = $max_uid - 3;
1042 $uid_pdbtest2 = $max_uid - 4;
1044 if ($unix_gids[0] < 0xffff - 5) {
1047 $max_gid = $unix_gids[0];
1050 $gid_nobody = $max_gid - 1;
1051 $gid_nogroup = $max_gid - 2;
1052 $gid_root = $max_gid - 3;
1053 $gid_domusers = $max_gid - 4;
1054 $gid_domadmins = $max_gid - 5;
1060 unless (open(CONF, ">$conffile")) {
1061 warn("Unable to open $conffile");
1066 netbios name = $server
1067 interfaces = $server_ip/8 $server_ipv6/64
1068 bind interfaces only = yes
1069 panic action = cd $self->{srcdir} && $self->{srcdir}/selftest/gdb_backtrace %d %\$(MAKE_TEST_BINARY)
1070 smbd:suicide mode = yes
1074 private dir = $privatedir
1075 pid directory = $piddir
1076 lock directory = $lockdir
1077 log file = $logdir/log.\%m
1082 state directory = $lockdir
1083 cache directory = $lockdir
1085 passdb backend = tdbsam
1089 add user script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action add --name %u --gid $gid_nogroup
1090 add group script = $nss_wrapper_pl --group_path $nss_wrapper_group --type group --action add --name %g
1091 add machine script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action add --name %u --gid $gid_nogroup
1092 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
1093 delete user script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action delete --name %u
1094 delete group script = $nss_wrapper_pl --group_path $nss_wrapper_group --type group --action delete --name %g
1095 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
1097 addprinter command = $mod_printer_pl -a -s $conffile --
1098 deleteprinter command = $mod_printer_pl -d -s $conffile --
1100 eventlog list = application \"dns server\"
1103 kernel change notify = no
1108 printcap name = /dev/null
1110 winbindd socket directory = $wbsockdir
1111 nmbd:socket dir = $nmbdsockdir
1112 idmap config * : range = 100000-200000
1113 winbind enum users = yes
1114 winbind enum groups = yes
1115 winbind separator = /
1117 # min receivefile size = 4000
1120 server signing = auto
1122 smbd:sharedelay = 100000
1123 smbd:writetimeupdatedelay = 500000
1127 store dos attributes = yes
1131 vfs objects = acl_xattr fake_acls xattr_tdb streams_depot
1134 print command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb print %p %s
1135 lpq command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lpq %p
1136 lp rm command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lprm %p %j
1137 lp pause command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lppause %p %j
1138 lp resume command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lpresume %p %j
1139 queue pause command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb queuepause %p
1140 queue resume command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb queueresume %p
1142 print notify backchannel = yes
1144 ncalrpc dir = $prefix_abs/ncalrpc
1146 # The samba3.blackbox.smbclient_s3 test uses this to test that
1147 # sending messages works, and that the %m sub works.
1148 message command = mv %s $shrdir/message.%m
1150 # Begin extra options
1154 #Include user defined custom parameters if set
1157 if (defined($ENV{INCLUDE_CUSTOM_CONF})) {
1158 print CONF "\t$ENV{INCLUDE_CUSTOM_CONF}\n";
1164 comment = smb username is [%U]
1167 comment = Load dirsort module
1168 vfs objects = dirsort acl_xattr fake_acls xattr_tdb streams_depot
1171 comment = encrypt smb username is [%U]
1172 smb encrypt = required
1173 vfs objects = dirsort
1183 force user = $unix_name
1187 force group = nogroup
1195 write list = $unix_name
1198 valid users = $unix_name
1200 path = $msdfs_shrdir
1205 hide unreadable = yes
1208 case sensitive = yes
1211 hide unwriteable files = yes
1214 kernel share modes = no
1228 default devmode = no
1234 comment = smb username is [%U]
1236 vfs objects = nfs4acl_xattr xattr_tdb
1240 comment = smb username is [%U]
1242 vfs objects = nfs4acl_xattr xattr_tdb
1246 comment = smb username is [%U]
1248 force create mode = 777
1251 comment = smb username is [%U]
1253 force create mode = 0
1254 directory mask = 0777
1255 force directory mode = 0
1256 vfs objects = xattr_tdb
1267 vfs objects = catia fruit streams_xattr
1268 fruit:ressource = file
1269 fruit:metadata = netatalk
1270 fruit:locking = netatalk
1271 fruit:encoding = native
1274 path = $badnames_shrdir
1284 ## create a test account
1287 unless (open(PASSWD, ">$nss_wrapper_passwd")) {
1288 warn("Unable to open $nss_wrapper_passwd");
1291 print PASSWD "nobody:x:$uid_nobody:$gid_nobody:nobody gecos:$prefix_abs:/bin/false
1292 $unix_name:x:$unix_uid:$unix_gids[0]:$unix_name gecos:$prefix_abs:/bin/false
1293 pdbtest:x:$uid_pdbtest:$gid_nogroup:pdbtest gecos:$prefix_abs:/bin/false
1294 pdbtest2:x:$uid_pdbtest2:$gid_nogroup:pdbtest gecos:$prefix_abs:/bin/false
1296 if ($unix_uid != 0) {
1297 print PASSWD "root:x:$uid_root:$gid_root:root gecos:$prefix_abs:/bin/false
1302 unless (open(GROUP, ">$nss_wrapper_group")) {
1303 warn("Unable to open $nss_wrapper_group");
1306 print GROUP "nobody:x:$gid_nobody:
1307 nogroup:x:$gid_nogroup:nobody
1308 $unix_name-group:x:$unix_gids[0]:
1309 domusers:X:$gid_domusers:
1310 domadmins:X:$gid_domadmins:
1312 if ($unix_gids[0] != 0) {
1313 print GROUP "root:x:$gid_root:
1320 my $hostname = lc($server);
1321 unless (open(HOSTS, ">>$nss_wrapper_hosts")) {
1322 warn("Unable to open $nss_wrapper_hosts");
1325 print HOSTS "${server_ip} ${hostname}.samba.example.com ${hostname}\n";
1326 print HOSTS "${server_ipv6} ${hostname}.samba.example.com ${hostname}\n";
1330 unless (open(RESOLV_CONF, ">$resolv_conf")) {
1331 warn("Unable to open $resolv_conf");
1334 if (defined($dc_server_ip) or defined($dc_server_ipv6)) {
1335 if (defined($dc_server_ip)) {
1336 print RESOLV_CONF "nameserver $dc_server_ip\n";
1338 if (defined($dc_server_ipv6)) {
1339 print RESOLV_CONF "nameserver $dc_server_ipv6\n";
1342 print RESOLV_CONF "nameserver ${server_ip}\n";
1343 print RESOLV_CONF "nameserver ${server_ipv6}\n";
1347 foreach my $evlog (@eventlog_list) {
1348 my $evlogtdb = "$eventlogdir/$evlog.tdb";
1349 open(EVENTLOG, ">$evlogtdb") or die("Unable to open $evlogtdb");
1353 $ENV{NSS_WRAPPER_PASSWD} = $nss_wrapper_passwd;
1354 $ENV{NSS_WRAPPER_GROUP} = $nss_wrapper_group;
1355 $ENV{NSS_WRAPPER_HOSTS} = $nss_wrapper_hosts;
1356 $ENV{NSS_WRAPPER_HOSTNAME} = "${hostname}.samba.example.com";
1357 if ($ENV{SAMBA_DNS_FAKING}) {
1358 $ENV{RESOLV_WRAPPER_CONF} = $resolv_conf;
1360 $ENV{RESOLV_WRAPPER_HOSTS} = $dns_host_file;
1363 my $cmd = "UID_WRAPPER_ROOT=1 " . Samba::bindir_path($self, "smbpasswd")." -c $conffile -L -s -a $unix_name > /dev/null";
1364 unless (open(PWD, "|$cmd")) {
1365 warn("Unable to set password for test account\n$cmd");
1368 print PWD "$password\n$password\n";
1369 unless (close(PWD)) {
1370 warn("Unable to set password for test account\n$cmd");
1375 open(DNS_UPDATE_LIST, ">$prefix/dns_update_list") or die("Unable to open $$prefix/dns_update_list");
1376 print DNS_UPDATE_LIST "A $server. $server_ip\n";
1377 print DNS_UPDATE_LIST "AAAA $server. $server_ipv6\n";
1378 close(DNS_UPDATE_LIST);
1380 $ret{SERVER_IP} = $server_ip;
1381 $ret{SERVER_IPV6} = $server_ipv6;
1382 $ret{NMBD_TEST_LOG} = "$prefix/nmbd_test.log";
1383 $ret{NMBD_TEST_LOG_POS} = 0;
1384 $ret{WINBINDD_TEST_LOG} = "$prefix/winbindd_test.log";
1385 $ret{WINBINDD_TEST_LOG_POS} = 0;
1386 $ret{SMBD_TEST_LOG} = "$prefix/smbd_test.log";
1387 $ret{SMBD_TEST_LOG_POS} = 0;
1388 $ret{SERVERCONFFILE} = $conffile;
1389 $ret{CONFIGURATION} ="-s $conffile";
1390 $ret{SERVER} = $server;
1391 $ret{USERNAME} = $unix_name;
1392 $ret{USERID} = $unix_uid;
1393 $ret{DOMAIN} = $domain;
1394 $ret{NETBIOSNAME} = $server;
1395 $ret{PASSWORD} = $password;
1396 $ret{PIDDIR} = $piddir;
1397 $ret{SELFTEST_WINBINDD_SOCKET_DIR} = $wbsockdir;
1398 $ret{WINBINDD_PRIV_PIPE_DIR} = $wbsockprivdir;
1399 $ret{NMBD_SOCKET_DIR} = $nmbdsockdir;
1400 $ret{SOCKET_WRAPPER_DEFAULT_IFACE} = $swiface;
1401 $ret{NSS_WRAPPER_PASSWD} = $nss_wrapper_passwd;
1402 $ret{NSS_WRAPPER_GROUP} = $nss_wrapper_group;
1403 $ret{NSS_WRAPPER_HOSTS} = $nss_wrapper_hosts;
1404 $ret{NSS_WRAPPER_HOSTNAME} = "${hostname}.samba.example.com";
1405 $ret{NSS_WRAPPER_MODULE_SO_PATH} = Samba::nss_wrapper_winbind_so_path($self);
1406 $ret{NSS_WRAPPER_MODULE_FN_PREFIX} = "winbind";
1407 if ($ENV{SAMBA_DNS_FAKING}) {
1408 $ret{RESOLV_WRAPPER_HOSTS} = $dns_host_file;
1410 $ret{RESOLV_WRAPPER_CONF} = $resolv_conf;
1412 $ret{LOCAL_PATH} = "$shrdir";
1413 $ret{LOGDIR} = $logdir;
1418 sub wait_for_start($$$$$)
1420 my ($self, $envvars, $nmbd, $winbindd, $smbd) = @_;
1423 if ($nmbd eq "yes") {
1426 # give time for nbt server to register its names
1427 print "checking for nmbd\n";
1429 # This will return quickly when things are up, but be slow if we need to wait for (eg) SSL init
1430 my $nmblookup = Samba::bindir_path($self, "nmblookup");
1433 $ret = system("$nmblookup $envvars->{CONFIGURATION} $envvars->{SERVER}");
1437 system("$nmblookup $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} __SAMBA__");
1438 system("$nmblookup $envvars->{CONFIGURATION} __SAMBA__");
1439 system("$nmblookup $envvars->{CONFIGURATION} -U 127.255.255.255 __SAMBA__");
1440 system("$nmblookup $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} $envvars->{SERVER}");
1443 } while ($ret != 0 && $count < 10);
1445 print "NMBD not reachable after 10 retries\n";
1446 teardown_env($self, $envvars);
1451 if ($winbindd eq "yes") {
1452 print "checking for winbindd\n";
1455 $ret = system("SELFTEST_WINBINDD_SOCKET_DIR=" . $envvars->{SELFTEST_WINBINDD_SOCKET_DIR} . " " . Samba::bindir_path($self, "wbinfo") . " --ping-dc");
1460 } while ($ret != 0 && $count < 10);
1462 print "WINBINDD not reachable after 20 seconds\n";
1463 teardown_env($self, $envvars);
1468 if ($smbd eq "yes") {
1469 # make sure smbd is also up set
1470 print "wait for smbd\n";
1474 $ret = system(Samba::bindir_path($self, "smbclient3") ." $envvars->{CONFIGURATION} -L $envvars->{SERVER} -U% -p 139");
1479 } while ($ret != 0 && $count < 10);
1481 print "SMBD failed to start up in a reasonable time (20sec)\n";
1482 teardown_env($self, $envvars);
1487 # Ensure we have domain users mapped.
1488 $ret = system(Samba::bindir_path($self, "net") ." $envvars->{CONFIGURATION} groupmap add rid=513 unixgroup=domusers type=domain");
1492 $ret = system(Samba::bindir_path($self, "net") ." $envvars->{CONFIGURATION} groupmap add rid=512 unixgroup=domadmins type=domain");
1497 if ($winbindd eq "yes") {
1498 # note: creating builtin groups requires winbindd for the
1500 $ret = system("SELFTEST_WINBINDD_SOCKET_DIR=" . $envvars->{SELFTEST_WINBINDD_SOCKET_DIR} . " " . Samba::bindir_path($self, "net") ." $envvars->{CONFIGURATION} sam createbuiltingroup Users");
1502 print "Failed to create BUILTIN\\Users group\n";
1507 system(Samba::bindir_path($self, "net") . " $envvars->{CONFIGURATION} cache flush");
1508 $ret = system("SELFTEST_WINBINDD_SOCKET_DIR=" . $envvars->{SELFTEST_WINBINDD_SOCKET_DIR} . " " . Samba::bindir_path($self, "wbinfo") . " --sid-to-gid=S-1-5-32-545");
1513 } while ($ret != 0 && $count < 10);
1515 print "WINBINDD not reachable after 20 seconds\n";
1516 teardown_env($self, $envvars);
1521 print $self->getlog_env($envvars);