r14527: Fix build problems.
authorJelmer Vernooij <jelmer@samba.org>
Fri, 17 Mar 2006 17:59:58 +0000 (17:59 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:57:37 +0000 (13:57 -0500)
(This used to be commit 863ca4014d9b821706ee90f58ab5d5cf3899a4c7)

49 files changed:
source4/torture/basic/aliases.c
source4/torture/basic/attr.c
source4/torture/basic/base.c
source4/torture/basic/charset.c
source4/torture/basic/delaywrite.c
source4/torture/basic/delete.c
source4/torture/basic/denytest.c
source4/torture/basic/dir.c
source4/torture/basic/disconnect.c
source4/torture/basic/locking.c
source4/torture/basic/mangle_test.c
source4/torture/basic/properties.c
source4/torture/basic/rename.c
source4/torture/basic/scanner.c
source4/torture/basic/secleak.c
source4/torture/basic/unlink.c
source4/torture/basic/utable.c
source4/torture/config.mk
source4/torture/gentest.c
source4/torture/local/iconv.c
source4/torture/nbench/nbench.c
source4/torture/nbench/nbio.c
source4/torture/rap/rap.c
source4/torture/raw/acls.c
source4/torture/raw/chkpath.c
source4/torture/raw/close.c
source4/torture/raw/composite.c
source4/torture/raw/context.c
source4/torture/raw/eas.c
source4/torture/raw/ioctl.c
source4/torture/raw/lock.c
source4/torture/raw/mkdir.c
source4/torture/raw/mux.c
source4/torture/raw/notify.c
source4/torture/raw/open.c
source4/torture/raw/oplock.c
source4/torture/raw/qfileinfo.c
source4/torture/raw/qfsinfo.c
source4/torture/raw/read.c
source4/torture/raw/rename.c
source4/torture/raw/search.c
source4/torture/raw/seek.c
source4/torture/raw/setfileinfo.c
source4/torture/raw/streams.c
source4/torture/raw/unlink.c
source4/torture/raw/write.c
source4/torture/torture.c
source4/torture/torture.h
source4/torture/torture_util.c

index 142899ba8d7998b565d51902a01bc5f6801d2db2..40a1c68b8bd10c73ca7f7fd9f8a20b23fdaeccbf 100644 (file)
@@ -22,6 +22,8 @@
 #include "dlinklist.h"
 #include "libcli/raw/libcliraw.h"
 #include "torture/torture.h"
+#include "libcli/libcli.h"
+#include "torture/util.h"
 
 int create_complex_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, const char *fname);
 
index e321993749a6050725ac68e8e1aeadab865f81f2..b410d5b3e5f844a6b1a579d8e5c206fafb0ceba6 100644 (file)
@@ -23,6 +23,7 @@
 #include "includes.h"
 #include "torture/torture.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 extern int torture_failures;
 
index 87ea9fe0ddba0d54e0fac364f79a183fdca05105..83ca7976696d2b61ac898b6489a8c6b813c7542c 100644 (file)
@@ -23,6 +23,7 @@
 #include "torture/torture.h"
 #include "torture/basic/proto.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 #include "system/filesys.h"
 #include "system/time.h"
 #include "libcli/resolve/resolve.h"
index 186b265e19336720c44c2632ea4404bdf334bcc5..81a9c6bb63fe6fae75cc8ca354dc89fba6708918 100644 (file)
@@ -24,6 +24,7 @@
 #include "torture/torture.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 #define BASEDIR "\\chartest\\"
 
index 37a9528f97306a80bed254ae5cc0a9d2c055d840..2f1c4b98c72c757304ca03b20a5a981800b8d15d 100644 (file)
@@ -28,6 +28,7 @@
 #include "system/time.h"
 #include "system/filesys.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 #define BASEDIR "\\delaywrite"
 
index 98bd00010f3b7ae7f3a9b9818543197b25ea0130..97ae518ea831966c4392a4639fed0977a59c77f0 100644 (file)
@@ -23,6 +23,7 @@
 #include "includes.h"
 #include "libcli/libcli.h"
 #include "torture/torture.h"
+#include "torture/util.h"
 #include "system/filesys.h"
 #include "libcli/raw/libcliraw.h"
 
index 127df9052db0056a353a8d41406018d364122872..2a01d12c5ba04dd673a1955738ba6f379cd46862 100644 (file)
@@ -23,6 +23,7 @@
 #include "system/filesys.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 extern BOOL torture_showall;
 extern int torture_failures;
