See if we can get a slight chance of this actually working...
[ira/wip.git] / testsuite / build_farm / basicsmb.fns
index 30964d8223080631f135faa3904bd4ae4827142f..75c40e879e4ef1a43a43098c0436c59e7aac5e38 100644 (file)
@@ -2,7 +2,7 @@
 
 # Common functions for Samba build scripts.
 
-# Copyright (C) 2001 by Martin Pool <mbp@samba.org>
+# Copyright (C) 2001 by Martin Pool <mbp@samba.org> and others
 
 # The following variables are passed in by the calling script.  They
 # originate in either the buildfarm scripts or the configured
@@ -24,7 +24,7 @@
 template_smb_conf_setup() {
        cat basicsmb.smb.conf$1.template | \
               sed "s|PREFIX|$prefix|g" | \
-             sed "s|BUILD_FARM|$pwd|g" | \
+             sed "s|BUILD_FARM|$test_root|g" | \
              sed "s|WHOAMI|$whoami|g" | \
              sed "s|LOGLEVEL|$loglevel|g" \
         > $prefix/lib/smb.conf$1
@@ -34,9 +34,10 @@ template_smb_conf_setup() {
 test_smb_conf_setup() {
     echo "test_smb_conf_setup: Configuring: "
     echo "    PREFIX=$prefix"
-    echo "    BUILD_FARM=$pwd"
+    echo "    BUILD_FARM=$test_root"
     echo "    WHOAMI=$whoami"
     echo "    LOGLEVEL=$loglevel"
+    echo "    TREE=$tree"
 
     case "$prefix" in
     /usr*|/|//)
@@ -85,6 +86,35 @@ test_smbpasswd() {
        return 0
 }
 
+test_smbpasswd_remote() {
+       test_smbpasswd_rem_password="$1"
+       test_smbpasswd_rem_newpassword="$2"
+       echo "( echo $test_smbpasswd_rem_password; echo $test_smbpasswd_rem_newpassword; echo $test_smbpasswd_rem_newpassword; ) | $prefix/bin/smbpasswd -r localhost -s -U $whoami"
+       ( echo $test_smbpasswd_rem_password; echo $test_smbpasswd_rem_newpassword; echo $test_smbpasswd_rem_newpassword; ) | $prefix/bin/smbpasswd -r localhost -s -U $whoami
+       status=$?
+       if [ $status = 0 ]; then
+           echo "smbpasswd correctly remotely changed password ($test_smbpasswd_rem_password -> $test_smbpasswd_rem_newpassword)"
+       else
+           echo "smbpasswd failed to remotely changed password ($test_smbpasswd_rem_password -> $test_smbpasswd_rem_newpassword)! (status $status)"
+           return 1
+       fi
+       return 0
+}
+
+test_smbpasswd_local() {
+       test_smbpasswd_newpassword="$2"
+       echo "( echo $test_smbpasswd_newpassword ; echo $test_smbpasswd_newpassword; ) | $prefix/bin/smbpasswd -L -s $whoami"
+       ( echo $test_smbpasswd_newpassword ; echo $test_smbpasswd_newpassword; ) | $prefix/bin/smbpasswd -L -s $whoami
+       status=$?
+       if [ $status = 0 ]; then
+           echo "smbpasswd correctly locally changed password ($test_smbpasswd_password -> $test_smbpasswd_newpassword)"
+       else
+           echo "smbpasswd failed to locallly changed password ($test_smbpasswd_password -> $test_smbpasswd_newpassword)! (status $status)"
+           return 1
+       fi
+       return 0
+}
+
 test_listfilesauth() {
        remote_name="$1"
        echo $prefix/bin/smbclient//$remote_name/samba  -n buildclient -U$whoami%$password -c 'ls'
@@ -152,5 +182,3 @@ then
     loglevel=1
 fi
 
-
-pwd=`pwd`