summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-11-20 14:35:38 +0100
committerStefan Metzmacher <metze@samba.org>2014-11-27 16:45:05 +0100
commitd0a1995b934895ae9f0bbeed52772a4ef5d4b0dd (patch)
tree7b8133bd8bac833f1db094008e6b6092431c80a7
parentbc83e45a19deccfb0106c9ad79b0624b1c5d1fa7 (diff)
downloadsamba-d0a1995b934895ae9f0bbeed52772a4ef5d4b0dd.tar.gz
s4:libcli/smb2: allow the caller to specify a specific value for max_protocol.
The default is still PROTOCOL_LATEST. As smb2_connect*() is about SMB2/3 only we upgrade to PROTOCOL_LATEST if PROTOCOL_NT1 or lower is given. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--source4/libcli/smb2/connect.c3
-rw-r--r--source4/libcli/smb2/transport.c8
2 files changed, 10 insertions, 1 deletions
diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c
index c81bd67fba5..9535380d646 100644
--- a/source4/libcli/smb2/connect.c
+++ b/source4/libcli/smb2/connect.c
@@ -149,7 +149,8 @@ static void smb2_connect_socket_done(struct composite_context *creq)
subreq = smbXcli_negprot_send(state, state->ev,
state->transport->conn, timeout_msec,
- PROTOCOL_SMB2_02, PROTOCOL_LATEST);
+ PROTOCOL_SMB2_02,
+ state->transport->options.max_protocol);
if (tevent_req_nomem(subreq, req)) {
return;
}
diff --git a/source4/libcli/smb2/transport.c b/source4/libcli/smb2/transport.c
index 9b0c1461fd9..e3b2954dd4c 100644
--- a/source4/libcli/smb2/transport.c
+++ b/source4/libcli/smb2/transport.c
@@ -55,6 +55,14 @@ struct smb2_transport *smb2_transport_init(struct smbcli_socket *sock,
transport->ev = sock->event.ctx;
transport->options = *options;
+ if (transport->options.max_protocol == PROTOCOL_DEFAULT) {
+ transport->options.max_protocol = PROTOCOL_LATEST;
+ }
+
+ if (transport->options.max_protocol < PROTOCOL_SMB2_02) {
+ transport->options.max_protocol = PROTOCOL_LATEST;
+ }
+
TALLOC_FREE(sock->event.fde);
TALLOC_FREE(sock->event.te);