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

Stefan Metzmacher metze at samba.org
Wed Sep 5 16:45:02 UTC 2018


The branch, v4-7-test has been updated
       via  dccaea5 krb5-samba: interdomain trust uses different salt principal
       via  b31ba49 testprogs/blackbox: let test_trust_user_account.sh check the correct kerberos salt
       via  5f89783 testprogs/blackbox: add testit[_expect_failure]_grep() to subunit.sh
       via  fab6d42 samba-tool: add virtualKerberosSalt attribute to 'user getpassword/syncpasswords'
       via  f7b9267 s4:selftest: test kinit with the interdomain trust user account
       via  38d7e58 libds: rename UF_MACHINE_ACCOUNT_MASK to UF_TRUST_ACCOUNT_MASK
       via  17ed5e0 vfs_fruit: Don't unlink the main file
       via  3d8fdc3 torture: Make sure that fruit_ftruncate only unlinks streams
       via  0e8298e s3:smbd: add a comment stating that file_close_user() is redundant for SMB2
       via  b7c659a s3:smbd: let session logoff close files and tcons before deleting the session
       via  5125304 s3:smbd: reorder tcon global record deletion and closing files of a tcon
       via  6a179a5 selftest: add a durable handle test with delayed disconnect
       via  34b4b5b s4:selftest: reformat smb2_s3only list
       via  ada2165 vfs_delay_inject: adding delay to VFS calls
       via  fc3d25b s4:rpc_server/netlogon: don't treet trusted domains as primary in LogonGetDomainInfo()
       via  f77ea35 s4:rpc_server/netlogon: make use of talloc_zero_array() for the netr_OneDomainInfo array
       via  f73ef35 s4:rpc_server/netlogon: use samdb_domain_guid()/dsdb_trust_local_tdo_info() to build our netr_OneDomainInfo values
       via  ecffd79 s4:dsdb/common: add samdb_domain_guid() helper function
       via  14a2695 dsdb:util_trusts: add dsdb_trust_local_tdo_info() helper function
       via  467e6ae dsdb/util_trusts: domain_dn is an input parameter of dsdb_trust_crossref_tdo_info()
       via  8e81aa4 s4:torture/rpc/netlogon: verify the trusted domains output of LogonGetDomainInfo()
       via  435e096a s4:torture/rpc/netlogon: assert that cli_credentials_get_{workstation,password} don't return NULL
       via  592bdff smbd: Fix a memleak in async search ask sharemode
       via  8f1183d s3: util: Do not take over stderr when there is no log file
      from  1cdf976 s3: smbd: Ensure get_real_filename() copes with empty pathnames.

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


- Log -----------------------------------------------------------------
commit dccaea50ce57d6718ffd937cc8b97b64c98c0e79
Author: Alexander Bokovoy <ab at samba.org>
Date:   Fri Feb 16 18:15:28 2018 +0200

    krb5-samba: interdomain trust uses different salt principal
    
    Salt principal for the interdomain trust is krbtgt/DOMAIN at REALM where
    DOMAIN is the sAMAccountName without the dollar sign ($)
    
    The salt principal for the BLA$ user object was generated wrong.
    
    dn: CN=bla.base,CN=System,DC=w4edom-l4,DC=base
    securityIdentifier: S-1-5-21-4053568372-2049667917-3384589010
    trustDirection: 3
    trustPartner: bla.base
    trustPosixOffset: -2147483648
    trustType: 2
    trustAttributes: 8
    flatName: BLA
    
    dn: CN=BLA$,CN=Users,DC=w4edom-l4,DC=base
    userAccountControl: 2080
    primaryGroupID: 513
    objectSid: S-1-5-21-278041429-3399921908-1452754838-1597
    accountExpires: 9223372036854775807
    sAMAccountName: BLA$
    sAMAccountType: 805306370
    pwdLastSet: 131485652467995000
    
    The salt stored by Windows in the package_PrimaryKerberosBlob
    (within supplementalCredentials) seems to be
    'W4EDOM-L4.BASEkrbtgtBLA' for the above trust
    and Samba stores 'W4EDOM-L4.BASEBLA$'.
    
    While the salt used when building the keys from
    trustAuthOutgoing/trustAuthIncoming is
    'W4EDOM-L4.BASEkrbtgtBLA.BASE', which we handle correct.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13539
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Alexander Bokovoy <ab at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Wed Sep  5 03:57:22 CEST 2018 on sn-devel-144
    
    (cherry picked from commit f3e349bebc443133fdbe4e14b148ca8db8237060)
    
    Autobuild-User(v4-7-test): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(v4-7-test): Wed Sep  5 18:44:46 CEST 2018 on sn-devel-144

commit b31ba498125995dcb67451e4cb28cc27f9e799ed
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 4 10:53:52 2018 +0200

    testprogs/blackbox: let test_trust_user_account.sh check the correct kerberos salt
    
    This demonstrates the bug we currently have.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13539
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 1b31fa62567ec549e32c9177b322cfbfb3b6ec1a)

commit 5f8978321fea94bab94810bda4ea4b16928fd150
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 4 10:38:44 2018 +0200

    testprogs/blackbox: add testit[_expect_failure]_grep() to subunit.sh
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13539
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 8526feb100e59bc5a15ceb940e6cecce0de59247)

commit fab6d42c6b98e5809d2abef886b16fb73fa27d7b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 4 10:16:59 2018 +0200

    samba-tool: add virtualKerberosSalt attribute to 'user getpassword/syncpasswords'
    
    This might be useful for someone, but at least it's very useful for
    tests.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13539
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 39c281a23673691bab621de1a632d64df2c1c102)

commit f7b9267767c7989213fa2d20d356cd12756d6d89
Author: Alexander Bokovoy <ab at samba.org>
Date:   Fri Feb 16 18:15:28 2018 +0200

    s4:selftest: test kinit with the interdomain trust user account
    
    To test it, add a blackbox test that ensures we pass a keytab-based
    authentication with the trust user account for a trusted domain.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13539
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Alexander Bokovoy <ab at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 7df505298f71432d5adbcffccde8f97c117a57a6)

commit 38d7e58f4202b8cf27c5465fe64d870829813cf0
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 8 17:34:08 2018 +0100

    libds: rename UF_MACHINE_ACCOUNT_MASK to UF_TRUST_ACCOUNT_MASK
    
    The name UF_TRUST_ACCOUNT_MASK better reflects the use case and it's not
    yet used.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 8497d2090900b252853278f29a4aaf3bce7515da)

commit 17ed5e06c7fe1085067e7bff8066f91aabbf2855
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Aug 7 15:10:31 2018 +0200

    vfs_fruit: Don't unlink the main file
    
    The original fix for bug 13441 was missing a check that verifies that
    fruit_ftruncate() is actually called on a stream.
    
    Follow-up to
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13441
    
    Pair-Programmed-With: Volker Lendecke <vl at samba.org>
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Thu Aug 23 15:28:48 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 8c14234871820eacde46670d722a676fb5f3a46c)

