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

Karolin Seeger kseeger at samba.org
Mon May 7 12:20:03 UTC 2018


The branch, v4-7-test has been updated
       via  bf466d2 s3: libsmbclient: Fix hard-coded connection error return of ETIMEDOUT.
       via  989c684 ceph: VFS: Add asynchronous fsync to ceph module, fake using synchronous call.
       via  314f0e1 rpc_server: Fix NetSessEnum with stale sessions
       via  0797e58 selftest: Add testcase for querying sessions after smbd crash
       via  cfbcd62 rpcclient: Print number of entries for NetSessEnum
       via  1f5faf4 printing: return the same error code as windows does on upload failures
       via  6db05c0 s3: tests: Regression test to ensure we can never return a DIRECTORY attribute on a stream.
       via  8607fea s3: smbd. Generic fix for incorrect reporting of stream dos attributes on a directory
       via  db8296b s3: vfs: vfs_streams_xattr: Don't blindly re-use the base file mode bits.
       via  d4940e6 winbindd: add retry to _winbind_SendToSam
       via  4319c43 winbindd: add retry to _winbind_DsrUpdateReadOnlyServerDnsRecords
       via  1e6275a winbindd: add retry to _wbint_DsGetDcName
       via  b7c598d winbindd: add retry to _wbint_LookupSids()
       via  b0a14aec winbindd: use reset_cm_connection_on_error() instead of dcerpc_binding_handle_is_connected()
       via  1b7c16a winbindd: fix logic calling dcerpc_binding_handle_is_connected()
       via  76a4df1 winbindd: call dcerpc_binding_handle_is_connected() from reset_cm_connection_on_error()
       via  30dd8bc winbindd: force netlogon reauth for certain errors in reset_cm_connection_on_error()
       via  5fde0c6 winbindd: call reset_cm_connection_on_error() from reconnect_need_retry()
       via  3ef2377 winbindd: make reset_cm_connection_on_error() public
       via  406a8f3 winbindd: check for NT_STATUS_IO_DEVICE_ERROR in reset_cm_connection_on_error()
       via  4f793f6 winbindd: add and use ldap_reconnect_need_retry() in winbindd_reconnect_ads.c
       via  bc655b6 winbind: Keep "force_reauth" in invalidate_cm_connection
       via  8da9fb5 winbind: Add smbcontrol disconnect-dc
       via  91fd11d utils: Add destroy_netlogon_creds_cli
      from  d6ac540 nsswitch: fix memory leak in winbind_open_pipe_sock() when the privileged pipe is not accessable.

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


- Log -----------------------------------------------------------------
commit bf466d26a9d48e19caa887c3c15781739c2d120d
Author: Jeremy Allison <jra at samba.org>
Date:   Wed May 2 11:19:31 2018 -0700

    s3: libsmbclient: Fix hard-coded connection error return of ETIMEDOUT.
    
    We shouldn't hard-code the connection error as ETIMEDOUT when
    we have a perfectly good NT_STATUS to map from.
    
    Found by the ChromeOS guys trying to connect an SMB2-only client
    to an SMB1-only supporting server.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13419
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu May  3 02:42:20 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 795ec751ac5f6e58966385bec25063c4af4f185d)
    
    Autobuild-User(v4-7-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-7-test): Mon May  7 14:19:42 CEST 2018 on sn-devel-144

commit 989c68483baa5925271c020dd9173726ad443ded
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Apr 27 14:25:54 2018 -0700

    ceph: VFS: Add asynchronous fsync to ceph module, fake using synchronous call.
    
    This will allow me to ultimately simplify the VFS by removing the synchronous
    fsync VFS call.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13412
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Mon Apr 30 21:48:55 CEST 2018 on sn-devel-144
    
    (cherry picked from commit aefe444d17a2eee3c0ff38bd34cf9e3f012ecf51)

commit 314f0e1ebe8e565e1df7f992b22aa359278e8bd5
Author: Christof Schmitt <cs at samba.org>
Date:   Tue Apr 24 13:53:41 2018 -0700

    rpc_server: Fix NetSessEnum with stale sessions
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13407
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Apr 25 22:49:07 CEST 2018 on sn-devel-144
    
    (cherry picked from commit a6fade4e10760284ef56abf45d3fa70038091cbe)