index 9dd62f3aa12b1ea8f12b529567d0fbf4e9f6a006..ca85ac4715abc67fdb7caccff3f5437fc062845f 100644 (file)
@@ -23,6 +23,7 @@
 #include "includes.h"
 #include "libcli/libcli.h"
 #include "torture/torture.h"
+#include "torture/util.h"
 #include "system/filesys.h"
 
 static void list_fn(struct clilist_file_info *finfo, const char *name, void *state)
index bc892120e3469c95ed00f2c37f2ad1c4eaa8b53e..d21807aa83973de5583518f9c3e580bcd7a4ee77 100644 (file)
@@ -25,6 +25,7 @@
 #include "system/filesys.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 #define BASEDIR "\\test_disconnect"
 
index 9a00ab3efa5fbd2ceca2a4cb0622d08f7648a401..65f2dbac31749e201d85eb385310e509db0585e1 100644 (file)
@@ -24,6 +24,7 @@
 #include "includes.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 #include "torture/torture.h"
 #include "system/time.h"
 #include "system/filesys.h"
index 36b7481316a7a1f03a28f263072d018d7b7fa6aa..18b2e912bad14667d2b74fdada72d7ccf111b8d1 100644 (file)
@@ -23,6 +23,7 @@
 #include "system/filesys.h"
 #include "lib/tdb/include/tdbutil.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 #include "pstring.h"
 
 static TDB_CONTEXT *tdb;
index c20edf545b666b0e6139b7af2f4f399633673501..1f0027cf0d56eefee9653b0485c38aed5f20b391 100644 (file)
@@ -24,6 +24,7 @@
 #include "torture/torture.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 struct bitmapping {
        const char *name;
index 4bdc6f2d9f34e68958e666ccd7a5db9922d2d70f..3f4e21812341f0505a25747fc439ef1f96184f14 100644 (file)
@@ -23,6 +23,7 @@
 #include "includes.h"
 #include "libcli/libcli.h"
 #include "torture/torture.h"
+#include "torture/util.h"
 
 /*
   Test rename on files open with share delete and no share delete.
index 92de78e7afc536a06d8f8920225181dfbf9aeda1..8017afadb1011986a6fa7503e1fed1e196851785 100644 (file)
@@ -21,6 +21,7 @@
 #include "includes.h"
 #include "torture/torture.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 #include "libcli/raw/libcliraw.h"
 #include "system/filesys.h"
 #include "pstring.h"
index eb0dad534dd20ccafea181ef7a406df79a076f50..5b3685e1e42c76e3a69f0ec73de65687377ad510 100644 (file)
@@ -24,6 +24,7 @@
 #include "torture/torture.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 #include "system/time.h"
 #include "libcli/smb_composite/smb_composite.h"
 #include "auth/credentials/credentials.h"
index d99fec5ee8017f3c86b9b45e560daf061ae54aee..ab7d5c5ac8f07b4730adb0aad0b067dcfc92787b 100644 (file)
@@ -25,6 +25,7 @@
 #include "system/filesys.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 #define BASEDIR "\\unlinktest"
 
index e76627fb03da15371558b94b0d771811601cb164..dfff6f168dc3cd98a8b106f3d1c16380d6c94bf8 100644 (file)
@@ -23,6 +23,7 @@
 #include "system/iconv.h"
 #include "system/filesys.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 #include "pstring.h"
 
 BOOL torture_utable(void)
index 5de3692f0581b8748776451efdbdf25faffcd328..5dd288cf6c9f379dc51f86928d49abc1d56d455f 100644 (file)
@@ -263,8 +263,7 @@ MANPAGE = man/smbtorture.1
 [BINARY::gentest]
 INSTALLDIR = BINDIR
 OBJ_FILES = \
-               gentest.o \
-               torture_util.o
+               gentest.o
 REQUIRED_SUBSYSTEMS = \
                CONFIG \
                LIBBASIC \
@@ -298,8 +297,7 @@ MANPAGE = man/masktest.1
 [BINARY::locktest]
 INSTALLDIR = BINDIR
 OBJ_FILES = \
-               locktest.o \
-               torture_util.o
+               locktest.o
 REQUIRED_SUBSYSTEMS = \
                LIBSMB \
                CONFIG \
index 9bfcbaac64124350918f89038315f93fd90e2a0d..6a97f24ba566cc2f3722957662af28efd39b9196 100644 (file)
@@ -26,7 +26,6 @@
 #include "libcli/raw/libcliraw.h"
 #include "librpc/gen_ndr/security.h"
 #include "auth/gensec/gensec.h"
-#include "torture/torture.h"
 
 #define NSERVERS 2
 #define NINSTANCES 2
@@ -2136,6 +2135,28 @@ static void usage(void)
 ");
 }
 
+/**
+  split a UNC name into server and share names
+*/
+static BOOL split_unc_name(const char *unc, char **server, char **share)
+{
+       char *p = strdup(unc);
+       if (!p) return False;
+       all_string_sub(p, "\\", "/", 0);
+       if (strncmp(p, "//", 2) != 0) return False;
+
+       (*server) = p+2;
+       p = strchr(*server, '/');
+       if (!p) return False;
+
+       *p = 0;
+       (*share) = p+1;
+       
+       return True;
+}
+
+
+
 /****************************************************************************
   main program
 ****************************************************************************/