commit 3d8fdc38453adb7a323b342c40226686bc9f3b41
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Aug 7 15:11:22 2018 +0200

    torture: Make sure that fruit_ftruncate only unlinks streams
    
    Follow-up to
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13441
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit c39ec64231b261fe4ada02f1f1b9aa344cf35bb5)

commit 0e8298e565657feee4fedec9e029d51504b903d8
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Aug 30 15:57:33 2018 +0200

    s3:smbd: add a comment stating that file_close_user() is redundant for SMB2
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13549
    
    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): Sat Sep  1 01:26:35 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 5d95f79f604d90c2646225a0f2470f05dd71e19e)

commit b7c659a4499dc7b62423ce930f7ce2128eded90e
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Aug 29 17:19:29 2018 +0200

    s3:smbd: let session logoff close files and tcons before deleting the session
    
    This avoids a race in durable handle reconnects if the reconnect comes
    in while the old session is still in the tear-down phase.
    
    The new session is supposed to rendezvous with and wait for destruction
    of the old session, which is internally implemented with
    dbwrap_watch_send() on the old session record.
    
    If the old session deletes the session record before calling
    file_close_user() which marks all file handles as disconnected, the
    durable handle reconnect in the new session will fail as the records are
    not yet marked as disconnected which is a prerequisite.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13549
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 8f6edcc1645e0ed35eaec914bd0b672500ce986c)

commit 51253045e827c14b14d527d1c48d037d8002588f
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Aug 30 15:50:02 2018 +0200

    s3:smbd: reorder tcon global record deletion and closing files of a tcon
    
    As such, this doesn't change overall behaviour, but in case we ever add
    semantics acting on tcon record changes via an API like
    dbwrap_watch_send(), this will make a difference as it enforces
    ordering.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13549
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (backported from commit b70b8503faded81b10859131f08486349876d132)

commit 6a179a5a9a8d790260c0285aaf4b5faed65a5aa3
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Aug 30 19:15:19 2018 +0200

    selftest: add a durable handle test with delayed disconnect
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13549
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 5508024a861e7c85e6c837552ad142aa1d5e8eca)

commit 34b4b5b7e22787820913d5f87fba4b14ebd88833
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Aug 31 08:28:46 2018 +0200

    s4:selftest: reformat smb2_s3only list
    
    No change besides reformatting the list to one entry per line.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13549
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 3255822f75163cb38e53f634a5c6b03d46bfaff1)

commit ada216537f9468aa33e5b0258b0b149dd06e4d8c
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Aug 30 17:27:08 2018 +0200

    vfs_delay_inject: adding delay to VFS calls
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13549
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 44840ba5b32a2ce7959fd3d7c87822b3159416d3)

