The branch, v4-10-test has been updated
       via  e3f51924971 libcli/smb: send SMB2_NETNAME_NEGOTIATE_CONTEXT_ID
       via  b6a50185389 libcli/smb: add new COMPRESSION and NETNAME negotiate 
context ids
       via  cb6a155b385 s3:ldap: Fix join with don't exists machine account
      from  2dbc9dce493 ctdb: fix compilation on systems with glibc robust 
mutexes

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


- Log -----------------------------------------------------------------
commit e3f51924971c9389659ec7b89c7a581e3315bda4
Author: Stefan Metzmacher <me...@samba.org>
Date:   Thu Jul 25 14:38:26 2019 +0200

    libcli/smb: send SMB2_NETNAME_NEGOTIATE_CONTEXT_ID
    
    Note: Unlike the current documentation, the utf16 string
    is not null-terminated, that matches Windows Server 1903
    as a client.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14055
    RN: Add the target server name of SMB 3.1.1 connections
    as a hint to load balancers or servers with "multi-tenancy"
    support.
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Aurelien Aptel <aap...@suse.com>
    (similar to commit 21f6cece543dd791e0f4636458bfe9819823420c)
    
    Autobuild-User(v4-10-test): Karolin Seeger <ksee...@samba.org>
    Autobuild-Date(v4-10-test): Wed Sep 11 11:33:00 UTC 2019 on sn-devel-144

commit b6a5018538903218c67742b5a732bf61bf447ab6
Author: Stefan Metzmacher <me...@samba.org>
Date:   Thu Jul 25 14:37:31 2019 +0200

    libcli/smb: add new COMPRESSION and NETNAME negotiate context ids
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14055
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Aurelien Aptel <aap...@suse.com>
    (cherry picked from commit e10b90f33bb812600886656a1124e2d434416563)

commit cb6a155b3857734d4bb20c7e9065efb428aae38c
Author: Evgeny Sinelnikov <s...@altlinux.org>
Date:   Wed Jul 31 23:17:20 2019 +0400

    s3:ldap: Fix join with don't exists machine account
    
    Add check for requested replies of existing machine object during join
    machine to domain. This solves regression fail during join with error:
    "None of the information to be translated has been translated."
    
    https://bugzilla.samba.org/show_bug.cgi?id=14007
    
    Reviewed-by: Guenther Deschner <g...@samba.org>
    Reviewed-by: Alexander Bokovoy <a...@samba.org>
    Reviewed-by: Stefan Metzmacher <me...@samba.org>
    
    Autobuild-User(master): Günther Deschner <g...@samba.org>
    Autobuild-Date(master): Wed Sep  4 17:02:37 UTC 2019 on sn-devel-184
    
    (cherry picked from commit ad4ef1657e9b2a088a3bfadcce196cfcceead1dc)

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

Summary of changes:
 libcli/smb/smb2_constants.h |  2 ++
 libcli/smb/smbXcli_base.c   | 17 +++++++++++++++++
 source3/libads/ldap.c       |  5 +++--
 3 files changed, 22 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/smb/smb2_constants.h b/libcli/smb/smb2_constants.h
index f6edf6ba109..e50e437d058 100644
--- a/libcli/smb/smb2_constants.h
+++ b/libcli/smb/smb2_constants.h
@@ -131,6 +131,8 @@
 /* Types of SMB2 Negotiate Contexts - only in dialect >= 0x310 */
 #define SMB2_PREAUTH_INTEGRITY_CAPABILITIES 0x0001
 #define SMB2_ENCRYPTION_CAPABILITIES        0x0002
+#define SMB2_COMPRESSION_CAPABILITIES       0x0003
+#define SMB2_NETNAME_NEGOTIATE_CONTEXT_ID   0x0005
 
 /* Values for the SMB2_PREAUTH_INTEGRITY_CAPABILITIES Context (>= 0x310) */
 #define SMB2_PREAUTH_INTEGRITY_SHA512       0x0001
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index a8c73be445a..4bbe6167053 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -4756,6 +4756,8 @@ static struct tevent_req 
*smbXcli_negprot_smb2_subreq(struct smbXcli_negprot_sta
        if (state->conn->max_protocol >= PROTOCOL_SMB3_10) {
                NTSTATUS status;
                struct smb2_negotiate_contexts c = { .num_contexts = 0, };
+               uint8_t *netname_utf16 = NULL;
+               size_t netname_utf16_len = 0;
                uint32_t offset;
                DATA_BLOB b;
                uint8_t p[38];
@@ -4790,6 +4792,21 @@ static struct tevent_req 
*smbXcli_negprot_smb2_subreq(struct smbXcli_negprot_sta
                        return NULL;
                }
 
+               ok = convert_string_talloc(state, CH_UNIX, CH_UTF16,
+                                          state->conn->remote_name,
+                                          strlen(state->conn->remote_name),
+                                          &netname_utf16, &netname_utf16_len);
+               if (!ok) {
+                       return NULL;
+               }
+
+               b = data_blob_const(netname_utf16, netname_utf16_len);
+               status = smb2_negotiate_context_add(state, &c,
+                                       SMB2_NETNAME_NEGOTIATE_CONTEXT_ID, b);
+               if (!NT_STATUS_IS_OK(status)) {
+                       return NULL;
+               }
+
                status = smb2_negotiate_context_push(state, &b, c);
                if (!NT_STATUS_IS_OK(status)) {
                        return NULL;
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 112100b0536..8d13a7cf18c 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -2121,13 +2121,14 @@ ADS_STATUS ads_create_machine_acct(ADS_STRUCT *ads,
        }
 
        ret = ads_find_machine_acct(ads, &res, machine_escaped);
-       ads_msgfree(ads, res);
-       if (ADS_ERR_OK(ret)) {
+       if (ADS_ERR_OK(ret) && ads_count_replies(ads, res) == 1) {
                DBG_DEBUG("Host account for %s already exists.\n",
                                machine_escaped);
                ret = ADS_ERROR_LDAP(LDAP_ALREADY_EXISTS);
+               ads_msgfree(ads, res);
                goto done;
        }
+       ads_msgfree(ads, res);
 
        new_dn = talloc_asprintf(ctx, "cn=%s,%s", machine_escaped, org_unit);
        samAccountName = talloc_asprintf(ctx, "%s$", machine_name);


-- 
Samba Shared Repository

Reply via email to