commit 0797e58833d7b4880df7e3ff9d76802952278175
Author: Christof Schmitt <cs at samba.org>
Date:   Tue Apr 24 13:52:59 2018 -0700

    selftest: Add testcase for querying sessions after smbd crash
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13407
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit e04846c7df8e3eec1f3dbb2fc5eaf47ceb1c44d2)

commit cfbcd62a54b07a7fc7932eef3526dd33f8aa5a15
Author: Christof Schmitt <cs at samba.org>
Date:   Tue Apr 24 12:18:49 2018 -0700

    rpcclient: Print number of entries for NetSessEnum
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13407
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 501819fa9e7926c2f54cb92d508ac0e8437fd476)

commit 1f5faf4424986178c94f941fb19c6329ec9fdd92
Author: Björn Jacke <bjacke at samba.org>
Date:   Thu Apr 19 16:14:38 2018 +0200

    printing: return the same error code as windows does on upload failures
    
    Some print drivers inf files are broken and cause driver installation to fail
    on Samba servers. Windows returns WERR_APP_INIT_FAILURE in that case, we should
    do the same. Windows machines are less unlucky with that.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13395
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Björn Jacke <bj at sernet.de>
    Autobuild-Date(master): Wed Apr 25 13:55:25 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 35f2afe411a3b22fb1befadb3bee8da1bc14753c)

commit 6db05c047f4501de5250689e8fe0fd358f359cc0
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Apr 11 10:33:22 2018 -0700

    s3: tests: Regression test to ensure we can never return a DIRECTORY attribute on a stream.
    
    Tests streams_xattr and also streams_depot.
    
    Inspired from a real-world test case by Andrew Walker <awalker at ixsystems.com>.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13380
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Apr 12 02:04:28 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 82beaf868f252c4bc975ddafd80240af6f679b83)

commit 8607feadb88ceeff688293691a5dc13021781ac2
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Apr 11 11:05:14 2018 -0700

    s3: smbd. Generic fix for incorrect reporting of stream dos attributes on a directory
    
    According to MS-FSA a stream name does not have
    separate DOS attribute metadata, so we must return
    the DOS attribute from the base filename. With one caveat,
    a non-default stream name can never be a directory.
    
    As this is common to all streams data stores, we handle
    it here instead of inside all stream VFS modules.
    
    Otherwise identical logic would have to be added to
    all streams modules in their [f]get_dos_attribute_fn()
    VFS calls.
    
    Found in real-world use case by Andrew Walker <awalker at ixsystems.com>.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13380
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>
    (cherry picked from commit 118e77d86a7171f589f805fa4f63246b0cb63672)

commit db8296bc1ba91afee9103165ff9dde49e2be87ab
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Apr 11 08:41:00 2018 -0700

    s3: vfs: vfs_streams_xattr: Don't blindly re-use the base file mode bits.
    
    When returning the stat struct for an xattr stream,
    we originally base the st_ex_mode field on the value
    from the base file containing the xattr. If the base
    file is a directory, it will have S_IFDIR set in st_ex_mode,
    but streams can never be directories, they must be reported
    as regular files.
    
    The original code OR'ed in S_IFREG, but neglected to
    AND out S_IFDIR.
    
    Note this is not a complete to fix bug 13380 as
    it doesn't fix the generic case with all streams
    modules. See later fix and regression test.
    
    Found in real-world use case by Andrew Walker <awalker at ixsystems.com>.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13380
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>
    (cherry picked from commit 4d839d0f46b723ed6809bb932b9ebe4ead2cec82)

commit d4940e673a29a82d25a3f9ef3c0b3b69b6d4cb59
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Mar 12 19:54:37 2018 +0100

    winbindd: add retry to _winbind_SendToSam
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13332
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Thu Mar 15 20:57:44 CET 2018 on sn-devel-144
    
    (backported from commit c37fbfcb248e5a8d6088a28eb0c1a62423f94502)

commit 4319c439da2b1ea4e3374d9a000087ffbedfe382
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Mar 12 19:53:53 2018 +0100

    winbindd: add retry to _winbind_DsrUpdateReadOnlyServerDnsRecords
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13332
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (backported from commit e608f058b8f2d2295e24498daa35852de3212b23)

