Add and modify some of the various tests I have had sitting around here for a
authorAndrew Bartlett <abartlet@samba.org>
Thu, 20 Sep 2001 06:23:29 +0000 (06:23 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 20 Sep 2001 06:23:29 +0000 (06:23 +0000)
little while.  This should give us a bit more coverage.

Andrew Bartlett
(This used to be commit 9e5a1d1623872a598c936e596270abe519c36e97)

12 files changed:
testsuite/build_farm/basicsmb-domainsec-nt4.test [new file with mode: 0644]
testsuite/build_farm/basicsmb-domainsec.test
testsuite/build_farm/basicsmb-hostsdeny.test [new file with mode: 0644]
testsuite/build_farm/basicsmb-hostsequiv.test [new file with mode: 0644]
testsuite/build_farm/basicsmb-invalidusers.test [new file with mode: 0644]
testsuite/build_farm/basicsmb.fns
testsuite/build_farm/basicsmb.smb.conf.domain
testsuite/build_farm/basicsmb.smb.conf.hostsdeny [new file with mode: 0644]
testsuite/build_farm/basicsmb.smb.conf.hostsequiv.template [new file with mode: 0644]
testsuite/build_farm/basicsmb.smb.conf.invalidusers.template [new file with mode: 0644]
testsuite/build_farm/basicsmb.smb.conf.template
testsuite/build_farm/runlist

diff --git a/testsuite/build_farm/basicsmb-domainsec-nt4.test b/testsuite/build_farm/basicsmb-domainsec-nt4.test
new file mode 100644 (file)
index 0000000..933f8f9
--- /dev/null
@@ -0,0 +1,31 @@
+if [ $whoami != "root" ]; then
+       exit 0;
+fi
+
+. basicsmb.fns
+
+test_joindomain_nt4() {
+
+       smbpasswd -a -m buildfarm$
+
+       echo $prefix/bin/smbpasswd -L -j TESTWG
+       $prefix/bin/smbpasswd -L -j TESTWG
+       status=$?
+       if [ $status = 0 ]; then
+           echo "smbpasswd correctly joined the domain ($workgroup)"
+       else
+           echo "smbpasswd failed to join the domain ($workgroup)! (status $status)"
+           return 1
+       fi
+       return 0
+}
+
+password=samba
+security=DOMAIN
+(test_smb_conf_setup && test_smbpasswd $password ) || exit 1
+
+test_joindomain_nt4 $password || exit 1
+
+test_listfilesauth $security  || exit 1
+test_listfilesnpw $security  || exit 1
+
index 0674e75bb82d509575d2b5e39ce582b76702243a..ff184c4c7f307b2d4c67f8505663b66c2fda3f5f 100644 (file)
@@ -1,9 +1,30 @@
+if [ $whoami != "root" ]; then
+       exit 0;
+fi
+
 . basicsmb.fns
 
+test_joindomain() {
+       test_joindomain_password="$1"
+
+       echo "$prefix/bin/smbpasswd -L -j TESTWG -U $whoami%$test_join_domain_password"
+       $prefix/bin/smbpasswd -L -j TESTWG -U $whoami%$test_join_domain_password
+       status=$?
+       if [ $status = 0 ]; then
+           echo "smbpasswd correctly joined the domain ($workgroup)"
+       else
+           echo "smbpasswd failed to join the domain ($workgroup)! (status $status)"
+           return 1
+       fi
+       return 0
+}
+
 password=samba
 security=DOMAIN
 (test_smb_conf_setup && test_smbpasswd $password ) || exit 1
 
+test_joindomain $password || exit 1
+
 test_listfilesauth $security  || exit 1
 test_listfilesnpw $security  || exit 1
 
diff --git a/testsuite/build_farm/basicsmb-hostsdeny.test b/testsuite/build_farm/basicsmb-hostsdeny.test
new file mode 100644 (file)
index 0000000..c7f6bec
--- /dev/null
@@ -0,0 +1,18 @@
+. basicsmb.fns
+
+password="samba"
+security="hostsdeny"
+(test_smb_conf_setup && test_smbpasswd $password) || exit 1
+
+(test_listfilesauth_should_deny $security) || exit 1
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testsuite/build_farm/basicsmb-hostsequiv.test b/testsuite/build_farm/basicsmb-hostsequiv.test
new file mode 100644 (file)
index 0000000..0df086e
--- /dev/null
@@ -0,0 +1,28 @@
+if [ $whoami = "root" ]; then
+       exit 0;
+fi
+
+. basicsmb.fns
+
+test_listfilesrootnpw() {
+       remote_name="$1"
+       echo $prefix/bin/smbclient //$remote_name/samba -n buildclient -Uroot%  -c 'ls'
+       $prefix/bin/smbclient //$remote_name/samba -n buildclient -Uroot% -c 'ls'
+       status=$?
+       if [ $status = 0 ]; then
+               echo "smbd listed files AS ROOT with NO PASSWORD (hosts equiv test)!"
+               return 1
+       else 
+               echo "listing files with smbd failed with status $status (correct)"
+       fi
+       return 0
+}
+
+password="not-a-valid-password"
+security="hostsequiv"
+(test_smb_conf_setup ) || exit 1
+
+(test_listfilesauth $security) || exit 1
+# (test_listfilesrootnpw $security) || exit 1
+# Unfortuetly we map to guest, and this is allowed access due to a BUG.  This
+# test disabled till we fix it.
diff --git a/testsuite/build_farm/basicsmb-invalidusers.test b/testsuite/build_farm/basicsmb-invalidusers.test
new file mode 100644 (file)
index 0000000..54c9c75
--- /dev/null
@@ -0,0 +1,8 @@
+. basicsmb.fns
+
+password="samba"
+security="invalidusers"
+(test_smb_conf_setup && test_smbpasswd $password) || exit 1
+
+(test_listfilesauth_should_deny $security) || exit 1
+
index d532d5eb2a08eb6e08dbfaa9ff799a890444c4e4..c38bbe5d1849fa5228b01a1354d4b13f00c3b79a 100644 (file)
@@ -1,21 +1,32 @@
-test_smb_conf_setup() {
-       cat basicsmb.smb.conf.template | \
+template_smb_conf_setup() {
+       cat basicsmb.smb.conf$1.template | \
               sed "s|PREFIX|$prefix|g" | \
              sed "s|BUILD_FARM|$pwd|g" | \
              sed "s|WHOAMI|$whoami|g" | \
              sed "s|LOGLEVEL|$loglevel|g" \
-        > $prefix/lib/smb.conf
+        > $prefix/lib/smb.conf$1
+}
+
+test_smb_conf_setup() {
+    template_smb_conf_setup 
+    template_smb_conf_setup .hostsequiv
+    template_smb_conf_setup .invalidusers
 
        echo "127.0.0.1    localhost">$prefix/lib/lmhosts
-       echo "127.0.0.1    BUILDFARM">>$prefix/lib/lmhosts
-    echo "127.0.0.1    SHARE">>$prefix/lib/lmhosts
-    echo "127.0.0.1    USER">>$prefix/lib/lmhosts
-    echo "127.0.0.1    SERVER">>$prefix/lib/lmhosts
-    echo "127.0.0.1    DOMAIN">>$prefix/lib/lmhosts
+       echo "127.0.0.2    BUILDFARM">>$prefix/lib/lmhosts
+    echo "127.0.0.3    SHARE">>$prefix/lib/lmhosts
+    echo "127.0.0.4    USER">>$prefix/lib/lmhosts
+    echo "127.0.0.5    SERVER">>$prefix/lib/lmhosts
+    echo "127.0.0.6    DOMAIN">>$prefix/lib/lmhosts
+    echo "127.0.0.7    HOSTSEQUIV">>$prefix/lib/lmhosts
+
+    echo "localhost" > $prefix/lib/hosts.equiv
+
     cp basicsmb.smb.conf.share $prefix/lib/smb.conf.share
     cp basicsmb.smb.conf.user $prefix/lib/smb.conf.user
     cp basicsmb.smb.conf.server $prefix/lib/smb.conf.server
     cp basicsmb.smb.conf.domain $prefix/lib/smb.conf.domain
+
     touch $prefix/lib/smb.conf.
     touch $prefix/lib/smb.conf.localhost
 }
@@ -63,3 +74,16 @@ test_listfilesnpw() {
        return 0
 }
 
+test_listfilesauth_should_deny() {
+       remote_name="$1"
+       echo $prefix/bin/smbclient //$remote_name/samba -n buildclient -U$whoami%$password  -c 'ls'
+       $prefix/bin/smbclient //$remote_name/samba -n buildclient -U$whoami%$password -c 'ls'
+       status=$?
+       if [ $status = 0 ]; then
+               echo "smbd LISTED FILES despite smb.conf entires to the contary!"
+               return 1
+       else 
+               echo "listing files with smbd failed with status $status (correct)"
+       fi
+       return 0
+}
\ No newline at end of file
index ddb515362c186e8d724569b80dd1eb7a62f37bd6..8b9728838e1172eefac145f7102a8fed18b10d8d 100644 (file)
@@ -1,2 +1,2 @@
 security=domain
-password server=127.0.0.1
+password server=user
diff --git a/testsuite/build_farm/basicsmb.smb.conf.hostsdeny b/testsuite/build_farm/basicsmb.smb.conf.hostsdeny
new file mode 100644 (file)
index 0000000..3fce0bd
--- /dev/null
@@ -0,0 +1 @@
+       hosts deny = 127.
\ No newline at end of file
diff --git a/testsuite/build_farm/basicsmb.smb.conf.hostsequiv.template b/testsuite/build_farm/basicsmb.smb.conf.hostsequiv.template
new file mode 100644 (file)
index 0000000..7356a73
--- /dev/null
@@ -0,0 +1,3 @@
+       hostname lookups = yes
+       hosts equiv=PREFIX/lib/hosts.equiv
+
diff --git a/testsuite/build_farm/basicsmb.smb.conf.invalidusers.template b/testsuite/build_farm/basicsmb.smb.conf.invalidusers.template
new file mode 100644 (file)
index 0000000..a96a316
--- /dev/null
@@ -0,0 +1 @@
+      invalid users = WHOAMI
index 6785866fc1066dcd72e685a3cf14f4153e1caff0..b001ed63e2724926648bb98c40f32354a91f7d57 100644 (file)
@@ -13,6 +13,8 @@
 
     include = PREFIX/lib/smb.conf.%L
 
+    add machine script = useradd %u -d /dev/null -s /bin/false
+
 [test]
     path = PREFIX/testdir
     read only = no
index ad5d12fb0f14c6b02d6f8cc548eec7b34ef6c6e3..784b5e0387d6e7db605c18a0ec7fd707e9451a26 100644 (file)
@@ -1,3 +1,3 @@
-TEST_ALL="basicsmb-sharelist basicsmb-sharesec basicsmb-usersec basicsmb-serversec basicsmb-shareguest torture-FDPASS torture-LOCK1 torture-LOCK2 torture-LOCK3 torture-LOCK4 torture-LOCK5 torture-UNLINK torture-BROWSE torture-ATTR torture-TRANS2 torture-TORTURE torture-OPLOCK1 torture-OPLOCK3 torture-DIR torture-DENY1 torture-DENY2 torture-TCON torture-RW1 torture-RW2 torture-OPEN torture-DELETE"
+TEST_ALL="basicsmb-sharelist basicsmb-sharesec basicsmb-usersec basicsmb-serversec basicsmb-domainsec basicsmb-domainsec-nt4 basicsmb-shareguest basicsmb-hostsequiv basicsmb-invalidusers basicsmb-hostsdeny torture-FDPASS torture-LOCK1 torture-LOCK2 torture-LOCK3 torture-LOCK4 torture-LOCK5 torture-UNLINK torture-BROWSE torture-ATTR torture-TRANS2 torture-TORTURE torture-OPLOCK1 torture-OPLOCK3 torture-DIR torture-DENY1 torture-DENY2 torture-TCON torture-RW1 torture-RW2 torture-OPEN torture-DELETE"
 
 #basicsmb-serversec