[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Dec 22 01:23:04 UTC 2015


The branch, master has been updated
       via  00e952e s3: fix encryption help messages
       via  b165d52 s4:torture:vfs_fruit: add test test_read_afpinfo
       via  21d4b5c s4:torture:vfs_fruit: add tests for AFP_Resource delete-on-close and eof
       via  ee431fc vfs_fruit: ignore delete on the AFP_Resource stream
       via  decde0b s4:torture:vfs_fruit: update AFP_AfpInfo IO tests
       via  f569fd5 vfs_fruit: fix offset and len handling for AFP_AfpInfo stream
       via  666a55b s4:torture:vfs_fruit: test nulling out AFP_AfpInfo stream
       via  e94b177 vfs_fruit: writing all 0 to AFP_AfpInfo stream
       via  e5588b4 s4:torture:vfs_fruit: add tests for AFP_AfpInfo delete-on-close and eof
       via  4024153 vfs_fruit: handling of ftruncate() on AFP_AfpInfo stream
       via  6f8c188 s4:torture:vfs_fruit: file without AFP_AfpInfo
       via  0af7bf4 vfs_fruit: stat AFP_AfpInfo must fail when it doesn't exist
       via  748adea vfs_fruit: fix some debug messages
       via  1650e79 s3:lib/errmap_unix: map EOVERFLOW to NT_STATUS_ALLOTTED_SPACE_EXCEEDED
       via  ba00884 s4:torture:vfs_fruit: fix flakey test_write_atalk_rfork_io with OS X
       via  3632609 s4:torture:vfs_fruit: fix test_rename_dir_openfile() to work with OS X
       via  0fc2ed8 s4:torture:vfs_fruit: fix test_aapl() to work with OS X
       via  56bf276 s4:torture:vfs_fruit: skip test_stream_names() without "localdir"
       via  987e12b s4:torture:vfs_fruit: skip test_adouble_conversion() without "localdir"
       via  0a9a7c2 s4:torture:vfs_fruit: skip test test_read_atalk_metadata() without "localdir" and rename it
       via  155397e s4:torture:vfs_fruit: add explicit cleanup of testfiles
       via  3c0ac9b s4:torture:vfs_fruit: add --option=torture:osx for enable_aapl()
       via  fdf937e s4:torture:vfs_fruit: enhance check_stream
       via  8694da4 s4:torture:vfs_fruit: use AFPINFO_STREAM_NAME
       via  8e0cf77 s4:torture:vfs_fruit: tweak check_stream_list()
       via  1d13744 s4:torture:vfs_fruit: rename tree1 -> tree
       via  9d28f82 s4:torture:vfs_fruit: remove unused tree2
      from  7ba9f82 s4-torture: add a negoex ndr pullpush test.

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


- Log -----------------------------------------------------------------
commit 00e952e3c6daa9fe51cc7e79b5d5e6dd37831246
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Nov 2 16:33:34 2015 +0100

    s3: fix encryption help messages
    
    Encryption is a SMB3 feature and not tied to UNIX extensions, so fix the
    help messages of various utilities.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Dec 22 02:22:50 CET 2015 on sn-devel-144

commit b165d520374cc2ae77acfd813b528e55acfc2f7e
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Dec 18 17:14:41 2015 +0100

    s4:torture:vfs_fruit: add test test_read_afpinfo
    
    This works against any SMB server and test basic IO on the AFP_AfpInfo
    stream.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 21d4b5cea8e4dec729912915d60922edaea0f418
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Dec 19 18:44:18 2015 +0100

    s4:torture:vfs_fruit: add tests for AFP_Resource delete-on-close and eof
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ee431fc5254dc735662d152dd19a81d439ca5e44
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Dec 19 18:27:06 2015 +0100

    vfs_fruit: ignore delete on the AFP_Resource stream
    
    OS X ignores deletes on the AFP_Resource stream. This was discovered by
    torture tests against OS X SMB server.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit decde0b4812eba5f80b717fd2ae868558a022753
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Dec 19 11:10:54 2015 +0100

    s4:torture:vfs_fruit: update AFP_AfpInfo IO tests
    
    When reading from the AFP_AfpInfo stream, OS X ignores the offset from
    the request and always reads from offset=0.
    
    The offset bounds check has a off-by-1 bug in OS X, so a request
    offset=60 (AFP_AfpInfo stream has a ficed size of 60 bytes), len=1
    returns 1 byte from offset 0 insteaf of returning 0.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f569fd5e44300ab41aa7298b3efdcac99cd330f2
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Dec 19 11:06:19 2015 +0100

    vfs_fruit: fix offset and len handling for AFP_AfpInfo stream
    
    When reading from the AFP_AfpInfo stream, OS X ignores the offset from
    the request and always reads from offset=0.
    
    The offset bounds check has a off-by-1 bug in OS X, so a request
    offset=60 (AFP_AfpInfo stream has a ficed size of 60 bytes), len=1
    returns 1 byte from offset 0 insteaf of returning 0.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 666a55b7060542ef78ff5f22d368f2ebc4c3318f
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Dec 20 19:55:06 2015 +0100

    s4:torture:vfs_fruit: test nulling out AFP_AfpInfo stream
    
    This must delete the stream.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e94b17715ea8049df8819b472178170b8e987946
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Dec 17 20:08:35 2015 +0100

    vfs_fruit: writing all 0 to AFP_AfpInfo stream
    
    When writing all 0 to AFP_AfpInfo stream we can remove the underlying
    storage object. This beaviour of OS X SMB server was found with a
    torture test.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e5588b463ee77aac3b396774e68c10b13a9f6f04
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Dec 17 19:47:18 2015 +0100

    s4:torture:vfs_fruit: add tests for AFP_AfpInfo delete-on-close and eof
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 4024153894a07b7b1115dbe1699cba94fee13f23
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 16:09:54 2015 +0100

    vfs_fruit: handling of ftruncate() on AFP_AfpInfo stream
    
    With help of some torture tests I verified the following behaviour of OS
    X SMB server:
    
    * ftruncate AFP_AfpInfo stream > 60 bytes results in an error
      NT_STATUS_ALLOTTED_SPACE_EXCEEDED
    
    * ftruncate AFP_AfpInfo stream <=60 returns success but has no effect
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 6f8c188dfc81a6d22bd54f248327b787e0b48f09
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Dec 20 18:42:23 2015 +0100

    s4:torture:vfs_fruit: file without AFP_AfpInfo
    
    Opening the AFP_AfpInfo on a file that doesn't have that stream must
    return ENOENT.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 0af7bf4249419ff7c88c5beece915db0a3697b72
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Dec 17 20:05:04 2015 +0100

    vfs_fruit: stat AFP_AfpInfo must fail when it doesn't exist
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 748adea77f95d7d6114f96b7850f384b77d6f7d2
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Dec 11 17:27:50 2015 +0100

    vfs_fruit: fix some debug messages
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 1650e793edb42b07501d7467aa64c80eacf33eb6
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Dec 17 19:16:43 2015 +0100

    s3:lib/errmap_unix: map EOVERFLOW to NT_STATUS_ALLOTTED_SPACE_EXCEEDED
    
    vfs_fruit returns the correct error NT_STATUS_ALLOTTED_SPACE_EXCEEDED
    when an attempt is made to extend the AFP_AfpInfo stream beyond 60
    bytes.
    
    This will be used in a subsequent commit in vfs_fruit.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ba00884e8a67420cf8d6c2530a778b9cee6e86b8
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Dec 19 18:56:24 2015 +0100

    s4:torture:vfs_fruit: fix flakey test_write_atalk_rfork_io with OS X
    
    Adjust desired_access to prevent flaky test with OS X SMB server.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 363260983f7ec85ecd3a2b35e6b07eeb5416bdc5
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Dec 18 17:25:07 2015 +0100

    s4:torture:vfs_fruit: fix test_rename_dir_openfile() to work with OS X
    
    OS X allows renaming of directories with open files regardless of AAPL
    negotiation. Samba will only allow this after negotiating AAPL.
    
    The first check in this test is that renaming fails without AAPL, so
    skip this test if the server is OS X.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 0fc2ed8f01f2e510ee58ad2ea9209d2fec10fd3f
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Dec 18 17:23:40 2015 +0100

    s4:torture:vfs_fruit: fix test_aapl() to work with OS X
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 56bf27667cc8f2fad0cad96d796bdd2f172326a8
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Dec 18 17:24:12 2015 +0100

    s4:torture:vfs_fruit: skip test_stream_names() without "localdir"
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 987e12b7a7518e498c47dd8dfee32aed148f8cd7
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Dec 18 17:22:32 2015 +0100

    s4:torture:vfs_fruit: skip test_adouble_conversion() without "localdir"
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 0a9a7c21073227c539fc1ced331e837c1c1f4bc4
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Dec 18 17:10:18 2015 +0100

    s4:torture:vfs_fruit: skip test test_read_atalk_metadata() without "localdir" and rename it
    
    The test is Netatalk specific. Skip the test if "localdir" is not
    specified.
    
    Use torture_assert() to check the result from check_stream().
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 155397e83173e13baebfc507ad9659d0ed213b5b
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Dec 18 17:18:41 2015 +0100

    s4:torture:vfs_fruit: add explicit cleanup of testfiles
    
    smb2_deltree() doesn't work with OS X (looks like OS X doesn't handle
    FILE_NON_DIRECTORY_FILE correctly). As a workaround, use explicit
    cleanup of all testfiles and directories.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3c0ac9b3899aa06315e592253c858f31d4bd2ae3
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Dec 18 17:08:32 2015 +0100

    s4:torture:vfs_fruit: add --option=torture:osx for enable_aapl()
    
    Check if the server is OS X and don't check the AAPL context size if it
    is.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit fdf937e77da29ec47002855db69d9e3f95005479
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Dec 17 19:22:12 2015 +0100

    s4:torture:vfs_fruit: enhance check_stream
    
    Don't sleep when create fails and use torture_ macros.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8694da43442abe3ae6ac3b6a16c524e455ae1a65
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Dec 17 16:51:10 2015 +0100

    s4:torture:vfs_fruit: use AFPINFO_STREAM_NAME
    
    I got erratic results from OS X SMB server with AFPINFO_STREAM
    (":AFP_AfpInfo:$DATA") in some tests. Using AFPINFO_STREAM_NAME
    (just the ":AFP_AfpInfo" part) instead fixed this.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8e0cf77ee230c0eaef01a2dc2316fc65aabd5a59
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Dec 17 13:31:12 2015 +0100

    s4:torture:vfs_fruit: tweak check_stream_list()
    
    Modify check_stream_list() to open the basefile (or directory) itself
    insteaf of having the callers pass in a filehandle. Removes some code
    duplication in the callers.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 1d13744547474592285eacab84d1217af46e0086
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Dec 20 10:18:31 2015 +0100

    s4:torture:vfs_fruit: rename tree1 -> tree
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9d28f82484e8b34c8d8f35f596fdb63614b103d2
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Dec 20 10:16:25 2015 +0100

    s4:torture:vfs_fruit: remove unused tree2
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 source3/lib/errmap_unix.c   |    3 +
 source3/lib/popt_common.c   |    2 +-
 source3/locale/net/de.po    |    8 +-
 source3/modules/vfs_fruit.c |   96 ++--
 source3/selftest/tests.py   |    4 +-
 source3/utils/net.c         |    2 +-
 source3/utils/smbget.c      |    2 +-
 source4/torture/vfs/fruit.c | 1252 +++++++++++++++++++++++++++++++++++--------
 8 files changed, 1086 insertions(+), 283 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/errmap_unix.c b/source3/lib/errmap_unix.c