commit 1e6275a2c9a160a419d3f4fe0960c542fe4bfddd
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Mar 12 19:53:26 2018 +0100

    winbindd: add retry to _wbint_DsGetDcName
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13332
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit fcf8edf9b8cdf5f3897c1a63ed97c302a231742f)

commit b7c598d35249db1e603f92f2d6bad0d179c7e27b
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Mar 12 17:09:34 2018 +0100

    winbindd: add retry to _wbint_LookupSids()
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13332
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit c2cd2d3f3137e27cd6e4cabd34f27b49251f078d)

commit b0a14aec00e61569e1808f6c736c9e6a69e4554f
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Mar 12 16:53:49 2018 +0100

    winbindd: use reset_cm_connection_on_error() instead of dcerpc_binding_handle_is_connected()
    
    This catches more errors and triggers retry as appropriate.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13332
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit 6244a2beb184de8d050389e304f087ef153d61dd)

commit 1b7c16af660a9c2a25e400ae2143d50c23140774
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Mar 12 16:15:02 2018 +0100

    winbindd: fix logic calling dcerpc_binding_handle_is_connected()
    
    The calls were missing the negation operator, a retry should be
    attempted is the binding handle got somehow disconnected behind the
    scenes and is NOT connected.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13332
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit 08718af36f3ed6cf2308beb3800abfb0414f94b9)

commit 76a4df1eb5d5ab284c79573e769086e56648a451
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Mar 12 16:11:37 2018 +0100

    winbindd: call dcerpc_binding_handle_is_connected() from reset_cm_connection_on_error()
    
    To consolidate the error handling for RPC calls, add the binding handle
    as an additional argument to reset_cm_connection_on_error().
    
    All callers pass NULL for now, so no change in behaviour up to here.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13332
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit 966ff3793a867a5ffe1a49e48c8ab3ecb02f8359)

commit 30dd8bc6a345b700447dc2bcb538a1e6a87e6993
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Mar 12 13:39:59 2018 +0100

    winbindd: force netlogon reauth for certain errors in reset_cm_connection_on_error()
    
    NT_STATUS_RPC_SEC_PKG_ERROR is returned by the server if the server
    doesn't know the server-side netlogon credentials anymore, eg after a
    reboot. If this happens we must force a full netlogon reauth.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13332
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    (cherry picked from commit 2d1f00cc3ad77bed4e810dc910979e6cdf582216)

commit 5fde0c6ae45fbc4ec33cd3719d924973f02b2768
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Mar 12 12:20:04 2018 +0100

    winbindd: call reset_cm_connection_on_error() from reconnect_need_retry()
    
    This ensures we use the same disconnect logic in the reconnect backend,
    which calls reconnect_need_retry(), and in the dual_srv frontend which
    calls reset_cm_connection_on_error.
    
    Both reset_cm_connection_on_error() and reconnect_need_retry() are very
    similar, both return a bool indicating whether a retry should be
    attempted, unfortunately the functions have a different default return,
    so I don't dare unifying them, but instead just call one from the other.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13332
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit 2837b796af3e491b6bb34bd441758ae214f629ee)

commit 3ef237744e26d954121024ebb708417e7e53e0a2
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Mar 12 11:29:22 2018 +0100

    winbindd: make reset_cm_connection_on_error() public
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13332
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (backported from commit 17749a5d9fa08da1c61de45728656a2c9b85782d)

commit 406a8f3184ec48017e9d7c4ced7eff5bd1845a19
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Mar 12 11:12:34 2018 +0100

    winbindd: check for NT_STATUS_IO_DEVICE_ERROR in reset_cm_connection_on_error()
    
    reconnect_need_retry() already checks for this error, it surfaces up
    from tstream_smbXcli_np as a mapping for EIO.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13332
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit a33c1d25e0422483c903001dd246626f84c4cbc1)

commit 4f793f6935b3ff9f776ec74da6659fc2cbdf7844
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Mar 12 13:30:01 2018 +0100

    winbindd: add and use ldap_reconnect_need_retry() in winbindd_reconnect_ads.c
    
    ldap_reconnect_need_retry() is a copy of reconnect_need_retry() minus
    the RPC connection invalidation.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13332
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit a8d5e4d36768bc199c631626488b2d0acbd6e91a)