commit fc3d25bb3acb1fc4da33e466a78b8a01d10035f0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 28 12:52:31 2018 +0200

    s4:rpc_server/netlogon: don't treet trusted domains as primary in LogonGetDomainInfo()
    
    We need to handle trusted domains differently than our primary
    domain. The most important part is that we don't return
    NETR_TRUST_FLAG_PRIMARY for them.
    
    NETR_TRUST_FLAG_{INBOUND,OUTBOUND,IN_FOREST} are the relavant flags
    for trusts.
    
    This is an example of what Windows returns in a complex trust
    environment:
    
         netr_LogonGetDomainInfo: struct netr_LogonGetDomainInfo
            out: struct netr_LogonGetDomainInfo
                return_authenticator     : *
                    return_authenticator: struct netr_Authenticator
                        cred: struct netr_Credential
                            data                     : f48b51ff12ff8c6c
                        timestamp                : Tue Aug 28 22:59:03 2018 CEST
                info                     : *
                    info                     : union netr_DomainInfo(case 1)
                    domain_info              : *
                        domain_info: struct netr_DomainInformation
                            primary_domain: struct netr_OneDomainInfo
                                domainname: struct lsa_StringLarge
                                    length                   : 0x0014 (20)
                                    size                     : 0x0016 (22)
                                    string                   : *
                                        string                   : 'W2012R2-L4'
                                dns_domainname: struct lsa_StringLarge
                                    length                   : 0x0020 (32)
                                    size                     : 0x0022 (34)
                                    string                   : *
                                        string                   : 'w2012r2-l4.base.'
                                dns_forestname: struct lsa_StringLarge
                                    length                   : 0x0020 (32)
                                    size                     : 0x0022 (34)
                                    string                   : *
                                        string                   : 'w2012r2-l4.base.'
                                domain_guid              : 0a133c91-8eac-4df0-96ac-ede69044a38b
                                domain_sid               : *
                                    domain_sid               : S-1-5-21-2930975464-1937418634-1288008815
                                trust_extension: struct netr_trust_extension_container
                                    length                   : 0x0000 (0)
                                    size                     : 0x0000 (0)
                                    info                     : NULL
                                dummy_string2: struct lsa_StringLarge
                                    length                   : 0x0000 (0)
                                    size                     : 0x0000 (0)
                                    string                   : NULL
                                dummy_string3: struct lsa_StringLarge
                                    length                   : 0x0000 (0)
                                    size                     : 0x0000 (0)
                                    string                   : NULL
                                dummy_string4: struct lsa_StringLarge
                                    length                   : 0x0000 (0)
                                    size                     : 0x0000 (0)
                                    string                   : NULL
                                dummy_long1              : 0x00000000 (0)
                                dummy_long2              : 0x00000000 (0)
                                dummy_long3              : 0x00000000 (0)
                                dummy_long4              : 0x00000000 (0)
                            trusted_domain_count     : 0x00000006 (6)
                            trusted_domains          : *
                                trusted_domains: ARRAY(6)
                                    trusted_domains: struct netr_OneDomainInfo
                                        domainname: struct lsa_StringLarge
                                            length                   : 0x000e (14)
                                            size                     : 0x0010 (16)
                                            string                   : *
                                                string                   : 'FREEIPA'
                                        dns_domainname: struct lsa_StringLarge
                                            length                   : 0x0018 (24)
                                            size                     : 0x001a (26)
                                            string                   : *
                                                string                   : 'freeipa.base'
                                        dns_forestname: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        domain_guid              : 00000000-0000-0000-0000-000000000000
                                        domain_sid               : *
                                            domain_sid               : S-1-5-21-429948374-2562621466-335716826
                                        trust_extension: struct netr_trust_extension_container
                                            length                   : 0x0010 (16)
                                            size                     : 0x0010 (16)
                                            info                     : *
                                                info: struct netr_trust_extension
                                                    length                   : 0x00000008 (8)
                                                    dummy                    : 0x00000000 (0)
                                                    size                     : 0x00000008 (8)
                                                    flags                    : 0x00000022 (34)
                                                           0: NETR_TRUST_FLAG_IN_FOREST
                                                           1: NETR_TRUST_FLAG_OUTBOUND
                                                           0: NETR_TRUST_FLAG_TREEROOT
                                                           0: NETR_TRUST_FLAG_PRIMARY
                                                           0: NETR_TRUST_FLAG_NATIVE
                                                           1: NETR_TRUST_FLAG_INBOUND
                                                           0: NETR_TRUST_FLAG_MIT_KRB5
                                                           0: NETR_TRUST_FLAG_AES
                                                    parent_index             : 0x00000000 (0)
                                                    trust_type               : LSA_TRUST_TYPE_UPLEVEL (2)
                                                    trust_attributes         : 0x00000008 (8)
                                                           0: LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE
                                                           0: LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY
                                                           0: LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN
                                                           1: LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE
                                                           0: LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION
                                                           0: LSA_TRUST_ATTRIBUTE_WITHIN_FOREST
                                                           0: LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL
                                                           0: LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION
                                        dummy_string2: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        dummy_string3: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        dummy_string4: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        dummy_long1              : 0x00000000 (0)
                                        dummy_long2              : 0x00000000 (0)
                                        dummy_long3              : 0x00000000 (0)
                                        dummy_long4              : 0x00000000 (0)
                                    trusted_domains: struct netr_OneDomainInfo
                                        domainname: struct lsa_StringLarge
                                            length                   : 0x0016 (22)
                                            size                     : 0x0018 (24)
                                            string                   : *
                                                string                   : 'S1-W2012-L4'
                                        dns_domainname: struct lsa_StringLarge
                                            length                   : 0x0036 (54)
                                            size                     : 0x0038 (56)
                                            string                   : *
                                                string                   : 's1-w2012-l4.w2012r2-l4.base'
                                        dns_forestname: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        domain_guid              : afe7fbde-af82-46cf-88a2-2df6920fc33e
                                        domain_sid               : *
                                            domain_sid               : S-1-5-21-1368093395-3821428921-3924672915
                                        trust_extension: struct netr_trust_extension_container
                                            length                   : 0x0010 (16)
                                            size                     : 0x0010 (16)
                                            info                     : *
                                                info: struct netr_trust_extension
                                                    length                   : 0x00000008 (8)
                                                    dummy                    : 0x00000000 (0)
                                                    size                     : 0x00000008 (8)
                                                    flags                    : 0x00000023 (35)
                                                           1: NETR_TRUST_FLAG_IN_FOREST
                                                           1: NETR_TRUST_FLAG_OUTBOUND
                                                           0: NETR_TRUST_FLAG_TREEROOT
                                                           0: NETR_TRUST_FLAG_PRIMARY
                                                           0: NETR_TRUST_FLAG_NATIVE
                                                           1: NETR_TRUST_FLAG_INBOUND
                                                           0: NETR_TRUST_FLAG_MIT_KRB5
                                                           0: NETR_TRUST_FLAG_AES
                                                    parent_index             : 0x00000004 (4)
                                                    trust_type               : LSA_TRUST_TYPE_UPLEVEL (2)
                                                    trust_attributes         : 0x00000020 (32)
                                                           0: LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE
                                                           0: LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY
                                                           0: LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN
                                                           0: LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE
                                                           0: LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION
                                                           1: LSA_TRUST_ATTRIBUTE_WITHIN_FOREST
                                                           0: LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL
                                                           0: LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION
                                        dummy_string2: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        dummy_string3: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        dummy_string4: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        dummy_long1              : 0x00000000 (0)
                                        dummy_long2              : 0x00000000 (0)
                                        dummy_long3              : 0x00000000 (0)
                                        dummy_long4              : 0x00000000 (0)
                                    trusted_domains: struct netr_OneDomainInfo
                                        domainname: struct lsa_StringLarge
                                            length                   : 0x0006 (6)
                                            size                     : 0x0008 (8)
                                            string                   : *
                                                string                   : 'BLA'
                                        dns_domainname: struct lsa_StringLarge
                                            length                   : 0x0010 (16)
                                            size                     : 0x0012 (18)
                                            string                   : *
                                                string                   : 'bla.base'
                                        dns_forestname: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        domain_guid              : 00000000-0000-0000-0000-000000000000
                                        domain_sid               : *
                                            domain_sid               : S-1-5-21-4053568372-2049667917-3384589010
                                        trust_extension: struct netr_trust_extension_container
                                            length                   : 0x0010 (16)
                                            size                     : 0x0010 (16)
                                            info                     : *
                                                info: struct netr_trust_extension
                                                    length                   : 0x00000008 (8)
                                                    dummy                    : 0x00000000 (0)
                                                    size                     : 0x00000008 (8)
                                                    flags                    : 0x00000022 (34)
                                                           0: NETR_TRUST_FLAG_IN_FOREST
                                                           1: NETR_TRUST_FLAG_OUTBOUND
                                                           0: NETR_TRUST_FLAG_TREEROOT
                                                           0: NETR_TRUST_FLAG_PRIMARY
                                                           0: NETR_TRUST_FLAG_NATIVE
                                                           1: NETR_TRUST_FLAG_INBOUND
                                                           0: NETR_TRUST_FLAG_MIT_KRB5
                                                           0: NETR_TRUST_FLAG_AES
                                                    parent_index             : 0x00000000 (0)
                                                    trust_type               : LSA_TRUST_TYPE_UPLEVEL (2)
                                                    trust_attributes         : 0x00000008 (8)
                                                           0: LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE
                                                           0: LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY
                                                           0: LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN
                                                           1: LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE
                                                           0: LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION
                                                           0: LSA_TRUST_ATTRIBUTE_WITHIN_FOREST
                                                           0: LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL
                                                           0: LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION
                                        dummy_string2: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        dummy_string3: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        dummy_string4: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        dummy_long1              : 0x00000000 (0)
                                        dummy_long2              : 0x00000000 (0)
                                        dummy_long3              : 0x00000000 (0)
                                        dummy_long4              : 0x00000000 (0)
                                    trusted_domains: struct netr_OneDomainInfo
                                        domainname: struct lsa_StringLarge
                                            length                   : 0x000c (12)
                                            size                     : 0x000e (14)
                                            string                   : *
                                                string                   : 'S4XDOM'
                                        dns_domainname: struct lsa_StringLarge
                                            length                   : 0x0016 (22)
                                            size                     : 0x0018 (24)
                                            string                   : *
                                                string                   : 's4xdom.base'
                                        dns_forestname: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        domain_guid              : 00000000-0000-0000-0000-000000000000
                                        domain_sid               : *
                                            domain_sid               : S-1-5-21-313966788-4060240134-2249344781
                                        trust_extension: struct netr_trust_extension_container
                                            length                   : 0x0010 (16)
                                            size                     : 0x0010 (16)
                                            info                     : *
                                                info: struct netr_trust_extension
                                                    length                   : 0x00000008 (8)
                                                    dummy                    : 0x00000000 (0)
                                                    size                     : 0x00000008 (8)
                                                    flags                    : 0x00000022 (34)
                                                           0: NETR_TRUST_FLAG_IN_FOREST
                                                           1: NETR_TRUST_FLAG_OUTBOUND
                                                           0: NETR_TRUST_FLAG_TREEROOT
                                                           0: NETR_TRUST_FLAG_PRIMARY
                                                           0: NETR_TRUST_FLAG_NATIVE
                                                           1: NETR_TRUST_FLAG_INBOUND
                                                           0: NETR_TRUST_FLAG_MIT_KRB5
                                                           0: NETR_TRUST_FLAG_AES
                                                    parent_index             : 0x00000000 (0)
                                                    trust_type               : LSA_TRUST_TYPE_UPLEVEL (2)
                                                    trust_attributes         : 0x00000008 (8)
                                                           0: LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE
                                                           0: LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY
                                                           0: LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN
                                                           1: LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE
                                                           0: LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION
                                                           0: LSA_TRUST_ATTRIBUTE_WITHIN_FOREST
                                                           0: LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL
                                                           0: LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION
                                        dummy_string2: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        dummy_string3: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        dummy_string4: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        dummy_long1              : 0x00000000 (0)
                                        dummy_long2              : 0x00000000 (0)
                                        dummy_long3              : 0x00000000 (0)
                                        dummy_long4              : 0x00000000 (0)
                                    trusted_domains: struct netr_OneDomainInfo
                                        domainname: struct lsa_StringLarge
                                            length                   : 0x0014 (20)
                                            size                     : 0x0016 (22)
                                            string                   : *
                                                string                   : 'W2012R2-L4'
                                        dns_domainname: struct lsa_StringLarge
                                            length                   : 0x001e (30)
                                            size                     : 0x0020 (32)
                                            string                   : *
                                                string                   : 'w2012r2-l4.base'
                                        dns_forestname: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        domain_guid              : 0a133c91-8eac-4df0-96ac-ede69044a38b
                                        domain_sid               : *
                                            domain_sid               : S-1-5-21-2930975464-1937418634-1288008815
                                        trust_extension: struct netr_trust_extension_container
                                            length                   : 0x0010 (16)
                                            size                     : 0x0010 (16)
                                            info                     : *
                                                info: struct netr_trust_extension
                                                    length                   : 0x00000008 (8)
                                                    dummy                    : 0x00000000 (0)
                                                    size                     : 0x00000008 (8)
                                                    flags                    : 0x0000001d (29)
                                                           1: NETR_TRUST_FLAG_IN_FOREST
                                                           0: NETR_TRUST_FLAG_OUTBOUND
                                                           1: NETR_TRUST_FLAG_TREEROOT
                                                           1: NETR_TRUST_FLAG_PRIMARY
                                                           1: NETR_TRUST_FLAG_NATIVE
                                                           0: NETR_TRUST_FLAG_INBOUND
                                                           0: NETR_TRUST_FLAG_MIT_KRB5
                                                           0: NETR_TRUST_FLAG_AES
                                                    parent_index             : 0x00000000 (0)
                                                    trust_type               : LSA_TRUST_TYPE_UPLEVEL (2)
                                                    trust_attributes         : 0x00000000 (0)
                                                           0: LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE
                                                           0: LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY
                                                           0: LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN
                                                           0: LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE
                                                           0: LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION
                                                           0: LSA_TRUST_ATTRIBUTE_WITHIN_FOREST
                                                           0: LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL
                                                           0: LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION
                                        dummy_string2: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        dummy_string3: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        dummy_string4: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        dummy_long1              : 0x00000000 (0)
                                        dummy_long2              : 0x00000000 (0)
                                        dummy_long3              : 0x00000000 (0)
                                        dummy_long4              : 0x00000000 (0)
                                    trusted_domains: struct netr_OneDomainInfo
                                        domainname: struct lsa_StringLarge
                                            length                   : 0x0016 (22)
                                            size                     : 0x0018 (24)
                                            string                   : *
                                                string                   : 'S2-W2012-L4'
                                        dns_domainname: struct lsa_StringLarge
                                            length                   : 0x004e (78)
                                            size                     : 0x0050 (80)
                                            string                   : *
                                                string                   : 's2-w2012-l4.s1-w2012-l4.w2012r2-l4.base'
                                        dns_forestname: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        domain_guid              : 29daace6-cded-4ce3-a754-7482a4d9127c
                                        domain_sid               : *
                                            domain_sid               : S-1-5-21-167342819-981449877-2130266853
                                        trust_extension: struct netr_trust_extension_container
                                            length                   : 0x0010 (16)
                                            size                     : 0x0010 (16)
                                            info                     : *
                                                info: struct netr_trust_extension
                                                    length                   : 0x00000008 (8)
                                                    dummy                    : 0x00000000 (0)
                                                    size                     : 0x00000008 (8)
                                                    flags                    : 0x00000001 (1)
                                                           1: NETR_TRUST_FLAG_IN_FOREST
                                                           0: NETR_TRUST_FLAG_OUTBOUND
                                                           0: NETR_TRUST_FLAG_TREEROOT
                                                           0: NETR_TRUST_FLAG_PRIMARY
                                                           0: NETR_TRUST_FLAG_NATIVE
                                                           0: NETR_TRUST_FLAG_INBOUND
                                                           0: NETR_TRUST_FLAG_MIT_KRB5
                                                           0: NETR_TRUST_FLAG_AES
                                                    parent_index             : 0x00000001 (1)
                                                    trust_type               : LSA_TRUST_TYPE_UPLEVEL (2)
                                                    trust_attributes         : 0x00000000 (0)
                                                           0: LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE
                                                           0: LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY
                                                           0: LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN
                                                           0: LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE
                                                           0: LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION
                                                           0: LSA_TRUST_ATTRIBUTE_WITHIN_FOREST
                                                           0: LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL
                                                           0: LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION
                                        dummy_string2: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        dummy_string3: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        dummy_string4: struct lsa_StringLarge
                                            length                   : 0x0000 (0)
                                            size                     : 0x0000 (0)
                                            string                   : NULL
                                        dummy_long1              : 0x00000000 (0)
                                        dummy_long2              : 0x00000000 (0)
                                        dummy_long3              : 0x00000000 (0)
                                        dummy_long4              : 0x00000000 (0)
                            lsa_policy: struct netr_LsaPolicyInformation
                                policy_size              : 0x00000000 (0)
                                policy                   : NULL
                            dns_hostname: struct lsa_StringLarge
                                length                   : 0x0036 (54)
                                size                     : 0x0038 (56)
                                string                   : *
                                    string                   : 'torturetest.w2012r2-l4.base'
                            dummy_string2: struct lsa_StringLarge
                                length                   : 0x0000 (0)
                                size                     : 0x0000 (0)
                                string                   : NULL
                            dummy_string3: struct lsa_StringLarge
                                length                   : 0x0000 (0)
                                size                     : 0x0000 (0)
                                string                   : NULL
                            dummy_string4: struct lsa_StringLarge
                                length                   : 0x0000 (0)
                                size                     : 0x0000 (0)
                                string                   : NULL
                            workstation_flags        : 0x00000003 (3)
                                   1: NETR_WS_FLAG_HANDLES_INBOUND_TRUSTS
                                   1: NETR_WS_FLAG_HANDLES_SPN_UPDATE
                            supported_enc_types      : 0x0000001f (31)
                                   1: KERB_ENCTYPE_DES_CBC_CRC
                                   1: KERB_ENCTYPE_DES_CBC_MD5
                                   1: KERB_ENCTYPE_RC4_HMAC_MD5
                                   1: KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96
                                   1: KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96
                                   0: KERB_ENCTYPE_FAST_SUPPORTED
                                   0: KERB_ENCTYPE_COMPOUND_IDENTITY_SUPPORTED
                                   0: KERB_ENCTYPE_CLAIMS_SUPPORTED
                                   0: KERB_ENCTYPE_RESOURCE_SID_COMPRESSION_DISABLED
                            dummy_long3              : 0x00000000 (0)
                            dummy_long4              : 0x00000000 (0)
                result                   : NT_STATUS_OK
    
    Best viewed with: git show --histogram -w
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11517
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 2099add0657126e4a5427ec2db0fe8025478b355)

