diff options
author | Stefan Metzmacher <metze@samba.org> | 2019-07-25 14:38:26 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2019-08-01 14:21:36 +0000 |
commit | 21f6cece543dd791e0f4636458bfe9819823420c (patch) | |
tree | f3ae42a0515a9d6b9fd45935858df755aff161a8 /libcli | |
parent | e10b90f33bb812600886656a1124e2d434416563 (diff) | |
download | samba-21f6cece543dd791e0f4636458bfe9819823420c.tar.gz |
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 <metze@samba.org>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Diffstat (limited to 'libcli')
-rw-r--r-- | libcli/smb/smbXcli_base.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index 98c928795ec..0375101b034 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -4771,6 +4771,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]; @@ -4803,6 +4805,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; + } + + status = smb2_negotiate_context_add(state, &c, + SMB2_NETNAME_NEGOTIATE_CONTEXT_ID, + netname_utf16, netname_utf16_len); + if (!NT_STATUS_IS_OK(status)) { + return NULL; + } + status = smb2_negotiate_context_push(state, &b, c); if (!NT_STATUS_IS_OK(status)) { return NULL; |