[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Feb 25 19:31:02 UTC 2020


The branch, master has been updated
       via  5076e28aec0 selftest: Slightly simplify setting up libsmbclient tests
       via  9df3ed7e12f selftest: We don't need an AD DC for libsmbclient tests
       via  ae76d218346 selftest: Consolidate planning libsmbclient tests to source4
       via  8f50e4fa12c torture4: Use higher-level torture macros
       via  b7b7fbf91bc torture4: Use torture_assert_not_null where appropriate
       via  15769f11a4d libsmb: Don't pass "sbuf" to cli_posix_stat_send()
       via  6d282d610f4 libsmb: Avoid casts
       via  42f744d8719 libsmb: Use IS[DOT]DOT
       via  78eae77ec1e libsmb: Remove a pointless ZERO_STRUCT()
       via  d7281e32103 libsmb: Simplify callers of SMBC_dlist_contains()
       via  427e10e8e32 libsmb: Make SMBC_dlist_contains return bool
       via  c3a2cc9ba2f libsmb: Align calls to SMBC_dlist_contains()
       via  a4a96a90bf2 libsmb: Add a NULL check
       via  a23f8d913fa VFS: default: add support for FILE_ATTRIBUTE_OFFLINE to async dosmode
       via  ace296b9764 VFS: default: use correct type for pathlen in vfswrap_getxattrat_do_sync()
       via  cbca811212a VFS: default: avoid a crash in vfswrap_getxattrat_do_sync()
       via  99873724cd4 VFS: default: remove unused arg from vfswrap_is_offline()
       via  d4c69d82bdc VFS: default: let vfswrap_is_offline() take conn, not handle
      from  0ca46a37268 ldb: version 2.1.1

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 5076e28aec0ff35b90eee871940cc077c2cacfd1
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Feb 23 04:34:18 2020 -0800

    selftest: Slightly simplify setting up libsmbclient tests
    
    We'll add per-test arguments soon
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Feb 25 19:30:27 UTC 2020 on sn-devel-184

commit 9df3ed7e12f740c65cf81f819293d8c1bfbd6f9f
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Feb 23 12:42:03 2020 +0100

    selftest: We don't need an AD DC for libsmbclient tests
    
    In case we would start to actually test kerberos auth via the libsmbclient API
    (which we right now don't), this will change again. Until then,
    
    make test TESTS=libsmbclient
    
    is a lot faster this way.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ae76d21834614df57512ad57bba422da387ca2af
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Feb 23 12:22:47 2020 +0100

    selftest: Consolidate planning libsmbclient tests to source4
    
    We don't need to plan those tests both in source3 and source4's
    tests.py. The source4 version seems more "advanced", it uses
    smbtorture4_testsuites() to list all tests, making it less
    error-prone, and it also does the tests for all SMB1 and SMB3
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8f50e4fa12cf1cb16c74b68dc89951934c68b0dc
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Feb 23 06:04:52 2020 -0800

    torture4: Use higher-level torture macros
    
    Makes an easier read of torture_libsmbclient_readdirplus_seek()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit b7b7fbf91bc0ceb2cd9bc9c511beb5322f7837d4
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Feb 23 11:15:06 2020 +0100

    torture4: Use torture_assert_not_null where appropriate
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 15769f11a4da2f4e00dda5eac49560c91faa2ebb
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Feb 22 14:55:07 2020 +0100

    libsmb: Don't pass "sbuf" to cli_posix_stat_send()
    
    Don't pass in the result buffer upon _send(), let the _recv() function
    fill this in. Internal API only, adapt to current conventions.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 6d282d610f493fce7dc0f8497d6db14af9d4bfdb
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Feb 22 11:52:51 2020 +0100

    libsmb: Avoid casts
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 42f744d87191a32dbd46166dbadb77392e0af54b
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Feb 22 11:48:45 2020 +0100

    libsmb: Use IS[DOT]DOT
    
    strequal is not necessary here
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 78eae77ec1ea82337540026ea4501f222b5d54a3
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Feb 22 11:21:44 2020 +0100

    libsmb: Remove a pointless ZERO_STRUCT()
    
    "c" is a pointer that was initialized to NULL above
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d7281e3210373725787e1b69d59bc12a5712b425
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Feb 21 22:35:44 2020 +0100

    libsmb: Simplify callers of SMBC_dlist_contains()
    
    This function already does the NULL check on the file pointer
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 427e10e8e3250d791134efcbbc34e07714d8eebf
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Feb 21 22:13:49 2020 +0100

    libsmb: Make SMBC_dlist_contains return bool
    
    It returned True/False, and is used as boolean only. Modernize
    formatting a bit.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c3a2cc9ba2fa8d1bfd25f4457bb13753e8ed0db1
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Feb 21 22:31:06 2020 +0100

    libsmb: Align calls to SMBC_dlist_contains()
    
    Everywhere else it's called as !SMBC_dlist_contains()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a4a96a90bf2af46f043d989e0f422e188e832a74
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Feb 21 22:07:19 2020 +0100

    libsmb: Add a NULL check
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a23f8d913fa8d77bab394aea9a8e7df2704e8b19
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Feb 24 15:03:56 2020 +0100

    VFS: default: add support for FILE_ATTRIBUTE_OFFLINE to async dosmode
    
    This had been missing in the initial async dosmode implementation. It's the
    responsibility of the sync and async dosmode functions to call
    vfswrap_is_offline() since the offline functionality has been converted from a
    first class VFS function to be a part of the DOS attributes VFS functions.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14293
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ace296b97642d9160ea66db89dcd0f24a21dba4e
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Feb 24 14:30:37 2020 +0100

    VFS: default: use correct type for pathlen in vfswrap_getxattrat_do_sync()
    
    full_path_tos() returns a ssize_t.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14293
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit cbca811212a930b94f9917e5a82b6a95ab085e91
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Feb 24 14:29:01 2020 +0100

    VFS: default: avoid a crash in vfswrap_getxattrat_do_sync()
    
    Must use tevent_req_data() to get our tevent_req state, talloc_get_type_abort()
    will just crash as struct tevent_req != struct vfswrap_getxattrat_state.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14293
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 99873724cd493366c9957fd9fe230d52a6f02691
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Feb 24 14:28:19 2020 +0100

    VFS: default: remove unused arg from vfswrap_is_offline()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14293
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d4c69d82bdc0fa029609032a9d32f32fa1708beb
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Feb 24 14:24:12 2020 +0100

    VFS: default: let vfswrap_is_offline() take conn, not handle
    
    vfswrap_is_offline() has been converted to a "helper" function some time ago, it
    had been a VFS interface function before. To make this change more obvious let
    it take a struct connection_struct instead of a struct vfs_handle_struct which
    is the canonical first parameter to VFS functions.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14293
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/include/libsmb_internal.h           |   3 +-
 source3/libsmb/clifile.c                    |  29 +++--
 source3/libsmb/libsmb_dir.c                 |  26 ++--
 source3/libsmb/libsmb_file.c                |  24 ++--
 source3/libsmb/libsmb_misc.c                |  15 ++-
 source3/libsmb/libsmb_server.c              |   1 -
 source3/libsmb/libsmb_stat.c                |   2 +-
 source3/libsmb/proto.h                      |   6 +-
 source3/modules/vfs_default.c               |  49 +++++--
 source3/selftest/tests.py                   |  20 +--
 source4/selftest/tests.py                   |  18 ++-
 source4/torture/libsmbclient/libsmbclient.c | 190 +++++++++++++++-------------
 12 files changed, 207 insertions(+), 176 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h
index 21a11c1a024..27eaeb5fd89 100644
--- a/source3/include/libsmb_internal.h
+++ b/source3/include/libsmb_internal.h
@@ -431,8 +431,7 @@ SMBC_ftruncate_ctx(SMBCCTX *context,
 
 
 /* Functions in libsmb_misc.c */
-int
-SMBC_dlist_contains(SMBCFILE * list, SMBCFILE *p);
+bool SMBC_dlist_contains(SMBCFILE * list, SMBCFILE *p);
 
 int
 SMBC_errno(SMBCCTX *context,
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index dd08b0e30f3..0ba406a4f2a 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -741,7 +741,7 @@ NTSTATUS cli_posix_setacl(struct cli_state *cli,
 ****************************************************************************/
 
 struct stat_state {
-	SMB_STRUCT_STAT *sbuf;
+	SMB_STRUCT_STAT sbuf;
 };
 
 static void cli_posix_stat_done(struct tevent_req *subreq);
@@ -749,8 +749,7 @@ static void cli_posix_stat_done(struct tevent_req *subreq);
 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
 				       struct tevent_context *ev,
 				       struct cli_state *cli,
-				       const char *fname,
-				       SMB_STRUCT_STAT *sbuf)
+				       const char *fname)
 {
 	struct tevent_req *req = NULL, *subreq = NULL;
 	struct stat_state *state = NULL;
@@ -759,7 +758,6 @@ struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
 	if (req == NULL) {
 		return NULL;
 	}
-	state->sbuf = sbuf;
 
 	subreq = cli_qpathinfo_send(state, ev, cli, fname,
 				    SMB_QUERY_FILE_UNIX_BASIC, 100, 100);
@@ -775,7 +773,7 @@ static void cli_posix_stat_done(struct tevent_req *subreq)
 	struct tevent_req *req = tevent_req_callback_data(
 				subreq, struct tevent_req);
 	struct stat_state *state = tevent_req_data(req, struct stat_state);
-	SMB_STRUCT_STAT *sbuf = state->sbuf;
+	SMB_STRUCT_STAT *sbuf = &state->sbuf;
 	uint8_t *data;
 	uint32_t num_data = 0;
 	NTSTATUS status;
@@ -795,8 +793,6 @@ static void cli_posix_stat_done(struct tevent_req *subreq)
 		return;
 	}
 
-	*sbuf = (SMB_STRUCT_STAT) { 0 };
-
 	/* total size, in bytes */
 	sbuf->st_ex_size = IVAL2_TO_SMB_BIG_UINT(data, 0);
 
@@ -840,9 +836,20 @@ static void cli_posix_stat_done(struct tevent_req *subreq)
 	tevent_req_done(req);
 }
 
-NTSTATUS cli_posix_stat_recv(struct tevent_req *req)
+NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
+			     SMB_STRUCT_STAT *sbuf)
 {
-	return tevent_req_simple_recv_ntstatus(req);
+	struct stat_state *state = tevent_req_data(req, struct stat_state);
+	NTSTATUS status;
+
+	if (tevent_req_is_nterror(req, &status)) {
+		return status;
+	}
+	if (sbuf != NULL) {
+		*sbuf = state->sbuf;
+	}
+	tevent_req_received(req);
+	return NT_STATUS_OK;
 }
 
 NTSTATUS cli_posix_stat(struct cli_state *cli,
@@ -868,7 +875,7 @@ NTSTATUS cli_posix_stat(struct cli_state *cli,
 		goto fail;
 	}
 
-	req = cli_posix_stat_send(frame, ev, cli, fname, sbuf);
+	req = cli_posix_stat_send(frame, ev, cli, fname);
 	if (req == NULL) {
 		status = NT_STATUS_NO_MEMORY;
 		goto fail;
@@ -878,7 +885,7 @@ NTSTATUS cli_posix_stat(struct cli_state *cli,
 		goto fail;
 	}
 
-	status = cli_posix_stat_recv(req);
+	status = cli_posix_stat_recv(req, sbuf);
 
  fail:
 	TALLOC_FREE(frame);
diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index 00d2a878e84..eaae38664cf 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -546,6 +546,12 @@ SMBC_opendir_ctx(SMBCCTX *context,
 
 	dir->cli_fd   = 0;
 	dir->fname    = SMB_STRDUP(fname);
+	if (dir->fname == NULL) {
+		SAFE_FREE(dir);
+		TALLOC_FREE(frame);
+		errno = ENOMEM;
+		return NULL;
+	}
 	dir->srv      = NULL;
 	dir->offset   = 0;
 	dir->file     = False;
@@ -1034,7 +1040,7 @@ SMBC_closedir_ctx(SMBCCTX *context,
 		return -1;
 	}
 
-	if (!dir || !SMBC_dlist_contains(context->internal->files, dir)) {
+	if (!SMBC_dlist_contains(context->internal->files, dir)) {
 		errno = EBADF;
 		TALLOC_FREE(frame);
 		return -1;
@@ -1147,7 +1153,7 @@ SMBC_readdir_ctx(SMBCCTX *context,
 
 	}
 
-	if (!dir || !SMBC_dlist_contains(context->internal->files, dir)) {
+	if (!SMBC_dlist_contains(context->internal->files, dir)) {
 
 		errno = EBADF;
                 DEBUG(0, ("Invalid dir in SMBC_readdir_ctx()\n"));
@@ -1226,9 +1232,7 @@ SMBC_readdirplus_ctx(SMBCCTX *context,
 		return NULL;
 	}
 
-	if (dir == NULL ||
-	    SMBC_dlist_contains(context->internal->files,
-				dir) == 0) {
+	if (!SMBC_dlist_contains(context->internal->files, dir)) {
 		DBG_ERR("Invalid dir in SMBC_readdirplus_ctx()\n");
 		TALLOC_FREE(frame);
 		errno = EBADF;
@@ -1307,10 +1311,7 @@ const struct libsmb_file_info *SMBC_readdirplus2_ctx(SMBCCTX *context,
 		return NULL;
 	}
 
-	if (dir == NULL ||
-	    SMBC_dlist_contains(context->internal->files,
-					dir) == 0)
-	{
+	if (!SMBC_dlist_contains(context->internal->files, dir)) {
 		DBG_ERR("Invalid dir in SMBC_readdirplus2_ctx()\n");
 		TALLOC_FREE(frame);
 		errno = EBADF;
@@ -1415,7 +1416,7 @@ SMBC_getdents_ctx(SMBCCTX *context,
 
 	}
 
-	if (!dir || !SMBC_dlist_contains(context->internal->files, dir)) {
+	if (!SMBC_dlist_contains(context->internal->files, dir)) {
 
 		errno = EBADF;
 		TALLOC_FREE(frame);
@@ -1782,7 +1783,7 @@ SMBC_telldir_ctx(SMBCCTX *context,
 
 	}
 
-	if (!dir || !SMBC_dlist_contains(context->internal->files, dir)) {
+	if (!SMBC_dlist_contains(context->internal->files, dir)) {
 
 		errno = EBADF;
 		TALLOC_FREE(frame);
@@ -2630,8 +2631,7 @@ SMBC_notify_ctx(SMBCCTX *context, SMBCFILE *dir, smbc_bool recursive,
 		errno = EINVAL;
 		return -1;
 	}
-	if ((dir == NULL) ||
-	    !SMBC_dlist_contains(context->internal->files, dir)) {
+	if (!SMBC_dlist_contains(context->internal->files, dir)) {
 		TALLOC_FREE(frame);
 		errno = EBADF;
 		return -1;
diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c
index 1577010e490..852c3952e1b 100644
--- a/source3/libsmb/libsmb_file.c
+++ b/source3/libsmb/libsmb_file.c
@@ -256,9 +256,9 @@ SMBC_read_ctx(SMBCCTX *context,
 		return -1;
 	}
 
-	DEBUG(4, ("smbc_read(%p, %d)\n", file, (int)count));
+	DEBUG(4, ("smbc_read(%p, %zu)\n", file, count));
 
-	if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
+	if (!SMBC_dlist_contains(context->internal->files, file)) {
 		errno = EBADF;
 		TALLOC_FREE(frame);
 		return -1;
@@ -284,7 +284,7 @@ SMBC_read_ctx(SMBCCTX *context,
 
 	file->offset += ret;
 
-	DEBUG(4, ("  --> %ld\n", (unsigned long)ret));
+	DEBUG(4, ("  --> %zu\n", ret));
 
 	TALLOC_FREE(frame);
 	return ret;  /* Success, ret bytes of data ... */
@@ -308,17 +308,13 @@ SMBC_splice_ctx(SMBCCTX *context,
 		return -1;
 	}
 
-	if (!srcfile ||
-	    !SMBC_dlist_contains(context->internal->files, srcfile))
-	{
+	if (!SMBC_dlist_contains(context->internal->files, srcfile)) {
 		errno = EBADF;
 		TALLOC_FREE(frame);
 		return -1;
 	}
 
-	if (!dstfile ||
-	    !SMBC_dlist_contains(context->internal->files, dstfile))
-	{
+	if (!SMBC_dlist_contains(context->internal->files, dstfile)) {
 		errno = EBADF;
 		TALLOC_FREE(frame);
 		return -1;
@@ -363,7 +359,7 @@ SMBC_write_ctx(SMBCCTX *context,
 		return -1;
 	}
 
-	if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
+	if (!SMBC_dlist_contains(context->internal->files, file)) {
 		errno = EBADF;
 		TALLOC_FREE(frame);
 		return -1;
@@ -409,7 +405,7 @@ SMBC_close_ctx(SMBCCTX *context,
 		return -1;
 	}
 
-	if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
+	if (!SMBC_dlist_contains(context->internal->files, file)) {
 		errno = EBADF;
 		TALLOC_FREE(frame);
 		return -1;
@@ -475,7 +471,7 @@ SMBC_getatr(SMBCCTX * context,
  	}
 
 	/* path fixup for . and .. */
-	if (strequal(path, ".") || strequal(path, "..")) {
+	if (ISDOT(path) || ISDOTDOT(path)) {
 		fixedpath = talloc_strdup(frame, "\\");
 		if (!fixedpath) {
 			errno = ENOMEM;
@@ -701,7 +697,7 @@ SMBC_lseek_ctx(SMBCCTX *context,
 		return -1;
 	}
 
-	if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
+	if (!SMBC_dlist_contains(context->internal->files, file)) {
 		errno = EBADF;
 		TALLOC_FREE(frame);
 		return -1;
@@ -764,7 +760,7 @@ SMBC_ftruncate_ctx(SMBCCTX *context,
 		return -1;
 	}
 
-	if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
+	if (!SMBC_dlist_contains(context->internal->files, file)) {
 		errno = EBADF;
 		TALLOC_FREE(frame);
 		return -1;
diff --git a/source3/libsmb/libsmb_misc.c b/source3/libsmb/libsmb_misc.c
index 1d874c74cd8..28e2ca842cf 100644
--- a/source3/libsmb/libsmb_misc.c
+++ b/source3/libsmb/libsmb_misc.c
@@ -31,15 +31,18 @@
 /*
  * check if an element is part of the list.
  */
-int
-SMBC_dlist_contains(SMBCFILE * list, SMBCFILE *p)
+bool SMBC_dlist_contains(SMBCFILE * list, SMBCFILE *p)
 {
-	if (!p || !list) return False;
+	if ((p == NULL) || (list == NULL)) {
+		return false;
+	}
 	do {
-		if (p == list) return True;
+		if (p == list) {
+			return true;
+		}
 		list = list->next;
-	} while (list);
-	return False;
+	} while (list != NULL);
+	return false;
 }
 
 
diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index d4f71d8c8b7..104a04a6fc8 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -296,7 +296,6 @@ SMBC_server_internal(TALLOC_CTX *ctx,
 	bool use_ccache = false;
 	bool pw_nt_hash = false;
 
-	ZERO_STRUCT(c);
 	*in_cache = false;
 
 	if (server[0] == 0) {
diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c
index f20f79579e2..a4aaf6c327f 100644
--- a/source3/libsmb/libsmb_stat.c
+++ b/source3/libsmb/libsmb_stat.c
@@ -251,7 +251,7 @@ SMBC_fstat_ctx(SMBCCTX *context,
 		return -1;
 	}
 
-	if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
+	if (!SMBC_dlist_contains(context->internal->files, file)) {
 		errno = EBADF;
 		TALLOC_FREE(frame);
 		return -1;
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index 48855d7112c..12241fda798 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -310,9 +310,9 @@ NTSTATUS cli_posix_setacl(struct cli_state *cli,
 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
 				       struct tevent_context *ev,
 				       struct cli_state *cli,
-				       const char *fname,
-				       SMB_STRUCT_STAT *sbuf);
-NTSTATUS cli_posix_stat_recv(struct tevent_req *req);
+				       const char *fname);
+NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
+			     SMB_STRUCT_STAT *sbuf);
 NTSTATUS cli_posix_stat(struct cli_state *cli,
 			const char *fname,
 			SMB_STRUCT_STAT *sbuf);
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 37b59d8c3c0..a30f3ba1d31 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1638,9 +1638,8 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
 	return NT_STATUS_NOT_SUPPORTED;
 }
 
-static bool vfswrap_is_offline(struct vfs_handle_struct *handle,
-			       const struct smb_filename *fname,
-			       SMB_STRUCT_STAT *sbuf);
+static bool vfswrap_is_offline(struct connection_struct *conn,
+			       const struct smb_filename *fname);
 
 static NTSTATUS vfswrap_get_dos_attributes(struct vfs_handle_struct *handle,
 					   struct smb_filename *smb_fname,
@@ -1648,7 +1647,7 @@ static NTSTATUS vfswrap_get_dos_attributes(struct vfs_handle_struct *handle,
 {
 	bool offline;
 
-	offline = vfswrap_is_offline(handle, smb_fname, &smb_fname->st);
+	offline = vfswrap_is_offline(handle->conn, smb_fname);
 	if (offline) {
 		*dosmode |= FILE_ATTRIBUTE_OFFLINE;
 	}
@@ -1720,6 +1719,12 @@ static void vfswrap_get_dos_attributes_getxattr_done(struct tevent_req *subreq)
 		struct vfswrap_get_dos_attributes_state);
 	ssize_t xattr_size;
 	DATA_BLOB blob = {0};
+	char *path = NULL;
+	char *tofree = NULL;
+	char pathbuf[PATH_MAX+1];
+	ssize_t pathlen;
+	struct smb_filename smb_fname;
+	bool offline;
 	NTSTATUS status;
 
 	xattr_size = SMB_VFS_GETXATTRAT_RECV(subreq,
@@ -1768,6 +1773,29 @@ static void vfswrap_get_dos_attributes_getxattr_done(struct tevent_req *subreq)
 		return;
 	}
 
+	pathlen = full_path_tos(state->dir_fsp->fsp_name->base_name,
+				state->smb_fname->base_name,
+				pathbuf,
+				sizeof(pathbuf),
+				&path,
+				&tofree);
+	if (pathlen == -1) {
+		tevent_req_nterror(req, NT_STATUS_NO_MEMORY);
+		return;
+	}
+
+	smb_fname = (struct smb_filename) {
+		.base_name = path,
+		.st = state->smb_fname->st,
+		.flags = state->smb_fname->flags,
+	};
+
+	offline = vfswrap_is_offline(state->conn, &smb_fname);
+	if (offline) {
+		state->dosmode |= FILE_ATTRIBUTE_OFFLINE;
+	}
+	TALLOC_FREE(tofree);
+
 	tevent_req_done(req);
 	return;
 }
@@ -1798,7 +1826,7 @@ static NTSTATUS vfswrap_fget_dos_attributes(struct vfs_handle_struct *handle,
 {
 	bool offline;
 
-	offline = vfswrap_is_offline(handle, fsp->fsp_name, &fsp->fsp_name->st);
+	offline = vfswrap_is_offline(handle->conn, fsp->fsp_name);
 	if (offline) {
 		*dosmode |= FILE_ATTRIBUTE_OFFLINE;
 	}
@@ -3326,12 +3354,12 @@ static struct tevent_req *vfswrap_getxattrat_send(
 
 static void vfswrap_getxattrat_do_sync(struct tevent_req *req)
 {
-	struct vfswrap_getxattrat_state *state = talloc_get_type_abort(
+	struct vfswrap_getxattrat_state *state = tevent_req_data(
 		req, struct vfswrap_getxattrat_state);
 	char *path = NULL;
 	char *tofree = NULL;
 	char pathbuf[PATH_MAX+1];
-	size_t pathlen;
+	ssize_t pathlen;
 	int err;
 
 	pathlen = full_path_tos(state->dir_fsp->fsp_name->base_name,
@@ -3543,9 +3571,8 @@ static bool vfswrap_aio_force(struct vfs_handle_struct *handle, struct files_str
 	return false;
 }
 
-static bool vfswrap_is_offline(struct vfs_handle_struct *handle,
-			       const struct smb_filename *fname,
-			       SMB_STRUCT_STAT *sbuf)
+static bool vfswrap_is_offline(struct connection_struct *conn,
+			       const struct smb_filename *fname)
 {
 	NTSTATUS status;
 	char *path;
@@ -3555,7 +3582,7 @@ static bool vfswrap_is_offline(struct vfs_handle_struct *handle,
 		return false;
 	}
 
-	if (!lp_dmapi_support(SNUM(handle->conn)) || !dmapi_have_session()) {
+	if (!lp_dmapi_support(SNUM(conn)) || !dmapi_have_session()) {
 #if defined(ENOTSUP)
 		errno = ENOTSUP;
 #endif
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 6060cec49c3..041bcf94e03 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -539,13 +539,6 @@ unix = ["unix.info2", "unix.whoami"]
 
 nbt = ["nbt.dgram"]
 
-libsmbclient = ["libsmbclient.version", "libsmbclient.initialize",
-                "libsmbclient.configuration", "libsmbclient.setConfiguration",
-                "libsmbclient.options", "libsmbclient.opendir",
-                "libsmbclient.list_shares", "libsmbclient.readdirplus",
-		"libsmbclient.readdirplus_seek",
-		"libsmbclient.readdirplus2"]
-
 vfs = [
     "vfs.fruit",
     "vfs.acl_xattr",
@@ -556,7 +549,7 @@ vfs = [
     "vfs.unfruit",
 ]
 
-tests = base + raw + smb2 + rpc + unix + local + rap + nbt + libsmbclient + idmap + vfs
+tests = base + raw + smb2 + rpc + unix + local + rap + nbt + idmap + vfs
 
 for t in tests:
     if t == "base.delaywrite" or t == "base.deny1" or t == "base.deny2":
@@ -729,17 +722,6 @@ for t in tests:
     elif t == "rpc.samba3.netlogon" or t == "rpc.samba3.sessionkey":
         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --option=torture:wksname=samba3rpctest')
         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD --option=torture:wksname=samba3rpctest')
-    elif t.startswith("libsmbclient"):
-        url = "smb://$USERNAME:$PASSWORD@$SERVER/tmp"
-        if t == "libsmbclient.list_shares":
-            url = "smb://$USERNAME:$PASSWORD@$SERVER"
-


-- 
Samba Shared Repository



More information about the samba-cvs mailing list