commit f77ea3554e3a94afd3ceb4e06829ba5d89bc9d28
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 28 16:30:17 2018 +0200

    s4:rpc_server/netlogon: make use of talloc_zero_array() for the netr_OneDomainInfo array
    
    It's much safer than having uninitialized memory when we hit an error
    case.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11517
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit ef0b489ad0d93199e08415dd895da5cfe2d1c11a)

commit f73ef3564f701b26143130823cfb72bb7d06fabb
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 28 11:46:16 2018 +0200

    s4:rpc_server/netlogon: use samdb_domain_guid()/dsdb_trust_local_tdo_info() to build our netr_OneDomainInfo values
    
    The logic for constructing the values for our own primary domain differs
    from the values of trusted domains. In order to make the code easier to
    understand we have a new fill_our_one_domain_info() helper that
    only takes care of our primary domain.
    
    The cleanup for the trust case will follow in a separate commit.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11517
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 61333f7787d78e3ec5c7bd2874d5a0f1f536275a)

commit ecffd79055789a058bee6ddf5dbd9913013a1066
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 28 11:52:27 2018 +0200

    s4:dsdb/common: add samdb_domain_guid() helper function
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11517
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 0e442e094240abbf79aaca00a9d1a053a200a7e8)

commit 14a2695de001c58b82618aeec79c7be0b2d956e9
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 1 23:09:26 2018 +0100

    dsdb:util_trusts: add dsdb_trust_local_tdo_info() helper function
    
    This is similar to dsdb_trust_xref_tdo_info(), but will also work
    if we ever support more than one domain in our forest.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11517
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit c1b0ac95db5c6112d90356c7ada8c3d445e9b668)

