selftest: run nt4_member with server max protocol = SMB3_02
[metze/samba/wip.git] / selftest / target / Samba3.pm
index a553405db0d895d29fd02284f7e3965422d59852..5afb3de566b30f95c6b7916f7ab8f6e76c3e06fd 100755 (executable)
@@ -3,6 +3,9 @@
 # Copyright (C) 2005-2007 Jelmer Vernooij <jelmer@samba.org>
 # Published under the GNU GPL, v3 or later.
 
+# NOTE: Refer to the README for more details about the various testenvs,
+# and tips about adding new testenvs.
+
 package Samba3;
 
 use strict;
@@ -298,6 +301,7 @@ sub setup_nt4_member
 
        my $member_options = "
        security = domain
+       server max protocol = SMB3_02
        dbwrap_tdb_mutexes:* = yes
        ${require_mutexes}
 ";
@@ -324,7 +328,8 @@ sub setup_nt4_member
        }
 
        my $net = Samba::bindir_path($self, "net");
-       my $cmd = "";
+       # Add hosts file for name lookups
+       my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' ";
        $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
        $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" ";
        $cmd .= "$net rpc join $ret->{CONFIGURATION} $nt4_dc_vars->{DOMAIN} member";
@@ -335,7 +340,8 @@ sub setup_nt4_member
            return undef;
        }
 
-       my $cmd = "";
+       # Add hosts file for name lookups
+       my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' ";
        $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
        $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" ";
        $cmd .= "$net $ret->{CONFIGURATION} primarytrust dumpinfo | grep -q 'REDACTED SECRET VALUES'";
@@ -446,9 +452,11 @@ sub setup_ad_member
        Samba::mk_krb5_conf($ctx, "");
 
        $ret->{KRB5_CONFIG} = $ctx->{krb5_conf};
+       $ret->{RESOLV_CONF} = $dcvars->{RESOLV_CONF};
 
        my $net = Samba::bindir_path($self, "net");
