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

Karolin Seeger kseeger at samba.org
Fri Jun 21 11:51:02 UTC 2019


The branch, v4-9-test has been updated
       via  3cd4642014b s3:mdssvc: fix flex compilation error
       via  44b5168845e ctdb-scripts: Fix tcp_tw_recycle existence check
       via  575739df9fd docs: Improve documentation of "lanman auth" and "ntlm auth" connection
       via  684d772e0e1 vfs_fruit: remove a now unnecessary include
       via  7ae1667bda9 vfs_fruit: use VFS functions in ad_read_rsrc_adouble()
       via  1a8dffceff4 vfs_fruit: use fsp and remove syscalls from ad_convert_blank_rfork()
       via  afc88153675 vfs_fruit: use VFS function in ad_convert_truncate()
       via  14048aaf176 vfs_fruit: add VFS handle to ad_convert_truncate()
       via  015586a4227 vfs_fruit: use fsp and remove mmap in ad_convert_xattr()
       via  42e6d4d4b5e vfs_fruit: remove use of mmap() from ad_convert_move_reso()
       via  e21d880614c vfs_fruit: convert ad_open_rsrc() to open a proper fsp with SMB_VFS_CREATE_FILE()
       via  b10eabed24d vfs_fruit: only do cross protocol locking on non-internal opens
       via  645836ff20a vfs_fruit: remove a layer of indirection
       via  06bd78910ec vfs_fruit: pass VFS handle to ad_convert_move_reso()
       via  e8cecc86ab5 vfs_fruit: remove xattr code from the AppleDouble subsystem
       via  76074dded7d vfs_fruit: remove now unused AppleDouble code for resource fork in xattr
       via  b24bac64570 vfs_fruit: use stream code for resource fork size calculation in readdir_attr_rfork_size()
       via  561d52f89a6 vfs_fruit: use correct case FRUIT_RSRC_STREAM in readdir_attr_rfork_size()
       via  c2c6377ebf8 vfs_fruit: ignore AppleDouble files in fruit_unlink()
       via  1542bb051be vfs_fruit: add a missing else
       via  18c45bb3440 vfs_fruit: add and use is_adouble_file()
       via  c3676d8d42b vfs_fruit: finally, remove ad_handle from struct adouble
       via  20e66673c39 vfs_fruit: pass handle to ad_convert_delete_adfile()
       via  fbc0501bed0 vfs_fruit: pass handle to ad_convert_finderinfo()
       via  b50f2ad9919 vfs_fruit: pass handle to ad_convert_blank_rfork()
       via  1efc046ceff vfs_fruit: pass handle to ad_convert_xattr()
       via  b5275f407f6 vfs_fruit: indentation fix
       via  f30219176ae vfs_fruit: pass handle to ad_read_rsrc() and all the way down
       via  5975a4a8dfd vfs_fruit: use proper VFS function in ad_read_meta()
       via  9ae195e4bd8 vfs_fruit: indentation fix
       via  b4c6efa3ebd vfs_fruit: pass handle to ad_read_meta()
       via  c99c7f2a641 vfs_fruit: pass handle to ad_read()
       via  7ece266411a vfs_fruit: pass handle to ad_set()
       via  f94d0095e8a vfs_fruit: pass handle to ad_fset()
       via  79beb172cc6 s3:auth: explicitly add BUILTIN\Guests to the guest token
       via  15fa6919b8a tests: add a test for guest authentication
       via  36641f70d05 selftest: allow guest login in the ad_member_idmap_rid env
       via  1cc8068e196 s3:smbd: call reinit_guest_session_info() in the conf updated handler
       via  71c33811c82 s3:auth: add reinit_guest_session_info()
       via  29e402f583b dsdb:audit_log: avoid printing "... remote host [Unknown] SID [(NULL SID)] ..."
       via  11b1f405ee9 ldap server: generate correct referral schemes
       via  670b864e908 ldap tests: test scheme for referrals
       via  2cde1306169 s4 dsdb: fix use after free in samldb_rename_search_base_callback
       via  936a71bfe0e s3/vfs_glusterfs_fuse: Avoid using NAME_MAX directly
       via  3136b31e957 s3/vfs_glusterfs: Avoid using NAME_MAX directly
       via  dba38ed369b Revert "s3/vfs_glusterfs_fuse: Dynamically determine NAME_MAX"
       via  3b1ccbfc0ce Revert "s3/vfs_glusterfs: Dynamically determine NAME_MAX"
       via  2a7e6eb8b1d dsdb/repl: we need to replicate the whole schema before we can apply it
      from  414261f3785 VERSION: Bump version up to 4.9.10.

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


- Log -----------------------------------------------------------------
commit 3cd4642014bfd69a0cbe4e2b38eb00f1f6f26b65
Author: Ralph Boehme <slow at samba.org>
Date:   Mon May 27 12:27:57 2019 +0200

    s3:mdssvc: fix flex compilation error
    
    [4440/4495] Compiling bin/default/source3/rpc_server/mdssvc/sparql_lexer.lex.c
    ../../source3/rpc_server/mdssvc/sparql_lexer.l:26: error: "yyalloc" redefined [-Werror]
    26 | #define yyalloc SMB_MALLOC
    
    Looks like the dirty redefine trick doesn't work anymore with newer flex
    versions. According to the flex manual the right thing to do is to provide own
    functions for yyalloc and yyrealloc when passing the options "noyyalloc
    noyyrealloc".
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13987
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Tue May 28 11:49:06 UTC 2019 on sn-devel-184
    
    (cherry picked from commit 9053391f86a529e0a7dbcd23fa3a555d85c2207c)
    
    Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-9-test): Fri Jun 21 11:49:59 UTC 2019 on sn-devel-144

