[SCM] Samba Shared Repository - branch v4-2-test updated

Karolin Seeger kseeger at samba.org
Wed Jan 6 11:38:05 UTC 2016


The branch, v4-2-test has been updated
       via  c1f06fe s3:smbd: fix a corner case of the symlink verification
       via  6b1c418 s3: libsmb: Correctly initialize the list head when keeping a list of primary followed by DFS connections.
       via  76213b0 vfs_streams_xattr: fix and simplify streams_xattr_get_name()
       via  73dac61 vfs_fruit: hide the Netatalk metadata xattr in streaminfo
       via  9bedefb vfs_fruit: add and use define for the Netatalk metadata xattr
       via  6d7e711 s4:torture:vfs_fruit: add test test_read_afpinfo
       via  985d331 s4:torture:vfs_fruit: add tests for AFP_Resource delete-on-close and eof
       via  3892a74 vfs_fruit: ignore delete on the AFP_Resource stream
       via  a48eb89 s4:torture:vfs_fruit: update AFP_AfpInfo IO tests
       via  c99c910 vfs_fruit: fix offset and len handling for AFP_AfpInfo stream
       via  d8511c0 s4:torture:vfs_fruit: test nulling out AFP_AfpInfo stream
       via  293363b vfs_fruit: writing all 0 to AFP_AfpInfo stream
       via  95699b3 s4:torture:vfs_fruit: add tests for AFP_AfpInfo delete-on-close and eof
       via  642b62b vfs_fruit: handling of ftruncate() on AFP_AfpInfo stream
       via  a4e0639 s4:torture:vfs_fruit: file without AFP_AfpInfo
       via  d26b979 vfs_fruit: stat AFP_AfpInfo must fail when it doesn't exist
       via  aa95842 vfs_fruit: fix some debug messages
       via  8a25a0a s3:lib/errmap_unix: map EOVERFLOW to NT_STATUS_ALLOTTED_SPACE_EXCEEDED
       via  b32587e s4:torture:vfs_fruit: fix flakey test_write_atalk_rfork_io with OS X
       via  7b2f35b s4:torture:vfs_fruit: fix test_rename_dir_openfile() to work with OS X
       via  b8512d4 s4:torture:vfs_fruit: fix test_aapl() to work with OS X
       via  08f61fa s4:torture:vfs_fruit: skip test_stream_names() without "localdir"
       via  4d7b2ab s4:torture:vfs_fruit: skip test_adouble_conversion() without "localdir"
       via  6a9f21c s4:torture:vfs_fruit: skip test test_read_atalk_metadata() without "localdir" and rename it
       via  6dba57e s4:torture:vfs_fruit: add explicit cleanup of testfiles
       via  432e9a1 s4:torture:vfs_fruit: add --option=torture:osx for enable_aapl()
       via  3bf1846 s4:torture:vfs_fruit: enhance check_stream
       via  b883c09 s4:torture:vfs_fruit: use AFPINFO_STREAM_NAME
       via  62a455a s4:torture:vfs_fruit: tweak check_stream_list()
       via  4eeb6db s4:torture:vfs_fruit: rename tree1 -> tree
       via  468c551 s4:torture:vfs_fruit: remove unused tree2
      from  2028bac docs: Fix typos in man vfs_gpfs.

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-2-test


- Log -----------------------------------------------------------------
commit c1f06fef7bc26537c0bed4a4a160f36c2c32fcb1
Author: Michael Adam <obnox at samba.org>
Date:   Wed Dec 23 18:01:23 2015 +0100

    s3:smbd: fix a corner case of the symlink verification
    
    Commit 7606c0db257b3f9d84da5b2bf5fbb4034cc8d77d fixes the
    path checks in check_reduced_name[_with_privilege]() to
    prevent unintended access via wide links.
    
    The fix fails to correctly treat a corner case where the share
    path is "/". This case is important for some real world
    scenarios, notably the use of the glusterfs VFS module:
    
    For the share path "/", the newly introduced checks deny all
    operations in the share.
    
    This change fixes the checks for the corner case.
    The point is that the assumptions on which the original
    checks are based are not true for the rootdir "/" case.
    This is the case where the rootdir starts _and ends_ with
    a slash. Hence a subdirectory does not continue with a
    slash after the rootdir, since the candidate path has
    been normalized.
    
    This fix just omits the string comparison and the
    next character checks in the case of rootdir "/",
    which is correct because we know that the candidate
    path is normalized and hence starts with a '/'.
    
    The patch is fairly minimal, but changes indentation,
    hence best viewed with 'git show -w'.
    
    A side effect is that the rootdir="/" case needs
    one strncmp less.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11647
    
    Pair-Programmed-With: Jose A. Rivera <jarrpa at samba.org>
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Signed-off-by: Jose A. Rivera <jarrpa at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Michael Adam <obnox at samba.org>
    Autobuild-Date(master): Thu Dec 24 00:57:31 CET 2015 on sn-devel-144
    
    (cherry picked from commit ada59ec7b3a5ed0478d11da2fe0c90991d137288)
    
    Autobuild-User(v4-2-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-2-test): Wed Jan  6 12:37:19 CET 2016 on sn-devel-104

