s3:selftest: fix Samba3.pm deprecated idmap config
[Samba.git] / selftest / target / Samba3.pm
blob6a18f27231e95d1b454374146a6d7840b4c24b8e
1 #!/usr/bin/perl
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 package Samba3;
8 use strict;
9 use Cwd qw(abs_path);
10 use FindBin qw($RealBin);
11 use POSIX;
13 sub binpath($$)
15 my ($self, $binary) = @_;
17 if (defined($self->{bindir})) {
18 my $path = "$self->{bindir}/$binary";
19 -f $path or die("File $path doesn't exist");
20 return $path;
23 return $binary;
26 sub new($$) {
27 my ($classname, $bindir, $srcdir) = @_;
28 my $self = { bindir => $bindir,
29 srcdir => $srcdir
31 bless $self;
32 return $self;
35 sub teardown_env($$)
37 my ($self, $envvars) = @_;
39 my $smbdpid = read_pid($envvars, "smbd");
40 my $nmbdpid = read_pid($envvars, "nmbd");
41 my $winbinddpid = read_pid($envvars, "winbindd");
43 $self->stop_sig_term($smbdpid);
44 $self->stop_sig_term($nmbdpid);
45 $self->stop_sig_term($winbinddpid);
47 sleep(2);
49 $self->stop_sig_kill($smbdpid);
50 $self->stop_sig_kill($nmbdpid);
51 $self->stop_sig_kill($winbinddpid);
53 return 0;
56 sub getlog_env_app($$$)
58 my ($self, $envvars, $name) = @_;
60 my $title = "$name LOG of: $envvars->{NETBIOSNAME}\n";
61 my $out = $title;
63 open(LOG, "<".$envvars->{$name."_TEST_LOG"});
65 seek(LOG, $envvars->{$name."_TEST_LOG_POS"}, SEEK_SET);
66 while (<LOG>) {
67 $out .= $_;
69 $envvars->{$name."_TEST_LOG_POS"} = tell(LOG);
70 close(LOG);
72 return "" if $out eq $title;
74 return $out;
77 sub getlog_env($$)
79 my ($self, $envvars) = @_;
80 my $ret = "";
82 $ret .= $self->getlog_env_app($envvars, "SMBD");
83 $ret .= $self->getlog_env_app($envvars, "NMBD");
84 $ret .= $self->getlog_env_app($envvars, "WINBINDD");
86 return $ret;
89 sub check_env($$)
91 my ($self, $envvars) = @_;
93 # TODO ...
94 return 1;
97 sub setup_env($$$)
99 my ($self, $envname, $path) = @_;
101 if ($envname eq "dc") {
102 return $self->setup_dc("$path/dc");
103 } elsif ($envname eq "secshare") {
104 return $self->setup_secshare("$path/secshare");
105 } elsif ($envname eq "member") {
106 if (not defined($self->{vars}->{dc})) {
107 $self->setup_dc("$path/dc");
109 return $self->setup_member("$path/member", $self->{vars}->{dc});
110 } else {
111 return undef;
115 sub setup_dc($$)
117 my ($self, $path) = @_;
119 print "PROVISIONING DC...";
121 my $dc_options = "
122 domain master = yes
123 domain logons = yes
124 lanman auth = yes
127 my $vars = $self->provision($path,
128 "LOCALDC2",
130 "localdc2pass",
131 $dc_options);
133 $self->check_or_start($vars,
134 ($ENV{SMBD_MAXTIME} or 2700),
135 "yes", "yes", "yes");
137 $self->wait_for_start($vars);
139 $vars->{DC_SERVER} = $vars->{SERVER};
140 $vars->{DC_SERVER_IP} = $vars->{SERVER_IP};
141 $vars->{DC_NETBIOSNAME} = $vars->{NETBIOSNAME};
142 $vars->{DC_USERNAME} = $vars->{USERNAME};
143 $vars->{DC_PASSWORD} = $vars->{PASSWORD};
145 $self->{vars}->{dc} = $vars;
147 return $vars;
150 sub setup_member($$$)
152 my ($self, $prefix, $dcvars) = @_;
154 print "PROVISIONING MEMBER...";
156 my $member_options = "
157 security = domain
158 server signing = on
160 my $ret = $self->provision($prefix,
161 "LOCALMEMBER3",
163 "localmember3pass",
164 $member_options);
166 $ret or die("Unable to provision");
168 my $net = $self->binpath("net");
169 my $cmd = "";
170 $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
171 $cmd .= "$net join $ret->{CONFIGURATION} $dcvars->{DOMAIN} member";
172 $cmd .= " -U$dcvars->{USERNAME}\%$dcvars->{PASSWORD}";
174 system($cmd) == 0 or die("Join failed\n$cmd");
176 $self->check_or_start($ret,
177 ($ENV{SMBD_MAXTIME} or 2700),
178 "yes", "yes", "yes");
180 $self->wait_for_start($ret);
182 $ret->{DC_SERVER} = $dcvars->{SERVER};
183 $ret->{DC_SERVER_IP} = $dcvars->{SERVER_IP};
184 $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME};
185 $ret->{DC_USERNAME} = $dcvars->{USERNAME};
186 $ret->{DC_PASSWORD} = $dcvars->{PASSWORD};
188 return $ret;
191 sub setup_secshare($$)
193 my ($self, $path) = @_;
195 print "PROVISIONING server with security=share...";
197 my $secshare_options = "
198 security = share
199 lanman auth = yes
202 my $vars = $self->provision($path,
203 "LOCALSHARE4",
205 "local4pass",
206 $secshare_options);
208 $self->check_or_start($vars,
209 ($ENV{SMBD_MAXTIME} or 2700),
210 "yes", "no", "yes");
212 $self->wait_for_start($vars);
214 $self->{vars}->{secshare} = $vars;
216 return $vars;
219 sub stop_sig_term($$) {
220 my ($self, $pid) = @_;
221 kill("USR1", $pid) or kill("ALRM", $pid) or warn("Unable to kill $pid: $!");
224 sub stop_sig_kill($$) {
225 my ($self, $pid) = @_;
226 kill("ALRM", $pid) or warn("Unable to kill $pid: $!");
229 sub write_pid($$$)
231 my ($env_vars, $app, $pid) = @_;
233 open(PID, ">$env_vars->{PIDDIR}/timelimit.$app.pid");
234 print PID $pid;
235 close(PID);
238 sub read_pid($$)
240 my ($env_vars, $app) = @_;
242 open(PID, "<$env_vars->{PIDDIR}/timelimit.$app.pid");
243 my $pid = <PID>;
244 close(PID);
245 return $pid;
248 sub check_or_start($$$$$) {
249 my ($self, $env_vars, $maxtime, $nmbd, $winbindd, $smbd) = @_;
251 unlink($env_vars->{NMBD_TEST_LOG});
252 print "STARTING NMBD...";
253 my $pid = fork();
254 if ($pid == 0) {
255 open STDOUT, ">$env_vars->{NMBD_TEST_LOG}";
256 open STDERR, '>&STDOUT';
258 SocketWrapper::set_default_iface($env_vars->{SOCKET_WRAPPER_DEFAULT_IFACE});
260 $ENV{WINBINDD_SOCKET_DIR} = $env_vars->{WINBINDD_SOCKET_DIR};
261 $ENV{NMBD_SOCKET_DIR} = $env_vars->{NMBD_SOCKET_DIR};
263 $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
264 $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
265 $ENV{NSS_WRAPPER_WINBIND_SO_PATH} = $env_vars->{NSS_WRAPPER_WINBIND_SO_PATH};
267 if ($nmbd ne "yes") {
268 $SIG{USR1} = $SIG{ALRM} = $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub {
269 my $signame = shift;
270 print("Skip nmbd received signal $signame");
271 exit 0;
273 sleep($maxtime);
274 exit 0;
277 my @optargs = ("-d0");
278 if (defined($ENV{NMBD_OPTIONS})) {
279 @optargs = split(/ /, $ENV{NMBD_OPTIONS});
282 $ENV{MAKE_TEST_BINARY} = $self->binpath("nmbd");
284 my @preargs = ($self->binpath("timelimit"), $maxtime);
285 if(defined($ENV{NMBD_VALGRIND})) {
286 @preargs = split(/ /, $ENV{NMBD_VALGRIND});
289 exec(@preargs, $self->binpath("nmbd"), "-F", "--no-process-group", "-S", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start nmbd: $!");
291 write_pid($env_vars, "nmbd", $pid);
292 print "DONE\n";
294 unlink($env_vars->{WINBINDD_TEST_LOG});
295 print "STARTING WINBINDD...";
296 $pid = fork();
297 if ($pid == 0) {
298 open STDOUT, ">$env_vars->{WINBINDD_TEST_LOG}";
299 open STDERR, '>&STDOUT';
301 SocketWrapper::set_default_iface($env_vars->{SOCKET_WRAPPER_DEFAULT_IFACE});
303 $ENV{WINBINDD_SOCKET_DIR} = $env_vars->{WINBINDD_SOCKET_DIR};
304 $ENV{NMBD_SOCKET_DIR} = $env_vars->{NMBD_SOCKET_DIR};
306 $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
307 $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
308 $ENV{NSS_WRAPPER_WINBIND_SO_PATH} = $env_vars->{NSS_WRAPPER_WINBIND_SO_PATH};
310 if ($winbindd ne "yes") {
311 $SIG{USR1} = $SIG{ALRM} = $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub {
312 my $signame = shift;
313 print("Skip winbindd received signal $signame");
314 exit 0;
316 sleep($maxtime);
317 exit 0;
320 my @optargs = ("-d0");
321 if (defined($ENV{WINBINDD_OPTIONS})) {
322 @optargs = split(/ /, $ENV{WINBINDD_OPTIONS});
325 $ENV{MAKE_TEST_BINARY} = $self->binpath("winbindd");
327 my @preargs = ($self->binpath("timelimit"), $maxtime);
328 if(defined($ENV{WINBINDD_VALGRIND})) {
329 @preargs = split(/ /, $ENV{WINBINDD_VALGRIND});
332 exec(@preargs, $self->binpath("winbindd"), "-F", "--no-process-group", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start winbindd: $!");
334 write_pid($env_vars, "winbindd", $pid);
335 print "DONE\n";
337 unlink($env_vars->{SMBD_TEST_LOG});
338 print "STARTING SMBD...";
339 $pid = fork();
340 if ($pid == 0) {
341 open STDOUT, ">$env_vars->{SMBD_TEST_LOG}";
342 open STDERR, '>&STDOUT';
344 SocketWrapper::set_default_iface($env_vars->{SOCKET_WRAPPER_DEFAULT_IFACE});
346 $ENV{WINBINDD_SOCKET_DIR} = $env_vars->{WINBINDD_SOCKET_DIR};
347 $ENV{NMBD_SOCKET_DIR} = $env_vars->{NMBD_SOCKET_DIR};
349 $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
350 $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
351 $ENV{NSS_WRAPPER_WINBIND_SO_PATH} = $env_vars->{NSS_WRAPPER_WINBIND_SO_PATH};
353 if ($smbd ne "yes") {
354 $SIG{USR1} = $SIG{ALRM} = $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub {
355 my $signame = shift;
356 print("Skip smbd received signal $signame");
357 exit 0;
359 sleep($maxtime);
360 exit 0;
363 $ENV{MAKE_TEST_BINARY} = $self->binpath("smbd");
364 my @optargs = ("-d0");
365 if (defined($ENV{SMBD_OPTIONS})) {
366 @optargs = split(/ /, $ENV{SMBD_OPTIONS});
368 my @preargs = ($self->binpath("timelimit"), $maxtime);
369 if(defined($ENV{SMBD_VALGRIND})) {
370 @preargs = split(/ /,$ENV{SMBD_VALGRIND});
372 exec(@preargs, $self->binpath("smbd"), "-F", "--no-process-group", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start smbd: $!");
374 write_pid($env_vars, "smbd", $pid);
375 print "DONE\n";
377 return 0;
380 sub provision($$$$$$)
382 my ($self, $prefix, $server, $swiface, $password, $extra_options) = @_;
385 ## setup the various environment variables we need
388 my %ret = ();
389 my $server_ip = "127.0.0.$swiface";
390 my $domain = "SAMBA-TEST";
392 my $unix_name = ($ENV{USER} or $ENV{LOGNAME} or `PATH=/usr/ucb:$ENV{PATH} whoami`);
393 chomp $unix_name;
394 my $unix_uid = $>;
395 my $unix_gids_str = $);
396 my @unix_gids = split(" ", $unix_gids_str);
398 my $prefix_abs = abs_path($prefix);
399 my $bindir_abs = abs_path($self->{bindir});
400 my $vfs_modulesdir_abs = ($ENV{VFSLIBDIR} or $bindir_abs);
402 my @dirs = ();
404 my $shrdir="$prefix_abs/share";
405 push(@dirs,$shrdir);
407 my $libdir="$prefix_abs/lib";
408 push(@dirs,$libdir);
410 my $piddir="$prefix_abs/pid";
411 push(@dirs,$piddir);
413 my $privatedir="$prefix_abs/private";
414 push(@dirs,$privatedir);
416 my $lockdir="$prefix_abs/lockdir";
417 push(@dirs,$lockdir);
419 my $eventlogdir="$prefix_abs/lockdir/eventlog";
420 push(@dirs,$eventlogdir);
422 my $logdir="$prefix_abs/logs";
423 push(@dirs,$logdir);
425 my $driver32dir="$shrdir/W32X86";
426 push(@dirs,$driver32dir);
428 my $driver64dir="$shrdir/x64";
429 push(@dirs,$driver64dir);
431 my $driver40dir="$shrdir/WIN40";
432 push(@dirs,$driver40dir);
434 my $ro_shrdir="$shrdir/root-tmp";
435 push(@dirs,$ro_shrdir);
437 my $msdfs_shrdir="$shrdir/msdfsshare";
438 push(@dirs,$msdfs_shrdir);
440 my $msdfs_deeppath="$msdfs_shrdir/deeppath";
441 push(@dirs,$msdfs_deeppath);
443 # this gets autocreated by winbindd
444 my $wbsockdir="$prefix_abs/winbindd";
445 my $wbsockprivdir="$lockdir/winbindd_privileged";
447 my $nmbdsockdir="$prefix_abs/nmbd";
448 unlink($nmbdsockdir);
451 ## create the test directory layout
453 die ("prefix_abs = ''") if $prefix_abs eq "";
454 die ("prefix_abs = '/'") if $prefix_abs eq "/";
456 mkdir($prefix_abs, 0777);
457 print "CREATE TEST ENVIRONMENT IN '$prefix'...";
458 system("rm -rf $prefix_abs/*");
459 mkdir($_, 0777) foreach(@dirs);
462 ## create ro and msdfs share layout
465 chmod 0755, $ro_shrdir;
466 my $unreadable_file = "$ro_shrdir/unreadable_file";
467 open(UNREADABLE_FILE, ">$unreadable_file") or die("Unable to open $unreadable_file");
468 close(UNREADABLE_FILE);
469 chmod 0600, $unreadable_file;
471 my $msdfs_target = "$ro_shrdir/msdfs-target";
472 open(MSDFS_TARGET, ">$msdfs_target") or die("Unable to open $msdfs_target");
473 close(MSDFS_TARGET);
474 chmod 0666, $msdfs_target;
475 symlink "msdfs:$server_ip\\ro-tmp", "$msdfs_shrdir/msdfs-src1";
476 symlink "msdfs:$server_ip\\ro-tmp", "$msdfs_shrdir/deeppath/msdfs-src2";
478 my $conffile="$libdir/server.conf";
480 my $nss_wrapper_pl = "$ENV{PERL} $self->{srcdir}/lib/nss_wrapper/nss_wrapper.pl";
481 my $nss_wrapper_passwd = "$privatedir/passwd";
482 my $nss_wrapper_group = "$privatedir/group";
484 my $mod_printer_pl = "$ENV{PERL} $self->{srcdir}/source3/script/tests/printing/modprinter.pl";
486 my @eventlog_list = ("dns server", "application");
489 ## calculate uids and gids
492 my ($max_uid, $max_gid);
493 my ($uid_nobody, $uid_root);
494 my ($gid_nobody, $gid_nogroup, $gid_root, $gid_domusers);
496 if ($unix_uid < 0xffff - 2) {
497 $max_uid = 0xffff;
498 } else {
499 $max_uid = $unix_uid;
502 $uid_root = $max_uid - 1;
503 $uid_nobody = $max_uid - 2;
505 if ($unix_gids[0] < 0xffff - 3) {
506 $max_gid = 0xffff;
507 } else {
508 $max_gid = $unix_gids[0];
511 $gid_nobody = $max_gid - 1;
512 $gid_nogroup = $max_gid - 2;
513 $gid_root = $max_gid - 3;
514 $gid_domusers = $max_gid - 4;
517 ## create conffile
520 open(CONF, ">$conffile") or die("Unable to open $conffile");
521 print CONF "
522 [global]
523 netbios name = $server
524 interfaces = $server_ip/8
525 bind interfaces only = yes
526 panic action = $self->{srcdir}/selftest/gdb_backtrace %d %\$(MAKE_TEST_BINARY)
528 workgroup = $domain
530 private dir = $privatedir
531 pid directory = $piddir
532 lock directory = $lockdir
533 log file = $logdir/log.\%m
534 log level = 0
535 debug pid = yes
537 name resolve order = bcast
539 state directory = $lockdir
540 cache directory = $lockdir
542 passdb backend = tdbsam
544 time server = yes
546 add user script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action add --name %u --gid $gid_nogroup
547 add group script = $nss_wrapper_pl --group_path $nss_wrapper_group --type group --action add --name %g
548 add machine script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action add --name %u --gid $gid_nogroup
549 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
550 delete user script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action delete --name %u
551 delete group script = $nss_wrapper_pl --group_path $nss_wrapper_group --type group --action delete --name %g
552 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
554 addprinter command = $mod_printer_pl -a -s $conffile --
555 deleteprinter command = $mod_printer_pl -d -s $conffile --
557 eventlog list = application \"dns server\"
559 kernel oplocks = no
560 kernel change notify = no
562 syslog = no
563 printing = bsd
564 printcap name = /dev/null
566 winbindd:socket dir = $wbsockdir
567 nmbd:socket dir = $nmbdsockdir
568 idmap config * : range = 100000-200000
569 winbind enum users = yes
570 winbind enum groups = yes
572 # min receivefile size = 4000
574 max protocol = SMB2
575 read only = no
576 server signing = auto
578 smbd:sharedelay = 100000
579 # smbd:writetimeupdatedelay = 500000
580 map hidden = no
581 map system = no
582 map readonly = no
583 store dos attributes = yes
584 create mask = 755
585 vfs objects = $vfs_modulesdir_abs/xattr_tdb.so $vfs_modulesdir_abs/streams_depot.so
587 printing = vlp
588 print command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb print %p %s
589 lpq command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lpq %p
590 lp rm command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lprm %p %j
591 lp pause command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lppause %p %j
592 lp resume command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lpresume %p %j
593 queue pause command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb queuepause %p
594 queue resume command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb queueresume %p
595 lpq cache time = 0
597 ncalrpc dir = $lockdir/ncalrpc
598 rpc_server:epmapper = embedded
600 # Begin extra options
601 $extra_options
602 # End extra options
604 #Include user defined custom parameters if set
607 if (defined($ENV{INCLUDE_CUSTOM_CONF})) {
608 print CONF "\t$ENV{INCLUDE_CUSTOM_CONF}\n";
611 print CONF "
612 [tmp]
613 path = $shrdir
614 [tmpguest]
615 path = $shrdir
616 guest ok = yes
617 [guestonly]
618 path = $shrdir
619 guest only = yes
620 guest ok = yes
621 [forceuser]
622 path = $shrdir
623 force user = $unix_name
624 guest ok = yes
625 [forcegroup]
626 path = $shrdir
627 force group = nogroup
628 guest ok = yes
629 [ro-tmp]
630 path = $ro_shrdir
631 guest ok = yes
632 [msdfs-share]
633 path = $msdfs_shrdir
634 msdfs root = yes
635 guest ok = yes
636 [hideunread]
637 copy = tmp
638 hide unreadable = yes
639 [tmpcase]
640 copy = tmp
641 case sensitive = yes
642 [hideunwrite]
643 copy = tmp
644 hide unwriteable files = yes
645 [print1]
646 copy = tmp
647 printable = yes
649 [print2]
650 copy = print1
651 [print3]
652 copy = print1
653 [lp]
654 copy = print1
655 [print\$]
656 copy = tmp
658 close(CONF);
661 ## create a test account
664 open(PASSWD, ">$nss_wrapper_passwd") or die("Unable to open $nss_wrapper_passwd");
665 print PASSWD "nobody:x:$uid_nobody:$gid_nobody:nobody gecos:$prefix_abs:/bin/false
666 $unix_name:x:$unix_uid:$unix_gids[0]:$unix_name gecos:$prefix_abs:/bin/false
668 if ($unix_uid != 0) {
669 print PASSWD "root:x:$uid_root:$gid_root:root gecos:$prefix_abs:/bin/false";
671 close(PASSWD);
673 open(GROUP, ">$nss_wrapper_group") or die("Unable to open $nss_wrapper_group");
674 print GROUP "nobody:x:$gid_nobody:
675 nogroup:x:$gid_nogroup:nobody
676 $unix_name-group:x:$unix_gids[0]:
677 domusers:X:$gid_domusers:
679 if ($unix_gids[0] != 0) {
680 print GROUP "root:x:$gid_root:";
683 close(GROUP);
685 foreach my $evlog (@eventlog_list) {
686 my $evlogtdb = "$eventlogdir/$evlog.tdb";
687 open(EVENTLOG, ">$evlogtdb") or die("Unable to open $evlogtdb");
688 close(EVENTLOG);
691 $ENV{NSS_WRAPPER_PASSWD} = $nss_wrapper_passwd;
692 $ENV{NSS_WRAPPER_GROUP} = $nss_wrapper_group;
694 open(PWD, "|".$self->binpath("smbpasswd")." -c $conffile -L -s -a $unix_name >/dev/null");
695 print PWD "$password\n$password\n";
696 close(PWD) or die("Unable to set password for test account");
698 print "DONE\n";
700 $ret{SERVER_IP} = $server_ip;
701 $ret{NMBD_TEST_LOG} = "$prefix/nmbd_test.log";
702 $ret{NMBD_TEST_LOG_POS} = 0;
703 $ret{WINBINDD_TEST_LOG} = "$prefix/winbindd_test.log";
704 $ret{WINBINDD_TEST_LOG_POS} = 0;
705 $ret{SMBD_TEST_LOG} = "$prefix/smbd_test.log";
706 $ret{SMBD_TEST_LOG_POS} = 0;
707 $ret{SERVERCONFFILE} = $conffile;
708 $ret{CONFIGURATION} ="-s $conffile";
709 $ret{SERVER} = $server;
710 $ret{USERNAME} = $unix_name;
711 $ret{USERID} = $unix_uid;
712 $ret{DOMAIN} = $domain;
713 $ret{NETBIOSNAME} = $server;
714 $ret{PASSWORD} = $password;
715 $ret{PIDDIR} = $piddir;
716 $ret{WINBINDD_SOCKET_DIR} = $wbsockdir;
717 $ret{WINBINDD_PRIV_PIPE_DIR} = $wbsockprivdir;
718 $ret{NMBD_SOCKET_DIR} = $nmbdsockdir;
719 $ret{SOCKET_WRAPPER_DEFAULT_IFACE} = $swiface;
720 $ret{NSS_WRAPPER_PASSWD} = $nss_wrapper_passwd;
721 $ret{NSS_WRAPPER_GROUP} = $nss_wrapper_group;
722 $ret{NSS_WRAPPER_WINBIND_SO_PATH} = $ENV{NSS_WRAPPER_WINBIND_SO_PATH};
723 $ret{LOCAL_PATH} = "$shrdir";
725 return \%ret;
728 sub wait_for_start($$)
730 my ($self, $envvars) = @_;
732 # give time for nbt server to register its names
733 print "delaying for nbt name registration\n";
734 sleep(10);
735 # This will return quickly when things are up, but be slow if we need to wait for (eg) SSL init
736 system($self->binpath("nmblookup") ." $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} __SAMBA__");
737 system($self->binpath("nmblookup") ." $envvars->{CONFIGURATION} __SAMBA__");
738 system($self->binpath("nmblookup") ." $envvars->{CONFIGURATION} -U 127.255.255.255 __SAMBA__");
739 system($self->binpath("nmblookup") ." $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} $envvars->{SERVER}");
740 system($self->binpath("nmblookup") ." $envvars->{CONFIGURATION} $envvars->{SERVER}");
741 # make sure smbd is also up set
742 print "wait for smbd\n";
743 system($self->binpath("smbclient") ." $envvars->{CONFIGURATION} -L $envvars->{SERVER_IP} -U% -p 139 | head -2");
744 system($self->binpath("smbclient") ." $envvars->{CONFIGURATION} -L $envvars->{SERVER_IP} -U% -p 139 | head -2");
746 # Ensure we have domain users mapped.
747 system($self->binpath("net") ." $envvars->{CONFIGURATION} groupmap add rid=513 unixgroup=domusers type=domain");
749 print $self->getlog_env($envvars);