commit 44b5168845e9be83e47b1ebe7cc75b849d12fad6
Author: Rafael David Tinoco via samba-technical <samba-technical at lists.samba.org>
Date:   Sun Jun 2 23:44:15 2019 -0300

    ctdb-scripts: Fix tcp_tw_recycle existence check
    
    net.ipv4.tcp_tw_recycle has been removed from Linux 4.12 but, still,
    makes sense to check its existence. Unfortunately, current check does
    not test for the procfs file existence. This commit fixes the issue.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13984
    
    Signed-off-by: Rafael David Tinoco <rafaeldtinoco at ubuntu.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Tue Jun  4 23:31:24 UTC 2019 on sn-devel-184
    
    (cherry picked from commit 843fbb1207ee7ac84f3282974b66b9290d8da0ac)

commit 575739df9fd354e17eedf27aafa137118ba9879a
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat Jun 1 09:04:48 2019 +1200

    docs: Improve documentation of "lanman auth" and "ntlm auth" connection
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13981
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit dbf3e81f7f0b28c69dca004b32ea3a7344b0cad3)

commit 684d772e0e1b75466c7c0f2039a91de9fc5c3ae5
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 24 15:15:59 2019 +0200

    vfs_fruit: remove a now unnecessary include
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    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): Thu May 30 22:12:50 UTC 2019 on sn-devel-184
    
    (cherry picked from commit 9a2c9834cb1b77547b8b932c35870301afb9fc25)

commit 7ae1667bda9eb395110dc94c6f0cf32b55a92fde
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 24 14:51:17 2019 +0200

    vfs_fruit: use VFS functions in ad_read_rsrc_adouble()
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 9fe84a6345bf5d9fdb1df87a853db3380e6fb0f7)

commit 1a8dffceff47a198875cb5155fe6d751c19f2c15
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 24 12:51:15 2019 +0200

    vfs_fruit: use fsp and remove syscalls from ad_convert_blank_rfork()
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 70c4a8f0ac307009c26e857523192c95b42a92f5)

commit afc88153675ac537c443fe9ea4169accf95b9b2a
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 24 12:07:55 2019 +0200

    vfs_fruit: use VFS function in ad_convert_truncate()
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 3739ad90cf2bbaa2094a34197c894363d2e24a5a)

commit 14048aaf176cf34417c826aad0e8d92dc131e1ea
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 24 12:05:51 2019 +0200

    vfs_fruit: add VFS handle to ad_convert_truncate()
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 4e44b1da9357120f0ad74e24c650bc6386085c47)

commit 015586a42274edc210d71fdc8d9158ecdd59d7b9
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 24 11:54:51 2019 +0200

    vfs_fruit: use fsp and remove mmap in ad_convert_xattr()
    
    No need to mmap() anyway, the xattr data is already available in ad->ad_data.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 4ff7ea0e0312c737aefd350f7b8fbed4c8602325)

commit 42e6d4d4b5ebec4346797214e5f70c5720369867
Author: Ralph Boehme <slow at samba.org>
Date:   Thu May 23 22:44:21 2019 +0200

    vfs_fruit: remove use of mmap() from ad_convert_move_reso()
    
    We now have an fsp that we can use, so we can get rid of mmap() and
    sys_pread()/sys_pwrite().
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 0041855af0b05d6c47558880d6eebd1970179272)

commit e21d880614c869bff867c6c12ad6b824b0f63928
Author: Ralph Boehme <slow at samba.org>
Date:   Thu May 23 16:42:52 2019 +0200

    vfs_fruit: convert ad_open_rsrc() to open a proper fsp with SMB_VFS_CREATE_FILE()
    
    A first step in converting all raw syscalls to use proper VFS functions. All
    existing users of the raw system filedescriptor continue to use the fd from
    fsp->fh for now.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 29418c726be74feb1d8c3ac9f7b8c983901a2aab)

commit b10eabed24d5acc6753a8045fa3ea7f08020ddad
Author: Ralph Boehme <slow at samba.org>
Date:   Thu May 23 16:22:39 2019 +0200

    vfs_fruit: only do cross protocol locking on non-internal opens
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit f5f7d1e9bf7e39933ccf7c874e682f9df80a6fec)

commit 645836ff20af10a9be367a310ca3f12e9017ee70
Author: Ralph Boehme <slow at samba.org>
Date:   Thu May 23 08:27:37 2019 +0200

    vfs_fruit: remove a layer of indirection
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 97d485ff2cda85edeba163ea01b6abfa705db20f)

commit 06bd78910ecc4f01638dd3bc30c048cde698c3ec
Author: Ralph Boehme <slow at samba.org>
Date:   Thu May 23 08:14:18 2019 +0200

    vfs_fruit: pass VFS handle to ad_convert_move_reso()
    
    Not used for now, that comes next.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 3919ea048fe3b763657e14cdfb5920184a900d27)

commit e8cecc86ab576c23e7279a019265ad5f09ebb83e
Author: Ralph Boehme <slow at samba.org>
Date:   Wed May 22 21:15:22 2019 +0200

    vfs_fruit: remove xattr code from the AppleDouble subsystem
    
    The subsystem consumers have been reworked in the previous commits, so this is
    not used anymore. ad_init() doesn't need a handle argument anymore due to this,
    remove it as well.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit e3cb1cb24f2a31d7fd03f3bdf417f4704fb4ac7c)

commit 76074dded7dd7fc5dca51911b7f96880e98549f8
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 17 14:31:15 2019 +0200

    vfs_fruit: remove now unused AppleDouble code for resource fork in xattr
    
    This was only needed to get the resourcefork size via the ad_* AppleDouble
    function. This is now done with a fstat on the low level xattr fd (remember,
    this is Solaris only code...), so we can remove the xattr special casing from
    the AppleDouble functions.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit cb9dffa1c66294b6eed85e7576aa99c642d0b541)

commit b24bac64570e9339620dffc0435f0b20dc2f4e6c
Author: Ralph Boehme <slow at samba.org>
Date:   Wed May 22 18:08:14 2019 +0200

    vfs_fruit: use stream code for resource fork size calculation in readdir_attr_rfork_size()
    
    This works as well, using an fstat() on the filehandle to get the size. This is
    tested by the torture test "vfs.fruit.SMB2/CREATE context AAPL".
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit a23bcc1916a49bf3e0edece190e5434e39862d2c)