commit bc655b6616875961b39d6a2871dfe48ee146c7aa
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 28 15:09:28 2018 +0000

    winbind: Keep "force_reauth" in invalidate_cm_connection
    
    Right now I don't see a way to actually force a re-serverauth
    from the client side as long as an entry in netlogon_creds_cli.tdb
    exists. cm_connect_netlogon goes through invalidate_cm_connection, and
    this wipes our wish to force a reauthenticatoin. Keep this intact until
    we actually did reauthenticate.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13332
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    (cherry picked from commit 4b7a9d560a51b51ac88f30276c87edc097b00d0b)

commit 8da9fb5a30ea5c11eb9292fd2a4ac7bc698b4c2e
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 28 15:08:44 2018 +0000

    winbind: Add smbcontrol disconnect-dc
    
    Make a winbind child drop all DC connections
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13332
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (backported from commit 0af88b98e7e1bba14827305257e77b63dc82d902)

commit 91fd11d0b62039bcabc6a350f28020c79083d4f8
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 28 07:59:08 2018 +0000

    utils: Add destroy_netlogon_creds_cli
    
    This is a pure testing utility that will garble the netlogon_creds_cli
    session_key. This creates a similar effect to our schannel credentials
    as does a domain controller reboot.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13332
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    (backported from commit bffae41842fe218959fe6f8b43df694feec1589c)

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

Summary of changes:
 librpc/idl/messaging.idl                           |   1 +
 selftest/target/Samba3.pm                          |   4 +
 source3/libsmb/libsmb_server.c                     |   2 +-
 source3/modules/vfs_ceph.c                         |  53 ++++++++
 source3/modules/vfs_streams_xattr.c                |   2 +
 source3/printing/nt_printing.c                     |   2 +-
 source3/rpcclient/cmd_srvsvc.c                     |   2 +
 source3/script/tests/test_rpcclient_netsessenum.sh |  55 ++++++++
 source3/script/tests/test_smbclient_s3.sh          |  76 +++++++++++
 source3/selftest/tests.py                          |   6 +
 source3/smbd/dosmode.c                             |  22 ++++
 source3/smbd/session.c                             |   4 +
 source3/utils/destroy_netlogon_creds_cli.c         | 136 ++++++++++++++++++++
 source3/utils/smbcontrol.c                         |  14 ++
 source3/utils/wscript_build                        |   9 ++
 source3/winbindd/winbindd.c                        |   4 +
 source3/winbindd/winbindd_cm.c                     |  18 ++-
 source3/winbindd/winbindd_dual.c                   |  21 ++-
 source3/winbindd/winbindd_dual_srv.c               | 141 +++++++++++++--------
 source3/winbindd/winbindd_proto.h                  |  15 +++
 source3/winbindd/winbindd_reconnect.c              |   8 +-
 source3/winbindd/winbindd_reconnect_ads.c          |  58 ++++++++-
 22 files changed, 584 insertions(+), 69 deletions(-)
 create mode 100755 source3/script/tests/test_rpcclient_netsessenum.sh
 create mode 100644 source3/utils/destroy_netlogon_creds_cli.c


Changeset truncated at 500 lines:

diff --git a/librpc/idl/messaging.idl b/librpc/idl/messaging.idl
index b962ab1..969e227 100644
--- a/librpc/idl/messaging.idl
+++ b/librpc/idl/messaging.idl
@@ -124,6 +124,7 @@ interface messaging
 		MSG_WINBIND_DOMAIN_ONLINE	= 0x040B,
 		MSG_WINBIND_DOMAIN_OFFLINE	= 0x040C,
 		MSG_WINBIND_NEW_TRUSTED_DOMAIN	= 0x040D,
+		MSG_WINBIND_DISCONNECT_DC       = 0x040E,
 
 		/* event messages */
 		MSG_DUMP_EVENT_LIST		= 0x0500,
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index f1e29bf..299d55b 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -2040,6 +2040,10 @@ sub provision($$$$$$$$$)
 	kernel oplocks = yes
 	vfs objects = streams_xattr xattr_tdb
 