commit 6b1c418f05417462af96ab223fe74908a778c80b
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Dec 16 11:04:20 2015 -0800

    s3: libsmb: Correctly initialize the list head when keeping a list of primary followed by DFS connections.
    
    Greatly helped by <shargagan at novell.com> to
    track down this issue.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11624
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Fri Dec 18 01:02:55 CET 2015 on sn-devel-144
    
    (cherry picked from commit d7feb1879ee711598540049c2c5eccc80fd6f1e5)

commit 76213b06292e865d36c04f8e98e45105cf71e838
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Aug 24 17:45:14 2015 +0200

    vfs_streams_xattr: fix and simplify streams_xattr_get_name()
    
    streams_xattr_get_name() fails to chop off the stream type in case
    config->store_stream_type is false and the passed stream name contains a
    stream type.
    
    Eg when the passed in stream name is ":mystream:$DATA", but
    config->store_stream_type is false, we must generate a xattr name of
    "mystream" or "user.mystream".
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11466
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Fri Oct 16 23:27:01 CEST 2015 on sn-devel-104
    
    (cherry picked from commit 2881679e3ecbaf07cdd82ba65af8d55e5e3be800)

commit 73dac61aeb87d7a18b7465abf76c053d2138efe9
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Aug 24 17:43:40 2015 +0200

    vfs_fruit: hide the Netatalk metadata xattr in streaminfo
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11466
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit fedd09662c889fb796135d86836c160171fac68d)

commit 9bedefbe7814ddd8e8213767ea73abbe5eea8450
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Aug 24 17:42:35 2015 +0200

    vfs_fruit: add and use define for the Netatalk metadata xattr
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11466
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit c8ee1a059b4484575b03ac76b469df85cdabdd9a)

commit 6d7e711327dd15eb82d19e8ecd94f366f5ca62cf
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>
    (cherry picked from commit b165d520374cc2ae77acfd813b528e55acfc2f7e)

commit 985d331344fcca16ae9696b7fbc7b79189441e3c
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>
    (cherry picked from commit 21d4b5cea8e4dec729912915d60922edaea0f418)

commit 3892a7443a0d6770fd287b7f7d11ae7c0ba62b05
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>
    (cherry picked from commit ee431fc5254dc735662d152dd19a81d439ca5e44)

commit a48eb89ded02597b35e7a7750db9dca2052c3df6
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>
    (cherry picked from commit decde0b4812eba5f80b717fd2ae868558a022753)

commit c99c91003355498c9623bfbe6782526ec25c84f3
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>
    (cherry picked from commit f569fd5e44300ab41aa7298b3efdcac99cd330f2)

commit d8511c06dae8509426583f48e9f1fcb676bd58d8
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>
    (cherry picked from commit 666a55b7060542ef78ff5f22d368f2ebc4c3318f)

commit 293363b483498272e572eae684f860669e7ef174
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>
    (cherry picked from commit e94b17715ea8049df8819b472178170b8e987946)

commit 95699b3680512f46d2a013f08be12b5c4fd10ed9
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>
    (cherry picked from commit e5588b463ee77aac3b396774e68c10b13a9f6f04)

commit 642b62b755f9f023438e4b8d3b0cac66a81b21b1
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>
    (cherry picked from commit 4024153894a07b7b1115dbe1699cba94fee13f23)

commit a4e06390ab61ad30e8305dfd6097556304e471cb
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>
    (cherry picked from commit 6f8c188dfc81a6d22bd54f248327b787e0b48f09)