commit 561d52f89a6092900a3ac65a40cd1590d8b89c10
Author: Ralph Boehme <slow at samba.org>
Date:   Wed May 22 17:02:20 2019 +0200

    vfs_fruit: use correct case FRUIT_RSRC_STREAM in readdir_attr_rfork_size()
    
    This is a genuine bug, but luckily this would only impact configs which nobody
    uses:
    
      fruit:metadata = netatalk
      fruit:resource = stream
    
    With the above configuration the switch in readdir_attr_rfork_size() would hit
    the default case and so always report resource forks as 0 bytes in size.
    
    All deployment that I've seen that use fruit:resource=stream also use
    fruit:metadata=stream, so the switch takes FRUIT_META_STREAM case which runs the
    correct code readdir_attr_rfork_size_stream().
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 83179a74119de84d20f796c241aae6bccb83a68b)

commit c2c6377ebf878aec8857579224142a807af3f21b
Author: Ralph Boehme <slow at samba.org>
Date:   Tue May 21 11:42:47 2019 +0200

    vfs_fruit: ignore AppleDouble files in fruit_unlink()
    
    Otherwise, if SMB_VFS_UNLINK() is called for an AppleDouble path "._file", we
    try to delete "._._file" which doesn't make sense. AppleDouble files don't have
    AppleDouble themselves.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 797dc649456f39add4af8b54b60db0268ad4e90e)

commit 1542bb051bef293abdbbfe2b73b373ca11b8fcf8
Author: Ralph Boehme <slow at samba.org>
Date:   Tue May 21 11:40:33 2019 +0200

    vfs_fruit: add a missing else
    
    Luckily the missing else has the same control flow due to the previous if and
    else blocks calling return.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 44d8568001c87d28962dfc4e3fde6d0f7f409997)

commit 18c45bb3440d5e54c2d4380a94317f0ac40e67b2
Author: Ralph Boehme <slow at samba.org>
Date:   Tue May 21 11:39:18 2019 +0200

    vfs_fruit: add and use is_adouble_file()
    
    This adds a helper function that checks whether the last component of a path is
    an AppleDouble sidecar file with "._" name prefix.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit ad70c947c759aa0965ee57f973fb8dc1909e0e39)

commit c3676d8d42b2b6acc4d68acae69df18ff04b2b5f
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 17 12:19:06 2019 +0200

    vfs_fruit: finally, remove ad_handle from struct adouble
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit e266daaed149561b746dbb8d5e9523862f0057b5)

commit 20e66673c39d52b5daa94c84dcc8d6bdabf60116
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 17 12:17:28 2019 +0200

    vfs_fruit: pass handle to ad_convert_delete_adfile()
    
    On the course of removing ad_handle from struct adouble, step 10.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 5f4d16b40e07acf8d27fee62f1a56de175663a1d)

commit fbc0501bed047cfb66196adecb843d8b751d53cf
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 17 12:05:07 2019 +0200

    vfs_fruit: pass handle to ad_convert_finderinfo()
    
    On the course of removing ad_handle from struct adouble, step 9.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 50874c1548d62ab0ddaaa6dd4124279ee5029fcf)

commit b50f2ad9919120f3a6ff556ac0694b12fc6fb88c
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 17 12:02:46 2019 +0200

    vfs_fruit: pass handle to ad_convert_blank_rfork()
    
    On the course of removing ad_handle from struct adouble, step 8.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit adc7ac38b849b4dce4a85fd6442c8d4b9da57686)

commit 1efc046ceffec570914fafcc538e2b03c4228dec
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 17 11:54:10 2019 +0200

    vfs_fruit: pass handle to ad_convert_xattr()
    
    On the course of removing ad_handle from struct adouble, step 7.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit fd2f4cf828ee4c31e3b5a27a79d3a0ee12a5877a)

commit b5275f407f614edf381fe80e4d62399f0f7581ba
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 17 11:23:17 2019 +0200

    vfs_fruit: indentation fix
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 400b3c2f8c82b1defe1e321e0cdae486b930344f)

commit f30219176ae1ff1536e7cab43a4dacc1daa5cbc8
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 17 11:47:26 2019 +0200

    vfs_fruit: pass handle to ad_read_rsrc() and all the way down
    
    On the course of removing ad_handle from struct adouble, step 5.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 661dfa4a19673fdb30d5bf36279cdf867454b947)

commit 5975a4a8dfdf9f460b0024ffb38f9517fb55885e
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 17 11:42:06 2019 +0200

    vfs_fruit: use proper VFS function in ad_read_meta()
    
    Continuing to ignore a possible error for now, this is in an error codepath
    anyway.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 30ca328c698c2e035e240359bda7c9dcbeb646df)

commit 9ae195e4bd8cf49a59af14e22f01896610a77e7e
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 17 11:23:17 2019 +0200

    vfs_fruit: indentation fix
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 47721d8d359ef78b8dd4f77f92c30c2caf2c4a80)

commit b4c6efa3ebd717abab502f9a5891e47750c653e5
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 17 11:22:24 2019 +0200

    vfs_fruit: pass handle to ad_read_meta()
    
    On the course of removing ad_handle from struct adouble, step 4.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit f8df09157f31b53dbe73eaf4349fc071bfcc1b90)

commit c99c7f2a6411cc2569570361c0b1e45382c6cb04
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 17 11:19:53 2019 +0200

    vfs_fruit: pass handle to ad_read()
    
    On the course of removing ad_handle from struct adouble, step 3.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit d0abf945e683766029d28915541a4baf9f3879ab)

commit 7ece266411a26405f7bb898b83c87a25c31dd048
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 17 10:43:55 2019 +0200

    vfs_fruit: pass handle to ad_set()
    
    On the course of removing ad_handle from struct adouble, step 2.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit c78ba30ac4534b7037b979ac96b77b834b2eb2fe)