+[streams_xattr]
+	copy = tmp
+	vfs objects = streams_xattr xattr_tdb
+
 [compound_find]
 	copy = tmp
 	smbd:find async delay usec = 10000
diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index e6067be..67dfcf7 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -500,7 +500,7 @@ SMBC_server_internal(TALLOC_CTX *ctx,
 				 lp_client_max_protocol());
 	if (!NT_STATUS_IS_OK(status)) {
 		cli_shutdown(c);
-		errno = ETIMEDOUT;
+		errno = map_errno_from_nt_status(status);
 		return NULL;
 	}
 
diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index f482a8b..87d3c00 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -37,6 +37,7 @@
 #include "cephfs/libcephfs.h"
 #include "smbprofile.h"
 #include "modules/posixacl_xattr.h"
+#include "lib/util/tevent_unix.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_VFS
@@ -569,6 +570,56 @@ static int cephwrap_fsync(struct vfs_handle_struct *handle, files_struct *fsp)
 	WRAP_RETURN(result);
 }
 
+/*
+ * Fake up an async ceph fsync by calling the sychronous API.
+ */
+
+static struct tevent_req *cephwrap_fsync_send(struct vfs_handle_struct *handle,
+					TALLOC_CTX *mem_ctx,
+					struct tevent_context *ev,
+					files_struct *fsp)
+{
+	struct tevent_req *req = NULL;
+	struct vfs_aio_state *state = NULL;
+	int ret = -1;
+
+	DBG_DEBUG("[CEPH] cephwrap_fsync_send\n");
+
+	req = tevent_req_create(mem_ctx, &state, struct vfs_aio_state);
+	if (req == NULL) {
+		return NULL;
+	}
+
+	/* Make sync call. */
+	ret = ceph_fsync(handle->data, fsp->fh->fd, false);
+
+	if (ret != 0) {
+		/* ceph_fsync returns -errno on error. */
+		tevent_req_error(req, -ret);
+		return tevent_req_post(req, ev);
+	}
+
+	/* Mark it as done. */
+	tevent_req_done(req);
+	/* Return and schedule the completion of the call. */
+	return tevent_req_post(req, ev);
+}
+
+static int cephwrap_fsync_recv(struct tevent_req *req,
+				struct vfs_aio_state *vfs_aio_state)
+{
+	struct vfs_aio_state *state =
+		tevent_req_data(req, struct vfs_aio_state);
+
+	DBG_DEBUG("[CEPH] cephwrap_fsync_recv\n");
+
+	if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
+		return -1;
+	}
+	*vfs_aio_state = *state;
+	return 0;
+}
+
 #ifdef HAVE_CEPH_STATX
 #define SAMBA_STATX_ATTR_MASK	(CEPH_STATX_BASIC_STATS|CEPH_STATX_BTIME)
 
@@ -1440,6 +1491,8 @@ static struct vfs_fn_pointers ceph_fns = {
 	.recvfile_fn = cephwrap_recvfile,
 	.rename_fn = cephwrap_rename,
 	.fsync_fn = cephwrap_fsync,
+	.fsync_send_fn = cephwrap_fsync_send,
+	.fsync_recv_fn = cephwrap_fsync_recv,
 	.stat_fn = cephwrap_stat,
 	.fstat_fn = cephwrap_fstat,
 	.lstat_fn = cephwrap_lstat,
diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c
index f75f6a1..1340d04 100644
--- a/source3/modules/vfs_streams_xattr.c
+++ b/source3/modules/vfs_streams_xattr.c
@@ -277,6 +277,7 @@ static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp,
 
 	sbuf->st_ex_ino = stream_inode(sbuf, io->xattr_name);
 	sbuf->st_ex_mode &= ~S_IFMT;
+	sbuf->st_ex_mode &= ~S_IFDIR;
         sbuf->st_ex_mode |= S_IFREG;
         sbuf->st_ex_blocks = sbuf->st_ex_size / STAT_ST_BLOCKSIZE + 1;
 
@@ -331,6 +332,7 @@ static int streams_xattr_stat(vfs_handle_struct *handle,
 
 	smb_fname->st.st_ex_ino = stream_inode(&smb_fname->st, xattr_name);
 	smb_fname->st.st_ex_mode &= ~S_IFMT;
+	smb_fname->st.st_ex_mode &= ~S_IFDIR;
         smb_fname->st.st_ex_mode |= S_IFREG;
         smb_fname->st.st_ex_blocks =
 	    smb_fname->st.st_ex_size / STAT_ST_BLOCKSIZE + 1;
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 47590f6..9601f05 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -1143,7 +1143,7 @@ static WERROR move_driver_file_to_download_area(TALLOC_CTX *mem_ctx,
 				 "to rename [%s] to [%s]: %s\n",
 				 smb_fname_old->base_name, new_name,
 				 nt_errstr(status)));
-			ret = WERR_ACCESS_DENIED;
+			ret = WERR_APP_INIT_FAILURE;
 			goto out;
 		}
 	}