commit d26b979bf4f3314017c303fe62c778933b9e0746
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>
    (cherry picked from commit 0af7bf4249419ff7c88c5beece915db0a3697b72)

commit aa95842903c9997ab81845f09e3a648102040fbb
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>
    (cherry picked from commit 748adea77f95d7d6114f96b7850f384b77d6f7d2)

commit 8a25a0a9c9d26079cb91be7f6360a4d6ff7ac5d4
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>
    (cherry picked from commit 1650e793edb42b07501d7467aa64c80eacf33eb6)

commit b32587e06cb12909b37dc98a90707849be9333a5
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>
    (cherry picked from commit ba00884e8a67420cf8d6c2530a778b9cee6e86b8)

commit 7b2f35b4fe9b9b5e4de6466172fe136e2b24801f
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>
    (cherry picked from commit 363260983f7ec85ecd3a2b35e6b07eeb5416bdc5)

commit b8512d414b933e30be9e3b9effee1df1311777da
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>
    (cherry picked from commit 0fc2ed8f01f2e510ee58ad2ea9209d2fec10fd3f)

commit 08f61fa47ed6ac6acd23d62b6f12e6186730c987
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>
    (cherry picked from commit 56bf27667cc8f2fad0cad96d796bdd2f172326a8)

commit 4d7b2ab6514b554e4345ecf7b2fd27770fb59923
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>
    (cherry picked from commit 987e12b7a7518e498c47dd8dfee32aed148f8cd7)

commit 6a9f21cc91965ea11a4fb90a84e583c338aa8ef6
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>
    (cherry picked from commit 0a9a7c21073227c539fc1ced331e837c1c1f4bc4)

commit 6dba57ef8d450ddbb84a7604d743575144c49d6b
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>
    (cherry picked from commit 155397e83173e13baebfc507ad9659d0ed213b5b)

commit 432e9a1157c7264af5457456bd2d85003cca6bb9
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>
    (cherry picked from commit 3c0ac9b3899aa06315e592253c858f31d4bd2ae3)

commit 3bf18468484cc38ef8f85df6730f1088d6b3244e
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>
    (cherry picked from commit fdf937e77da29ec47002855db69d9e3f95005479)

commit b883c09a2baa7e9645b4cfc0867928f1c6999d29
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>
    (cherry picked from commit 8694da43442abe3ae6ac3b6a16c524e455ae1a65)

commit 62a455a5e1b9fb5d6e7e2f1547e6e6c5057943aa
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>
    (cherry picked from commit 8e0cf77ee230c0eaef01a2dc2316fc65aabd5a59)

commit 4eeb6db1073b36aa99a1bc71b18c12cecab0dd66
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>
    (cherry picked from commit 1d13744547474592285eacab84d1217af46e0086)

commit 468c551c69253a49464ea26fa3dbd5bb645f5b53
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>
    (cherry picked from commit 9d28f82484e8b34c8d8f35f596fdb63614b103d2)

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

Summary of changes:
 source3/lib/errmap_unix.c           |    3 +
 source3/libsmb/libsmb_server.c      |    4 +-
 source3/modules/vfs_fruit.c         |  152 +++--
 source3/modules/vfs_streams_xattr.c |   39 +-
 source3/selftest/tests.py           |    4 +-
 source3/smbd/vfs.c                  |   78 ++-
 source4/torture/vfs/fruit.c         | 1252 ++++++++++++++++++++++++++++-------
 7 files changed, 1205 insertions(+), 327 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/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index 0a58d8c..6e8e3c3 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -628,7 +628,7 @@ SMBC_server_internal(TALLOC_CTX *ctx,
 	}
 
 	ZERO_STRUCTP(srv);
-	srv->cli = c;
+	DLIST_ADD(srv->cli, c);
 	srv->dev = (dev_t)(str_checksum(server) ^ str_checksum(share));
         srv->no_pathinfo = False;
         srv->no_pathinfo2 = False;
@@ -824,7 +824,7 @@ SMBC_attr_server(TALLOC_CTX *ctx,
                 }
 
                 ZERO_STRUCTP(ipc_srv);
