From d09b70c98b8222eb293bc9d8713ec071188ed01d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 17 Mar 2006 17:59:58 +0000 Subject: r14527: Fix build problems. (This used to be commit 863ca4014d9b821706ee90f58ab5d5cf3899a4c7) --- source4/torture/basic/aliases.c | 2 + source4/torture/basic/attr.c | 1 + source4/torture/basic/base.c | 1 + source4/torture/basic/charset.c | 1 + source4/torture/basic/delaywrite.c | 1 + source4/torture/basic/delete.c | 1 + source4/torture/basic/denytest.c | 1 + source4/torture/basic/dir.c | 1 + source4/torture/basic/disconnect.c | 1 + source4/torture/basic/locking.c | 1 + source4/torture/basic/mangle_test.c | 1 + source4/torture/basic/properties.c | 1 + source4/torture/basic/rename.c | 1 + source4/torture/basic/scanner.c | 1 + source4/torture/basic/secleak.c | 1 + source4/torture/basic/unlink.c | 1 + source4/torture/basic/utable.c | 1 + source4/torture/config.mk | 6 +-- source4/torture/gentest.c | 23 ++++++++- source4/torture/local/iconv.c | 1 + source4/torture/nbench/nbench.c | 3 +- source4/torture/nbench/nbio.c | 2 + source4/torture/rap/rap.c | 3 +- source4/torture/raw/acls.c | 1 + source4/torture/raw/chkpath.c | 1 + source4/torture/raw/close.c | 1 + source4/torture/raw/composite.c | 1 + source4/torture/raw/context.c | 1 + source4/torture/raw/eas.c | 1 + source4/torture/raw/ioctl.c | 1 + source4/torture/raw/lock.c | 1 + source4/torture/raw/mkdir.c | 1 + source4/torture/raw/mux.c | 1 + source4/torture/raw/notify.c | 1 + source4/torture/raw/open.c | 1 + source4/torture/raw/oplock.c | 1 + source4/torture/raw/qfileinfo.c | 1 + source4/torture/raw/qfsinfo.c | 1 + source4/torture/raw/read.c | 1 + source4/torture/raw/rename.c | 1 + source4/torture/raw/search.c | 1 + source4/torture/raw/seek.c | 1 + source4/torture/raw/setfileinfo.c | 1 + source4/torture/raw/streams.c | 1 + source4/torture/raw/unlink.c | 1 + source4/torture/raw/write.c | 1 + source4/torture/torture.c | 74 ----------------------------- source4/torture/torture.h | 2 +- source4/torture/torture_util.c | 95 +++++++++++++++++++++++++++++-------- 49 files changed, 148 insertions(+), 102 deletions(-) diff --git a/source4/torture/basic/aliases.c b/source4/torture/basic/aliases.c index 142899ba8d..40a1c68b8b 100644 --- a/source4/torture/basic/aliases.c +++ b/source4/torture/basic/aliases.c @@ -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); diff --git a/source4/torture/basic/attr.c b/source4/torture/basic/attr.c index e321993749..b410d5b3e5 100644 --- a/source4/torture/basic/attr.c +++ b/source4/torture/basic/attr.c @@ -23,6 +23,7 @@ #include "includes.h" #include "torture/torture.h" #include "libcli/libcli.h" +#include "torture/util.h" extern int torture_failures; diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index 87ea9fe0dd..83ca797669 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -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" diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 186b265e19..81a9c6bb63 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -24,6 +24,7 @@ #include "torture/torture.h" #include "libcli/raw/libcliraw.h" #include "libcli/libcli.h" +#include "torture/util.h" #define BASEDIR "\\chartest\\" diff --git a/source4/torture/basic/delaywrite.c b/source4/torture/basic/delaywrite.c index 37a9528f97..2f1c4b98c7 100644 --- a/source4/torture/basic/delaywrite.c +++ b/source4/torture/basic/delaywrite.c @@ -28,6 +28,7 @@ #include "system/time.h" #include "system/filesys.h" #include "libcli/libcli.h" +#include "torture/util.h" #define BASEDIR "\\delaywrite" diff --git a/source4/torture/basic/delete.c b/source4/torture/basic/delete.c index 98bd00010f..97ae518ea8 100644 --- a/source4/torture/basic/delete.c +++ b/source4/torture/basic/delete.c @@ -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" diff --git a/source4/torture/basic/denytest.c b/source4/torture/basic/denytest.c index 127df9052d..2a01d12c5b 100644 --- a/source4/torture/basic/denytest.c +++ b/source4/torture/basic/denytest.c @@ -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; diff --git a/source4/torture/basic/dir.c b/source4/torture/basic/dir.c index 9dd62f3aa1..ca85ac4715 100644 --- a/source4/torture/basic/dir.c +++ b/source4/torture/basic/dir.c @@ -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) diff --git a/source4/torture/basic/disconnect.c b/source4/torture/basic/disconnect.c index bc892120e3..d21807aa83 100644 --- a/source4/torture/basic/disconnect.c +++ b/source4/torture/basic/disconnect.c @@ -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" diff --git a/source4/torture/basic/locking.c b/source4/torture/basic/locking.c index 9a00ab3efa..65f2dbac31 100644 --- a/source4/torture/basic/locking.c +++ b/source4/torture/basic/locking.c @@ -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" diff --git a/source4/torture/basic/mangle_test.c b/source4/torture/basic/mangle_test.c index 36b7481316..18b2e912ba 100644 --- a/source4/torture/basic/mangle_test.c +++ b/source4/torture/basic/mangle_test.c @@ -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; diff --git a/source4/torture/basic/properties.c b/source4/torture/basic/properties.c index c20edf545b..1f0027cf0d 100644 --- a/source4/torture/basic/properties.c +++ b/source4/torture/basic/properties.c @@ -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; diff --git a/source4/torture/basic/rename.c b/source4/torture/basic/rename.c index 4bdc6f2d9f..3f4e218123 100644 --- a/source4/torture/basic/rename.c +++ b/source4/torture/basic/rename.c @@ -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. diff --git a/source4/torture/basic/scanner.c b/source4/torture/basic/scanner.c index 92de78e7af..8017afadb1 100644 --- a/source4/torture/basic/scanner.c +++ b/source4/torture/basic/scanner.c @@ -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" diff --git a/source4/torture/basic/secleak.c b/source4/torture/basic/secleak.c index eb0dad534d..5b3685e1e4 100644 --- a/source4/torture/basic/secleak.c +++ b/source4/torture/basic/secleak.c @@ -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" diff --git a/source4/torture/basic/unlink.c b/source4/torture/basic/unlink.c index d99fec5ee8..ab7d5c5ac8 100644 --- a/source4/torture/basic/unlink.c +++ b/source4/torture/basic/unlink.c @@ -25,6 +25,7 @@ #include "system/filesys.h" #include "libcli/raw/libcliraw.h" #include "libcli/libcli.h" +#include "torture/util.h" #define BASEDIR "\\unlinktest" diff --git a/source4/torture/basic/utable.c b/source4/torture/basic/utable.c index e76627fb03..dfff6f168d 100644 --- a/source4/torture/basic/utable.c +++ b/source4/torture/basic/utable.c @@ -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) diff --git a/source4/torture/config.mk b/source4/torture/config.mk index 5de3692f05..5dd288cf6c 100644 --- a/source4/torture/config.mk +++ b/source4/torture/config.mk @@ -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 \ diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index 9bfcbaac64..6a97f24ba5 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -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 ****************************************************************************/ diff --git a/source4/torture/local/iconv.c b/source4/torture/local/iconv.c index 27f7f6fcef..4a91997817 100644 --- a/source4/torture/local/iconv.c +++ b/source4/torture/local/iconv.c @@ -25,6 +25,7 @@ #include "torture/torture.h" #include "system/iconv.h" #include "system/time.h" +#include "torture/util.h" #if HAVE_NATIVE_ICONV /* diff --git a/source4/torture/nbench/nbench.c b/source4/torture/nbench/nbench.c index 77a94145f5..43e9e0b4c5 100644 --- a/source4/torture/nbench/nbench.c +++ b/source4/torture/nbench/nbench.c @@ -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" diff --git a/source4/torture/nbench/nbio.c b/source4/torture/nbench/nbio.c index 86e1eac59f..ce408bba93 100644 --- a/source4/torture/nbench/nbio.c +++ b/source4/torture/nbench/nbio.c @@ -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 diff --git a/source4/torture/rap/rap.c b/source4/torture/rap/rap.c index 77cf2a1c0a..78edf21820 100644 --- a/source4/torture/rap/rap.c +++ b/source4/torture/rap/rap.c @@ -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" diff --git a/source4/torture/raw/acls.c b/source4/torture/raw/acls.c index 8c6fbce851..1c6b28f6ee 100644 --- a/source4/torture/raw/acls.c +++ b/source4/torture/raw/acls.c @@ -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" diff --git a/source4/torture/raw/chkpath.c b/source4/torture/raw/chkpath.c index 7ce5422cfe..c311ea9fa5 100644 --- a/source4/torture/raw/chkpath.c +++ b/source4/torture/raw/chkpath.c @@ -22,6 +22,7 @@ #include "torture/torture.h" #include "libcli/raw/libcliraw.h" #include "libcli/libcli.h" +#include "torture/util.h" #define BASEDIR "\\rawchkpath" diff --git a/source4/torture/raw/close.c b/source4/torture/raw/close.c index bfc3127b2e..417fedf204 100644 --- a/source4/torture/raw/close.c +++ b/source4/torture/raw/close.c @@ -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 diff --git a/source4/torture/raw/composite.c b/source4/torture/raw/composite.c index d8f7a78b11..237136c3f7 100644 --- a/source4/torture/raw/composite.c +++ b/source4/torture/raw/composite.c @@ -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" diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c index 09968cc1e3..90f4b81131 100644 --- a/source4/torture/raw/context.c +++ b/source4/torture/raw/context.c @@ -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" diff --git a/source4/torture/raw/eas.c b/source4/torture/raw/eas.c index a636f8e1cd..d5e0f33586 100644 --- a/source4/torture/raw/eas.c +++ b/source4/torture/raw/eas.c @@ -25,6 +25,7 @@ #include "torture/torture.h" #include "libcli/raw/libcliraw.h" #include "libcli/libcli.h" +#include "torture/util.h" #define BASEDIR "\\testeas" diff --git a/source4/torture/raw/ioctl.c b/source4/torture/raw/ioctl.c index 8631d8efb4..79bb6cd95b 100644 --- a/source4/torture/raw/ioctl.c +++ b/source4/torture/raw/ioctl.c @@ -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" diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c index ae29cae4a7..d49d8613cb 100644 --- a/source4/torture/raw/lock.c +++ b/source4/torture/raw/lock.c @@ -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)) { \ diff --git a/source4/torture/raw/mkdir.c b/source4/torture/raw/mkdir.c index ac19ee1187..c68fa7400e 100644 --- a/source4/torture/raw/mkdir.c +++ b/source4/torture/raw/mkdir.c @@ -22,6 +22,7 @@ #include "torture/torture.h" #include "libcli/raw/libcliraw.h" #include "libcli/libcli.h" +#include "torture/util.h" #define BASEDIR "\\mkdirtest" diff --git a/source4/torture/raw/mux.c b/source4/torture/raw/mux.c index 98872bb9e3..880300c5d7 100644 --- a/source4/torture/raw/mux.c +++ b/source4/torture/raw/mux.c @@ -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" diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c index b87f1bddac..617eddf73f 100644 --- a/source4/torture/raw/notify.c +++ b/source4/torture/raw/notify.c @@ -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" diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c index 94b28f6379..9073d8452e 100644 --- a/source4/torture/raw/open.c +++ b/source4/torture/raw/open.c @@ -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}; diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c index 5630f94e64..bb1da3c67f 100644 --- a/source4/torture/raw/oplock.c +++ b/source4/torture/raw/oplock.c @@ -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)) { \ diff --git a/source4/torture/raw/qfileinfo.c b/source4/torture/raw/qfileinfo.c index 8f248cac04..e9b8475094 100644 --- a/source4/torture/raw/qfileinfo.c +++ b/source4/torture/raw/qfileinfo.c @@ -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; diff --git a/source4/torture/raw/qfsinfo.c b/source4/torture/raw/qfsinfo.c index 26bac4c0ad..520dc2a5d0 100644 --- a/source4/torture/raw/qfsinfo.c +++ b/source4/torture/raw/qfsinfo.c @@ -22,6 +22,7 @@ #include "torture/torture.h" #include "libcli/raw/libcliraw.h" #include "libcli/libcli.h" +#include "torture/util.h" static struct { diff --git a/source4/torture/raw/read.c b/source4/torture/raw/read.c index 424d2f486a..8fdeb61fb8 100644 --- a/source4/torture/raw/read.c +++ b/source4/torture/raw/read.c @@ -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)) { \ diff --git a/source4/torture/raw/rename.c b/source4/torture/raw/rename.c index c669f5fb2f..264b9f0b14 100644 --- a/source4/torture/raw/rename.c +++ b/source4/torture/raw/rename.c @@ -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)) { \ diff --git a/source4/torture/raw/search.c b/source4/torture/raw/search.c index 3707287c12..d027ebd273 100644 --- a/source4/torture/raw/search.c +++ b/source4/torture/raw/search.c @@ -23,6 +23,7 @@ #include "system/filesys.h" #include "libcli/raw/libcliraw.h" #include "libcli/libcli.h" +#include "torture/util.h" #define BASEDIR "\\testsearch" diff --git a/source4/torture/raw/seek.c b/source4/torture/raw/seek.c index 366d0a45dc..dc0b1ea529 100644 --- a/source4/torture/raw/seek.c +++ b/source4/torture/raw/seek.c @@ -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)) { \ diff --git a/source4/torture/raw/setfileinfo.c b/source4/torture/raw/setfileinfo.c index a48fa237aa..3223f266bb 100644 --- a/source4/torture/raw/setfileinfo.c +++ b/source4/torture/raw/setfileinfo.c @@ -23,6 +23,7 @@ #include "system/time.h" #include "libcli/raw/libcliraw.h" #include "libcli/libcli.h" +#include "torture/util.h" #define BASEDIR "\\testsfileinfo" diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c index 2557724fe3..4b3d7a2a89 100644 --- a/source4/torture/raw/streams.c +++ b/source4/torture/raw/streams.c @@ -25,6 +25,7 @@ #include "libcli/raw/libcliraw.h" #include "system/filesys.h" #include "libcli/libcli.h" +#include "torture/util.h" #define BASEDIR "\\teststreams" diff --git a/source4/torture/raw/unlink.c b/source4/torture/raw/unlink.c index 2e5111803c..2808124cd5 100644 --- a/source4/torture/raw/unlink.c +++ b/source4/torture/raw/unlink.c @@ -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)) { \ diff --git a/source4/torture/raw/write.c b/source4/torture/raw/write.c index 894c9de08d..a00a5dd9c9 100644 --- a/source4/torture/raw/write.c +++ b/source4/torture/raw/write.c @@ -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)) { \ diff --git a/source4/torture/torture.c b/source4/torture/torture.c index d56e550703..a663a03beb 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -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) diff --git a/source4/torture/torture.h b/source4/torture/torture.h index ff7ee09d23..7fe546b007 100644 --- a/source4/torture/torture.h +++ b/source4/torture/torture.h @@ -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__ */ diff --git a/source4/torture/torture_util.c b/source4/torture/torture_util.c index ba96731b20..69c462bc6d 100644 --- a/source4/torture/torture_util.c +++ b/source4/torture/torture_util.c @@ -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; +} + + -- cgit