index 27f7f6fcef24e0f22e5a45262b2337db45d44da6..4a91997817627675d17816b344d8323d9dff60c0 100644 (file)
@@ -25,6 +25,7 @@
 #include "torture/torture.h"
 #include "system/iconv.h"
 #include "system/time.h"
+#include "torture/util.h"
 
 #if HAVE_NATIVE_ICONV
 /*
index 77a94145f51dc526061522d4f23a29f87b604c2b..43e9e0b4c581be4fc00b0065369b02c0736f06ee 100644 (file)
@@ -19,8 +19,9 @@
 */
 
 #include "includes.h"
-#include "torture/torture.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
+#include "torture/torture.h"
 #include "system/filesys.h"
 #include "pstring.h"
 
index 86e1eac59f68f06b92505e29ccc36e0d31ca47a1..ce408bba93a6521ae429b2d858d3842f55969d5d 100644 (file)
@@ -27,6 +27,8 @@
 #include "libcli/libcli.h"
 #include "libcli/raw/libcliraw.h"
 #include "torture/torture.h"
+#include "libcli/libcli.h"
+#include "torture/util.h"
 
 #define MAX_FILES 100
 
index 77cf2a1c0ae7b44553f6d5babd8c155d512f6009..78edf218202fff3332ba66afcce4b42c3609d0dc 100644 (file)
@@ -20,7 +20,8 @@
 */
 
 #include "includes.h"
-#include "torture/torture.h"
+#include "libcli/libcli.h"
+#include "torture/util.h"
 #include "libcli/rap/rap.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
index 8c6fbce8516a0d9d674fcb2189d2e714b24ba3e5..1c6b28f6ee6ee3c13c29789fd8f8d4333a5a7fae 100644 (file)
@@ -28,6 +28,7 @@
 #include "libcli/util/clilsa.h"
 #include "libcli/security/proto.h"
 #include "librpc/gen_ndr/ndr_security.h"
+#include "torture/util.h"
 
 #define BASEDIR "\\testsd"
 
index 7ce5422cfe9963ea95a5d169a02360ac5a176922..c311ea9fa5e602b4af10988204519dc3d5c412f3 100644 (file)
@@ -22,6 +22,7 @@
 #include "torture/torture.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 #define BASEDIR "\\rawchkpath"
 