index 56d3f00..f572b99 100644
--- a/source3/lib/errmap_unix.c
+++ b/source3/lib/errmap_unix.c
@@ -115,6 +115,9 @@ static const struct {
 #ifdef ETXTBSY
 	{ ETXTBSY,      NT_STATUS_SHARING_VIOLATION },
 #endif
+#ifdef EOVERFLOW
+	{ EOVERFLOW,      NT_STATUS_ALLOTTED_SPACE_EXCEEDED },
+#endif
 };
 
 /*********************************************************************
diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c
index c2a95d7..b685b65 100644
--- a/source3/lib/popt_common.c
+++ b/source3/lib/popt_common.c
@@ -508,7 +508,7 @@ struct poptOption popt_common_credentials[] = {
 	{ "authentication-file", 'A', POPT_ARG_STRING, NULL, 'A', "Get the credentials from a file", "FILE" },
 	{ "signing", 'S', POPT_ARG_STRING, NULL, 'S', "Set the client signing state", "on|off|required" },
 	{"machine-pass", 'P', POPT_ARG_NONE, NULL, 'P', "Use stored machine account password" },
-	{"encrypt", 'e', POPT_ARG_NONE, NULL, 'e', "Encrypt SMB transport (UNIX extended servers only)" },
+	{"encrypt", 'e', POPT_ARG_NONE, NULL, 'e', "Encrypt SMB transport" },
 	{"use-ccache", 'C', POPT_ARG_NONE, NULL, 'C',
 	 "Use the winbind ccache for authentication" },
 	{"pw-nt-hash", '\0', POPT_ARG_NONE, NULL, 'H',
diff --git a/source3/locale/net/de.po b/source3/locale/net/de.po
index 4b40ef0..904052b 100644
--- a/source3/locale/net/de.po
+++ b/source3/locale/net/de.po
@@ -495,8 +495,8 @@ msgid "  Use 'net help help' to list usage information for 'net' commands."
 msgstr ""
 
 #: ../../utils/net.c:759
-msgid "Encrypt SMB transport (UNIX extended servers only)"
-msgstr "SMB Übertragung verschlüsseln (nur UNIX erweiterte Server)"
+msgid "Encrypt SMB transport"
+msgstr "SMB Übertragung verschlüsseln"
 
 #: ../../utils/net.c:827
 msgid ""
@@ -3061,8 +3061,8 @@ msgid "\t-P or --machine-pass\t\tAuthenticate as machine account\n"
 msgstr "\t-P oder --machine-pass\t\tMit Rechnerkonto authentifizieren\n"
 
 #: ../../utils/net_help_common.c:52
-msgid "\t-e or --encrypt\t\t\tEncrypt SMB transport (UNIX extended servers only)\n"
-msgstr "\t-e oder --encrypt\t\t\tSMB Übertragung verschlüsseln  (nur UNIX erweiterte Server)\n"
+msgid "\t-e or --encrypt\t\t\tEncrypt SMB transport\n"
+msgstr "\t-e oder --encrypt\t\t\tSMB Übertragung verschlüsseln\n"
 
 #: ../../utils/net_help_common.c:54
 msgid "\t-k or --kerberos\t\tUse kerberos (active directory) authentication\n"
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index e9a54b0..cb0d284 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -2455,7 +2455,7 @@ static int fruit_unlink(vfs_handle_struct *handle,
 		}
 
 		/* FIXME: direct unlink(), missing smb_fname */