diff --git a/source3/rpcclient/cmd_srvsvc.c b/source3/rpcclient/cmd_srvsvc.c
index e7929e7..f78fb9a1 100644
--- a/source3/rpcclient/cmd_srvsvc.c
+++ b/source3/rpcclient/cmd_srvsvc.c
@@ -883,6 +883,8 @@ static WERROR cmd_srvsvc_net_sess_enum(struct rpc_pipe_client *cli,
 		goto done;
 	}
 
+	d_printf("Received %d entries.\n", total_entries);
+
  done:
 	return result;
 }
diff --git a/source3/script/tests/test_rpcclient_netsessenum.sh b/source3/script/tests/test_rpcclient_netsessenum.sh
new file mode 100755
index 0000000..9abb3ae
--- /dev/null
+++ b/source3/script/tests/test_rpcclient_netsessenum.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+# Blackbox tests for the rpcclient srvsvc commands
+#
+# Copyright (C) 2018 Christof Schmitt
+
+if [ $# -lt 6 ]; then
+cat <<EOF
+Usage: $0 DOMAIN ADMIN_USER ADMIN_PASSWORD SERVER RPCCLIENT SMBTORTURE3 SHARE
+EOF
+exit 1;
+fi
+
+DOMAIN="$1"
+ADMIN_USER="$2"
+ADMIN_PASSWORD="$3"
+SERVER="$4"
+RPCCLIENT="$5"
+SMBTORTURE3="$6"
+SHARE="$7"
+
+USERPASS="-U$DOMAIN/$ADMIN_USER%$ADMIN_PASSWORD"
+RPCCLIENTCMD="$RPCCLIENT $SERVER $USERPASS"
+
+incdir=$(dirname $0)/../../../testprogs/blackbox
+. $incdir/subunit.sh
+
+failed=0
+
+#
+# Verify initial number of sessions.
+#
+$RPCCLIENTCMD -c NetSessEnum | grep Received
+RC=$?
+testit "netsessenum" test $RC = 0 || failed=$(expr $failed + 1)
+
+OUT=$($RPCCLIENTCMD -c NetSessEnum | grep Received)
+test "$OUT" = "Received 1 entries."
+RC=$?
+testit "count1" test $RC -eq 0  || failed=$(expr $failed + 1)
+
+#
+# Inject smbd crash
+#
+$SMBTORTURE3 //"$SERVER"/"$SHARE" "$USERPASS" CLEANUP1
+
+#
+# Verify number of sessions after crash
+#
+OUT=$($RPCCLIENTCMD -c NetSessEnum | grep Received)
+test "$OUT" = "Received 1 entries."
+RC=$?
+testit "count2" test $RC -eq 0  || failed=$(expr $failed + 1)
+
+testok $0 $failed
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
index 05fcf69..04c2e2d 100755
--- a/source3/script/tests/test_smbclient_s3.sh
+++ b/source3/script/tests/test_smbclient_s3.sh
@@ -1521,6 +1521,78 @@ EOF
     return 0
 }
 