index bfc3127b2ea80db1d46712b0e3152a240e7aa03e..417fedf2046a02bd81963594f20460007692f34f 100644 (file)
@@ -23,6 +23,7 @@
 #include "system/time.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 
 /* basic testing of all RAW_CLOSE_* calls 
index d8f7a78b11764274798d2299f149db62337956e7..237136c3f7eb7a23f4e23e70c137249a3e0f7aa4 100644 (file)
@@ -30,6 +30,7 @@
 #include "libcli/smb_composite/smb_composite.h"
 #include "lib/cmdline/popt_common.h"
 #include "librpc/gen_ndr/security.h"
+#include "torture/util.h"
 
 #define BASEDIR "\\composite"
 
index 09968cc1e3767da4d6238bdbf34209bac4862e2e..90f4b811317d61c2601241d42a3866dfbf1f148b 100644 (file)
@@ -26,6 +26,7 @@
 #include "lib/cmdline/popt_common.h"
 #include "lib/events/events.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 #include "auth/credentials/credentials.h"
 
 #define BASEDIR "\\rawcontext"
index a636f8e1cd304930130f61713e47112098a6340d..d5e0f33586b83da265f396ead3ca53d17619eac1 100644 (file)
@@ -25,6 +25,7 @@
 #include "torture/torture.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 #define BASEDIR "\\testeas"
 
index 8631d8efb45274cf15f725d27e503ca4c2369e0d..79bb6cd95b8f9456fa1ae4e670ebace8e67cd214 100644 (file)
@@ -24,6 +24,7 @@
 #include "libcli/raw/ioctl.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 #define BASEDIR "\\rawioctl"
 
index ae29cae4a7dc909e9fbe2760d999fb5977f014a9..d49d8613cb98e3c5e8d04886de3bb375125b9bec 100644 (file)
@@ -24,6 +24,7 @@
 #include "system/time.h"
 #include "system/filesys.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 #define CHECK_STATUS(status, correct) do { \
        if (!NT_STATUS_EQUAL(status, correct)) { \
index ac19ee1187f43e65f8d62becb3b8d9f6eb135736..c68fa7400e568c2978996557868b42bbbea10054 100644 (file)
@@ -22,6 +22,7 @@
 #include "torture/torture.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 #define BASEDIR "\\mkdirtest"
 
index 98872bb9e35a818a9d48b11bf7d7f21c9c44a96f..880300c5d74c7f0541b07b824eda909d86b15f98 100644 (file)
@@ -23,6 +23,7 @@
 #include "system/filesys.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 #define BASEDIR "\\test_mux"
 
index b87f1bddac13be318148fb80b58b0ae939bede42..617eddf73f0c8bbc83704763b0f1daf04eb05dbc 100644 (file)
@@ -23,6 +23,7 @@
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
 #include "system/filesys.h"
+#include "torture/util.h"
 
 #define BASEDIR "\\test_notify"
 
index 94b28f6379265cc6ec0cc8d98051c01898c58542..9073d8452e2f584090552679e30f93e6a08a9371 100644 (file)
@@ -26,6 +26,7 @@
 #include "librpc/gen_ndr/security.h"
 #include "lib/events/events.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 /* enum for whether reads/writes are possible on a file */
 enum rdwr_mode {RDWR_NONE, RDWR_RDONLY, RDWR_WRONLY, RDWR_RDWR};