commit 467e6aeca631369a436bd5d3d96690f3552c3d67
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 1 23:08:08 2018 +0100

    dsdb/util_trusts: domain_dn is an input parameter of dsdb_trust_crossref_tdo_info()
    
    We should not overwrite it within the function.
    Currently it doesn't matter as we don't have multiple domains
    within our forest, but that will change in future.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11517
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit f5f96f558b499770cdeb3d38998167a387e058b9)

commit 8e81aa4ec37e0f45a338d5741cca93bf7094ae84
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 28 17:46:46 2018 +0200

    s4:torture/rpc/netlogon: verify the trusted domains output of LogonGetDomainInfo()
    
    This makes sure we don't treat trusted domains in the same way we treat
    our primary domain.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11517
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit d5dd8fdc647d6a202c5da0451d395116c2cd92b9)

commit 435e096a628e1ef6ee91d0ebb1d8c312afd14e3c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Sep 3 09:55:18 2018 +0200

    s4:torture/rpc/netlogon: assert that cli_credentials_get_{workstation,password} don't return NULL
    
    This is better that generating a segfault while dereferencing a NULL
    pointer later.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11517
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit dffc182c6943d21513d8db9f6cf66bdc09206b17)

commit 592bdff15e01b83111aa35291dd9434a18cf5c2c
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Sep 3 15:54:48 2018 +0200

    smbd: Fix a memleak in async search ask sharemode
    
    fetch_share_mode_unlocked_parser() takes a "struct
    fetch_share_mode_unlocked_state *" as
    "private_data". fetch_share_mode_send() used a talloc_zero'ed "struct
    share_mode_lock". This lead to the parser putting a "struct
    share_mode_lock on the NULL talloc_context where nobody really picked it
    up.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13602
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 0bd109b733fbce774feae2142d25f7e828b56bcb)

commit 8f1183d53aa2e1b282d2954c11495552546a9899
Author: Paulo Alcantara <paulo at paulo.ac>
Date:   Fri Aug 17 11:30:16 2018 -0300

    s3: util: Do not take over stderr when there is no log file
    
    In case we don't have either a /var/log/samba directory, or pass a
    non-existent log directory through '-l' option, all commands that are
    daemonized with '-D' option hang when executed within a subshell.
    
    An example on how to trigger that:
    
      # rm -r /var/log/samba
      # s=$(nmbd -D -s /etc/samba/smb.conf -l /foo123)
      (never returns)
    
    So, when the above command is executed within a subshell the following
    happens:
    
      (a) Parent shell creates a pipe, sets write side of it to fd 1
        (stdout), call read() on read-side fd, forks off a new child process
        and then executes nmbd in it.
      (b) nmbd sets up initial logging to go through fd 1 (stdout) by
        calling setup_logging(..., DEBUG_DEFAULT_STDOUT). 'state.fd' is now
        set to 1.
      (c) reopen_logs() is called by the first time which then calls
        reopen_logs_internal()
      (d) in reopen_logs_internal(), it attempts to create log.nmbd file in
        /foo123 directory and fails because directory doesn't exist.
      (e) Regardless whether the log file was created or not, it calls
        dup2(state.fd, 2) which dups fd 1 into fd 2.
      (f) At some point, fd 0 and 1 are closed and set to /dev/null
    
    The problem with that is because parent shell in (a) is still blocked in
    read() call and the new write side of the pipe is now fd 2 -- after
    dup2() in (e) -- and remains unclosed.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13578
    
    Signed-off-by: Paulo Alcantara <palcantara at suse.de>
    Reviewed-by: Jim McDonough <jmcd at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Sat Aug 18 01:32:25 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 41aa55f49233ea7682cf14e5a7062617274434ce)

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

