s3-selftest: Fix invalid /etc/group file used with nss_wrapper.
[ira/wip.git] / selftest / target / Samba3.pm
index fdff4b76e910563c267c3ef077807a731fc827cf..4723fd690995f312b8956e80219a736ff7c0f8f3 100644 (file)
@@ -41,6 +41,9 @@ sub teardown_env($$)
        $self->stop_sig_term($smbdpid);
        $self->stop_sig_term($nmbdpid);
        $self->stop_sig_term($winbinddpid);
+
+       sleep(2);
+
        $self->stop_sig_kill($smbdpid);
        $self->stop_sig_kill($nmbdpid);
        $self->stop_sig_kill($winbinddpid);
@@ -114,6 +117,7 @@ sub setup_dc($$)
        my $dc_options = "
        domain master = yes
        domain logons = yes
+       lanman auth = yes
 ";
 
        my $vars = $self->provision($path,
@@ -123,9 +127,8 @@ sub setup_dc($$)
                                    $dc_options);
 
        $self->check_or_start($vars,
-                             ($ENV{NMBD_MAXTIME} or 2700),
-                             ($ENV{WINBINDD_MAXTIME} or 2700),
-                             ($ENV{SMBD_MAXTIME} or 2700));
+                             ($ENV{SMBD_MAXTIME} or 2700),
+                              "yes", "yes", "yes");
 
        $self->wait_for_start($vars);
 
@@ -142,6 +145,7 @@ sub setup_member($$$)
 
        my $member_options = "
        security = domain
+       server signing = on
 ";
        my $ret = $self->provision($prefix,
                                   "LOCALMEMBER3",
@@ -160,9 +164,8 @@ sub setup_member($$$)
        system($cmd) == 0 or die("Join failed\n$cmd");
 
        $self->check_or_start($ret,
-                             ($ENV{NMBD_MAXTIME} or 2700),
-                             ($ENV{WINBINDD_MAXTIME} or 2700),
-                             ($ENV{SMBD_MAXTIME} or 2700));
+                             ($ENV{SMBD_MAXTIME} or 2700),
+                              "yes", "yes", "yes");
 
        $self->wait_for_start($ret);
 
@@ -209,8 +212,8 @@ sub read_pid($$)
        return $pid;
 }
 