commit f94d0095e8ac92e348e94b3c14ffe2d78fbdd596
Author: Ralph Boehme <slow at samba.org>
Date:   Fri May 17 10:41:29 2019 +0200

    vfs_fruit: pass handle to ad_fset()
    
    On the course of removing ad_handle from struct adouble, step 1.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 585d4d49770b4ddc3f7d9dcbb3e322f072767781)

commit 79beb172cc6329f75ae53a309a715ae1fa1b0b50
Author: Ralph Boehme <slow at samba.org>
Date:   Mon May 13 20:16:47 2019 +0200

    s3:auth: explicitly add BUILTIN\Guests to the guest token
    
    This changes ensures that smbd always adds BUILTIN\Guests to the guest token
    which is required for guest authentication.
    
    Currently the guest token depends on the on-disk configured group mappings. If
    there's an existing group mapping for BUILTIN\Guests, but LOCALSAM\Guest is not
    a member, the final guest token won't contain BUILTIN\Guests.
    
    For SMB2 the flag SMB2_SESSION_FLAG_IS_GUEST will not be set in the final SMB2
    SESSION_SETUP response, because smbd sets it based on the token containing the
    BUILTIN\Guests SID S-1-5-32-546.
    
    At the same time, the packet is not signed which causes Windows clients and
    smbclient to reject the unsigned SMB2 SESSION_SETUP response.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13944
    
    Pair-programmed-with: Stefan Metzmacher <metze at samba.org>
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Wed Jun  5 16:55:26 UTC 2019 on sn-devel-184
    
    (cherry picked from commit a66af4c96accba4ee64eeb1958458b69f3ccec1d)

commit 15fa6919b8a52942d3f71620657aefe33cebc216
Author: Ralph Boehme <slow at samba.org>
Date:   Thu May 16 12:47:34 2019 +0200

    tests: add a test for guest authentication
    
    This verifies that smbd always adds BUILTIN\Guests to the guest token which is
    required for guest authentication.
    
    Currently the guest token depends on the on-disk configured group mappings. If
    there's an existing group mapping for BUILTIN\Guests, but LOCALSAM\Guest is not
    a member, the final guest token won't contain BUILTIN\Guests.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13944
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 0e88f98855e24cfddb55bef65c5910b8e662c630)

commit 36641f70d05b4b05495053941e8fcd5c9a470954
Author: Ralph Boehme <slow at samba.org>
Date:   Thu May 16 12:43:40 2019 +0200

    selftest: allow guest login in the ad_member_idmap_rid env
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13944
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (backported from commit ac2167eb2349dc1c453e14a65692f16c8ba6532e)

commit 1cc8068e196175a7b2c8f589f8f336a4da9a7e46
Author: Ralph Boehme <slow at samba.org>
Date:   Thu May 16 12:42:54 2019 +0200

    s3:smbd: call reinit_guest_session_info() in the conf updated handler
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13944
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit f4e340a48b6f059a1daa66deb9c26da9e8fcd5e7)

commit 71c33811c82b25e399a46fe0f12062d63be6cf3c
Author: Ralph Boehme <slow at samba.org>
Date:   Thu May 16 12:42:29 2019 +0200

    s3:auth: add reinit_guest_session_info()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13944
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 8096cc7eb2b36b074ff17a52dc3540be4ecff6bb)

commit 29e402f583b520c25f355318b2868befac99fa9c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Apr 26 14:31:46 2019 +0000

    dsdb:audit_log: avoid printing "... remote host [Unknown] SID [(NULL SID)] ..."
    
    We better print "... remote host [Unknown] SID [S-1-5-18] ..."
    in 'dsdb_audit' message, this matches what we print for
    'dsdb_json_audit'.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13916
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 706aba5bf62e674ae12786f6ab275752b8714464)

commit 11b1f405ee9d41abf7d801494dbee3d8efc8935d
Author: Gary Lockyer <gary at catalyst.net.nz>
Date:   Tue May 21 13:17:22 2019 +1200

    ldap server: generate correct referral schemes
    
    Ensure that the referrals returned in a search request use the same
    scheme as the request, i.e. referrals recieved via ldap are prefixed
    with "ldap://" and those over ldaps are prefixed with "ldaps://"
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12478
    
    Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Fri May 24 05:12:14 UTC 2019 on sn-devel-184
    
    (cherry picked from commit 1958cd8a7fb81ec51b81944ecf4dd0fb5c4208fa)

commit 670b864e908a52f14437f7f63e70bf9603906528
Author: Gary Lockyer <gary at catalyst.net.nz>
Date:   Tue May 21 13:14:08 2019 +1200

    ldap tests: test scheme for referrals
    
    Ensure that the referrals returned in a search request use the same
    scheme as the request, i.e. referrals recieved via ldap are prefixed
    with "ldap://" and those over ldaps are prefixed with "ldaps://"
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12478
    
    Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 6ccf74cf878c295903673e3a1d1ed924a5e87547)

commit 2cde13061695f099f4a5110232f2630869f897b6
Author: Gary Lockyer <gary at catalyst.net.nz>
Date:   Tue May 14 13:10:22 2019 +1200

    s4 dsdb: fix use after free in samldb_rename_search_base_callback
    
    Fix use after free detected by AddressSanitizer
    
    AddressSanitizer: heap-use-after-free on address 0x60f0002b2738
                      at pc 0x7f89b1a213b5 bp 0x7ffce9528810 sp 0x7ffce9528800
                      READ of size 8 at 0x60f0002b2738 thread T0
        #0 0x7f89b1a213b4 in samldb_rename_search_base_callback
            ../../source4/dsdb/samdb/ldb_modules/samldb.c:4203
        #1 0x7f89d3a0db4a in ldb_module_send_entry
            ../../lib/ldb/common/ldb_modules.c:793
        #2 0x7f89b6f27356 in es_callback
            ../../source4/dsdb/samdb/ldb_modules/encrypted_secrets.c:1418
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13942
    
    Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit b0cc6d217485c317b2138347216fac5d74684328)