-                ipc_srv->cli = ipc_cli;
+                DLIST_ADD(ipc_srv->cli, ipc_cli);
 
                 nt_status = cli_rpc_pipe_open_noauth(
 			ipc_srv->cli, &ndr_table_lsarpc, &pipe_hnd);
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 17da629..9803fe2 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -103,11 +103,12 @@ static int vfs_fruit_debug_level = DBGC_VFS;
  * REVIEW:
  * This is hokey, but what else can we do?
  */
+#define NETATALK_META_XATTR "org.netatalk.Metadata"
 #if defined(HAVE_ATTROPEN) || defined(FREEBSD)
-#define AFPINFO_EA_NETATALK "org.netatalk.Metadata"
+#define AFPINFO_EA_NETATALK NETATALK_META_XATTR
 #define AFPRESOURCE_EA_NETATALK "org.netatalk.ResourceFork"
 #else
-#define AFPINFO_EA_NETATALK "user.org.netatalk.Metadata"
+#define AFPINFO_EA_NETATALK "user." NETATALK_META_XATTR
 #define AFPRESOURCE_EA_NETATALK "user.org.netatalk.ResourceFork"
 #endif
 
@@ -1530,6 +1531,37 @@ static bool add_fruit_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams,
 	return true;
 }
 
+static bool del_fruit_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams,
+			     struct stream_struct **streams,
+			     const char *name)
+{
+	struct stream_struct *tmp = *streams;
+	int i;
+
+	if (*num_streams == 0) {
+		return true;
+	}
+
+	for (i = 0; i < *num_streams; i++) {
+		if (strequal_m(tmp[i].name, name)) {
+			break;
+		}
+	}
+
+	if (i == *num_streams) {
+		return true;
+	}
+
+	TALLOC_FREE(tmp[i].name);
+	if (*num_streams - 1 > i) {
+		memmove(&tmp[i], &tmp[i+1],
+			(*num_streams - i - 1) * sizeof(struct stream_struct));
+	}
+
+	*num_streams -= 1;
+	return true;
+}
+
 static bool empty_finderinfo(const struct adouble *ad)
 {
 
@@ -2430,7 +2462,7 @@ static int fruit_unlink(vfs_handle_struct *handle,
 		}
 
 		/* FIXME: direct unlink(), missing smb_fname */
-		DEBUG(1,("fruit_unlink: %s\n", adp));
+		DEBUG(10,("fruit_unlink: %s\n", adp));
 		rc = unlink(adp);
 		if ((rc == -1) && (errno == ENOENT)) {
 			rc = 0;
@@ -2453,27 +2485,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);
@@ -2675,13 +2688,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) {
@@ -2704,7 +2723,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(
@@ -2795,6 +2817,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) {
+				DEBUG(1,("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,
@@ -2853,6 +2892,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) {
+		DEBUG(3,("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;
@@ -3106,6 +3156,7 @@ static NTSTATUS fruit_streaminfo(vfs_handle_struct *handle,
 	struct fruit_config_data *config = NULL;
 	struct smb_filename *smb_fname = NULL;
 	struct adouble *ad = NULL;
+	NTSTATUS status;
 
 	SMB_VFS_HANDLE_GET_DATA(handle, config, struct fruit_config_data,
 				return NT_STATUS_UNSUCCESSFUL);
@@ -3154,8 +3205,23 @@ static NTSTATUS fruit_streaminfo(vfs_handle_struct *handle,
 
 	TALLOC_FREE(smb_fname);
 
-	return SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx,
-				       pnum_streams, pstreams);
+	status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx,
+					 pnum_streams, pstreams);
+	if (!NT_STATUS_IS_OK(status)) {
+		return status;
+	}
+
+	if (config->meta == FRUIT_META_NETATALK) {
+		/* Remove the Netatalk xattr from the list */
+		if (!del_fruit_stream(mem_ctx, pnum_streams, pstreams,
+				      ":" NETATALK_META_XATTR ":$DATA")) {
+				TALLOC_FREE(ad);
+				TALLOC_FREE(smb_fname);
+				return NT_STATUS_NO_MEMORY;
+		}
+	}
+
+	return NT_STATUS_OK;
 }
 
 static int fruit_ntimes(vfs_handle_struct *handle,
@@ -3219,19 +3285,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) {
 		DEBUG(1,("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);
+	DEBUG(1,("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,
@@ -3278,8 +3348,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));
+	DEBUG(10,("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);
@@ -3560,7 +3630,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)));
+	DEBUG(10,("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)) {
@@ -3576,10 +3646,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/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c
index 5277741..7ef4279 100644
--- a/source3/modules/vfs_streams_xattr.c
+++ b/source3/modules/vfs_streams_xattr.c
@@ -106,12 +106,18 @@ static NTSTATUS streams_xattr_get_name(vfs_handle_struct *handle,
 				       const char *stream_name,
 				       char **xattr_name)
 {
+	char *sname;
 	char *stype;
 	struct streams_xattr_config *config;
 
 	SMB_VFS_HANDLE_GET_DATA(handle, config, struct streams_xattr_config,
 				return NT_STATUS_UNSUCCESSFUL);
 
+	sname = talloc_strdup(ctx, stream_name + 1);
+	if (sname == NULL) {
+		return NT_STATUS_NO_MEMORY;
+	}
+
 	/*
 	 * With vfs_fruit option "fruit:encoding = native" we're
 	 * already converting stream names that contain illegal NTFS
@@ -126,41 +132,34 @@ static NTSTATUS streams_xattr_get_name(vfs_handle_struct *handle,
 	 * In check_path_syntax() we've already ensured the streamname
 	 * we got from the client is valid.
 	 */
-	stype = strrchr_m(stream_name + 1, ':');
+	stype = strrchr_m(sname, ':');
 
 	if (stype) {
+		/*
+		 * We only support one stream type: "$DATA"
+		 */
 		if (strcasecmp_m(stype, ":$DATA") != 0) {
+			talloc_free(sname);
 			return NT_STATUS_INVALID_PARAMETER;
 		}
+
+		/* Split name and type */
+		stype[0] = '\0';
 	}
 
-	*xattr_name = talloc_asprintf(ctx, "%s%s",
+	*xattr_name = talloc_asprintf(ctx, "%s%s%s",
 				      config->prefix,
-				      stream_name + 1);
+				      sname,
+				      config->store_stream_type ? ":$DATA" : "");
 	if (*xattr_name == NULL) {
+		talloc_free(sname);
 		return NT_STATUS_NO_MEMORY;
 	}
 
-	if (stype != NULL) {
-		/* Normalize the stream type to upercase. */
-		if (!strupper_m(strrchr_m(*xattr_name, ':') + 1)) {
-			return NT_STATUS_INVALID_PARAMETER;
-		}
-	} else if (config->store_stream_type) {
-		/*
-		 * Append an explicit stream type if one wasn't
-		 * specified.
-		 */
-		*xattr_name = talloc_asprintf(ctx, "%s%s",
-					      *xattr_name, ":$DATA");
-		if (*xattr_name == NULL) {
-			return NT_STATUS_NO_MEMORY;
-		}
-	}
-
 	DEBUG(10, ("xattr_name: %s, stream_name: %s\n", *xattr_name,
 		   stream_name));
 
+	talloc_free(sname);
 	return NT_STATUS_OK;
 }
 
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 2d7ecf6..7279927 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -373,8 +373,8 @@ for t in tests:
         plansmbtorture4testsuite(t, "s3dc", '//$SERVER_IP/tmpsort -U$USERNAME%$PASSWORD')
         plansmbtorture4testsuite(t, "plugin_s4_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
     elif t == "vfs.fruit":
-        plansmbtorture4testsuite(t, "s3dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --option=torture:share1=vfs_fruit --option=torture:share2=tmp --option=torture:localdir=$SELFTEST_PREFIX/s3dc/share')
-        plansmbtorture4testsuite(t, "plugin_s4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --option=torture:share1=vfs_fruit --option=torture:share2=tmp --option=torture:localdir=$SELFTEST_PREFIX/plugin_s4_dc/share')
+        plansmbtorture4testsuite(t, "s3dc", '//$SERVER_IP/vfs_fruit -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/s3dc/share')
+        plansmbtorture4testsuite(t, "plugin_s4_dc", '//$SERVER_IP/vfs_fruit -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/plugin_s4_dc/share')
     elif t == "smb2.notify":
         plansmbtorture4testsuite(t, "s3dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --signing=required')
         plansmbtorture4testsuite(t, "plugin_s4_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD --signing=required')
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 5916793..4d66012 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -996,7 +996,6 @@ NTSTATUS check_reduced_name_with_privilege(connection_struct *conn,
 	struct smb_filename *smb_fname_cwd = NULL;
 	struct privilege_paths *priv_paths = NULL;
 	int ret;
-	bool matched;
 
 	DEBUG(3,("check_reduced_name_with_privilege [%s] [%s]\n",
 			fname,
@@ -1091,18 +1090,32 @@ NTSTATUS check_reduced_name_with_privilege(connection_struct *conn,
 	}
 
 	rootdir_len = strlen(conn_rootdir);
-	matched = (strncmp(conn_rootdir, resolved_name, rootdir_len) == 0);
-
-	if (!matched || (resolved_name[rootdir_len] != '/' &&
-			 resolved_name[rootdir_len] != '\0')) {
-		DEBUG(2, ("check_reduced_name_with_privilege: Bad access "
-			"attempt: %s is a symlink outside the "
-			"share path\n",
-			dir_name));
-		DEBUGADD(2, ("conn_rootdir =%s\n", conn_rootdir));
-		DEBUGADD(2, ("resolved_name=%s\n", resolved_name));
-		status = NT_STATUS_ACCESS_DENIED;
-		goto err;
+
+	/*
+	 * In the case of rootdir_len == 1, we know that conn_rootdir is
+	 * "/", and we also know that resolved_name starts with a slash.
+	 * So, in this corner case, resolved_name is automatically a
+	 * sub-directory of the conn_rootdir. Thus we can skip the string
+	 * comparison and the next character checks (which are even
+	 * wrong in this case).
+	 */
+	if (rootdir_len != 1) {
+		bool matched;
+
+		matched = (strncmp(conn_rootdir, resolved_name,
+				rootdir_len) == 0);
+
+		if (!matched || (resolved_name[rootdir_len] != '/' &&
+				 resolved_name[rootdir_len] != '\0')) {
+			DEBUG(2, ("check_reduced_name_with_privilege: Bad "
+				"access attempt: %s is a symlink outside the "
+				"share path\n",
+				dir_name));
+			DEBUGADD(2, ("conn_rootdir =%s\n", conn_rootdir));
+			DEBUGADD(2, ("resolved_name=%s\n", resolved_name));
+			status = NT_STATUS_ACCESS_DENIED;
+			goto err;
+		}
 	}
 
 	/* Now ensure that the last component either doesn't
@@ -1234,7 +1247,6 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
 	if (!allow_widelinks || !allow_symlinks) {
 		const char *conn_rootdir;
 		size_t rootdir_len;
-		bool matched;
 
 		conn_rootdir = SMB_VFS_CONNECTPATH(conn, fname);
 		if (conn_rootdir == NULL) {
@@ -1245,17 +1257,33 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
 		}
 
 		rootdir_len = strlen(conn_rootdir);
-		matched = (strncmp(conn_rootdir, resolved_name,
-				rootdir_len) == 0);
-		if (!matched || (resolved_name[rootdir_len] != '/' &&
-				 resolved_name[rootdir_len] != '\0')) {
-			DEBUG(2, ("check_reduced_name: Bad access "
-				"attempt: %s is a symlink outside the "
-				"share path\n", fname));
-			DEBUGADD(2, ("conn_rootdir =%s\n", conn_rootdir));
-			DEBUGADD(2, ("resolved_name=%s\n", resolved_name));
-			SAFE_FREE(resolved_name);
-			return NT_STATUS_ACCESS_DENIED;
+
+		/*
+		 * In the case of rootdir_len == 1, we know that
+		 * conn_rootdir is "/", and we also know that
+		 * resolved_name starts with a slash.  So, in this
+		 * corner case, resolved_name is automatically a
+		 * sub-directory of the conn_rootdir. Thus we can skip
+		 * the string comparison and the next character checks
+		 * (which are even wrong in this case).
+		 */
+		if (rootdir_len != 1) {
+			bool matched;
+
+			matched = (strncmp(conn_rootdir, resolved_name,
+					rootdir_len) == 0);
+			if (!matched || (resolved_name[rootdir_len] != '/' &&
+					 resolved_name[rootdir_len] != '\0')) {
+				DEBUG(2, ("check_reduced_name: Bad access "
+					"attempt: %s is a symlink outside the "
+					"share path\n", fname));
+				DEBUGADD(2, ("conn_rootdir =%s\n",
+					     conn_rootdir));


-- 
Samba Shared Repository



More information about the samba-cvs mailing list