-sub check_or_start($$$$) {
-       my ($self, $env_vars, $nmbd_maxtime, $winbindd_maxtime, $smbd_maxtime) = @_;
+sub check_or_start($$$$$) {
+       my ($self, $env_vars, $maxtime, $nmbd, $winbindd, $smbd) = @_;
 
        unlink($env_vars->{NMBD_TEST_LOG});
        print "STARTING NMBD...";
@@ -226,6 +229,16 @@ sub check_or_start($$$$) {
                $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
                $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
 
+               if ($nmbd ne "yes") {
+                       $SIG{USR1} = $SIG{ALRM} = $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub {
+                               my $signame = shift;
+                               print("Skip nmbd received signal $signame");
+                               exit 0;
+                       };
+                       sleep($maxtime);
+                       exit 0;
+               }
+
                my @optargs = ("-d0");
                if (defined($ENV{NMBD_OPTIONS})) {
                        @optargs = split(/ /, $ENV{NMBD_OPTIONS});
@@ -233,7 +246,7 @@ sub check_or_start($$$$) {
 
                $ENV{MAKE_TEST_BINARY} = $self->binpath("nmbd");
 
-               my @preargs = ($self->binpath("timelimit"), $nmbd_maxtime);
+               my @preargs = ($self->binpath("timelimit"), $maxtime);
                if(defined($ENV{NMBD_VALGRIND})) { 
                        @preargs = split(/ /, $ENV{NMBD_VALGRIND});
                }
@@ -257,6 +270,16 @@ sub check_or_start($$$$) {
                $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
                $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
 
+               if ($winbindd ne "yes") {
+                       $SIG{USR1} = $SIG{ALRM} = $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub {
+                               my $signame = shift;
+                               print("Skip winbindd received signal $signame");
+                               exit 0;
+                       };
+                       sleep($maxtime);
+                       exit 0;
+               }
+
                my @optargs = ("-d0");
                if (defined($ENV{WINBINDD_OPTIONS})) {
                        @optargs = split(/ /, $ENV{WINBINDD_OPTIONS});
@@ -264,7 +287,7 @@ sub check_or_start($$$$) {
 
                $ENV{MAKE_TEST_BINARY} = $self->binpath("winbindd");
 
-               my @preargs = ($self->binpath("timelimit"), $winbindd_maxtime);
+               my @preargs = ($self->binpath("timelimit"), $maxtime);
                if(defined($ENV{WINBINDD_VALGRIND})) {
                        @preargs = split(/ /, $ENV{WINBINDD_VALGRIND});
                }
@@ -288,12 +311,22 @@ sub check_or_start($$$$) {
                $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
                $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
 
+               if ($smbd ne "yes") {
+                       $SIG{USR1} = $SIG{ALRM} = $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub {
+                               my $signame = shift;
+                               print("Skip smbd received signal $signame");
+                               exit 0;
+                       };
+                       sleep($maxtime);
+                       exit 0;
+               }
+
                $ENV{MAKE_TEST_BINARY} = $self->binpath("smbd");
                my @optargs = ("-d0");
                if (defined($ENV{SMBD_OPTIONS})) {
                        @optargs = split(/ /, $ENV{SMBD_OPTIONS});
                }
-               my @preargs = ($self->binpath("timelimit"), $smbd_maxtime);
+               my @preargs = ($self->binpath("timelimit"), $maxtime);
                if(defined($ENV{SMBD_VALGRIND})) {
                        @preargs = split(/ /,$ENV{SMBD_VALGRIND});
                }
@@ -425,9 +458,13 @@ sub provision($$$$$$)
 
        time server = yes
 
-       add user script = $nss_wrapper_pl --path $nss_wrapper_passwd --type passwd --action add --name %u
-       add machine script = $nss_wrapper_pl --path $nss_wrapper_passwd --type passwd --action add --name %u
-       delete user script = $nss_wrapper_pl --path $nss_wrapper_passwd --type passwd --action delete --name %u
+       add user script =               $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action add --name %u
+       add group script =              $nss_wrapper_pl --group_path  $nss_wrapper_group  --type group  --action add --name %g
+       add machine script =            $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action add --name %u
+       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
+       delete user script =            $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action delete --name %u
+       delete group script =           $nss_wrapper_pl --group_path  $nss_wrapper_group  --type group  --action delete --name %g
+       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
 
        kernel oplocks = no
        kernel change notify = no
@@ -473,7 +510,15 @@ sub provision($$$$$$)
 [print1]
        copy = tmp
        printable = yes
-       printing = test
+       printing = vlp
+       print command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb print %p %s
+       lpq command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lpq %p
+       lp rm command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lprm %p %j
+       lp pause command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lppause %p %j
+       lp resume command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lpresume %p %j
+       queue pause command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb queuepause %p
+       queue resume command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb queueresume %p
+
 [print2]
        copy = print1
 [print3]
@@ -489,6 +534,7 @@ sub provision($$$$$$)
 
        open(PASSWD, ">$nss_wrapper_passwd") or die("Unable to open $nss_wrapper_passwd");
        print PASSWD "nobody:x:65534:65533:nobody gecos:$prefix_abs:/bin/false
+root:x:65533:65532:root gecos:$prefix_abs:/bin/false
 $unix_name:x:$unix_uid:$unix_gids[0]:$unix_name gecos:$prefix_abs:/bin/false
 ";
        close(PASSWD);
@@ -496,6 +542,7 @@ $unix_name:x:$unix_uid:$unix_gids[0]:$unix_name gecos:$prefix_abs:/bin/false
        open(GROUP, ">$nss_wrapper_group") or die("Unable to open $nss_wrapper_group");
        print GROUP "nobody:x:65533:
 nogroup:x:65534:nobody
+root:x:65532:
 $unix_name-group:x:$unix_gids[0]:
 ";
        close(GROUP);