commit 936a71bfe0e40f705e7d110a14528db9f6e10667
Author: Günther Deschner <gd at samba.org>
Date:   Mon Jun 3 16:28:36 2019 +0200

    s3/vfs_glusterfs_fuse: Avoid using NAME_MAX directly
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13872
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Günther Deschner <gd at samba.org>
    Autobuild-Date(master): Tue Jun 11 00:29:19 UTC 2019 on sn-devel-184

commit 3136b31e957fb9d790dbb987afefd0844f05d724
Author: Günther Deschner <gd at samba.org>
Date:   Mon Jun 3 16:25:46 2019 +0200

    s3/vfs_glusterfs: Avoid using NAME_MAX directly
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13872
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit dba38ed369b197e57f90c3e197316d1e727e6e36
Author: Günther Deschner <gd at samba.org>
Date:   Mon Jun 3 14:27:44 2019 +0200

    Revert "s3/vfs_glusterfs_fuse: Dynamically determine NAME_MAX"
    
    This reverts commit e28d172b00cadf492c22bd892e2dda3bf2fe2d70.
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 3b1ccbfc0ce607de3848fff4202775a657440d28
Author: Günther Deschner <gd at samba.org>
Date:   Mon Jun 3 14:27:18 2019 +0200

    Revert "s3/vfs_glusterfs: Dynamically determine NAME_MAX"
    
    This reverts commit 8e3a042eb9e502821b147f1bbb2d98d59f17a095.
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 2a7e6eb8b1dd2469b7e2b3897017af0a2edd1e8a
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 8 14:49:55 2019 +0000

    dsdb/repl: we need to replicate the whole schema before we can apply it
    
    Otherwise we may not be able to construct a working schema that's
    required to apply the changes.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12204
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13713
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    (cherry picked from commit 661dc4574110b0f13c127c8aa6ed0c385292b77c)

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

Summary of changes:
 ctdb/config/nfs-linux-kernel-callout        |   4 +-
 docs-xml/smbdotconf/security/lanmanauth.xml |  14 +-
 docs-xml/smbdotconf/security/ntlmauth.xml   |   9 +-
 lib/ldb/include/ldb_module.h                |   5 +
 python/samba/tests/ldap_referrals.py        |  91 ++++++
 selftest/target/Samba3.pm                   |   1 +
 source3/auth/auth_util.c                    |  26 ++
 source3/auth/proto.h                        |   1 +
 source3/modules/vfs_fruit.c                 | 485 +++++++++++++---------------
 source3/modules/vfs_glusterfs.c             |  41 +--
 source3/modules/vfs_glusterfs_fuse.c        |  34 +-
 source3/rpc_server/mdssvc/sparql_lexer.l    |  12 +-
 source3/script/tests/test_guest_auth.sh     | 103 ++++++
 source3/selftest/tests.py                   |   5 +
 source3/smbd/server.c                       |   6 +
 source4/dsdb/repl/drepl_out_helpers.c       | 174 +++++++++-
 source4/dsdb/samdb/ldb_modules/audit_log.c  |   4 +-
 source4/dsdb/samdb/ldb_modules/partition.c  |  16 +-
 source4/dsdb/samdb/ldb_modules/samldb.c     |   1 -
 source4/ldap_server/ldap_backend.c          |  18 ++
 source4/ldap_server/ldap_server.c           |   1 +
 source4/ldap_server/ldap_server.h           |   6 +
 source4/selftest/tests.py                   |   9 +
 23 files changed, 725 insertions(+), 341 deletions(-)
 create mode 100644 python/samba/tests/ldap_referrals.py
 create mode 100755 source3/script/tests/test_guest_auth.sh


Changeset truncated at 500 lines:

diff --git a/ctdb/config/nfs-linux-kernel-callout b/ctdb/config/nfs-linux-kernel-callout
index 3d1dc63c590..12ed17c6d9e 100755
--- a/ctdb/config/nfs-linux-kernel-callout
+++ b/ctdb/config/nfs-linux-kernel-callout
@@ -281,8 +281,8 @@ nfs_startup ()
     basic_stop "nfs" || true
     basic_start "nfs"
     _f="${PROCFS_PATH}/sys/net/ipv4/tcp_tw_recycle"
-    if [ "$_f" ] ; then
-	echo 1 >"$_f"
+    if [ -f "$_f" ] ; then
+	    echo 1 >"$_f"
     fi
 }
 
diff --git a/docs-xml/smbdotconf/security/lanmanauth.xml b/docs-xml/smbdotconf/security/lanmanauth.xml
index a9e4f88b89f..97f2fb04dcb 100644
--- a/docs-xml/smbdotconf/security/lanmanauth.xml
+++ b/docs-xml/smbdotconf/security/lanmanauth.xml
@@ -24,16 +24,18 @@
     auth is re-enabled later on.
     </para>
 		
-    <para>Unlike the <command moreinfo="none">encrypt
-    passwords</command> option, this parameter cannot alter client
+    <para>Unlike the <parameter moreinfo="none">encrypt
+    passwords</parameter> option, this parameter cannot alter client
     behaviour, and the LANMAN response will still be sent over the
     network.  See the <command moreinfo="none">client lanman
     auth</command> to disable this for Samba's clients (such as smbclient)</para>
 
-    <para>If this option, and <command moreinfo="none">ntlm
-    auth</command> are both disabled, then only NTLMv2 logins will be
-    permited.  Not all clients support NTLMv2, and most will require
-    special configuration to use it.</para>
+    <para>This parameter is overriden by <parameter moreinfo="none">ntlm
+    auth</parameter>, so unless that it is also set to
+    <constant>ntlmv1-permitted</constant> or <constant>yes</constant>,
+    then only NTLMv2 logins will be permited and no LM hash will be
+    stored.  All modern clients support NTLMv2, and but some older
+    clients require special configuration to use it.</para>
 </description>
 
 <value type="default">no</value>
diff --git a/docs-xml/smbdotconf/security/ntlmauth.xml b/docs-xml/smbdotconf/security/ntlmauth.xml
index dceae44d81b..dd5dbaea117 100644
--- a/docs-xml/smbdotconf/security/ntlmauth.xml
+++ b/docs-xml/smbdotconf/security/ntlmauth.xml
@@ -19,11 +19,9 @@
     control NTLM authentiation for domain users, this must option must
     be configured on each DC.</para>
 
