[SCM] Samba Shared Repository - branch v3-6-stable updated

Karolin Seeger kseeger at samba.org
Mon Dec 10 00:52:04 MST 2012


The branch, v3-6-stable has been updated
       via  89cb247 WHATSNEW: Prepare release notes for Samba 3.6.10.
       via  801a704 Fix bug #9460 - Samba 3.6.x and Master respond incorrectly to FILE_STREAM_INFO requests.
       via  5f9cf80 s3-net: Fix DEBUG() location.
       via  9de2d87 s3-net: give more control how to update/register DNS entries.
       via  88d57bc s3-net: pass down a flags field to DoDNSUpdate().
       via  22bff5f s3-net: move out some prototypes to net_dns.h.
       via  2143dd8 s3-net: pass down struct net_context to the dns update calls.
       via  ac36194 Final part of #9374 - Allow smb2.acls torture test to pass against smbd with a POSIX ACLs backend.
       via  3da9c3d More for #9374 - Allow smb2.acls torture test to pass against smbd with a POSIX ACLs backend.
       via  3c94475 Ensure when calculating the access mask for MAXIMUM_ALLOWED_ACCESS that we add in FILE_READ_ATTRIBUTES, even if this doesn't come from the file/directory ACL.
       via  7f68710 Add comment explaining exactly *why* we don't check FILE_READ_ATTRIBUTES when evaluating file/directory ACE's.
       via  43c2b1a First part of #9374 - Allow smb2.acls torture test to pass against smbd with a POSIX ACLs backend.
       via  2beafab Use work around for 'winbind use default domain' only if it is set
       via  e00a8b1 s3-winbind: use new reconnect logic in rpc_lookup_sids() also.
       via  48b9e78 s3-winbindd: rework reconnect logic in winbindd_lookup_names().
       via  a5aa6b6 s3-winbindd: rework reconnect logic in winbindd_lookup_sids().
       via  38a7d54 s3-winbindd: remove lookup_sids_fn_t.
       via  c18689c s3-winbindd: remove lookup_names_fn_t.
       via  17a3e0f s3-rpc_client: make dcerpc_lsa_lookup_names_generic() public.
       via  078904b s3-rpc_cli: make dcerpc_lsa_lookup_sids_generic() public.
       via  8824ce1 s3-winbindd: add cm_connect_lsat().
       via  c3f7d01 s3-rpc_cli: Remove some unused wrapping code.
       via  7a354f8 s3: Make winbindd_lookup_names static
       via  5c6b050 spoolss: fix segfault when "default devmode" is disabled
       via  184ae80 BUG 9436: Fix leaking sockets of SMB connections to a DC.
       via  b61a99c Fix MD5 detection in the autoconf build
       via  4c2863c Fix Bug 9422 - large read requests cause server to issue malformed reply (cherry picked from commit ecc9f5bdb8c56853a37ff6e980fed815fc5ee0a9)
       via  f49eecb s3-rpc_client: lookup nametype 0x20 in rpc_pipe_open_tcp_port(). (bug #9426)
       via  b5d5966 lib/addns: don't depend on the order in resp->answers[]
       via  fff6962 lib/addns: remove pointless check for resp->num_additionals != 1
       via  abd85a2 lib/replace: replace all *printf function if we replace snprintf (bug #9390)
       via  b526723 libreplace: Fix symbol names for snprintf/asprintf/vasprintf.
       via  692b817 Another fix needed for bug #9236 - ACL masks incorrectly applied when setting ACLs.
       via  92280d2 s3-kerberos: also try with AES keys, when decrypting tickets.
       via  f8034f4 s3-libsmb: make sure we copy at most 16 bytes in cli_set_session_key().
       via  54cfef6 samba: check for AES encryption type defines.
       via  0926ca6 s3:winbind: BUG 9386: Failover if netlogon pipe is not available.
       via  a625f1b lib/krb5_wrap: request enc_types in the correct order (bug #9272)
       via  8c10d64 s3-kerberos: add aes enctypes to generated krb5.conf.
       via  b7138c3 s3-krb5: use and request AES keys in kerberos operations.
       via  4384833 s3-aio_pthread: Optimize aio_pthread_handle_completion
       via  8679684 lib/tsocket: optimize syscalls in tstream_readv_pdu_send()
       via  70a6cc8 lib/tsocket: disable the syscall optimization for recvfrom/readv by default
       via  81130a5 docs-xml: fix use of <smbconfoption> tag (fix bug #9345)
       via  fa81342 s4:torture/smb2: improve the smb2.create.blob test
       via  841e157 BUG 9326: Fix net ads join message for the dns domain.
       via  b68dca6 pam_winbind: fix segfault in pam_sm_authenticate()
      from  c59fdd9 WHATSNEW: Start release notes for Samba 3.6.10.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-stable


- Log -----------------------------------------------------------------
commit 89cb2474a635ba3fc68eb2816f9fca62b329dd1f
Author: Karolin Seeger <kseeger at samba.org>
Date:   Thu Dec 6 10:26:19 2012 +0100

    WHATSNEW: Prepare release notes for Samba 3.6.10.
    
    Karolin
    (cherry picked from commit 29b36a1fb4e494be0851ebbea17a22839a344bf3)

commit 801a7047d570b5edf04efdc07f84fc251c0cd860
Author: Richard Sharpe <realrichardsharpe at gmail.com>
Date:   Tue Dec 4 17:21:29 2012 -0800

    Fix bug #9460 - Samba 3.6.x and Master respond incorrectly to FILE_STREAM_INFO requests.
    
    Ensure we check the buffer size correctly.
    
    Reviewed by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Dec  6 01:31:08 CET 2012 on sn-devel-104
    (cherry picked from commit 943797c232f96a5dd411a803ad90b6980b2785b0)
    (cherry picked from commit 0eba72e42174b01792a5434f4b163d6241a64b35)

commit 5f9cf80f02f537e1271773bcf5e8c463dd4cc1b0
Author: Günther Deschner <gd at samba.org>
Date:   Mon Oct 1 16:19:28 2012 +0200

    s3-net: Fix DEBUG() location.
    
    Guenther
    
    Autobuild-User(master): Günther Deschner <gd at samba.org>
    Autobuild-Date(master): Tue Oct  2 18:06:17 CEST 2012 on sn-devel-104
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    
    The last 5 patches address bug #9451 - Allow to force DNS updates using net.
    (cherry picked from commit ceb2c81481ea8a37bb281a4d4df604573b371a2d)

commit 9de2d870c3072c5ac76adccade34ea1a72c676ff
Author: Günther Deschner <gd at samba.org>
Date:   Tue Sep 25 11:09:45 2012 +0200

    s3-net: give more control how to update/register DNS entries.
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit ac0f0e7bc9126ee897d6eaac753c66853514326a)

commit 88d57bce37409b3e9c4c41d3fdecf7e2b58dc610
Author: Günther Deschner <gd at samba.org>
Date:   Tue Sep 25 11:08:48 2012 +0200

    s3-net: pass down a flags field to DoDNSUpdate().
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit 0d41b631faf95714eafec4836f7424edb4dda4af)

commit 22bff5f5393f95f4123db85543430f05bfd4e5ca
Author: Günther Deschner <gd at samba.org>
Date:   Wed Sep 19 15:35:15 2012 +0200

    s3-net: move out some prototypes to net_dns.h.
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit a294a6d2fdbbd9fe54882a365cb54c1f49b900bc)

commit 2143dd85f2ee30bb5250e5d8827d1e0cafbeba93
Author: Günther Deschner <gd at samba.org>
Date:   Wed Sep 19 15:31:57 2012 +0200

    s3-net: pass down struct net_context to the dns update calls.
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit 2443f18b0c90956ae7840ac13487b9595b4cff4b)