+# Test xattr_stream correctly reports mode.
+# BUG: https://bugzilla.samba.org/show_bug.cgi?id=13380
+
+test_stream_directory_xattr()
+{
+    tmpfile=$PREFIX/smbclient_interactive_prompt_commands
+#
+# Test against streams_xattr
+#
+    cat > $tmpfile <<EOF
+deltree foo
+mkdir foo
+put ${PREFIX}/smbclient_interactive_prompt_commands foo:bar
+setmode foo -a
+allinfo foo:bar
+deltree foo
+quit
+EOF
+    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/streams_xattr -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
+    eval echo "$cmd"
+    out=`eval $cmd`
+    ret=$?
+    rm -f $tmpfile
+
+    if [ $ret != 0 ] ; then
+	echo "$out"
+	echo "failed checking attributes on xattr stream foo:bar with error $ret"
+	return 1
+    fi
+
+    echo "$out" | grep "attributes:.*80"
+    ret=$?
+    if [ $ret != 0 ] ; then
+	echo "$out"
+	echo "failed checking attributes on xattr stream foo:bar"
+	return 1
+    fi
+
+#
+# Test against streams_depot
+#
+    cat > $tmpfile <<EOF
+deltree foo
+mkdir foo
+put ${PREFIX}/smbclient_interactive_prompt_commands foo:bar
+setmode foo -a
+allinfo foo:bar
+deltree foo
+quit
+EOF
+    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
+    eval echo "$cmd"
+    out=`eval $cmd`
+    ret=$?
+    rm -f $tmpfile
+
+    if [ $ret != 0 ] ; then
+	echo "$out"
+	echo "failed checking attributes on depot stream foo:bar with error $ret"
+	return 1
+    fi
+
+    echo "$out" | grep "attributes:.*80"
+    ret=$?
+    if [ $ret != 0 ] ; then
+	echo "$out"
+	echo "failed checking attributes on depot stream foo:bar"
+	return 1
+    fi
+}
+
+#
 LOGDIR_PREFIX=test_smbclient_s3
 
 # possibly remove old logdirs:
@@ -1620,6 +1692,10 @@ testit "streams_depot can delete correctly" \
     test_streams_depot_delete || \
     failed=`expr $failed + 1`
 
+testit "stream_xattr attributes" \
+    test_stream_directory_xattr || \
+    failed=`expr $failed + 1`
+
 testit "follow symlinks = no" \
     test_nosymlinks || \
     failed=`expr $failed + 1`
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 593ac1d..20e1c03 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -612,6 +612,12 @@ plantestsuite("samba3.blackbox.smbclient.encryption_off", "simpleserver",
                "$USERNAME", "$PASSWORD", "$SERVER",
                smbclient3])
 
+plantestsuite("samba3.blackbox.rpcclient_netsessenum", "ad_member",
+              [os.path.join(samba3srcdir,
+                            "script/tests/test_rpcclient_netsessenum.sh"),
+               "$DOMAIN", "$DC_USERNAME", "$DC_PASSWORD", "$SERVER",
+               os.path.join(bindir(), "rpcclient"), smbtorture3, "tmp"])
+
 # The ktest environment uses:
 # server min protocol = SMB3_00
 # client max protocol = SMB3
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index 8a11c8f..7ac876a 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -681,6 +681,28 @@ uint32_t dos_mode(connection_struct *conn, struct smb_filename *smb_fname)
 		}
 	}
 