-    <para>By default with <command moreinfo="none">lanman
-    auth</command> set to <constant>no</constant> and
-    <command moreinfo="none">ntlm auth</command> set to
+    <para>By default with <command moreinfo="none">ntlm auth</command> set to
     <constant>ntlmv2-only</constant> only NTLMv2 logins will be
-    permited.  Most clients support NTLMv2 by default, but some older
+    permited.  All modern clients support NTLMv2 by default, but some older
     clients will require special configuration to use it.</para>
 
     <para>The primary user of NTLMv1 is MSCHAPv2 for VPNs and 802.1x.</para>
@@ -35,6 +33,9 @@
           <para><constant>ntlmv1-permitted</constant>
 	  (alias <constant>yes</constant>) - Allow NTLMv1 and above for all clients.</para>
 
+	  <para>This is the required setting for to enable the <parameter
+	  moreinfo="none">lanman auth</parameter> parameter.</para>
+
         </listitem>
 
         <listitem>
diff --git a/lib/ldb/include/ldb_module.h b/lib/ldb/include/ldb_module.h
index 6ba2a49300a..c73fc37f3aa 100644
--- a/lib/ldb/include/ldb_module.h
+++ b/lib/ldb/include/ldb_module.h
@@ -103,6 +103,11 @@ struct ldb_module;
  * attributes, not to be printed in trace messages */
 #define LDB_SECRET_ATTRIBUTE_LIST_OPAQUE "LDB_SECRET_ATTRIBUTE_LIST"
 
+/*
+ * The scheme to be used for referral entries, i.e. ldap or ldaps
+ */
+#define LDAP_REFERRAL_SCHEME_OPAQUE "LDAP_REFERRAL_SCHEME"
+
 /*
    these function pointers define the operations that a ldb module can intercept
 */
diff --git a/python/samba/tests/ldap_referrals.py b/python/samba/tests/ldap_referrals.py
new file mode 100644
index 00000000000..86a39d4e602
--- /dev/null
+++ b/python/samba/tests/ldap_referrals.py
@@ -0,0 +1,91 @@
+# Test that ldap referral entiries are created and formatted correctly
+#
+# Copyright (C) Andrew Bartlett 2019
+#
+# Based on Unit tests for the notification control
+# Copyright (C) Stefan Metzmacher 2016
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+from __future__ import print_function
+import optparse
+import os
+import sys
+
+import samba
+from samba.auth import system_session
+import samba.getopt as options
+from samba import ldb
+from samba.samdb import SamDB
+import samba.tests
+from samba.tests.subunitrun import SubunitOptions
+
+sys.path.insert(0, "bin/python")
+parser = optparse.OptionParser("ldap_referrals.py [options]")
+sambaopts = options.SambaOptions(parser)
+parser.add_option_group(sambaopts)
+parser.add_option_group(options.VersionOptions(parser))
+# use command line creds if available
+credopts = options.CredentialsOptions(parser)
+parser.add_option_group(credopts)
+subunitopts = SubunitOptions(parser)
+parser.add_option_group(subunitopts)
+opts, args = parser.parse_args()
+
+lp = sambaopts.get_loadparm()
+creds = credopts.get_credentials(lp)
+
+
+class LdapReferralTest(samba.tests.TestCase):
+
+    def setUp(self):
+        super(LdapReferralTest, self).setUp()
+
+    # The referral entries for an ldap request should have the ldap scheme
+    # i.e. then should all start with "ldap://"
+    def test_ldap_search(self):
+        server = os.environ["SERVER"]
+        url = "ldap://{0}".format(server)
+        db = SamDB(
+            url, credentials=creds, session_info=system_session(lp), lp=lp)
+        res = db.search(
+            base=db.domain_dn(),
+            expression="(objectClass=nonexistent)",
+            scope=ldb.SCOPE_SUBTREE,
+            attrs=["objectGUID", "samAccountName"])
+
+        referals = res.referals
+        for referal in referals:
+            self.assertTrue(
+                referal.startswith("ldap://"),
+                "{0} does not start with ldap://".format(referal))
+
+    # The referral entries for an ldaps request should have the ldaps scheme
+    # i.e. then should all start with "ldaps://"
+    def test_ldaps_search(self):
+        server = os.environ["SERVER"]
+        url = "ldaps://{0}".format(server)
+        db = SamDB(
+            url, credentials=creds, session_info=system_session(lp), lp=lp)
+        res = db.search(
+            base=db.domain_dn(),
+            expression="(objectClass=nonexistent)",
+            scope=ldb.SCOPE_SUBTREE,
+            attrs=["objectGUID", "samAccountName"])
+
+        referals = res.referals
+        for referal in referals:
+            self.assertTrue(
+                referal.startswith("ldaps://"),
+                "{0} does not start with ldaps://".format(referal))
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 75e4585ce67..14252344175 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -597,6 +597,7 @@ sub setup_ad_member_idmap_rid
 	idmap config * : range = 1000000-1999999
 	idmap config $dcvars->{DOMAIN} : backend = rid
 	idmap config $dcvars->{DOMAIN} : range = 2000000-2999999
+        map to guest = bad user
 ";
 
 	my $ret = $self->provision($prefix, $dcvars->{DOMAIN},
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index 24d1e37e9cb..a08df0aabe4 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -1383,6 +1383,21 @@ static NTSTATUS make_new_session_info_guest(TALLOC_CTX *mem_ctx,
 		goto done;
 	}
 
+	/*
+	 * It's ugly, but for now it's
+	 * needed to force Builtin_Guests
+	 * here, because memberships of
+	 * Builtin_Guests might be incomplete.
+	 */
+	status = add_sid_to_array_unique(session_info->security_token,
+					 &global_sid_Builtin_Guests,
+					 &session_info->security_token->sids,
+					 &session_info->security_token->num_sids);
+	if (!NT_STATUS_IS_OK(status)) {
+		DBG_ERR("Failed to force Builtin_Guests to nt token\n");
+		goto done;
+	}
+
 	/* annoying, but the Guest really does have a session key, and it is
 	   all zeros! */
 	session_info->session_key = data_blob_talloc_zero(session_info, 16);
@@ -1756,6 +1771,17 @@ bool init_guest_session_info(TALLOC_CTX *mem_ctx)
 	return true;
 }
 