Summary of changes:
 auth/credentials/credentials_krb5.c                |  16 +-
 lib/krb5_wrap/krb5_samba.c                         |  61 ++++--
 lib/krb5_wrap/krb5_samba.h                         |   2 +-
 lib/util/debug.c                                   |   7 +-
 libds/common/flags.h                               |   2 +-
 python/samba/netcmd/user.py                        |  24 +++
 selftest/target/Samba3.pm                          |   8 +
 source3/locking/share_mode_lock.c                  |  13 +-
 source3/modules/vfs_delay_inject.c                 |  58 +++++
 source3/modules/vfs_fruit.c                        |   6 +-
 source3/modules/wscript_build                      |   7 +
 source3/passdb/machine_account_secrets.c           |   3 +-
 .../script/tests/test_durable_handle_reconnect.sh  |  21 ++
 source3/selftest/tests.py                          |   5 +-
 source3/smbd/smbXsrv_session.c                     |  52 +++--
 source3/smbd/smbXsrv_tcon.c                        |  38 ++--
 source3/wscript                                    |   1 +
 source4/dsdb/common/util.c                         |  55 +++++
 source4/dsdb/common/util_trusts.c                  |  22 +-
 source4/dsdb/samdb/ldb_modules/password_hash.c     |   6 +-
 source4/rpc_server/netlogon/dcerpc_netlogon.c      | 234 +++++++++++++++------
 source4/selftest/tests.py                          |   9 +-
 source4/torture/rpc/netlogon.c                     | 146 ++++++++++++-
 source4/torture/smb2/durable_v2_open.c             |  95 +++++++++
 source4/torture/smb2/smb2.c                        |   2 +
 source4/torture/vfs/fruit.c                        |  45 ++++
 testprogs/blackbox/subunit.sh                      |  50 +++++
 testprogs/blackbox/test_trust_user_account.sh      |  58 +++++
 28 files changed, 890 insertions(+), 156 deletions(-)
 create mode 100644 source3/modules/vfs_delay_inject.c
 create mode 100755 source3/script/tests/test_durable_handle_reconnect.sh
 create mode 100755 testprogs/blackbox/test_trust_user_account.sh


Changeset truncated at 500 lines:

diff --git a/auth/credentials/credentials_krb5.c b/auth/credentials/credentials_krb5.c
index b88497d..fb46797 100644
--- a/auth/credentials/credentials_krb5.c
+++ b/auth/credentials/credentials_krb5.c
@@ -34,6 +34,7 @@
 #include "auth/kerberos/kerberos_util.h"
 #include "auth/kerberos/pac_utils.h"
 #include "param/param.h"