-       my $cmd = "";
+       # Add hosts file for name lookups
+       my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' ";
        $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
        if (defined($ret->{RESOLV_WRAPPER_CONF})) {
                $cmd .= "RESOLV_WRAPPER_CONF=\"$ret->{RESOLV_WRAPPER_CONF}\" ";
@@ -540,9 +548,11 @@ sub setup_ad_member_rfc2307
        Samba::mk_krb5_conf($ctx, "");
 
        $ret->{KRB5_CONFIG} = $ctx->{krb5_conf};
+       $ret->{RESOLV_CONF} = $dcvars->{RESOLV_CONF};
 
        my $net = Samba::bindir_path($self, "net");
-       my $cmd = "";
+       # Add hosts file for name lookups
+       my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' ";
        $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
        if (defined($ret->{RESOLV_WRAPPER_CONF})) {
                $cmd .= "RESOLV_WRAPPER_CONF=\"$ret->{RESOLV_WRAPPER_CONF}\" ";
@@ -597,6 +607,9 @@ sub setup_ad_member_idmap_rid
        idmap config * : range = 1000000-1999999
        idmap config $dcvars->{DOMAIN} : backend = rid
        idmap config $dcvars->{DOMAIN} : range = 2000000-2999999
+       # Prevent overridding the provisioned lib/krb5.conf which sets certain
+       # values required for tests to succeed
+       create krb5 conf = no
 ";
 
        my $ret = $self->provision($prefix, $dcvars->{DOMAIN},
@@ -626,9 +639,11 @@ sub setup_ad_member_idmap_rid
        Samba::mk_krb5_conf($ctx, "");
 
        $ret->{KRB5_CONFIG} = $ctx->{krb5_conf};
+       $ret->{RESOLV_CONF} = $dcvars->{RESOLV_CONF};
 
        my $net = Samba::bindir_path($self, "net");
-       my $cmd = "";
+       # Add hosts file for name lookups
+       my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' ";
        $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
        if (defined($ret->{RESOLV_WRAPPER_CONF})) {
                $cmd .= "RESOLV_WRAPPER_CONF=\"$ret->{RESOLV_WRAPPER_CONF}\" ";
@@ -713,9 +728,11 @@ sub setup_ad_member_idmap_ad
        Samba::mk_krb5_conf($ctx, "");
 
        $ret->{KRB5_CONFIG} = $ctx->{krb5_conf};
+       $ret->{RESOLV_CONF} = $dcvars->{RESOLV_CONF};
 
        my $net = Samba::bindir_path($self, "net");
-       my $cmd = "";
+       # Add hosts file for name lookups
+       my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' ";
        $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
        if (defined($ret->{RESOLV_WRAPPER_CONF})) {
                $cmd .= "RESOLV_WRAPPER_CONF=\"$ret->{RESOLV_WRAPPER_CONF}\" ";
@@ -762,19 +779,58 @@ sub setup_simpleserver
        my $simpleserver_options = "
        lanman auth = yes
        ntlm auth = yes
-       vfs objects = xattr_tdb streams_depot time_audit full_audit
+       vfs objects = xattr_tdb streams_depot
        change notify = no
        smb encrypt = off
 
-       full_audit:syslog = no
-       full_audit:success = none
-       full_audit:failure = none
-
 [vfs_aio_pthread]
        path = $prefix_abs/share
        read only = no
        vfs objects = aio_pthread
        aio_pthread:aio open = yes
+       smbd:async dosmode = no
+
+[vfs_aio_pthread_async_dosmode_default1]
+       path = $prefix_abs/share
+       read only = no
+       vfs objects = aio_pthread
+       store dos attributes = yes
+       aio_pthread:aio open = yes
+       smbd:async dosmode = yes
+
+[vfs_aio_pthread_async_dosmode_default2]
+       path = $prefix_abs/share
+       read only = no
+       vfs objects = aio_pthread xattr_tdb
+       store dos attributes = yes
+       aio_pthread:aio open = yes
+       smbd:async dosmode = yes
+
+[vfs_aio_pthread_async_dosmode_force_sync1]
+       path = $prefix_abs/share
+       read only = no
+       vfs objects = aio_pthread
+       store dos attributes = yes
+       aio_pthread:aio open = yes
+       smbd:async dosmode = yes
+       # This simulates non linux systems
+       smbd:force sync user path safe threadpool = yes
+       smbd:force sync user chdir safe threadpool = yes
+       smbd:force sync root path safe threadpool = yes
+       smbd:force sync root chdir safe threadpool = yes
+
+[vfs_aio_pthread_async_dosmode_force_sync2]
+       path = $prefix_abs/share
+       read only = no
+       vfs objects = aio_pthread xattr_tdb
+       store dos attributes = yes
+       aio_pthread:aio open = yes
+       smbd:async dosmode = yes
+       # This simulates non linux systems
+       smbd:force sync user path safe threadpool = yes
+       smbd:force sync user chdir safe threadpool = yes
+       smbd:force sync root path safe threadpool = yes
+       smbd:force sync root chdir safe threadpool = yes
 
 [vfs_aio_fork]
        path = $prefix_abs/share
@@ -793,6 +849,10 @@ sub setup_simpleserver
        path = $prefix_abs/share
        vfs objects =
        smb encrypt = desired
+
+[hidenewfiles]
+       path = $prefix_abs/share
+       hide new files timeout = 5
 ";
 
        my $vars = $self->provision($path, "WORKGROUP",
@@ -842,6 +902,9 @@ sub setup_fileserver
        push(@dirs, "$dfree_share_dir/subdir2");
        push(@dirs, "$dfree_share_dir/subdir3");
 
+       my $quotadir_dir="$share_dir/quota";
+       push(@dirs, $quotadir_dir);
+
        my $valid_users_sharedir="$share_dir/valid_users";
        push(@dirs,$valid_users_sharedir);
 
@@ -868,6 +931,8 @@ sub setup_fileserver
        usershare allow guests = yes
        usershare prefix allow list = $usershare_sharedir
 
+       get quota command = $prefix_abs/getset_quota.py
+       set quota command = $prefix_abs/getset_quota.py
 [lowercase]
        path = $lower_case_share_dir
        comment = smb username is [%U]
@@ -920,6 +985,15 @@ sub setup_fileserver
        comment = inherit only unix owner
        inherit owner = unix only
        acl_xattr:ignore system acls = yes
+# BUG: https://bugzilla.samba.org/show_bug.cgi?id=13690
+[force_group_test]
+       path = $share_dir
+       comment = force group test
+#      force group = everyone
+[homes]
+       comment = Home directories
+       browseable = No
+       read only = No
 ";
 
        my $vars = $self->provision($path, "WORKGROUP",
@@ -1581,6 +1655,8 @@ sub provision($$$$$$$$$)
 
        my $conffile="$libdir/server.conf";
        my $dfqconffile="$libdir/dfq.conf";
+       my $errorinjectconf="$libdir/error_inject.conf";
+       my $delayinjectconf="$libdir/delay_inject.conf";
 
        my $nss_wrapper_pl = "$ENV{PERL} $self->{srcdir}/third_party/nss_wrapper/nss_wrapper.pl";
        my $nss_wrapper_passwd = "$privatedir/passwd";
@@ -1609,8 +1685,11 @@ sub provision($$$$$$$$$)
        my ($gid_force_user);
        my ($uid_user1);
        my ($uid_user2);
+       my ($uid_gooduser);
+       my ($uid_eviluser);
+       my ($uid_slashuser);
 
-       if ($unix_uid < 0xffff - 10) {
+       if ($unix_uid < 0xffff - 13) {
                $max_uid = 0xffff;
        } else {
                $max_uid = $unix_uid;
@@ -1626,6 +1705,9 @@ sub provision($$$$$$$$$)
        $uid_smbget = $max_uid - 8;
        $uid_user1 = $max_uid - 9;
        $uid_user2 = $max_uid - 10;
+       $uid_gooduser = $max_uid - 11;
+       $uid_eviluser = $max_uid - 12;
+       $uid_slashuser = $max_uid - 13;
 
        if ($unix_gids[0] < 0xffff - 8) {
                $max_gid = 0xffff;
@@ -1718,7 +1800,11 @@ sub provision($$$$$$$$$)
        dos filemode = yes
        strict rename = yes
        strict sync = yes
-       vfs objects = acl_xattr fake_acls xattr_tdb streams_depot
+       vfs objects = acl_xattr fake_acls xattr_tdb streams_depot time_audit full_audit
+
+       full_audit:syslog = no
+       full_audit:success = none
+       full_audit:failure = none
 
        printing = vlp
        print command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb print %p %s
@@ -1952,6 +2038,24 @@ sub provision($$$$$$$$$)
        fruit:time machine = yes
        fruit:time machine max size = 32K
 
+[vfs_fruit_wipe_intentionally_left_blank_rfork]
+       path = $shrdir
+       vfs objects = fruit streams_xattr acl_xattr xattr_tdb
+       fruit:resource = file
+       fruit:metadata = stream
+       fruit:wipe_intentionally_left_blank_rfork = true
+       fruit:delete_empty_adfiles = false
+       fruit:veto_appledouble = no
+
+[vfs_fruit_delete_empty_adfiles]
+       path = $shrdir
+       vfs objects = fruit streams_xattr acl_xattr xattr_tdb
+       fruit:resource = file
+       fruit:metadata = stream
+       fruit:wipe_intentionally_left_blank_rfork = true
+       fruit:delete_empty_adfiles = true
+       fruit:veto_appledouble = no
+
 [badname-tmp]
        path = $badnames_shrdir
        guest ok = yes
@@ -2111,6 +2215,15 @@ sub provision($$$$$$$$$)
        vfs objects = shadow_copy2
        shadow:mountpoint = $shadow_mntdir
        wide links = yes
+
+[shadow_write]
+       path = $shadow_tstdir
+       comment = previous versions snapshots under mount point
+       vfs objects = shadow_copy2 streams_xattr error_inject
+       aio write size = 0
+       error_inject:pwrite = EBADF
+       shadow:mountpoint = $shadow_tstdir
+
 [dfq]
        path = $shrdir/dfree
        vfs objects = acl_xattr fake_acls xattr_tdb fake_dfq
@@ -2127,6 +2240,10 @@ sub provision($$$$$$$$$)
        vfs objects = acl_xattr fake_acls xattr_tdb fake_dfq
        inherit owner = yes
        include = $dfqconffile
+[quotadir]
+       path = $shrdir/quota
+       admin users = $unix_name
+
 [acl_xattr_ign_sysacl_posix]
        copy = tmp
        acl_xattr:ignore system acls = yes
@@ -2165,7 +2282,25 @@ sub provision($$$$$$$$$)
 [error_inject]
        copy = tmp
        vfs objects = error_inject
-       include = $libdir/error_inject.conf
+       include = $errorinjectconf
+
+[delay_inject]
+       copy = tmp
+       vfs objects = delay_inject
+       kernel share modes = no
+       kernel oplocks = no
+       posix locking = no
+       include = $delayinjectconf
+
+[aio_delay_inject]
+       copy = tmp
+       vfs objects = delay_inject
+       delay_inject:pread_send = 2000
+       delay_inject:pwrite_send = 2000
+
+[delete_readonly]
+       path = $prefix_abs/share
+       delete readonly = yes
        ";
        close(CONF);
 
@@ -2179,6 +2314,18 @@ sub provision($$$$$$$$$)
            return undef;
        }
 
+       unless (open(ERRORCONF, ">$errorinjectconf")) {
+               warn("Unable to open $errorinjectconf");
+               return undef;
+       }
+       close(ERRORCONF);
+
+       unless (open(DELAYCONF, ">$delayinjectconf")) {
+               warn("Unable to open $delayinjectconf");
+               return undef;
+       }
+       close(DELAYCONF);
+
        unless (open(DFQCONF, ">$dfqconffile")) {
                warn("Unable to open $dfqconffile");
                return undef;
@@ -2203,6 +2350,9 @@ force_user:x:$uid_force_user:$gid_force_user:force user gecos:$prefix_abs:/bin/f
 smbget_user:x:$uid_smbget:$gid_domusers:smbget_user gecos:$prefix_abs:/bin/false
 user1:x:$uid_user1:$gid_nogroup:user1 gecos:$prefix_abs:/bin/false
 user2:x:$uid_user2:$gid_nogroup:user2 gecos:$prefix_abs:/bin/false
+gooduser:x:$uid_gooduser:$gid_domusers:gooduser gecos:$prefix_abs:/bin/false
+eviluser:x:$uid_eviluser:$gid_domusers:eviluser gecos::/bin/false
+slashuser:x:$uid_slashuser:$gid_domusers:slashuser gecos:/:/bin/false
 ";
        if ($unix_uid != 0) {
                print PASSWD "root:x:$uid_root:$gid_root:root gecos:$prefix_abs:/bin/false
@@ -2279,6 +2429,9 @@ force_user:x:$gid_force_user:
        createuser($self, "smbget_user", $password, $conffile, \%createuser_env) || die("Unable to create smbget_user");
        createuser($self, "user1", $password, $conffile, \%createuser_env) || die("Unable to create user1");
        createuser($self, "user2", $password, $conffile, \%createuser_env) || die("Unable to create user2");
+       createuser($self, "gooduser", $password, $conffile, \%createuser_env) || die("Unable to create gooduser");
+       createuser($self, "eviluser", $password, $conffile, \%createuser_env) || die("Unable to create eviluser");
+       createuser($self, "slashuser", $password, $conffile, \%createuser_env) || die("Unable to create slashuser");
 
        open(DNS_UPDATE_LIST, ">$prefix/dns_update_list") or die("Unable to open $$prefix/dns_update_list");
        print DNS_UPDATE_LIST "A $server. $server_ip\n";