+bool reinit_guest_session_info(TALLOC_CTX *mem_ctx)
+{
+	TALLOC_FREE(guest_info);
+	TALLOC_FREE(guest_server_info);
+	TALLOC_FREE(anonymous_info);
+
+	DBG_DEBUG("Reinitialing guest info\n");
+
+	return init_guest_session_info(mem_ctx);
+}
+
 NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
 				struct auth_serversupplied_info **server_info)
 {
diff --git a/source3/auth/proto.h b/source3/auth/proto.h
index e4a6830eecb..0bec7c5daaa 100644
--- a/source3/auth/proto.h
+++ b/source3/auth/proto.h
@@ -273,6 +273,7 @@ NTSTATUS make_session_info_from_username(TALLOC_CTX *mem_ctx,
 struct auth_session_info *copy_session_info(TALLOC_CTX *mem_ctx,
 					     const struct auth_session_info *src);
 bool init_guest_session_info(TALLOC_CTX *mem_ctx);
+bool reinit_guest_session_info(TALLOC_CTX *mem_ctx);
 NTSTATUS init_system_session_info(TALLOC_CTX *mem_ctx);
 bool session_info_set_session_key(struct auth_session_info *info,
 				 DATA_BLOB session_key);
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 25f8f140c44..c85f3dd07a4 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -29,7 +29,6 @@
 #include "messages.h"
 #include "libcli/security/security.h"
 #include "../libcli/smb/smb2_create_ctx.h"
-#include "lib/util/sys_rw.h"
 #include "lib/util/tevent_ntstatus.h"
 #include "lib/util/tevent_unix.h"
 #include "offload_token.h"
@@ -411,8 +410,7 @@ struct ad_entry {
 };
 
 struct adouble {
-	vfs_handle_struct        *ad_handle;
-	int                       ad_fd;
+	files_struct             *ad_fsp;
 	bool                      ad_opened;
 	adouble_type_t            ad_type;
 	uint32_t                  ad_magic;
@@ -450,18 +448,6 @@ struct ad_entry_order entry_order_dot_und[ADEID_NUM_DOT_UND + 1] = {
 	{0, 0, 0}
 };
 
-/*
- * Fake AppleDouble entry oder for resource fork xattr.  The xattr
- * isn't an AppleDouble file, it simply contains the resource data,
- * but in order to be able to use some API calls like ad_getentryoff()
- * we build a fake/helper struct adouble with this entry order struct.
- */
-static const
-struct ad_entry_order entry_order_rsrc_xattr[ADEID_NUM_RSRC_XATTR + 1] = {
-	{ADEID_RFORK, 0, 0},
-	{0, 0, 0}
-};
-
 /* Conversion from enumerated id to on-disk AppleDouble id */
 #define AD_EID_DISK(a) (set_eid[a])
 static const uint32_t set_eid[] = {
@@ -533,14 +519,18 @@ struct fio {
 /*
  * Forward declarations
  */
-static struct adouble *ad_init(TALLOC_CTX *ctx, vfs_handle_struct *handle,
+static struct adouble *ad_init(TALLOC_CTX *ctx,
 			       adouble_type_t type);
 static struct adouble *ad_get(TALLOC_CTX *ctx,
 			      vfs_handle_struct *handle,
 			      const struct smb_filename *smb_fname,
 			      adouble_type_t type);
-static int ad_set(struct adouble *ad, const struct smb_filename *smb_fname);
-static int ad_fset(struct adouble *ad, files_struct *fsp);
+static int ad_set(vfs_handle_struct *handle,
+		  struct adouble *ad,
+		  const struct smb_filename *smb_fname);
+static int ad_fset(struct vfs_handle_struct *handle,
+		   struct adouble *ad,
+		   files_struct *fsp);
 static int adouble_path(TALLOC_CTX *ctx,
 			const struct smb_filename *smb_fname__in,
 			struct smb_filename **ppsmb_fname_out);
@@ -1001,67 +991,76 @@ static bool ad_unpack(struct adouble *ad, const size_t nentries,
 	return true;
 }
 
-static bool ad_convert_move_reso(struct adouble *ad,
+static bool ad_convert_move_reso(vfs_handle_struct *handle,
+				 struct adouble *ad,
 				 const struct smb_filename *smb_fname)
 {
-	char *map = MAP_FAILED;
-	size_t maplen;
-	ssize_t len;
-	int rc;
+	char *buf = NULL;
+	size_t rforklen;
+	size_t rforkoff;
+	ssize_t n;
+	int ret;
 	bool ok;
 
-	if (ad_getentrylen(ad, ADEID_RFORK) == 0) {
+	rforklen = ad_getentrylen(ad, ADEID_RFORK);
+	if (rforklen == 0) {
 		return true;
 	}
 
-	maplen = ad_getentryoff(ad, ADEID_RFORK) +
-		ad_getentrylen(ad, ADEID_RFORK);
-
-	/* FIXME: direct use of mmap(), vfs_aio_fork does it too */
-	map = mmap(NULL, maplen, PROT_READ|PROT_WRITE, MAP_SHARED,
-		   ad->ad_fd, 0);
-	if (map == MAP_FAILED) {
-		DBG_ERR("mmap AppleDouble: %s\n", strerror(errno));
+	buf = talloc_size(ad, rforklen);
+	if (buf == NULL) {
+		/*
+		 * This allocates a buffer for reading the resource fork data in
+		 * one big swoop. Resource forks won't be larger then, say, 64
+		 * MB, I swear, so just doing the allocation with the talloc
+		 * limit as safeguard seems safe.
+		 */
+		DBG_ERR("Failed to allocate %zu bytes for rfork\n",
+			rforklen);
 		return false;
 	}
 
+	rforkoff = ad_getentryoff(ad, ADEID_RFORK);
+
+	n = SMB_VFS_PREAD(ad->ad_fsp, buf, rforklen, rforkoff);
+	if (n != rforklen) {
+		DBG_ERR("Reading %zu bytes from rfork [%s] failed: %s\n",
+			rforklen, fsp_str_dbg(ad->ad_fsp), strerror(errno));
+		return false;
+	}
 
-	memmove(map + ADEDOFF_RFORK_DOT_UND,
-		map + ad_getentryoff(ad, ADEID_RFORK),
-		ad_getentrylen(ad, ADEID_RFORK));
+	rforkoff = ADEDOFF_RFORK_DOT_UND;
 
-	rc = munmap(map, maplen);
-	if (rc != 0) {
-		DBG_ERR("munmap failed: %s\n", strerror(errno));
+	n = SMB_VFS_PWRITE(ad->ad_fsp, buf, rforklen, rforkoff);
+	if (n != rforklen) {
+		DBG_ERR("Writing %zu bytes to rfork [%s] failed: %s\n",
+			rforklen, fsp_str_dbg(ad->ad_fsp), strerror(errno));
 		return false;
 	}
 
 	ad_setentryoff(ad, ADEID_RFORK, ADEDOFF_RFORK_DOT_UND);
-
 	ok = ad_pack(ad);
 	if (!ok) {
 		DBG_WARNING("ad_pack [%s] failed\n", smb_fname->base_name);
 		return false;
 	}
 
-	len = sys_pwrite(ad->ad_fd, ad->ad_data, AD_DATASZ_DOT_UND, 0);
-	if (len != AD_DATASZ_DOT_UND) {
-		DBG_ERR("%s: bad size: %zd\n", smb_fname->base_name, len);
+	ret = ad_fset(handle, ad, ad->ad_fsp);
+	if (ret != 0) {
+		DBG_ERR("ad_fset on [%s] failed\n", fsp_str_dbg(ad->ad_fsp));
 		return false;
 	}
 
 	return true;
 }
 
-static bool ad_convert_xattr(struct adouble *ad,
+static bool ad_convert_xattr(vfs_handle_struct *handle,
+			     struct adouble *ad,
 			     const struct smb_filename *smb_fname,
 			     bool *converted_xattr)
 {
 	static struct char_mappings **string_replace_cmaps = NULL;
-	char *map = MAP_FAILED;
-	size_t maplen;
 	uint16_t i;
-	ssize_t len;
 	int saved_errno = 0;
 	NTSTATUS status;
 	int rc;
@@ -1085,17 +1084,6 @@ static bool ad_convert_xattr(struct adouble *ad,
 		TALLOC_FREE(mappings);
 	}
 
-	maplen = ad_getentryoff(ad, ADEID_RFORK) +
-		ad_getentrylen(ad, ADEID_RFORK);
-
-	/* FIXME: direct use of mmap(), vfs_aio_fork does it too */
-	map = mmap(NULL, maplen, PROT_READ|PROT_WRITE, MAP_SHARED,
-		   ad->ad_fd, 0);
-	if (map == MAP_FAILED) {
-		DBG_ERR("mmap AppleDouble: %s\n", strerror(errno));
-		return false;
-	}
-
 	for (i = 0; i < ad->adx_header.adx_num_attrs; i++) {
 		struct ad_xattr_entry *e = &ad->adx_entries[i];
 		char *mapped_name = NULL;
@@ -1104,7 +1092,7 @@ static bool ad_convert_xattr(struct adouble *ad,
 		files_struct *fsp = NULL;
 		ssize_t nwritten;
 
-		status = string_replace_allocate(ad->ad_handle->conn,
+		status = string_replace_allocate(handle->conn,
 						 e->adx_name,
 						 string_replace_cmaps,
 						 talloc_tos(),
@@ -1141,7 +1129,7 @@ static bool ad_convert_xattr(struct adouble *ad,
 		DBG_DEBUG("stream_name: %s\n", smb_fname_str_dbg(stream_name));
 
 		status = SMB_VFS_CREATE_FILE(
-			ad->ad_handle->conn,		/* conn */
+			handle->conn,			/* conn */
 			NULL,				/* req */
 			0,				/* root_dir_fid */
 			stream_name,			/* fname */
@@ -1167,7 +1155,7 @@ static bool ad_convert_xattr(struct adouble *ad,
 		}
 
 		nwritten = SMB_VFS_PWRITE(fsp,
-					  map + e->adx_offset,
+					  ad->ad_data + e->adx_offset,
 					  e->adx_length,
 					  0);
 		if (nwritten == -1) {
@@ -1195,14 +1183,15 @@ static bool ad_convert_xattr(struct adouble *ad,
 		goto fail;
 	}
 
-	len = sys_pwrite(ad->ad_fd, ad->ad_data, AD_DATASZ_DOT_UND, 0);
-	if (len != AD_DATASZ_DOT_UND) {
-		DBG_ERR("%s: bad size: %zd\n", smb_fname->base_name, len);
+	rc = ad_fset(handle, ad, ad->ad_fsp);
+	if (rc != 0) {
+		DBG_ERR("ad_fset on [%s] failed: %s\n",
+			fsp_str_dbg(ad->ad_fsp), strerror(errno));
 		ok = false;
 		goto fail;
 	}
 
-	ok = ad_convert_move_reso(ad, smb_fname);
+	ok = ad_convert_move_reso(handle, ad, smb_fname);
 	if (!ok) {
 		goto fail;
 	}
@@ -1211,16 +1200,11 @@ static bool ad_convert_xattr(struct adouble *ad,
 	ok = true;
 
 fail:
-	rc = munmap(map, maplen);
-	if (rc != 0) {
-		DBG_ERR("munmap failed: %s\n", strerror(errno));
-		return false;
-	}
-
 	return ok;
 }
 
-static bool ad_convert_finderinfo(struct adouble *ad,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list