summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2001-09-20 06:23:29 +0000
committerAndrew Bartlett <abartlet@samba.org>2001-09-20 06:23:29 +0000
commitc16effd5fb4f53a9f900da9be2a94c5468f4677f (patch)
treeb3370b3e952d40355b3e642278370e3ffbf85c7d /testsuite
parent395454db5d7e911ea418b88250778749463f7247 (diff)
downloadsamba-c16effd5fb4f53a9f900da9be2a94c5468f4677f.tar.gz
samba-c16effd5fb4f53a9f900da9be2a94c5468f4677f.tar.xz
samba-c16effd5fb4f53a9f900da9be2a94c5468f4677f.zip
Add and modify some of the various tests I have had sitting around here for a
little while. This should give us a bit more coverage. Andrew Bartlett (This used to be commit 9e5a1d1623872a598c936e596270abe519c36e97)
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/build_farm/basicsmb-domainsec-nt4.test31
-rw-r--r--testsuite/build_farm/basicsmb-domainsec.test21
-rw-r--r--testsuite/build_farm/basicsmb-hostsdeny.test18
-rw-r--r--testsuite/build_farm/basicsmb-hostsequiv.test28
-rw-r--r--testsuite/build_farm/basicsmb-invalidusers.test8
-rw-r--r--testsuite/build_farm/basicsmb.fns40
-rw-r--r--testsuite/build_farm/basicsmb.smb.conf.domain2
-rw-r--r--testsuite/build_farm/basicsmb.smb.conf.hostsdeny1
-rw-r--r--testsuite/build_farm/basicsmb.smb.conf.hostsequiv.template3
-rw-r--r--testsuite/build_farm/basicsmb.smb.conf.invalidusers.template1
-rw-r--r--testsuite/build_farm/basicsmb.smb.conf.template2
-rw-r--r--testsuite/build_farm/runlist2
12 files changed, 147 insertions, 10 deletions
diff --git a/testsuite/build_farm/basicsmb-domainsec-nt4.test b/testsuite/build_farm/basicsmb-domainsec-nt4.test
new file mode 100644
index 0000000000..933f8f9804
--- /dev/null
+++ b/testsuite/build_farm/basicsmb-domainsec-nt4.test
@@ -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
+
diff --git a/testsuite/build_farm/basicsmb-domainsec.test b/testsuite/build_farm/basicsmb-domainsec.test
index 0674e75bb8..ff184c4c7f 100644
--- a/testsuite/build_farm/basicsmb-domainsec.test
+++ b/testsuite/build_farm/basicsmb-domainsec.test
@@ -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
index 0000000000..c7f6bec62f
--- /dev/null
+++ b/testsuite/build_farm/basicsmb-hostsdeny.test
@@ -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
index 0000000000..0df086e910
--- /dev/null
+++ b/testsuite/build_farm/basicsmb-hostsequiv.test
@@ -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
index 0000000000..54c9c758c6
--- /dev/null
+++ b/testsuite/build_farm/basicsmb-invalidusers.test
@@ -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
+
diff --git a/testsuite/build_farm/basicsmb.fns b/testsuite/build_farm/basicsmb.fns
index d532d5eb2a..c38bbe5d18 100644
--- a/testsuite/build_farm/basicsmb.fns
+++ b/testsuite/build_farm/basicsmb.fns
@@ -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
diff --git a/testsuite/build_farm/basicsmb.smb.conf.domain b/testsuite/build_farm/basicsmb.smb.conf.domain
index ddb515362c..8b9728838e 100644
--- a/testsuite/build_farm/basicsmb.smb.conf.domain
+++ b/testsuite/build_farm/basicsmb.smb.conf.domain
@@ -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
index 0000000000..3fce0bdbf4
--- /dev/null
+++ b/testsuite/build_farm/basicsmb.smb.conf.hostsdeny
@@ -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
index 0000000000..7356a73945
--- /dev/null
+++ b/testsuite/build_farm/basicsmb.smb.conf.hostsequiv.template
@@ -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
index 0000000000..a96a316db9
--- /dev/null
+++ b/testsuite/build_farm/basicsmb.smb.conf.invalidusers.template
@@ -0,0 +1 @@
+ invalid users = WHOAMI
diff --git a/testsuite/build_farm/basicsmb.smb.conf.template b/testsuite/build_farm/basicsmb.smb.conf.template
index 6785866fc1..b001ed63e2 100644
--- a/testsuite/build_farm/basicsmb.smb.conf.template
+++ b/testsuite/build_farm/basicsmb.smb.conf.template
@@ -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
diff --git a/testsuite/build_farm/runlist b/testsuite/build_farm/runlist
index ad5d12fb0f..784b5e0387 100644
--- a/testsuite/build_farm/runlist
+++ b/testsuite/build_farm/runlist
@@ -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