r26654: libcli/smb_composite: Rather than specifying each of the gazillion options...
[jelmer/samba4-debian.git] / source / libcli / raw / clitransport.c
index 98f5042d9990790106407d3768400516bf676c2e..62c32d305845908c9780278bd6845b322bad8131 100644 (file)
@@ -26,6 +26,7 @@
 #include "lib/events/events.h"
 #include "lib/stream/packet.h"
 #include "librpc/gen_ndr/ndr_nbt.h"
+#include "param/param.h"
 
 
 /*
@@ -71,7 +72,9 @@ static NTSTATUS smbcli_transport_finish_recv(void *private, DATA_BLOB blob);
   create a transport structure based on an established socket
 */
 struct smbcli_transport *smbcli_transport_init(struct smbcli_socket *sock,
-                                              TALLOC_CTX *parent_ctx, BOOL primary)
+                                              TALLOC_CTX *parent_ctx, 
+                                              bool primary, 
+                                              struct smbcli_options *options)
 {
        struct smbcli_transport *transport;
 
@@ -84,11 +87,7 @@ struct smbcli_transport *smbcli_transport_init(struct smbcli_socket *sock,
                transport->socket = talloc_reference(transport, sock);
        }
        transport->negotiate.protocol = PROTOCOL_NT1;
-       transport->options.use_spnego = lp_use_spnego() && lp_nt_status_support();
-       transport->options.max_xmit = lp_max_xmit();
-       transport->options.max_mux = lp_maxmux();
-       transport->options.request_timeout = SMB_REQUEST_TIMEOUT;
-
+       transport->options = *options;
        transport->negotiate.max_xmit = transport->options.max_xmit;
 
        /* setup the stream -> packet parser */
@@ -259,7 +258,7 @@ NTSTATUS smbcli_transport_connect_recv(struct smbcli_request *req)
 /*
   send a session request (if needed)
 */
-BOOL smbcli_transport_connect(struct smbcli_transport *transport,
+bool smbcli_transport_connect(struct smbcli_transport *transport,
                              struct nbt_name *calling, 
                              struct nbt_name *called)
 {
@@ -267,7 +266,7 @@ BOOL smbcli_transport_connect(struct smbcli_transport *transport,
        NTSTATUS status;
 
        if (transport->socket->port == 445) {
-               return True;
+               return true;
        }
 
        req = smbcli_transport_connect_send(transport, 
@@ -498,16 +497,16 @@ error:
 
 /*
   process some read/write requests that are pending
-  return False if the socket is dead
+  return false if the socket is dead
 */
-BOOL smbcli_transport_process(struct smbcli_transport *transport)
+bool smbcli_transport_process(struct smbcli_transport *transport)
 {
        NTSTATUS status;
        size_t npending;
 
        packet_queue_run(transport->packet);
        if (transport->socket->sock == NULL) {
-               return False;
+               return false;
        }
 
        status = socket_pending(transport->socket->sock, &npending);
@@ -515,9 +514,9 @@ BOOL smbcli_transport_process(struct smbcli_transport *transport)
                packet_recv(transport->packet);
        }
        if (transport->socket->sock == NULL) {
-               return False;
+               return false;
        }
-       return True;
+       return true;
 }
 
 /*
@@ -635,7 +634,7 @@ NTSTATUS smb_raw_echo_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx,
        p->out.sequence_number = SVAL(req->in.vwv, VWV(0));
        p->out.size = req->in.data_size;
        talloc_free(p->out.data);
-       p->out.data = talloc_size(mem_ctx, p->out.size);
+       p->out.data = talloc_array(mem_ctx, uint8_t, p->out.size);
        NT_STATUS_HAVE_NO_MEMORY(p->out.data);
 
        if (!smbcli_raw_pull_data(req, req->in.data, p->out.size, p->out.data)) {