index 5630f94e64e6320b7f6a2bbeb5db491cbf983c25..bb1da3c67fb781471cdb0943d3d8c354873fc49a 100644 (file)
@@ -23,6 +23,7 @@
 #include "librpc/gen_ndr/security.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 #define CHECK_VAL(v, correct) do { \
        if ((v) != (correct)) { \
index 8f248cac048ef149e547de94c14a1b43f62debeb..e9b847509459eb53252892063a210dce31a55e0c 100644 (file)
@@ -22,6 +22,7 @@
 #include "torture/torture.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 static struct {
        const char *name;
index 26bac4c0ad0431216a6fa8c7d897783c775cf903..520dc2a5d04f776d343811131c1cda344f091d65 100644 (file)
@@ -22,6 +22,7 @@
 #include "torture/torture.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 
 static struct {
index 424d2f486a450320ecb236dcc1649701084d4bc8..8fdeb61fb8729c5fed394f16a786980868db2f0c 100644 (file)
@@ -24,6 +24,7 @@
 #include "system/time.h"
 #include "system/filesys.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 #define CHECK_STATUS(status, correct) do { \
        if (!NT_STATUS_EQUAL(status, correct)) { \
index c669f5fb2f321dbcf8cae40791832f303a5180f1..264b9f0b14fe68592bd700185cedd1d1de4af8f4 100644 (file)
@@ -22,6 +22,7 @@
 #include "torture/torture.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 #define CHECK_STATUS(status, correct) do { \
        if (!NT_STATUS_EQUAL(status, correct)) { \
index 3707287c12626e212de89b04eb0b963460d22345..d027ebd273f4afa1c021ae3370a42ff9c39e4138 100644 (file)
@@ -23,6 +23,7 @@
 #include "system/filesys.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 
 #define BASEDIR "\\testsearch"
index 366d0a45dcefc8a6c05e1df87aad11d2bc3da6bb..dc0b1ea529d57af35752291340fede22d37864db 100644 (file)
@@ -23,6 +23,7 @@
 #include "system/filesys.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 #define CHECK_STATUS(status, correct) do { \
        if (!NT_STATUS_EQUAL(status, correct)) { \
index a48fa237aac76578b32a0d260f151558248d0812..3223f266bb96094f18704f585eae0871c9b5ec6a 100644 (file)
@@ -23,6 +23,7 @@
 #include "system/time.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 #define BASEDIR "\\testsfileinfo"
 
index 2557724fe36a911c948262c21b7ed8788b9c9102..4b3d7a2a89262d9e8fcf501398b491e522d1fc6a 100644 (file)
@@ -25,6 +25,7 @@
 #include "libcli/raw/libcliraw.h"
 #include "system/filesys.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 #define BASEDIR "\\teststreams"
 
index 2e5111803cdec9727f69529121001062ae5dbef0..2808124cd52e5fbf142c5e7e7df15d8e2dbc3cf3 100644 (file)
@@ -23,6 +23,7 @@
 #include "system/filesys.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 #define CHECK_STATUS(status, correct) do { \
        if (!NT_STATUS_EQUAL(status, correct)) { \
index 894c9de08d8c39e862b3ba79ae82cbaabc7670c4..a00a5dd9c91eb691e7aa276310ac943b1cfc2e8d 100644 (file)
@@ -25,6 +25,7 @@
 #include "system/time.h"
 #include "system/filesys.h"
 #include "libcli/libcli.h"
+#include "torture/util.h"
 
 #define CHECK_STATUS(status, correct) do { \
        if (!NT_STATUS_EQUAL(status, correct)) { \
index d56e55070349d43f805e996e97fe6e8afcb0aabc..a663a03bebccc87a0292c6f5d2e7edfff71c78e6 100644 (file)
@@ -61,80 +61,6 @@ _PUBLIC_ BOOL use_level_II_oplocks;
 _PUBLIC_ BOOL torture_showall = False;
 
 
-BOOL torture_open_connection_share(TALLOC_CTX *mem_ctx,
-                                  struct smbcli_state **c, 
-                                  const char *hostname, 
-                                  const char *sharename,
-                                  struct event_context *ev)
-{
-       NTSTATUS status;
-
-       status = smbcli_full_connection(mem_ctx, c, hostname, 
-                                       sharename, NULL,
-                                       cmdline_credentials, ev);
-       if (!NT_STATUS_IS_OK(status)) {
-               printf("Failed to open connection - %s\n", nt_errstr(status));
-               return False;
-       }
-
-       (*c)->transport->options.use_oplocks = use_oplocks;
-       (*c)->transport->options.use_level2_oplocks = use_level_II_oplocks;
-
-       return True;
-}
-
-_PUBLIC_ BOOL torture_open_connection(struct smbcli_state **c)
-{
-       const char *host = lp_parm_string(-1, "torture", "host");
-       const char *share = lp_parm_string(-1, "torture", "share");
-
-       return torture_open_connection_share(NULL, c, host, share, NULL);
-}
-
-
-
-_PUBLIC_ BOOL torture_close_connection(struct smbcli_state *c)
-{
-       BOOL ret = True;
-       if (!c) return True;
-       if (NT_STATUS_IS_ERR(smbcli_tdis(c))) {
-               printf("tdis failed (%s)\n", smbcli_errstr(c->tree));
-               ret = False;
-       }
-       talloc_free(c);
-       return ret;
-}
-
-
-/* check if the server produced the expected error code */
-_PUBLIC_ BOOL check_error(const char *location, struct smbcli_state *c, 
-                uint8_t eclass, uint32_t ecode, NTSTATUS nterr)
-{
-       NTSTATUS status;
-       
-       status = smbcli_nt_error(c->tree);
-       if (NT_STATUS_IS_DOS(status)) {
-               int class, num;
-               class = NT_STATUS_DOS_CLASS(status);
-               num = NT_STATUS_DOS_CODE(status);
-                if (eclass != class || ecode != num) {
-                        printf("unexpected error code %s\n", nt_errstr(status));
-                        printf(" expected %s or %s (at %s)\n", 
-                              nt_errstr(NT_STATUS_DOS(eclass, ecode)), 
-                               nt_errstr(nterr), location);
-                        return False;
-                }
-        } else {
-                if (!NT_STATUS_EQUAL(nterr, status)) {
-                        printf("unexpected error code %s\n", nt_errstr(status));
-                        printf(" expected %s (at %s)\n", nt_errstr(nterr), location);
-                        return False;
-                }
-        }
-
-       return True;
-}
-
 
 
 static BOOL wait_lock(struct smbcli_state *c, int fnum, uint32_t offset, uint32_t len)
index ff7ee09d23bb1efbec9308388b19d9f6ac05a005..7fe546b0071eb91d2c6f192efcd98e5f21a371e3 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef __TORTURE_H__
 #define __TORTURE_H__
 
+struct smbcli_state;
 struct torture_op {
        const char *name;
        BOOL (*fn)(void);
@@ -40,7 +41,6 @@ extern int torture_numops;
 extern int torture_failures;
 extern BOOL use_level_II_oplocks;
 
-#include "libcli/libcli.h"
 #include "torture/proto.h"
 
 #endif /* __TORTURE_H__ */
index ba96731b20175b04c8e50756d5d669de1f630e01..69c462bc6dd70d72b5faa9d1438fc26db36501d5 100644 (file)
@@ -353,26 +353,6 @@ void torture_all_info(struct smbcli_tree *tree, const char *fname)
 }
 
 
-/*
-  split a UNC name into server and share names
-*/
-BOOL split_unc_name(const char *unc, char **server, char **share)
-{
-       char *p = strdup(unc);
-       if (!p) return False;
-       all_string_sub(p, "\\", "/", 0);
-       if (strncmp(p, "//", 2) != 0) return False;
-
-       (*server) = p+2;
-       p = strchr(*server, '/');
-       if (!p) return False;
-
-       *p = 0;
-       (*share) = p+1;
-       
-       return True;
-}
-
 /*
   set a attribute on a file
 */
@@ -483,3 +463,78 @@ NTSTATUS torture_check_ea(struct smbcli_state *cli,
        return NT_STATUS_EA_CORRUPT_ERROR;
 }
 
+BOOL torture_open_connection_share(TALLOC_CTX *mem_ctx,
+                                  struct smbcli_state **c, 
+                                  const char *hostname, 
+                                  const char *sharename,
+                                  struct event_context *ev)
+{
+       NTSTATUS status;
+
+       status = smbcli_full_connection(mem_ctx, c, hostname, 
+                                       sharename, NULL,
+                                       cmdline_credentials, ev);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("Failed to open connection - %s\n", nt_errstr(status));
+               return False;
+       }
+
+       (*c)->transport->options.use_oplocks = use_oplocks;
+       (*c)->transport->options.use_level2_oplocks = use_level_II_oplocks;
+
+       return True;
+}
+
+_PUBLIC_ BOOL torture_open_connection(struct smbcli_state **c)
+{
+       const char *host = lp_parm_string(-1, "torture", "host");
+       const char *share = lp_parm_string(-1, "torture", "share");
+
+       return torture_open_connection_share(NULL, c, host, share, NULL);
+}
+
+
+
+_PUBLIC_ BOOL torture_close_connection(struct smbcli_state *c)
+{
+       BOOL ret = True;
+       if (!c) return True;
+       if (NT_STATUS_IS_ERR(smbcli_tdis(c))) {
+               printf("tdis failed (%s)\n", smbcli_errstr(c->tree));
+               ret = False;
+       }
+       talloc_free(c);
+       return ret;
+}
+
+
+/* check if the server produced the expected error code */
+_PUBLIC_ BOOL check_error(const char *location, struct smbcli_state *c, 
+                uint8_t eclass, uint32_t ecode, NTSTATUS nterr)
+{
+       NTSTATUS status;
+       
+       status = smbcli_nt_error(c->tree);
+       if (NT_STATUS_IS_DOS(status)) {
+               int class, num;
+               class = NT_STATUS_DOS_CLASS(status);
+               num = NT_STATUS_DOS_CODE(status);
+                if (eclass != class || ecode != num) {
+                        printf("unexpected error code %s\n", nt_errstr(status));
+                        printf(" expected %s or %s (at %s)\n", 
+                              nt_errstr(NT_STATUS_DOS(eclass, ecode)), 
+                               nt_errstr(nterr), location);
+                        return False;
+                }
+        } else {
+                if (!NT_STATUS_EQUAL(nterr, status)) {
+                        printf("unexpected error code %s\n", nt_errstr(status));
+                        printf(" expected %s (at %s)\n", nt_errstr(nterr), location);
+                        return False;
+                }
+        }
+
+       return True;
+}
+
+