+#include "../libds/common/flags.h"
 
 static void cli_credentials_invalidate_client_gss_creds(
 					struct cli_credentials *cred,
@@ -971,7 +972,7 @@ _PUBLIC_ int cli_credentials_get_keytab(struct cli_credentials *cred,
 	const char *upn = NULL;
 	const char *realm = cli_credentials_get_realm(cred);
 	char *salt_principal = NULL;
-	bool is_computer = false;
+	uint32_t uac_flags = 0;
 
 	if (cred->keytab_obtained >= (MAX(cred->principal_obtained, 
 					  cred->username_obtained))) {
@@ -996,9 +997,15 @@ _PUBLIC_ int cli_credentials_get_keytab(struct cli_credentials *cred,
 
 	switch (cred->secure_channel_type) {
 	case SEC_CHAN_WKSTA:
-	case SEC_CHAN_BDC:
 	case SEC_CHAN_RODC:
-		is_computer = true;
+		uac_flags = UF_WORKSTATION_TRUST_ACCOUNT;
+		break;
+	case SEC_CHAN_BDC:
+		uac_flags = UF_SERVER_TRUST_ACCOUNT;
+		break;
+	case SEC_CHAN_DOMAIN:
+	case SEC_CHAN_DNS_DOMAIN:
+		uac_flags = UF_INTERDOMAIN_TRUST_ACCOUNT;
 		break;
 	default:
 		upn = cli_credentials_get_principal(cred, mem_ctx);
@@ -1006,13 +1013,14 @@ _PUBLIC_ int cli_credentials_get_keytab(struct cli_credentials *cred,
 			TALLOC_FREE(mem_ctx);
 			return ENOMEM;
 		}
+		uac_flags = UF_NORMAL_ACCOUNT;
 		break;
 	}
 
 	ret = smb_krb5_salt_principal(realm,
 				      username, /* sAMAccountName */
 				      upn, /* userPrincipalName */
-				      is_computer,
+				      uac_flags,
 				      mem_ctx,
 				      &salt_principal);
 	if (ret) {
diff --git a/lib/krb5_wrap/krb5_samba.c b/lib/krb5_wrap/krb5_samba.c
index 0ba8aae..73e89ea 100644
--- a/lib/krb5_wrap/krb5_samba.c
+++ b/lib/krb5_wrap/krb5_samba.c
@@ -24,6 +24,7 @@
 #include "system/filesys.h"
 #include "krb5_samba.h"
 #include "lib/crypto/crypto.h"
+#include "../libds/common/flags.h"
 
 #ifdef HAVE_COM_ERR_H
 #include <com_err.h>
@@ -445,8 +446,7 @@ int smb_krb5_get_pw_salt(krb5_context context,
  * @param[in]  userPrincipalName  The userPrincipalName attribute of the object
  *                                or NULL is not available.
  *
- * @param[in]  is_computer        The indication of the object includes
- *                                objectClass=computer.
+ * @param[in]  uac_flags          UF_ACCOUNT_TYPE_MASKed userAccountControl field
  *
  * @param[in]  mem_ctx            The TALLOC_CTX to allocate _salt_principal.
  *
@@ -459,7 +459,7 @@ int smb_krb5_get_pw_salt(krb5_context context,
 int smb_krb5_salt_principal(const char *realm,
 			    const char *sAMAccountName,
 			    const char *userPrincipalName,
-			    bool is_computer,
+			    uint32_t uac_flags,
 			    TALLOC_CTX *mem_ctx,
 			    char **_salt_principal)
 {
@@ -480,6 +480,23 @@ int smb_krb5_salt_principal(const char *realm,
 		return EINVAL;
 	}
 
+	if (uac_flags & ~UF_ACCOUNT_TYPE_MASK) {
+		/*
+		 * catch callers which still
+		 * pass 'true'.
+		 */
+		TALLOC_FREE(frame);
+		return EINVAL;
+	}
+	if (uac_flags == 0) {
+		/*
+		 * catch callers which still
+		 * pass 'false'.
+		 */
+		TALLOC_FREE(frame);
+		return EINVAL;
+	}
+
 	upper_realm = strupper_talloc(frame, realm);
 	if (upper_realm == NULL) {
 		TALLOC_FREE(frame);
@@ -493,7 +510,7 @@ int smb_krb5_salt_principal(const char *realm,
 	/*
 	 * Determine a salting principal
 	 */
-	if (is_computer) {
+	if (uac_flags & UF_TRUST_ACCOUNT_MASK) {
 		int computer_len = 0;
 		char *tmp = NULL;
 
@@ -502,20 +519,32 @@ int smb_krb5_salt_principal(const char *realm,
 			computer_len -= 1;
 		}
 
-		tmp = talloc_asprintf(frame, "host/%*.*s.%s",
-				      computer_len, computer_len,
-				      sAMAccountName, realm);
-		if (tmp == NULL) {
-			TALLOC_FREE(frame);
-			return ENOMEM;
-		}
+		if (uac_flags & UF_INTERDOMAIN_TRUST_ACCOUNT) {
+			principal = talloc_asprintf(frame, "krbtgt/%*.*s",
+						    computer_len, computer_len,
+						    sAMAccountName);
+			if (principal == NULL) {
+				TALLOC_FREE(frame);
+				return ENOMEM;
+			}
+		} else {
 
-		principal = strlower_talloc(frame, tmp);
-		TALLOC_FREE(tmp);
-		if (principal == NULL) {
-			TALLOC_FREE(frame);
-			return ENOMEM;
+			tmp = talloc_asprintf(frame, "host/%*.*s.%s",
+					      computer_len, computer_len,
+					      sAMAccountName, realm);
+			if (tmp == NULL) {
+				TALLOC_FREE(frame);
+				return ENOMEM;
+			}
+
+			principal = strlower_talloc(frame, tmp);
+			TALLOC_FREE(tmp);
+			if (principal == NULL) {
+				TALLOC_FREE(frame);
+				return ENOMEM;
+			}
 		}
+
 		principal_len = strlen(principal);
 
 	} else if (userPrincipalName != NULL) {
diff --git a/lib/krb5_wrap/krb5_samba.h b/lib/krb5_wrap/krb5_samba.h
index 315d3c3..8305c1f 100644
--- a/lib/krb5_wrap/krb5_samba.h
+++ b/lib/krb5_wrap/krb5_samba.h
@@ -353,7 +353,7 @@ int smb_krb5_get_pw_salt(krb5_context context,
 int smb_krb5_salt_principal(const char *realm,
 			    const char *sAMAccountName,
 			    const char *userPrincipalName,
-			    bool is_computer,
+			    uint32_t uac_flags,
 			    TALLOC_CTX *mem_ctx,
 			    char **_salt_principal);
 int smb_krb5_salt_principal2data(krb5_context context,
diff --git a/lib/util/debug.c b/lib/util/debug.c
index 135cdb6..8033c80 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -1069,8 +1069,11 @@ bool reopen_logs_internal(void)
 	force_check_log_size();
 	(void)umask(oldumask);
 
-	/* Take over stderr to catch output into logs */
-	if (state.fd > 0) {
+	/*
+	 * If log file was opened or created successfully, take over stderr to
+	 * catch output into logs.
+	 */
+	if (new_fd != -1) {
 		if (dup2(state.fd, 2) == -1) {
 			/* Close stderr too, if dup2 can't point it -
 			   at the logfile.  There really isn't much
diff --git a/libds/common/flags.h b/libds/common/flags.h
index 88b93cb..11242e1 100644
--- a/libds/common/flags.h
+++ b/libds/common/flags.h
@@ -53,7 +53,7 @@
 #define UF_PARTIAL_SECRETS_ACCOUNT		0x04000000
 #define UF_USE_AES_KEYS                         0x08000000
 
-#define UF_MACHINE_ACCOUNT_MASK (\
+#define UF_TRUST_ACCOUNT_MASK (\
 		UF_INTERDOMAIN_TRUST_ACCOUNT |\
 		UF_WORKSTATION_TRUST_ACCOUNT |\
 		UF_SERVER_TRUST_ACCOUNT \
diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py
index 3b744a3..a82ac76 100644
--- a/python/samba/netcmd/user.py
+++ b/python/samba/netcmd/user.py
@@ -199,6 +199,9 @@ for (alg, attr) in [("5", "virtualCryptSHA256"), ("6", "virtualCryptSHA512")]:
 for x in range(1, 30):
     virtual_attributes["virtualWDigest%02d" % x] = {}
 
+# Add Kerberos virtual attributes
+virtual_attributes["virtualKerberosSalt"] = {}
+
 virtual_attributes_help  = "The attributes to display (comma separated). "
 virtual_attributes_help += "Possible supported virtual attributes: %s" % ", ".join(sorted(virtual_attributes.keys()))
 if len(disabled_virtual_attributes) != 0:
@@ -1217,6 +1220,16 @@ class GetPasswordCommand(Command):
             # first matching scheme
             return (None, scheme_match)
 
+        def get_kerberos_ctr():
+            primary_krb5 = get_package("Primary:Kerberos-Newer-Keys")
+            if primary_krb5 is None:
+                primary_krb5 = get_package("Primary:Kerberos")
+            if primary_krb5 is None:
+                return (0, None)
+            krb5_blob = ndr_unpack(drsblobs.package_PrimaryKerberosBlob,
+                                   primary_krb5)
+            return (krb5_blob.version, krb5_blob.ctr)
+
         # We use sort here in order to have a predictable processing order
         for a in sorted(virtual_attributes.keys()):
             if not a.lower() in lower_attrs:
@@ -1268,6 +1281,11 @@ class GetPasswordCommand(Command):
                 v = get_package("Primary:SambaGPG", min_idx=-1)
                 if v is None:
                     continue
+            elif a == "virtualKerberosSalt":
+                (krb5_v, krb5_ctr) = get_kerberos_ctr()
+                if krb5_v not in [3, 4]:
+                    continue
+                v = krb5_ctr.salt.string
             elif a.startswith("virtualWDigest"):
                 primary_wdigest = get_package("Primary:WDigest")
                 if primary_wdigest is None:
@@ -1384,6 +1402,9 @@ for which virtual attributes are supported in your environment):
                         https://msdn.microsoft.com/en-us/library/cc245680.aspx
                           is incorrect
 
+   virtualKerberosSalt:   This results the salt string that is used to compute
+                          Kerberos keys from a UTF-8 cleartext password.
+
    virtualSambaGPG:       The raw cleartext as stored in the
                           'Primary:SambaGPG' buffer inside of the
                           supplementalCredentials attribute.
@@ -1551,6 +1572,9 @@ for supported virtual attributes in your environment):
                         https://msdn.microsoft.com/en-us/library/cc245680.aspx
                           is incorrect.
 
+   virtualKerberosSalt:   This results the salt string that is used to compute
+                          Kerberos keys from a UTF-8 cleartext password.
+
    virtualSambaGPG:       The raw cleartext as stored in the
                           'Primary:SambaGPG' buffer inside of the
                           supplementalCredentials attribute.
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 9c41b8c..25c134e 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -2057,6 +2057,14 @@ sub provision($$$$$$$$$)
 	copy = tmp
 	vfs objects = error_inject
 	include = $libdir/error_inject.conf
+
+[delay_inject]
+	copy = tmp
+	vfs objects = delay_inject
+	kernel share modes = no
+	kernel oplocks = no
+	posix locking = no
+	include = $libdir/delay_inject.conf
 	";
 	close(CONF);
 
diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c
index cee0045..ec17bca 100644
--- a/source3/locking/share_mode_lock.c
+++ b/source3/locking/share_mode_lock.c
@@ -673,7 +673,7 @@ static void fetch_share_mode_done(struct tevent_req *subreq);
 struct fetch_share_mode_state {
 	struct file_id id;
 	TDB_DATA key;
-	struct share_mode_lock *lck;
+	struct fetch_share_mode_unlocked_state parser_state;
 	enum dbwrap_req_state req_state;
 };
 
@@ -721,17 +721,14 @@ struct tevent_req *fetch_share_mode_send(TALLOC_CTX *mem_ctx,
 
 	state->id = id;
 	state->key = locking_key(&state->id);
-	state->lck = talloc_zero(state, struct share_mode_lock);
-	if (tevent_req_nomem(state->lck, req)) {
-		return tevent_req_post(req, ev);
-	}
+	state->parser_state.mem_ctx = state;
 
 	subreq = dbwrap_parse_record_send(state,
 					  ev,
 					  lock_db,
 					  state->key,
 					  fetch_share_mode_unlocked_parser,
-					  state->lck,
+					  &state->parser_state,
 					  &state->req_state);
 	if (tevent_req_nomem(subreq, req)) {
 		return tevent_req_post(req, ev);
@@ -775,12 +772,12 @@ NTSTATUS fetch_share_mode_recv(struct tevent_req *req,
 		return status;
 	}
 
-	if (state->lck->data == NULL) {
+	if (state->parser_state.lck->data == NULL) {
 		tevent_req_received(req);
 		return NT_STATUS_NOT_FOUND;
 	}
 
-	lck = talloc_move(mem_ctx, &state->lck);
+	lck = talloc_move(mem_ctx, &state->parser_state.lck);
 
 	if (DEBUGLEVEL >= 10) {
 		DBG_DEBUG("share_mode_data:\n");
diff --git a/source3/modules/vfs_delay_inject.c b/source3/modules/vfs_delay_inject.c
new file mode 100644
index 0000000..21fea9b
--- /dev/null
+++ b/source3/modules/vfs_delay_inject.c
@@ -0,0 +1,58 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  Samba VFS module for delay injection in VFS calls
+ *  Copyright (C) Ralph Boehme 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 "smbd/smbd.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_VFS
+
+static void inject_delay(const char *vfs_func, vfs_handle_struct *handle)
+{
+	int delay;
+
+	delay = lp_parm_int(SNUM(handle->conn), "delay_inject", vfs_func, 0);
+	if (delay == 0) {
+		return;
+	}
+
+	DBG_DEBUG("Injected delay for [%s] of [%d] ms\n", vfs_func, delay);
+
+	smb_msleep(delay);
+}
+
+static int vfs_delay_inject_ntimes(vfs_handle_struct *handle,
+				   const struct smb_filename *smb_fname,
+				   struct smb_file_time *ft)
+{
+	inject_delay("ntimes", handle);
+
+	return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
+}
+
+static struct vfs_fn_pointers vfs_delay_inject_fns = {
+	.ntimes_fn = vfs_delay_inject_ntimes,
+};
+
+static_decl_vfs;
+NTSTATUS vfs_delay_inject_init(TALLOC_CTX *ctx)
+{
+	return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "delay_inject",
+				&vfs_delay_inject_fns);
+}
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 684fcd6..f3e6871 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -5514,7 +5514,11 @@ static int fruit_ftruncate(struct vfs_handle_struct *handle,
 		  (intmax_t)offset);
 
 	if (fio == NULL) {
-		if (offset == 0 && global_fruit_config.nego_aapl) {
+		if (offset == 0 &&
+		    global_fruit_config.nego_aapl &&
+		    is_ntfs_stream_smb_fname(fsp->fsp_name) &&
+		    !is_ntfs_default_stream_smb_fname(fsp->fsp_name))
+		{
 			return SMB_VFS_NEXT_UNLINK(handle, fsp->fsp_name);
 		}
 		return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
diff --git a/source3/modules/wscript_build b/source3/modules/wscript_build
index a6a01f9..61b776f 100644
--- a/source3/modules/wscript_build
+++ b/source3/modules/wscript_build
@@ -516,3 +516,10 @@ bld.SAMBA3_MODULE('vfs_error_inject',
                  init_function='',
                  internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_error_inject'),
                  enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_error_inject'))
+
+bld.SAMBA3_MODULE('vfs_delay_inject',
+                 subsystem='vfs',
+                 source='vfs_delay_inject.c',
+                 init_function='',
+                 internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_delay_inject'),
+                 enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_delay_inject'))
diff --git a/source3/passdb/machine_account_secrets.c b/source3/passdb/machine_account_secrets.c
index d36fa26..ce435ef 100644
--- a/source3/passdb/machine_account_secrets.c
+++ b/source3/passdb/machine_account_secrets.c
@@ -36,6 +36,7 @@
 #include "lib/crypto/crypto.h"
 #include "lib/krb5_wrap/krb5_samba.h"
 #include "lib/util/time_basic.h"
+#include "../libds/common/flags.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_PASSDB
@@ -1600,7 +1601,7 @@ NTSTATUS secrets_store_JoinCtx(const struct libnet_JoinCtx *r)
 		ret = smb_krb5_salt_principal(info->domain_info.dns_domain.string,
 					      info->account_name,
 					      NULL /* userPrincipalName */,
-					      true /* is_computer */,
+					      UF_WORKSTATION_TRUST_ACCOUNT,
 					      info, &p);
 		if (ret != 0) {
 			status = krb5_to_nt_status(ret);
diff --git a/source3/script/tests/test_durable_handle_reconnect.sh b/source3/script/tests/test_durable_handle_reconnect.sh
new file mode 100755
index 0000000..bca8e2d
--- /dev/null
+++ b/source3/script/tests/test_durable_handle_reconnect.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# Test Durable Handle reconnect with injected delay in the disconnect.
+#
+# Copyright (C) 2018 Ralph Boehme
+
+. $(dirname $0)/../../../testprogs/blackbox/subunit.sh
+failed=0
+
+delay_inject_conf=$(dirname $SMB_CONF_PATH)/delay_inject.conf
+
+echo 'delay_inject:ntimes = 5000' > $delay_inject_conf
+
+testit "durable_v2_delay" $VALGRIND \
+       $BINDIR/smbtorture //$SERVER_IP/delay_inject \
+       -U$USERNAME%$PASSWORD  smb2.durable-v2-delay ||
+	failed=$(expr $failed + 1)
+
+rm $delay_inject_conf
+
+testok $0 $failed
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 9362627..1e9959c 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -457,7 +457,7 @@ for t in tests:
     elif t == "rpc.samr.passwords.validate":
         plansmbtorture4testsuite(t, "nt4_dc", 'ncacn_ip_tcp:$SERVER_IP[seal] -U$USERNAME%$PASSWORD', 'over ncacn_ip_tcp ')
         plansmbtorture4testsuite(t, "ad_dc", 'ncacn_ip_tcp:$SERVER_IP[seal] -U$USERNAME%$PASSWORD', 'over ncacn_ip_tcp ')
-    elif t == "smb2.durable-open" or t == "smb2.durable-v2-open" or t == "smb2.replay":
+    elif t == "smb2.durable-open" or t == "smb2.durable-v2-open" or t == "smb2.replay" or t == "smb2.durable-v2-delay":
         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/durable -U$USERNAME%$PASSWORD')
         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER_IP/durable -U$USERNAME%$PASSWORD')
     elif t == "base.rw1":
@@ -602,6 +602,9 @@ plantestsuite("samba3.blackbox.net_tdb", "simpleserver:local",
 plantestsuite("samba3.blackbox.smbd_error", "simpleserver:local",
               [ os.path.join(samba3srcdir, "script/tests/test_smbd_error.sh") ])
 
+plantestsuite("samba3.blackbox.durable_v2_delay", "simpleserver:local",


-- 
Samba Shared Repository



More information about the samba-cvs mailing list