-		DEBUG(1,("fruit_unlink: %s\n", adp));
+		DBG_DEBUG("fruit_unlink: %s\n", adp);
 		rc = unlink(adp);
 		if ((rc == -1) && (errno == ENOENT)) {
 			rc = 0;
@@ -2478,27 +2478,8 @@ static int fruit_unlink(vfs_handle_struct *handle,
 	}
 
 	if (is_afpresource_stream(smb_fname)) {
-		if (config->rsrc == FRUIT_RSRC_ADFILE) {
-			char *adp = NULL;
-
-			rc = adouble_path(talloc_tos(),
-					  smb_fname->base_name, &adp);
-			if (rc != 0) {
-				return -1;
-			}
-			/* FIXME: direct unlink(), missing smb_fname */
-			rc = unlink(adp);
-			if ((rc == -1) && (errno == ENOENT)) {
-				rc = 0;
-			}
-			TALLOC_FREE(adp);
-		} else {
-			rc = SMB_VFS_REMOVEXATTR(handle->conn,
-						 smb_fname->base_name,
-						 AFPRESOURCE_EA_NETATALK);
-		}
-
-		return rc;
+		/* OS X ignores deletes on the AFP_Resource stream */
+		return 0;
 	}
 
 	return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
@@ -2700,13 +2681,19 @@ static ssize_t fruit_pread(vfs_handle_struct *handle,
 		char afpinfo_buf[AFP_INFO_SIZE];
 		size_t to_return;
 
-		if ((offset < 0) || (offset >= AFP_INFO_SIZE)) {
+		/*
+		 * OS X has a off-by-1 error in the offset calculation, so we're
+		 * bug compatible here. It won't hurt, as any relevant real
+		 * world read requests from the AFP_AfpInfo stream will be
+		 * offset=0 n=60. offset is ignored anyway, see below.
+		 */
+		if ((offset < 0) || (offset >= AFP_INFO_SIZE + 1)) {
 			len = 0;
 			rc = 0;
 			goto exit;
 		}
 
-		to_return = AFP_INFO_SIZE - offset;
+		to_return = MIN(n, AFP_INFO_SIZE);
 
 		ai = afpinfo_new(talloc_tos());
 		if (ai == NULL) {
@@ -2729,7 +2716,10 @@ static ssize_t fruit_pread(vfs_handle_struct *handle,
 			goto exit;
 		}
 
-		memcpy(data, afpinfo_buf + offset, to_return);
+		/*
+		 * OS X ignores offset when reading from AFP_AfpInfo stream!
+		 */
+		memcpy(data, afpinfo_buf, to_return);
 		len = to_return;
 	} else {
 		len = SMB_VFS_NEXT_PREAD(
@@ -2820,6 +2810,23 @@ static ssize_t fruit_pwrite(vfs_handle_struct *handle,
 		}
 		memcpy(ad_entry(ad, ADEID_FINDERI),
 		       &ai->afpi_FinderInfo[0], ADEDLEN_FINDERI);
+		if (empty_finderinfo(ad)) {
+			/* Discard metadata */
+			if (config->meta == FRUIT_META_STREAM) {
+				rc = SMB_VFS_FTRUNCATE(fsp, 0);
+			} else {
+				rc = SMB_VFS_REMOVEXATTR(handle->conn,
+							 fsp->fsp_name->base_name,
+							 AFPINFO_EA_NETATALK);
+			}
+			if (rc != 0 && errno != ENOENT && errno != ENOATTR) {
+				DBG_WARNING("Can't delete metadata for %s: %s\n",
+					    fsp->fsp_name->base_name, strerror(errno));
+				goto exit;
+			}
+			rc = 0;
+			goto exit;
+		}
 		rc = ad_write(ad, name);
 	} else {
 		len = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n,
@@ -2878,6 +2885,17 @@ static int fruit_stat_meta(vfs_handle_struct *handle,
 			   struct smb_filename *smb_fname,
 			   bool follow_links)
 {
+	struct adouble *ad = NULL;
+
+	ad = ad_get(talloc_tos(), handle, smb_fname->base_name, ADOUBLE_META);
+	if (ad == NULL) {
+		DBG_INFO("fruit_stat_meta %s: %s\n",
+			 smb_fname_str_dbg(smb_fname), strerror(errno));
+		errno = ENOENT;
+		return -1;
+	}
+	TALLOC_FREE(ad);
+
 	/* Populate the stat struct with info from the base file. */
 	if (fruit_stat_base(handle, smb_fname, follow_links) == -1) {
 		return -1;
@@ -3260,19 +3278,23 @@ static int fruit_ftruncate_meta(struct vfs_handle_struct *handle,
 				off_t offset,
 				struct adouble *ad)
 {
-	/*
-	 * As this request hasn't been seen in the wild,
-	 * the only sensible use I can imagine is the client
-	 * truncating the stream to 0 bytes size.
-	 * We simply remove the metadata on such a request.
-	 */
-	if (offset != 0) {
+	struct fruit_config_data *config;
+
+	SMB_VFS_HANDLE_GET_DATA(handle, config,
+				struct fruit_config_data, return -1);
+
+	if (offset > 60) {
 		DBG_WARNING("ftruncate %s to %jd",
 			    fsp_str_dbg(fsp), (intmax_t)offset);
+		/* OS X returns NT_STATUS_ALLOTTED_SPACE_EXCEEDED  */
+		errno = EOVERFLOW;
 		return -1;
 	}
 
-	return SMB_VFS_FREMOVEXATTR(fsp, AFPRESOURCE_EA_NETATALK);
+	DBG_WARNING("ignoring ftruncate %s to %jd",
+		    fsp_str_dbg(fsp), (intmax_t)offset);
+	/* OS X returns success but does nothing  */
+	return 0;
 }
 
 static int fruit_ftruncate_rsrc(struct vfs_handle_struct *handle,
@@ -3319,8 +3341,8 @@ static int fruit_ftruncate(struct vfs_handle_struct *handle,
         struct adouble *ad =
 		(struct adouble *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
 
-	DEBUG(10, ("streams_xattr_ftruncate called for file %s offset %.0f\n",
-		   fsp_str_dbg(fsp), (double)offset));
+	DBG_DEBUG("fruit_ftruncate called for file %s offset %.0f\n",
+		   fsp_str_dbg(fsp), (double)offset);
 
 	if (ad == NULL) {
 		return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
@@ -3601,7 +3623,7 @@ static NTSTATUS fruit_fset_nt_acl(vfs_handle_struct *handle,
 	mode_t ms_nfs_mode;
 	int result;
 
-	DEBUG(1, ("fruit_fset_nt_acl: %s\n", fsp_str_dbg(fsp)));
+	DBG_DEBUG("fruit_fset_nt_acl: %s\n", fsp_str_dbg(fsp));
 
 	status = check_ms_nfs(handle, fsp, psd, &ms_nfs_mode, &do_chmod);
 	if (!NT_STATUS_IS_OK(status)) {
@@ -3617,10 +3639,8 @@ static NTSTATUS fruit_fset_nt_acl(vfs_handle_struct *handle,
 
 	if (do_chmod) {
 		if (fsp->fh->fd != -1) {
-			DEBUG(1, ("fchmod: %s\n", fsp_str_dbg(fsp)));
 			result = SMB_VFS_FCHMOD(fsp, ms_nfs_mode);
 		} else {
-			DEBUG(1, ("chmod: %s\n", fsp_str_dbg(fsp)));
 			result = SMB_VFS_CHMOD(fsp->conn,
 					       fsp->fsp_name->base_name,
 					       ms_nfs_mode);
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 9c68943..655c593 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -382,8 +382,8 @@ for t in tests:
         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmpsort -U$USERNAME%$PASSWORD')
         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
     elif t == "vfs.fruit":
-        plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --option=torture:share1=vfs_fruit --option=torture:share2=tmp --option=torture:localdir=$SELFTEST_PREFIX/nt4_dc/share')
-        plansmbtorture4testsuite(t, "ad_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --option=torture:share1=vfs_fruit --option=torture:share2=tmp --option=torture:localdir=$SELFTEST_PREFIX/ad_dc/share')
+        plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/nt4_dc/share')
+        plansmbtorture4testsuite(t, "ad_dc", '//$SERVER_IP/vfs_fruit -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/ad_dc/share')
     elif t == "rpc.schannel_anon_setpw":
         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$%', description="anonymous password set")
         plansmbtorture4testsuite(t, "nt4_dc_schannel", '//$SERVER_IP/tmp -U$%', description="anonymous password set (schannel enforced server-side)")
diff --git a/source3/utils/net.c b/source3/utils/net.c
index 0cd1337..3d0940d 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -795,7 +795,7 @@ static struct functable net_func[] = {
 		{"port",	'p', POPT_ARG_INT,    &c->opt_port},
 		{"myname",	'n', POPT_ARG_STRING, &c->opt_requester_name},
 		{"server",	'S', POPT_ARG_STRING, &c->opt_host},
-		{"encrypt",	'e', POPT_ARG_NONE,   NULL, 'e', N_("Encrypt SMB transport (UNIX extended servers only)") },
+		{"encrypt",	'e', POPT_ARG_NONE,   NULL, 'e', N_("Encrypt SMB transport") },
 		{"container",	'c', POPT_ARG_STRING, &c->opt_container},
 		{"comment",	'C', POPT_ARG_STRING, &c->opt_comment},
 		{"maxusers",	'M', POPT_ARG_INT,    &c->opt_maxusers},
diff --git a/source3/utils/smbget.c b/source3/utils/smbget.c
index c3eb471..b3ce743 100644
--- a/source3/utils/smbget.c
+++ b/source3/utils/smbget.c
@@ -597,7 +597,7 @@ int main(int argc, const char **argv)
 	int ret = 0;
 	struct poptOption long_options[] = {
 		{"guest", 'a', POPT_ARG_NONE, NULL, 'a', "Work as user guest" },	
-		{"encrypt", 'e', POPT_ARG_NONE, NULL, 'e', "Encrypt SMB transport (UNIX extended servers only)" },	
+		{"encrypt", 'e', POPT_ARG_NONE, NULL, 'e', "Encrypt SMB transport" },
 		{"resume", 'r', POPT_ARG_NONE, &resume, 0, "Automatically resume aborted files" },
 		{"update", 'U',  POPT_ARG_NONE, &update, 0, "Download only when remote file is newer than local file or local file is missing"},
 		{"recursive", 'R',  POPT_ARG_NONE, &recursive, 0, "Recursively download files" },
diff --git a/source4/torture/vfs/fruit.c b/source4/torture/vfs/fruit.c
index 2488b7a..ae978c2 100644
--- a/source4/torture/vfs/fruit.c
+++ b/source4/torture/vfs/fruit.c
@@ -64,7 +64,7 @@ static bool check_stream_list(struct smb2_tree *tree,
 			      const char *fname,
 			      int num_exp,
 			      const char **exp,
-			      struct smb2_handle h);
+			      bool is_dir);
 
 static int qsort_string(char * const *s1, char * const *s2)
 {
@@ -849,7 +849,7 @@ static bool torture_write_afpinfo(struct smb2_tree *tree,
 	char *infobuf;
 	bool ret = true;
 
-	full_name = talloc_asprintf(mem_ctx, "%s%s", fname, AFPINFO_STREAM);
+	full_name = talloc_asprintf(mem_ctx, "%s%s", fname, AFPINFO_STREAM_NAME);
 	if (full_name == NULL) {
 	    torture_comment(tctx, "talloc_asprintf error\n");
 	    return false;
@@ -900,7 +900,8 @@ static bool check_stream(struct smb2_tree *tree,
 	struct smb2_create create;
 	struct smb2_read r;
 	NTSTATUS status;
-	const char *full_name;
+	char *full_name;
+	bool ret = true;
 
 	full_name = talloc_asprintf(mem_ctx, "%s%s", fname, sname);
 	if (full_name == NULL) {
@@ -917,22 +918,21 @@ static bool check_stream(struct smb2_tree *tree,
 
 	status = smb2_create(tree, mem_ctx, &create);
 	if (!NT_STATUS_IS_OK(status)) {
+		TALLOC_FREE(full_name);
 		if (value == NULL) {
 			return true;
-		} else {
-			torture_comment(tctx, "Unable to open stream %s\n",
-			    full_name);
-			sleep(10000000);
-			return false;
 		}
+		torture_comment(tctx, "Unable to open stream %s\n", full_name);
+		return false;
 	}
 
 	handle = create.out.file.handle;
 	if (value == NULL) {
+		TALLOC_FREE(full_name);
+		smb2_util_close(tree, handle);
 		return true;
 	}
 
-
 	ZERO_STRUCT(r);
 	r.in.file.handle = handle;
 	r.in.length      = read_count;
@@ -940,19 +940,24 @@ static bool check_stream(struct smb2_tree *tree,
 
 	status = smb2_read(tree, tree, &r);
 
-	if (!NT_STATUS_IS_OK(status)) {
-		torture_comment(tctx, "(%s) Failed to read %lu bytes from "
-		    "stream '%s'\n", location, (long)strlen(value), full_name);
-		return false;
-	}
+	torture_assert_ntstatus_ok_goto(
+		tctx, status, ret, done,
+		talloc_asprintf(tctx, "(%s) Failed to read %lu bytes from stream '%s'\n",
+				location, (long)strlen(value), full_name));
 
-	if (memcmp(r.out.data.data + comp_offset, value, comp_count) != 0) {
-		torture_comment(tctx, "(%s) Bad data in stream\n", location);
-		return false;
-	}
+	torture_assert_goto(tctx, r.out.data.length == read_count, ret, done,
+			    talloc_asprintf(tctx, "smb2_read returned %jd bytes, expected %jd\n",
+					    (intmax_t)r.out.data.length, (intmax_t)read_count));
 
+	torture_assert_goto(
+		tctx, memcmp(r.out.data.data + comp_offset, value, comp_count) == 0,
+		ret, done,
+		talloc_asprintf(tctx, "(%s) Bad data in stream\n", location));
+
+done:
+	TALLOC_FREE(full_name);
 	smb2_util_close(tree, handle);
-	return true;
+	return ret;
 }
 
 /**
@@ -1189,7 +1194,7 @@ static bool torture_setup_file(TALLOC_CTX *mem_ctx, struct smb2_tree *tree,
 }
 
 static bool enable_aapl(struct torture_context *tctx,
-			struct smb2_tree *tree1)
+			struct smb2_tree *tree)
 {
 	TALLOC_CTX *mem_ctx = talloc_new(tctx);
 	NTSTATUS status;
@@ -1202,6 +1207,7 @@ static bool enable_aapl(struct torture_context *tctx,
 				   SMB2_CRTCTX_AAPL_SUPPORTS_READ_DIR_ATTR |
 				   SMB2_CRTCTX_AAPL_SUPPORTS_NFS_ACE |
 				   SMB2_CRTCTX_AAPL_SUPPORTS_OSX_COPYFILE);
+	bool is_osx_server = torture_setting_bool(tctx, "osx", false);
 
 	ZERO_STRUCT(io);
 	io.in.desired_access     = SEC_FLAG_MAXIMUM_ALLOWED;
@@ -1230,10 +1236,10 @@ static bool enable_aapl(struct torture_context *tctx,
 	status = smb2_create_blob_add(tctx, &io.in.blobs, "AAPL", data);
 	torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create_blob_add");
 
-	status = smb2_create(tree1, tctx, &io);
+	status = smb2_create(tree, tctx, &io);
 	torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
 
-	status = smb2_util_close(tree1, io.out.file.handle);
+	status = smb2_util_close(tree, io.out.file.handle);
 	torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_util_close");
 
 	/*
@@ -1244,7 +1250,10 @@ static bool enable_aapl(struct torture_context *tctx,
 	aapl = smb2_create_blob_find(&io.out.blobs,
 				     SMB2_CREATE_TAG_AAPL);
 	torture_assert_goto(tctx, aapl != NULL, ret, done, "missing AAPL context");
-	torture_assert_goto(tctx, aapl->data.length == 50, ret, done, "bad AAPL size");
+
+	if (!is_osx_server) {
+		torture_assert_goto(tctx, aapl->data.length == 50, ret, done, "bad AAPL size");
+	}
 
 	aapl_server_caps = BVAL(aapl->data.data, 16);
 	torture_assert_goto(tctx, aapl_server_caps == expexted_scaps,
@@ -1255,9 +1264,8 @@ done:
 	return ret;
 }
 
-static bool test_read_atalk_metadata(struct torture_context *tctx,
-				     struct smb2_tree *tree1,
-				     struct smb2_tree *tree2)
+static bool test_read_netatalk_metadata(struct torture_context *tctx,
+					struct smb2_tree *tree)
 {
 	TALLOC_CTX *mem_ctx = talloc_new(tctx);
 	const char *fname = BASEDIR "\\torture_read_metadata";
@@ -1265,16 +1273,22 @@ static bool test_read_atalk_metadata(struct torture_context *tctx,
 	struct smb2_handle testdirh;
 	bool ret = true;
 	ssize_t len;
+	const char *localdir = NULL;
 
 	torture_comment(tctx, "Checking metadata access\n");
 
-	smb2_util_unlink(tree1, fname);
+	localdir = torture_setting_string(tctx, "localdir", NULL);
+	if (localdir == NULL) {
+		torture_skip(tctx, "Need localdir for test");
+	}
+
+	smb2_util_unlink(tree, fname);
 
-	status = torture_smb2_testdir(tree1, BASEDIR, &testdirh);
+	status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
 	CHECK_STATUS(status, NT_STATUS_OK);
-	smb2_util_close(tree1, testdirh);
+	smb2_util_close(tree, testdirh);
 
-	ret = torture_setup_file(mem_ctx, tree1, fname, false);
+	ret = torture_setup_file(mem_ctx, tree, fname, false);
 	if (ret == false) {
 		goto done;
 	}
@@ -1287,42 +1301,122 @@ static bool test_read_atalk_metadata(struct torture_context *tctx,
 		goto done;
 	}
 
-	ret &= check_stream(tree1, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
-			    0, 60, 0, 4, "AFP");
+	ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
+			   0, 60, 0, 4, "AFP");
+	torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
 
-	ret &= check_stream(tree1, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
-			    0, 60, 16, 8, "BARRFOOO");
+	ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
+			   0, 60, 16, 8, "BARRFOOO");
+	torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
 
-	ret &= check_stream(tree1, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
-			    16, 8, 0, 8, "BARRFOOO");
+	ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
+			   16, 8, 0, 3, "AFP");
+	torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
 
 	/* Check reading offset and read size > sizeof(AFPINFO_STREAM) */
 
-	len = read_stream(tree1, __location__, tctx, mem_ctx, fname,
+	len = read_stream(tree, __location__, tctx, mem_ctx, fname,
 			  AFPINFO_STREAM, 0, 61);
 	CHECK_VALUE(len, 60);
 
-	len = read_stream(tree1, __location__, tctx, mem_ctx, fname,
+	len = read_stream(tree, __location__, tctx, mem_ctx, fname,
 			  AFPINFO_STREAM, 59, 2);
-	CHECK_VALUE(len, 1);
+	CHECK_VALUE(len, 2);
 
-	len = read_stream(tree1, __location__, tctx, mem_ctx, fname,
+	len = read_stream(tree, __location__, tctx, mem_ctx, fname,
 			  AFPINFO_STREAM, 60, 1);
-	CHECK_VALUE(len, 0);
+	CHECK_VALUE(len, 1);
 
-	len = read_stream(tree1, __location__, tctx, mem_ctx, fname,
+	len = read_stream(tree, __location__, tctx, mem_ctx, fname,
 			  AFPINFO_STREAM, 61, 1);
 	CHECK_VALUE(len, 0);
 
 done:
-	smb2_deltree(tree1, BASEDIR);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list