+	/*
+	 * According to MS-FSA a stream name does not have
+	 * separate DOS attribute metadata, so we must return
+	 * the DOS attribute from the base filename. With one caveat,
+	 * a non-default stream name can never be a directory.
+	 *
+	 * As this is common to all streams data stores, we handle
+	 * it here instead of inside all stream VFS modules.
+	 *
+	 * BUG: https://bugzilla.samba.org/show_bug.cgi?id=13380
+	 */
+
+	if (is_ntfs_stream_smb_fname(smb_fname)) {
+		/* is_ntfs_stream_smb_fname() returns false for a POSIX path. */
+		if (!is_ntfs_default_stream_smb_fname(smb_fname)) {
+			/*
+			 * Non-default stream name, not a posix path.
+			 */
+			result &= ~(FILE_ATTRIBUTE_DIRECTORY);
+		}
+	}
+
 	if (conn->fs_capabilities & FILE_FILE_COMPRESSION) {
 		bool compressed = false;
 		status = dos_mode_check_compressed(conn, smb_fname,
diff --git a/source3/smbd/session.c b/source3/smbd/session.c
index 4ddb856..8b4c660 100644
--- a/source3/smbd/session.c
+++ b/source3/smbd/session.c
@@ -139,6 +139,10 @@ static int gather_sessioninfo(const char *key, struct sessionid *session,
 		return 0;
 	}
 
+	if (!process_exists(session->pid)) {
+		return 0;
+	}
+
 	sesslist->sessions = talloc_realloc(
 		sesslist->mem_ctx, sesslist->sessions, struct sessionid,
 		sesslist->count+1);
diff --git a/source3/utils/destroy_netlogon_creds_cli.c b/source3/utils/destroy_netlogon_creds_cli.c
new file mode 100644
index 0000000..c7726d2
--- /dev/null
+++ b/source3/utils/destroy_netlogon_creds_cli.c
@@ -0,0 +1,136 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * Garble the netlogon_creds_cli key for testing purposes
+ * Copyright (C) Volker Lendecke 2018
+ *
+ * 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/>.
+ */
+
+#include "includes.h"
+#include "system/filesys.h"
+#include <talloc.h>
+#include <tevent.h>
+#include "messages.h"
+#include "lib/util/talloc_stack.h"
+#include "popt_common.h"
+#include "lib/param/loadparm.h"
+#include "lib/param/param.h"
+#include "libcli/auth/netlogon_creds_cli.h"
+#include "lib/dbwrap/dbwrap.h"
+#include "lib/dbwrap/dbwrap_open.h"
+
+int main(int argc, const char *argv[])
+{
+	TALLOC_CTX *mem_ctx = talloc_stackframe();
+	struct tevent_context *ev;
+	struct messaging_context *msg_ctx;
+	struct loadparm_context *lp_ctx;
+	struct db_context *global_db;
+	struct netlogon_creds_cli_context *ctx;
+	struct netlogon_creds_CredentialState *creds;
+	NTSTATUS status;
+	int ret = 1;
+
+	smb_init_locale();
+
+	if (!lp_load_global(get_dyn_CONFIGFILE())) {
+		fprintf(stderr, "error opening config file %s. Error was %s\n",
+			get_dyn_CONFIGFILE(), strerror(errno));
+		goto done;
+	}
+
+	if (argc != 4) {
+		fprintf(stderr, "usage: %s cli_computer domain dc\n", argv[0]);
+		goto done;
+	}
+
+	lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_helpers());
+	if (lp_ctx == NULL) {
+		fprintf(stderr, "loadparm_init_s3 failed\n");
+		goto done;
+	}
+
+	ev = samba_tevent_context_init(mem_ctx);
+	if (ev == NULL) {
+		fprintf(stderr, "samba3_tevent_context_init failed\n");
+		goto done;
+	}
+	msg_ctx = messaging_init(mem_ctx, ev);
+	if (msg_ctx == NULL) {
+		fprintf(stderr, "messaging_init failed\n");
+		goto done;
+	}
+
+	global_db = db_open(
+		mem_ctx,
+		lpcfg_private_db_path(mem_ctx, lp_ctx, "netlogon_creds_cli"),
+		0, TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
+		O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_2,
+		DBWRAP_FLAG_OPTIMIZE_READONLY_ACCESS);
+	if (global_db == NULL) {
+		fprintf(stderr, "db_open failed\n");
+		goto done;
+	}
+
+	status = netlogon_creds_cli_set_global_db(&global_db);
+	if (!NT_STATUS_IS_OK(status)) {
+		fprintf(stderr,
+			"netlogon_creds_cli_set_global_db failed: %s\n",
+			nt_errstr(status));
+		goto done;
+	}
+
+	status = netlogon_creds_cli_context_global(
+		lp_ctx,
+		msg_ctx,
+		talloc_asprintf(mem_ctx, "%s$", argv[1]),
+		SEC_CHAN_WKSTA,
+		argv[3],
+		argv[2],
+		mem_ctx,
+		&ctx);
+	if (!NT_STATUS_IS_OK(status)) {
+		fprintf(stderr,
+			"netlogon_creds_cli_context_global failed: %s\n",
+			nt_errstr(status));
+		goto done;
+	}
+
+	status = netlogon_creds_cli_lock(ctx,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list