s4:libcli/smb2: allow the caller to specify a specific value for max_protocol.
authorStefan Metzmacher <metze@samba.org>
Thu, 20 Nov 2014 13:35:38 +0000 (14:35 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 27 Nov 2014 15:45:05 +0000 (16:45 +0100)
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>
source4/libcli/smb2/connect.c
source4/libcli/smb2/transport.c

index c81bd67fba5655bd41fdc354b2046e143e1ec43a..9535380d6468dc9831cc65b1ea5982a0a57c5c71 100644 (file)
@@ -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;
        }
index 9b0c1461fd9a8649d1e8302c1202eb3bd411731c..e3b2954dd4ce59d421d715030f96ea91a8d05b06 100644 (file)
@@ -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);