commit ac36194c2c3d5ca3f4f8b5f0dbaee8d7b3035476
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Nov 12 16:30:32 2012 -0800

    Final part of #9374 - Allow smb2.acls torture test to pass against smbd with a POSIX ACLs backend.
    
    We need to do the same check for overriding ACCESS_DENIED on DELETE_ACCESS
    as we do in smbd/open.c, as the ACL check is duplicated here. This has
    been fixed in 4.0.0 and later code.
    (cherry picked from commit 005d7c28e35f58d5f8b114fb6234e663a6c30824)

commit 3da9c3d89986ab7c531560e56e9b2c29c26f7a72
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Nov 12 16:26:25 2012 -0800

    More for #9374 - Allow smb2.acls torture test to pass against smbd with a POSIX ACLs backend.
    
    Change can_delete_directory() to can_delete_directory_fsp(), as
    we only ever call this from an open directory file handle.
    
    This allows us to use OpenDir_fsp() instead of OpenDir().
    OpenDir() re-checks the ACL on the directory, which may
    refuse DIR_LIST permissions. OpenDir_fsp() does not. As
    this is a file-server internal check to see if the directory
    actually contains any files before setting delete on close,
    we can ignore the ACL here (Windows does).
    (cherry picked from commit cc17ce366a459bf1cb2207a45e5528ea0167b323)

commit 3c94475a06472c71ec364d4c3e098c9740f702bd
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Nov 12 16:22:52 2012 -0800

    Ensure when calculating the access mask for MAXIMUM_ALLOWED_ACCESS that we add in FILE_READ_ATTRIBUTES, even if this doesn't come from the file/directory ACL.
    
    If we can access the path to this file, by
    default we have FILE_READ_ATTRIBUTES from the
    containing directory. See the section.
    "Algorithm to Check Access to an Existing File"
    in MS-FSA.pdf.
    (cherry picked from commit 32892d6357469287bf9594b269bde5b9ffabd54e)

commit 7f687101ce9d79c07d7616b188c9088b8bc06d26
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Nov 12 16:21:15 2012 -0800

    Add comment explaining exactly *why* we don't check FILE_READ_ATTRIBUTES when evaluating file/directory ACE's.
    
    If we can access the path to this file, by
    default we have FILE_READ_ATTRIBUTES from the
    containing directory. See the section.
    "Algorithm to Check Access to an Existing File"
    in MS-FSA.pdf.
    (cherry picked from commit a115a4e9799e8e5497232a149d4d927308c81a5b)

commit 43c2b1ac0599963a3d794185c9cc372c3bc4a3a1
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Nov 12 16:17:19 2012 -0800

    First part of #9374 - Allow smb2.acls torture test to pass against smbd with a POSIX ACLs backend.
    
    Use the requested access mask before making the fd_open request in
    open_directory() rather than faking up an access mask of
    FILE_READ_DATA | FILE_READ_ATTRIBUTES.
    
    The underlying ACL may not permit FILE_READ_DATA.
    (cherry picked from commit 1c7d00e8ef48c2cd57d79a00cb26bc56a2979241)

commit 2beafaba3a5c13c77f5711dbe52d6171f0776f3f
Author: Sumit Bose <sbose at redhat.com>
Date:   Mon Oct 29 12:09:22 2012 +0100

    Use work around for 'winbind use default domain' only if it is set
    
    Currently in smb_getpwnam() the NetBIOS domain name and the winbind separator
    character is always added to the user name returned by Get_Pwnam_alloc() if it
    does not contain the winbind separator character. As comments in the code
    indicates this is done as a work around if 'winbind use default domain' is set
    to yes in the samba configuration.
    
    This make sense if the option is set because otherwise the domain information is
    lost from the user name. But it causes errors if other services than winbind are
    used for user lookup, e.g. sssd. sssd can handle different kind of fully
    qualified user names as input, e.g. user at domain.name or DOM\user, but returns a
    canonical name, by default user at domain.name.
    
    While it would be possible to get around this issue with a special configuration
    either on the sssd or samba side I think the cleaner solution is to use the work
    around only if 'winbind use default domain' is set to yes which is what this
    patch does.
    
    Fix bug #9367 - Use work around for 'winbind use default domain' only if it is
    set.
    (cherry picked from commit 6c0b864654001046b8bbb585112e60a7e146cb2a)
    (cherry picked from commit de2c0f0d3d1217814fce840a5050741de3938e0f)

commit e00a8b166d79efa8efff69ff54fc25dd5a1bb306
Author: Günther Deschner <gd at samba.org>
Date:   Thu Nov 29 14:31:19 2012 +0100

    s3-winbind: use new reconnect logic in rpc_lookup_sids() also.
    
    Volker, please check.
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    
    The last 10 patches address bug #9439 - ncacn_ip_tcp reconnection code for lsa
    lookups still broken.
    (cherry picked from commit 4ab547a8ddcb45e479079361a601e08476954110)

commit 48b9e782848e154dca13c9ec851ad52d5c131caf
Author: Günther Deschner <gd at samba.org>
Date:   Thu Nov 29 12:03:53 2012 +0100

    s3-winbindd: rework reconnect logic in winbindd_lookup_names().
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit c64473ab88ca36462e7976bf0006bc092386894c)

commit a5aa6b61991f04a0582d82b6f434aee7ec4af1a6
Author: Günther Deschner <gd at samba.org>
Date:   Thu Nov 29 12:03:16 2012 +0100

    s3-winbindd: rework reconnect logic in winbindd_lookup_sids().
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit 7cdebbe5122c7174bc7e74297bf1e891cb14fe78)

commit 38a7d542814386a4d676670acb590f28f49155fa
Author: Günther Deschner <gd at samba.org>
Date:   Wed Nov 28 20:41:21 2012 +0100

    s3-winbindd: remove lookup_sids_fn_t.
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit 1c1340846926f97bda823f4fac1fea86b4b6f0d1)

commit c18689cee2e1fca61a6f25f9f83e5572d8f11910
Author: Günther Deschner <gd at samba.org>
Date:   Wed Nov 28 17:03:40 2012 +0100

    s3-winbindd: remove lookup_names_fn_t.
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit ea687479739d6d6e371e641cf0aa432e355a2fce)

commit 17a3e0f19a0a34d90aef96131af33040cd19382f
Author: Günther Deschner <gd at samba.org>
Date:   Wed Nov 28 17:00:49 2012 +0100

    s3-rpc_client: make dcerpc_lsa_lookup_names_generic() public.
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit 4a86c29fa5140a5a3ad68967abef5eeffaf448c1)

commit 078904b8a059fed1f1f2bbb8b03f5352272743d8
Author: Günther Deschner <gd at samba.org>
Date:   Wed Nov 28 16:57:57 2012 +0100

    s3-rpc_cli: make dcerpc_lsa_lookup_sids_generic() public.
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit bb5e0a95f62354129ef3569a23298091d58a02e3)

commit 8824ce146bd40eec526e7610fdf669a058022816
Author: Günther Deschner <gd at samba.org>
Date:   Wed Nov 28 16:57:24 2012 +0100

    s3-winbindd: add cm_connect_lsat().
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit 5ccb4e5a90aa1b681380899d56971dfc7ceb1b34)

commit c3f7d01044ded454031c38d96443997f529854f4
Author: Günther Deschner <gd at samba.org>
Date:   Wed Nov 28 14:53:27 2012 +0100

    s3-rpc_cli: Remove some unused wrapping code.
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit 83ac2771622d90e50ef27778a8227872571b9af3)

commit 7a354f85511055eba14094ad416e58f44477b9a0
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Sep 6 18:33:35 2011 +0200

    s3: Make winbindd_lookup_names static
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Tue Sep  6 20:03:56 CEST 2011 on sn-devel-104
    (cherry picked from commit fd65e5eb8cdd38917a574734c9079cd75e4e1be0)
    (cherry picked from commit bbaa7142d168949019d989c2d853717faad30cb0)

commit 5c6b0500fa8b6273dd735ea8d8a1d8df715cdc89
Author: David Disseldorp <ddiss at samba.org>
Date:   Tue Nov 27 16:10:28 2012 +0100

    spoolss: fix segfault when "default devmode" is disabled
    
    Currently when "default devmode" is explicitly disabled, and a printer
    is added with a null device mode, spoolssd crashes in copy_devicemode().
    
    Both construct_printer_info2() and construct_printer_info8() code paths
    currently unconditionally attempt to copy a printers device mode,
    without checking whether one is present.
    
    This change fixes this regression such that construct_printer_info*()
    functions check for a null device mode before copying.
    
    https://bugzilla.samba.org/show_bug.cgi?id=9433
    
    Reviewed-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit d7fdb05464a67ced7afb8dfdf0aa6be77cb84fd6)

commit 184ae8079ce7f8ecf3b472f180309e3108897aad
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Nov 28 12:53:39 2012 +0100

    BUG 9436: Fix leaking sockets of SMB connections to a DC.
    
    As this is a burst of 3 unbound sockets with each try to reach a DC
    we're running out of file descriptors pretty fast. So winbind is then
    mostly spinning in an accept loop failing with EMFILE.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jim McDonough <jmcd at samba.org>
    
    Autobuild-User(master): Jim McDonough <jmcd at samba.org>
    Autobuild-Date(master): Wed Nov 28 17:17:21 CET 2012 on sn-devel-104
    (cherry picked from commit 1106ca59eea9fe5d95a1098c84f77c9e6108659f)

commit b61a99c87f6e0e24ee36815976bb733b95ac4a3a
Author: Matthieu Patou <mat at matws.net>
Date:   Thu Nov 22 16:14:42 2012 -0800

    Fix MD5 detection in the autoconf build
    
    This is synthesis of patches made for bugs
    * 9037
    * 9086
    * 9094
    * 9418
    
    It checks if there is a library for md5 related functions (libmd or
    libmd5) and if so it checks for the presence of md5.h headers.
    
    Signed-off-by: Matthieu Patou <mat at matws.net>
    (cherry picked from commit 40c6cfeb6ff39e73d824f17cb2ddc26eedb2b022)

commit 4c2863c7979e4395b8c77b6d3d1e823283af4d00
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Nov 22 21:46:53 2012 +0100

    Fix Bug 9422 - large read requests cause server to issue malformed reply
    (cherry picked from commit ecc9f5bdb8c56853a37ff6e980fed815fc5ee0a9)

commit f49eecbf899498d78a402920ed4a262455cac25b
Author: Günther Deschner <gd at samba.org>
Date:   Fri Nov 23 13:19:53 2012 +0100

    s3-rpc_client: lookup nametype 0x20 in rpc_pipe_open_tcp_port(). (bug #9426)
    
    The server name type (0x20) is much more likely to be available in the name cache, as
    this type gets stored by winbind itself - the primary user of the ncacn_ip_tcp
    code currently.
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Fri Nov 23 16:30:57 CET 2012 on sn-devel-104
    (cherry picked from commit 2032f2746d70bbebd1af26a7a046eb1cc61ac175)
    (cherry picked from commit ac0623cab847a4df9c5cd35442e9be8924d9e261)
    (cherry picked from commit 0a52a89f8ed23d2f55cb4d6a0fbb94571e70a8ee)

commit b5d59660d16954d9169323235d210c2891d674dd
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Nov 9 08:59:36 2012 +0100

    lib/addns: don't depend on the order in resp->answers[]
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit eecc1d294256210ee8c2f6ab79d21b835258a6d4)
    
    The last 2 patches address bug #9402 - lib/addns doesn't work samba4 with a
    bind9 server.
    (cherry picked from commit abb142b4db54ecf17e3b05c374e9d51c6ddc4e04)

commit fff6962f70e195c55db344d5a20be417213160c3
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Nov 9 08:55:40 2012 +0100

    lib/addns: remove pointless check for resp->num_additionals != 1
    
    We never use resp->additionals, so there's no reason to check.
    
    This fixes dns updates against BIND9 (used in a Samba4 domain).
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit b59c5db5f74f56c0536635a41ae51c389109ceb5)
    (cherry picked from commit 0a836951838a1aa70b1f6ade4ad09d4e6cee3c24)

commit abd85a22861400977093b0eea50a12234d41f78a
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Nov 13 14:07:11 2012 +0100

    lib/replace: replace all *printf function if we replace snprintf (bug #9390)
    
    This fixes segfaults in log level = 10 on Solaris.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Signed-off-by: Björn Jacke <bj at sernet.de>
    
    Autobuild-User(master): Björn Jacke <bj at sernet.de>
    Autobuild-Date(master): Wed Nov 14 19:41:14 CET 2012 on sn-devel-104
    (cherry picked from commit a15da3625850d97b3da1b02308c870f820007c52)
    (cherry picked from commit 364a70cc4d5aea4006ceb3dde97779242afa328c)

commit b52672386b246ccc5fc3993c8e4d642ba20a01a7
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun May 13 03:21:34 2012 +0200

    libreplace: Fix symbol names for snprintf/asprintf/vasprintf.
    
    Autobuild-User: Jelmer Vernooij <jelmer at samba.org>
    Autobuild-Date: Sun May 13 05:16:28 CEST 2012 on sn-devel-104
    (cherry picked from commit cf67da70c9a63c4dc63f287059321d6c36d1e19e)
    (cherry picked from commit c0d91f8cdfd99286644b57b02d6b5517774081de)

commit 692b817ffcc3b03a87e1e66c78b38f3dc67084f3
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Nov 8 13:45:19 2012 -0800

    Another fix needed for bug #9236 - ACL masks incorrectly applied when setting ACLs.
    
    Not caught by make test as it's an extreme edge case for strange
    incoming ACLs. I only found this as I'm making raw.acls and smb2.acls
    pass against 3.6.x with acl_xattr mapped onto a POSIX backend (which
    isn't tested in make test).
    
    An incoming inheritable ACE entry containing only one permission,
    WRITE_DATA maps into a POSIX owner perm of "-w-", which violates
    the principle that the owner of a file/directory can always read.
    (cherry picked from commit e2eb914cb986e28e412863553010795bff8ac3e1)

commit 92280d202e0708c5ba394456a7d739c242a750f6
Author: Günther Deschner <gd at samba.org>
Date:   Tue Nov 13 16:23:52 2012 +0100

    s3-kerberos: also try with AES keys, when decrypting tickets.
    
    Guenther
    
    The last 3 patches address bug #9272 - net ads join does not provide AES keys
    in host keytab.
    (cherry picked from commit ffdd0a86ac9cb5fbee67d27958b65872873a009b)

commit f8034f4aae77c90cae7daad8e033430e7e50689e
Author: Günther Deschner <gd at samba.org>
Date:   Tue Nov 13 15:11:08 2012 +0100

    s3-libsmb: make sure we copy at most 16 bytes in cli_set_session_key().
    
    Guenther
    (cherry picked from commit a176370f3e245221b9b9ccaa0fae8ecac8594d1c)

commit 54cfef64d018510c5768bb4aadf9dd8307d46568
Author: Günther Deschner <gd at samba.org>
Date:   Thu Dec 15 17:50:33 2011 +0100

    samba: check for AES encryption type defines.
    
    Guenther
    
    Autobuild-User: Günther Deschner <gd at samba.org>
    Autobuild-Date: Tue Jan 10 15:05:38 CET 2012 on sn-devel-104
    (cherry picked from commit bad52390260caa31eabe7c1b2334c56088447909)

commit 0926ca631752a6519f94a71516daa8676978b5af
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Nov 9 15:33:09 2012 +0100

    s3:winbind: BUG 9386: Failover if netlogon pipe is not available.
    
    Samba continues to query a broken DC while the DC did not finish to
    rebuild Sysvol (after a Windows crash, for example). It causes end users
    to received strange codes while trying to authenticate, even if there is
    a secondary DC available.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Mon Nov 12 18:57:18 CET 2012 on sn-devel-104
    (cherry picked from commit 3b01dd5f59841b11e9906b8c23345946e0d0ea8c)
    (cherry picked from commit 8ba1bdfe5ee784c6652c329760a8226e9da4a8a8)

commit a625f1bee259664db11fa67b30d68301ad1251b6
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Oct 22 13:47:48 2012 +0200

    lib/krb5_wrap: request enc_types in the correct order (bug #9272)
    
    aes256-cts-hmac-sha1-96 and aes128-cts-hmac-sha1-96
    should have a higher priority than arcfour-hmac-md5,
    otherwise the KDC still gives us arcfour-hmac-md5 session keys.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    (similar to commit 24f3f87706329e6e280dc6be6d025e997d46c910)
    
    The last 3 patches address bug #9272 - net ads join does not provide AES keys in
    host keytab.
    (cherry picked from commit 5fbedc11e685684e037d23f75f42ec234c6d08f0)

commit 8c10d644715714d522090a254dc0a19f73e258ae
Author: Günther Deschner <gd at samba.org>
Date:   Mon Dec 19 10:52:58 2011 +0100

    s3-kerberos: add aes enctypes to generated krb5.conf.
    
    Guenther
    
    (cherry picked from commit 06f3b1f0b0dcf9355a8d634cdb62f1f0a8ea4dbe)
    (cherry picked from commit 789d801b69934e34ac293342516fa4e1cc68b4fa)

commit b7138c30e337f9f0289c598d9953bc99d9845426
Author: Günther Deschner <gd at samba.org>
Date:   Thu Dec 15 18:12:41 2011 +0100

    s3-krb5: use and request AES keys in kerberos operations.
    
    Guenther
    
    (cherry picked from commit eae33e96fcaa456830862325b91579faf2a96213)
    (cherry picked from commit 90b1e987ac0cfda112267a0e8e1d98af70df1bc8)

commit 4384833462ca8696fc013672079c977d7c305c1a
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Nov 5 15:53:31 2012 +0100

    s3-aio_pthread: Optimize aio_pthread_handle_completion
    
    Read as much as we can
    
    The last 3 patches address bug #9359 - Optimization needed for SMB2 performance
    sensitive workloads.
    (cherry picked from commit 0e607ead8e605f0ee7f2153f98b6c171e6acc437)

commit 8679684f546271c6855629f5e929e137fd531201
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Nov 2 13:56:53 2012 +0100

    lib/tsocket: optimize syscalls in tstream_readv_pdu_send()
    
    Once we've got the first part of a pdu we try to optimize
    readv calls for the rest of the pdu.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    (cherry picked from commit 7f83d75a3a666ca1bc6213433344b8017eb4932a)

commit 70a6cc80e3655952bd42cd760f2a9f1d8092fffc
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Nov 2 13:45:49 2012 +0100

    lib/tsocket: disable the syscall optimization for recvfrom/readv by default
    
    We only do the optimization on recvfrom/readv if the caller asked for it.
    
    This is needed because in most cases we preferr to flush send
    buffers before receiving incoming requests.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    (cherry picked from commit 53aa9727b8157ca1ad6c59ef9ebbb9f519b33f1e)

commit 81130a5a135920ae23dc5766862691558640aa96
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Nov 2 10:25:27 2012 +0100

    docs-xml: fix use of <smbconfoption> tag (fix bug #9345)
    
    Signed-off-by: Björn Baumbach <bb at sernet.de>
    Reviewed-by: Karolin Seeger <ks at samba.org>
    
    Autobuild-User(master): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(master): Fri Nov  2 12:37:42 CET 2012 on sn-devel-104
    (cherry picked from commit 3ecbe8c83a003825fc58f6dcb9e02a35aad2d86e)
    
    Autobuild-User(v4-0-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-0-test): Mon Nov  5 13:09:12 CET 2012 on sn-devel-104
    (cherry picked from commit 6195cb667b1c162436bfbf5d4f499bdc776f83b4)
    (cherry picked from commit a6dea8e6556bd5e391cd709b86664fb7cc34433a)

commit fa81342981cead4292e031a268c25e84bc9273c6
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Sep 19 21:18:46 2012 +0200

    s4:torture/smb2: improve the smb2.create.blob test
    
    metze
    (cherry picked from commit e6c600aa2c751e694917322378417816c3e58eb6)
    
    See https://bugzilla.samba.org/show_bug.cgi?id=9209 for details.
    (cherry picked from commit e95da423965cf332f6d0a849725cd0808c42c1e2)

commit 841e157cf6b9798ffafaee1dbfc8ef324c4ec917
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Oct 23 17:12:59 2012 +0200

    BUG 9326: Fix net ads join message for the dns domain.
    
    We don't get a realm back from the server which is useable as a realm on
    Unix. On Unix they are case sensitive and on Windows they aren't. This
    confuses uses and if we write realm they try to use it as it came back
    in lowercase.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit 155d132434e96d69bac31dd7413ecb4d4b09b017)

commit b68dca610c4e662b86f2d9ea7e34c47c2fc6486a
Author: David Disseldorp <ddiss at suse.de>
Date:   Wed Nov 2 18:39:03 2011 +0100

    pam_winbind: fix segfault in pam_sm_authenticate()
    
    Ensure the potentially null winbind context is not dereferenced on
    cleanup.
    
    https://bugzilla.samba.org/show_bug.cgi?id=8564
    (cherry picked from commit 11b798cdd0056e55a4958fc049a464f680f3c149)

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

Summary of changes:
 WHATSNEW.txt                                |   56 +++++++++++-
 docs-xml/build/DTD/samba.entities           |   13 ++-
 lib/addns/dnsgss.c                          |   16 +++-
 lib/replace/replace.c                       |    4 +-
 lib/replace/replace.h                       |   42 ++++++---
 lib/replace/snprintf.c                      |   17 ++--
 lib/tsocket/tsocket.h                       |   42 +++++++++
 lib/tsocket/tsocket_bsd.c                   |   73 ++++++++++++++--
 lib/tsocket/tsocket_helpers.c               |   29 ++++++
 nsswitch/pam_winbind.c                      |    7 +-
 source3/auth/auth_util.c                    |    3 +-
 source3/configure.in                        |   49 +++++++----
 source3/include/proto.h                     |    3 +-
 source3/lib/dummysmbd.c                     |    3 +-
 source3/lib/util.c                          |    2 +-
 source3/libads/kerberos.c                   |   28 +++++-
 source3/libads/kerberos_keytab.c            |    8 ++-
 source3/libads/kerberos_verify.c            |    6 ++
 source3/libsmb/cliconnect.c                 |    4 +-
 source3/libsmb/clikrb5.c                    |    6 ++
 source3/locking/locking.c                   |    3 +-
 source3/modules/vfs_acl_common.c            |   17 ++++-
 source3/modules/vfs_aio_pthread.c           |   58 +++++++++----
 source3/rpc_client/cli_lsarpc.c             |  101 +++++----------------
 source3/rpc_client/cli_lsarpc.h             |   39 +++++----
 source3/rpc_client/cli_pipe.c               |    2 +-
 source3/rpc_server/spoolss/srv_spoolss_nt.c |   52 +++++++----
 source3/smbd/dir.c                          |   15 ++--
 source3/smbd/open.c                         |   20 ++++-
 source3/smbd/posix_acls.c                   |   14 ++-
 source3/smbd/process.c                      |    5 +-
 source3/smbd/trans2.c                       |   23 +++++-
 source3/utils/net_ads.c                     |   44 ++++++----
 source3/utils/net_dns.c                     |   96 ++++++++++++--------
 source3/utils/net_dns.h                     |   43 +++++++++
 source3/winbindd/winbindd_cm.c              |   35 +++++++
 source3/winbindd/winbindd_msrpc.c           |  131 +++++++++++++--------------
 source3/winbindd/winbindd_pam.c             |   52 ++++++++---
 source3/winbindd/winbindd_proto.h           |   11 +--
 source3/winbindd/winbindd_rpc.c             |   23 ++----
 source3/wscript                             |    2 +
 source4/torture/smb2/create.c               |   93 +++++++++++++++++++-
 42 files changed, 903 insertions(+), 387 deletions(-)
 create mode 100644 source3/utils/net_dns.h


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 51ff299..45c3b4b 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -8,12 +8,66 @@ This is is the latest stable release of Samba 3.6.
 
 Major enhancements in Samba 3.6.10 include:
 
-o  
+o  Respond correctly to FILE_STREAM_INFO requests (bug #9460).
+o  Fix segfault when "default devmode" is disabled (bug #9433).
+o  Fix segfaults in "log level = 10" on Solaris (bug #9390).
+
 
 Changes since 3.6.9:
 --------------------
 
 o   Jeremy Allison <jra at samba.org>
+    * BUG 9236: ACL masks incorrectly applied when setting ACLs.
+    * BUG 9374: Allow smb2.acls torture test to pass against smbd with a POSIX
+      ACLs backend.
+
+
+o   Björn Baumbach <bb at sernet.de>
+    * BUG 9345: Manpages: Fix use of <smbconfoption> tag.
+
+
+o   Sumit Bose <sbose at redhat.com>
+    * BUG 9367: Use work around for 'winbind use default domain' only if it is
+      set.
+
+
+o   Günther Deschner <gd at samba.org>
+    * BUG 9272: 'net ads join' does not provide AES keys in host keytab.
+    * BUG 9426: Lookup nametype 0x20 in rpc_pipe_open_tcp_port().
+    * BUG 9439: Fix ncacn_ip_tcp reconnection code for lsa lookups.
+    * BUG 9451: Allow to force DNS updates using net.
+
+
+o   David Disseldorp <ddiss at samba.org>
+    * BUG 9433: Fix segfault when "default devmode" is disabled.
+
+
+o   Volker Lendecke <vl at samba.org>
+    * BUG 9359: Optimization needed for SMB2 performance sensitive workloads.
+    * BUG 9422: Large read requests cause server to issue malformed reply.
+    * BUG 9439: Fix ncacn_ip_tcp reconnection code for lsa lookups.
+
+
+o   Stefan Metzmacher <metze at samba.org>
+    * BUG 9209: Improve the smb2.create.blob test.
+    * BUG 9272: 'net ads join' does not provide AES keys in host keytab.
+    * BUG 9390: Fix segfaults in "log level = 10" on Solaris.
+    * BUG 9402: lib/addns doesn't work with a bind9 server.
+
+
+o   Matthieu Patou <mat at matws.net>
+    * BUG 9418: Fix MD5 detection in the autoconf build.
+
+
+o   Andreas Schneider <asn at samba.org>
+    * BUG 8564: Fix segfault in pam_sm_authenticate().
+    * BUG 9326: Fix 'net ads join' message for the dns domain.
+    * BUG 9386: Winbind: Failover if netlogon pipe is not available.
+    * BUG 9436: Fix leaking sockets of SMB connections to a DC.
+
+
+o   Richard Sharpe <realrichardsharpe at gmail.com>
+    * BUG 9460: Respond correctly to FILE_STREAM_INFO requests.
 
 
 ######################################################################
diff --git a/docs-xml/build/DTD/samba.entities b/docs-xml/build/DTD/samba.entities
index f5d8cd2..c7e46c2 100644
--- a/docs-xml/build/DTD/samba.entities
+++ b/docs-xml/build/DTD/samba.entities
@@ -180,7 +180,7 @@ use only by developers and generate HUGE amounts of log
 data, most of which is extremely cryptic.</para>
 
 <para>Note that specifying this parameter here will 
-override the <smbconfoption><name>log level</name></smbconfoption> parameter
+override the <smbconfoption name="log level" /> parameter
 in the &smb.conf; file.</para>
 </listitem>
 </varlistentry>'>
@@ -207,7 +207,7 @@ use only by developers and generate HUGE amounts of log
 data, most of which is extremely cryptic.</para>
 
 <para>Note that specifying this parameter here will 
-override the <smbconfoption><name>log level</name></smbconfoption> parameter
+override the <smbconfoption name="log level" /> parameter
 in the &smb.conf; file.</para>
 </listitem>
 </varlistentry>'>
@@ -297,11 +297,13 @@ being on a locally connected subnet.
 
 <para>If this parameter is not set then the name resolve order 
 defined in the &smb.conf; file parameter  
-(<smbconfoption><name>name resolve order</name></smbconfoption>) will be used.
+(<smbconfoption name="name resolve order" />) will be used.
 </para>
 
 <para>The default order is lmhosts, host, wins, bcast. Without 
-this parameter or any entry in the <smbconfoption><name>name resolve order</name></smbconfoption> parameter of the &smb.conf; file, the name 
+this parameter or any entry in the
+<smbconfoption name="name resolve order" /> parameter of
+the &smb.conf; file, the name
 resolution methods will be attempted in this order. </para></listitem>
 </varlistentry>'>
 
@@ -310,7 +312,8 @@ resolution methods will be attempted in this order. </para></listitem>
 <term>-n|--netbiosname <primary NetBIOS name></term>
 <listitem><para>This option allows you to override
 the NetBIOS name that Samba uses for itself. This is identical
-to setting the <smbconfoption><name>netbios name</name></smbconfoption> parameter in the &smb.conf; file. 
+to setting the <smbconfoption name="netbios name" /> parameter in
+the &smb.conf; file.
 However, a command
 line setting will take precedence over settings in
 &smb.conf;.</para></listitem>
diff --git a/lib/addns/dnsgss.c b/lib/addns/dnsgss.c
index c903741..a8b2ea1 100644
--- a/lib/addns/dnsgss.c
+++ b/lib/addns/dnsgss.c
@@ -164,6 +164,8 @@ static DNS_ERROR dns_negotiate_gss_ctx_int( TALLOC_CTX *mem_ctx,
 			struct dns_request *resp;
 			struct dns_buffer *buf;
 			struct dns_tkey_record *tkey;
+			struct dns_rrec *tkey_answer = NULL;
+			uint16_t i;
 
 			err = dns_receive(mem_ctx, conn, &buf);
 			if (!ERR_DNS_IS_OK(err)) goto error;
@@ -174,10 +176,16 @@ static DNS_ERROR dns_negotiate_gss_ctx_int( TALLOC_CTX *mem_ctx,
 			/*
 			 * TODO: Compare id and keyname
 			 */
-			
-			if ((resp->num_additionals != 1) ||
-			    (resp->num_answers == 0) ||
-			    (resp->answers[0]->type != QTYPE_TKEY)) {
+
+			for (i=0; i < resp->num_answers; i++) {
+				if (resp->answers[i]->type != QTYPE_TKEY) {
+					continue;
+				}
+
+				tkey_answer = resp->answers[i];
+			}
+
+			if (tkey_answer == NULL) {
 				err = ERROR_DNS_INVALID_MESSAGE;
 				goto error;
 			}
diff --git a/lib/replace/replace.c b/lib/replace/replace.c
index d9a96ff..83fa6b3 100644
--- a/lib/replace/replace.c
+++ b/lib/replace/replace.c
@@ -750,7 +750,7 @@ void *rep_memmem(const void *haystack, size_t haystacklen,
 }
 #endif
 
-#ifndef HAVE_VDPRINTF
+#if !defined(HAVE_VDPRINTF) || !defined(HAVE_C99_VSNPRINTF)
 int rep_vdprintf(int fd, const char *format, va_list ap)
 {
 	char *s = NULL;
@@ -767,7 +767,7 @@ int rep_vdprintf(int fd, const char *format, va_list ap)
 }
 #endif
 
-#ifndef HAVE_DPRINTF
+#if !defined(HAVE_DPRINTF) || !defined(HAVE_C99_VSNPRINTF)
 int rep_dprintf(int fd, const char *format, ...)
 {
 	int ret;
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index c47cf1c..926ccc7 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -355,16 +355,6 @@ int rep_dlclose(void *handle);
 /* prototype is in system/network.h */
 #endif
 
-#ifndef HAVE_VDPRINTF
-#define vdprintf rep_vdprintf
-int rep_vdprintf(int fd, const char *format, va_list ap);
-#endif
-
-#ifndef HAVE_DPRINTF
-#define dprintf rep_dprintf
-int rep_dprintf(int fd, const char *format, ...);
-#endif
-
 #ifndef PRINTF_ATTRIBUTE
 #if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 )
 /** Use gcc attribute to check printf fns.  a1 is the 1-based index of
@@ -385,7 +375,17 @@ int rep_dprintf(int fd, const char *format, ...);
 #endif
 #endif
 
-#ifndef HAVE_VASPRINTF
+#if !defined(HAVE_VDPRINTF) || !defined(HAVE_C99_VSNPRINTF)
+#define vdprintf rep_vdprintf
+int rep_vdprintf(int fd, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0);
+#endif
+
+#if !defined(HAVE_DPRINTF) || !defined(HAVE_C99_VSNPRINTF)
+#define dprintf rep_dprintf
+int rep_dprintf(int fd, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
+#endif
+
+#if !defined(HAVE_VASPRINTF) || !defined(HAVE_C99_VSNPRINTF)
 #define vasprintf rep_vasprintf
 int rep_vasprintf(char **ptr, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0);
 #endif
@@ -400,11 +400,29 @@ int rep_snprintf(char *,size_t ,const char *, ...) PRINTF_ATTRIBUTE(3,4);
 int rep_vsnprintf(char *,size_t ,const char *, va_list ap) PRINTF_ATTRIBUTE(3,0);
 #endif
 
-#ifndef HAVE_ASPRINTF
+#if !defined(HAVE_ASPRINTF) || !defined(HAVE_C99_VSNPRINTF)
 #define asprintf rep_asprintf
 int rep_asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3);
 #endif
 
+#if !defined(HAVE_C99_VSNPRINTF)
+#ifdef REPLACE_BROKEN_PRINTF
+/*
+ * We do not redefine printf by default
+ * as it breaks the build if system headers
+ * use __attribute__((format(printf, 3, 0)))
+ * instead of __attribute__((format(__printf__, 3, 0)))
+ */
+#define printf rep_printf
+#endif
+int rep_printf(const char *, ...) PRINTF_ATTRIBUTE(1,2);
+#endif
+
+#if !defined(HAVE_C99_VSNPRINTF)
+#define fprintf rep_fprintf
+int rep_fprintf(FILE *stream, const char *, ...) PRINTF_ATTRIBUTE(2,3);
+#endif
+
 #ifndef HAVE_VSYSLOG
 #ifdef HAVE_SYSLOG
 #define vsyslog rep_vsyslog
diff --git a/lib/replace/snprintf.c b/lib/replace/snprintf.c
index bca7742..6b4a711 100644
--- a/lib/replace/snprintf.c
+++ b/lib/replace/snprintf.c
@@ -1187,7 +1187,7 @@ static int add_cnk_list_entry(struct pr_chunk_x **list,
 	return max;
 }
 
- int vsnprintf (char *str, size_t count, const char *fmt, va_list args)
+ int rep_vsnprintf (char *str, size_t count, const char *fmt, va_list args)
 {
 	return dopr(str, count, fmt, args);
 }
@@ -1200,7 +1200,7 @@ static int add_cnk_list_entry(struct pr_chunk_x **list,
  * that doesn't work properly according to the autoconf test.
  */
 #if !defined(HAVE_SNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
- int snprintf(char *str,size_t count,const char *fmt,...)
+ int rep_snprintf(char *str,size_t count,const char *fmt,...)
 {
 	size_t ret;
 	va_list ap;
@@ -1213,7 +1213,7 @@ static int add_cnk_list_entry(struct pr_chunk_x **list,
 #endif
 
 #ifndef HAVE_C99_VSNPRINTF
- int printf(const char *fmt, ...)
+ int rep_printf(const char *fmt, ...)
 {
 	va_list ap;
 	int ret;
@@ -1234,7 +1234,7 @@ static int add_cnk_list_entry(struct pr_chunk_x **list,
 #endif
 
 #ifndef HAVE_C99_VSNPRINTF
- int fprintf(FILE *stream, const char *fmt, ...)
+ int rep_fprintf(FILE *stream, const char *fmt, ...)
 {
 	va_list ap;
 	int ret;
@@ -1256,8 +1256,8 @@ static int add_cnk_list_entry(struct pr_chunk_x **list,
 
 #endif 
 
-#ifndef HAVE_VASPRINTF
- int vasprintf(char **ptr, const char *format, va_list ap)
+#if !defined(HAVE_VASPRINTF) || !defined(HAVE_C99_VSNPRINTF)
+ int rep_vasprintf(char **ptr, const char *format, va_list ap)
 {
 	int ret;
 	va_list ap2;
@@ -1278,9 +1278,8 @@ static int add_cnk_list_entry(struct pr_chunk_x **list,
 }
 #endif
 
-
-#ifndef HAVE_ASPRINTF
- int asprintf(char **ptr, const char *format, ...)
+#if !defined(HAVE_ASPRINTF) || !defined(HAVE_C99_VSNPRINTF)
+ int rep_asprintf(char **ptr, const char *format, ...)
 {
 	va_list ap;
 	int ret;
diff --git a/lib/tsocket/tsocket.h b/lib/tsocket/tsocket.h
index 3aca536..98f864e 100644
--- a/lib/tsocket/tsocket.h
+++ b/lib/tsocket/tsocket.h
@@ -627,6 +627,27 @@ int _tsocket_address_unix_from_path(TALLOC_CTX *mem_ctx,
 char *tsocket_address_unix_path(const struct tsocket_address *addr,
 				TALLOC_CTX *mem_ctx);
 
+/**
+ * @brief Request a syscall optimization for tdgram_recvfrom_send()
+ *
+ * This function is only used to reduce the amount of syscalls and
+ * optimize performance. You should only use this if you know
+ * what you're doing.
+ *
+ * The optimization is off by default.
+ *
+ * @param[in]  dgram    The tdgram_context of a bsd socket, if this
+ *                      not a bsd socket the function does nothing.
+ *
+ * @param[in]  on       The boolean value to turn the optimization on and off.
+ *
+ * @return              The old boolean value.
+ *
+ * @see tdgram_recvfrom_send()
+ */
+bool tdgram_bsd_optimize_recvfrom(struct tdgram_context *dgram,
+				  bool on);
+
 #ifdef DOXYGEN
 /**
  * @brief Create a tdgram_context for a ipv4 or ipv6 UDP communication.
@@ -689,6 +710,27 @@ int _tdgram_unix_socket(const struct tsocket_address *local,
 #endif
 
 /**
+ * @brief Request a syscall optimization for tstream_readv_send()
+ *
+ * This function is only used to reduce the amount of syscalls and
+ * optimize performance. You should only use this if you know
+ * what you're doing.
+ *
+ * The optimization is off by default.
+ *
+ * @param[in]  stream   The tstream_context of a bsd socket, if this
+ *                      not a bsd socket the function does nothing.
+ *
+ * @param[in]  on       The boolean value to turn the optimization on and off.
+ *
+ * @return              The old boolean value.
+ *
+ * @see tstream_readv_send()
+ */
+bool tstream_bsd_optimize_readv(struct tstream_context *stream,
+				bool on);
+
+/**
  * @brief Connect async to a TCP endpoint and create a tstream_context for the
  * stream based communication.
  *
diff --git a/lib/tsocket/tsocket_bsd.c b/lib/tsocket/tsocket_bsd.c
index 9e80065..58598d1 100644
--- a/lib/tsocket/tsocket_bsd.c
+++ b/lib/tsocket/tsocket_bsd.c
@@ -654,6 +654,7 @@ struct tdgram_bsd {
 
 	void *event_ptr;
 	struct tevent_fd *fde;
+	bool optimize_recvfrom;
 
 	void *readable_private;
 	void (*readable_handler)(void *private_data);
@@ -661,6 +662,25 @@ struct tdgram_bsd {
 	void (*writeable_handler)(void *private_data);
 };
 
+bool tdgram_bsd_optimize_recvfrom(struct tdgram_context *dgram,
+				  bool on)
+{
+	struct tdgram_bsd *bsds =
+		talloc_get_type(_tdgram_context_data(dgram),
+		struct tdgram_bsd);
+	bool old;
+
+	if (bsds == NULL) {
+		/* not a bsd socket */
+		return false;
+	}
+
+	old = bsds->optimize_recvfrom;
+	bsds->optimize_recvfrom = on;
+
+	return old;
+}
+
 static void tdgram_bsd_fde_handler(struct tevent_context *ev,
 				   struct tevent_fd *fde,
 				   uint16_t flags,
@@ -837,14 +857,25 @@ static struct tevent_req *tdgram_bsd_recvfrom_send(TALLOC_CTX *mem_ctx,
 		goto post;
 	}
 
+
 	/*
 	 * this is a fast path, not waiting for the
 	 * socket to become explicit readable gains
 	 * about 10%-20% performance in benchmark tests.
 	 */
-	tdgram_bsd_recvfrom_handler(req);
-	if (!tevent_req_is_in_progress(req)) {
-		goto post;
+	if (bsds->optimize_recvfrom) {
+		/*
+		 * We only do the optimization on
+		 * recvfrom if the caller asked for it.
+		 *
+		 * This is needed because in most cases
+		 * we preferr to flush send buffers before
+		 * receiving incoming requests.
+		 */
+		tdgram_bsd_recvfrom_handler(req);
+		if (!tevent_req_is_in_progress(req)) {
+			goto post;
+		}
 	}
 
 	ret = tdgram_bsd_set_readable_handler(bsds, ev,
@@ -1400,6 +1431,7 @@ struct tstream_bsd {
 
 	void *event_ptr;
 	struct tevent_fd *fde;
+	bool optimize_readv;
 
 	void *readable_private;
 	void (*readable_handler)(void *private_data);
@@ -1407,6 +1439,25 @@ struct tstream_bsd {
 	void (*writeable_handler)(void *private_data);
 };
 
+bool tstream_bsd_optimize_readv(struct tstream_context *stream,
+				bool on)
+{
+	struct tstream_bsd *bsds =
+		talloc_get_type(_tstream_context_data(stream),
+		struct tstream_bsd);
+	bool old;
+
+	if (bsds == NULL) {
+		/* not a bsd socket */
+		return false;
+	}
+
+	old = bsds->optimize_readv;
+	bsds->optimize_readv = on;
+
+	return old;
+}
+
 static void tstream_bsd_fde_handler(struct tevent_context *ev,
 				    struct tevent_fd *fde,
 				    uint16_t flags,
@@ -1619,9 +1670,19 @@ static struct tevent_req *tstream_bsd_readv_send(TALLOC_CTX *mem_ctx,
 	 * socket to become explicit readable gains
 	 * about 10%-20% performance in benchmark tests.
 	 */
-	tstream_bsd_readv_handler(req);
-	if (!tevent_req_is_in_progress(req)) {
-		goto post;
+	if (bsds->optimize_readv) {
+		/*
+		 * We only do the optimization on
+		 * readv if the caller asked for it.
+		 *
+		 * This is needed because in most cases
+		 * we preferr to flush send buffers before
+		 * receiving incoming requests.
+		 */
+		tstream_bsd_readv_handler(req);
+		if (!tevent_req_is_in_progress(req)) {
+			goto post;
+		}
 	}
 
 	ret = tstream_bsd_set_readable_handler(bsds, ev,
diff --git a/lib/tsocket/tsocket_helpers.c b/lib/tsocket/tsocket_helpers.c
index 3a41a3e..809830d 100644
--- a/lib/tsocket/tsocket_helpers.c
+++ b/lib/tsocket/tsocket_helpers.c
@@ -212,6 +212,20 @@ static void tstream_readv_pdu_ask_for_next_vector(struct tevent_req *req)
 	size_t to_read = 0;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list