r26654: libcli/smb_composite: Rather than specifying each of the gazillion options...
authorJelmer Vernooij <jelmer@samba.org>
Thu, 3 Jan 2008 23:22:12 +0000 (17:22 -0600)
committerStefan Metzmacher <metze@samba.org>
Thu, 3 Jan 2008 18:33:36 +0000 (12:33 -0600)
(This used to be commit 8a97886e24a4b969aa91409c06f423b71a45f6eb)

32 files changed:
source4/client/cifsdd.c
source4/client/cifsdd.h
source4/client/cifsddio.c
source4/client/client.c
source4/client/smbspool.c
source4/dsdb/schema/schema_syntax.c
source4/libcli/cliconnect.c
source4/libcli/raw/clitransport.c
source4/libcli/raw/clitree.c
source4/libcli/raw/libcliraw.h
source4/libcli/smb_composite/connect.c
source4/libcli/smb_composite/fetchfile.c
source4/libcli/smb_composite/fsinfo.c
source4/libcli/smb_composite/smb_composite.h
source4/librpc/rpc/dcerpc_connect.c
source4/ntvfs/cifs/vfs_cifs.c
source4/param/loadparm.c
source4/param/param.h
source4/scripting/ejs/smbcalls_cli.c
source4/torture/basic/base.c
source4/torture/basic/misc.c
source4/torture/gentest.c
source4/torture/locktest.c
source4/torture/locktest2.c
source4/torture/masktest.c
source4/torture/raw/lockbench.c
source4/torture/raw/openbench.c
source4/torture/rpc/join.c
source4/torture/rpc/samba3rpc.c
source4/torture/unix/unix_info2.c
source4/torture/unix/whoami.c
source4/torture/util_smb.c

index 8749a82573cf1161201eb5f3a2fe663621c04fc4..8e25dab92756969622859717438e297b4bf502ba 100644 (file)
@@ -23,6 +23,7 @@
 #include "auth/gensec/gensec.h"
 #include "lib/cmdline/popt_common.h"
 #include "libcli/resolve/resolve.h"
+#include "libcli/raw/libcliraw.h"
 
 #include "cifsdd.h"
 #include "param/param.h"
@@ -353,7 +354,8 @@ static void print_transfer_stats(void)
 }
 
 static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx, 
-                                     const char * which, const char **ports)
+                                     const char * which, const char **ports,
+                                     struct smbcli_options *smb_options)
 {
        int                     options = 0;
        const char *            path = NULL;
@@ -374,12 +376,14 @@ static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx,
        if (strcmp(which, "if") == 0) {
                path = check_arg_pathname("if");
                handle = dd_open_path(resolve_ctx, path, ports, 
-                                     check_arg_numeric("ibs"), options);
+                                     check_arg_numeric("ibs"), options,
+                                     smb_options);
        } else if (strcmp(which, "of") == 0) {
                options |= DD_WRITE;
                path = check_arg_pathname("of");
                handle = dd_open_path(resolve_ctx, path, ports, 
-                                     check_arg_numeric("obs"), options);
+                                     check_arg_numeric("obs"), options,
+                                     smb_options);
        } else {
                SMB_ASSERT(0);
                return(NULL);
@@ -392,14 +396,6 @@ static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx,
        return(handle);
 }
 
-static void set_max_xmit(struct loadparm_context *lp_ctx, uint64_t iomax)
-{
-       char buf[64];
-
-       snprintf(buf, sizeof(buf), "%llu", (unsigned long long)iomax);
-       lp_set_cmdline(lp_ctx, "max xmit", buf);
-}
-
 static int copy_files(struct loadparm_context *lp_ctx)
 {
        uint8_t *       iobuf;  /* IO buffer. */
@@ -413,10 +409,14 @@ static int copy_files(struct loadparm_context *lp_ctx)
        struct dd_iohandle *    ifile;
        struct dd_iohandle *    ofile;
 
+       struct smbcli_options options;
+
        ibs = check_arg_numeric("ibs");
        obs = check_arg_numeric("obs");
        count = check_arg_numeric("count");
 
+       lp_smbcli_options(lp_ctx, &options);
+
        /* Allocate IO buffer. We need more than the max IO size because we
         * could accumulate a remainder if ibs and obs don't match.
         */
@@ -428,18 +428,18 @@ static int copy_files(struct loadparm_context *lp_ctx)
                return(EOM_EXIT_CODE);
        }
 
-       set_max_xmit(lp_ctx, MAX(ibs, obs));
+       options.max_xmit = MAX(ibs, obs);
 
        DEBUG(4, ("IO buffer size is %llu, max xmit is %d\n",
-                       (unsigned long long)iomax, lp_max_xmit(lp_ctx)));
+                       (unsigned long long)iomax, options.max_xmit));
 
        if (!(ifile = open_file(lp_resolve_context(lp_ctx), "if", 
-                               lp_smb_ports(lp_ctx)))) {
+                               lp_smb_ports(lp_ctx), &options))) {
                return(FILESYS_EXIT_CODE);
        }
 
        if (!(ofile = open_file(lp_resolve_context(lp_ctx), "of", 
-                               lp_smb_ports(lp_ctx)))) {
+                               lp_smb_ports(lp_ctx), &options))) {
                return(FILESYS_EXIT_CODE);
        }
 
@@ -447,7 +447,7 @@ static int copy_files(struct loadparm_context *lp_ctx)
        ifile->io_seek(ifile, check_arg_numeric("skip") * ibs);
        ofile->io_seek(ofile, check_arg_numeric("seek") * obs);
 
-       DEBUG(4, ("max xmit was negotiated to be %d\n", lp_max_xmit(lp_ctx)));
+       DEBUG(4, ("max xmit was negotiated to be %d\n", options.max_xmit));
 
        for (data_size = 0;;) {
 
index 0c44b9158192a84b306f6e398fcf1fdfcbac1b16..810c882ea9afb4502378c0eb2d5c386050fcb13c 100644 (file)
@@ -88,10 +88,13 @@ struct dd_iohandle
 #define DD_WRITE               0x00000004
 #define DD_OPLOCK              0x00000008
 
+struct smbcli_options;
+
 struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx, 
                                  const char * path,
                                  const char **ports,
-                               uint64_t io_size, int options);
+                               uint64_t io_size, int options, 
+                               struct smbcli_options *smb_options);
 bool dd_fill_block(struct dd_iohandle * h, uint8_t * buf,
                uint64_t * buf_size, uint64_t need_size, uint64_t block_size);
 bool dd_flush_block(struct dd_iohandle * h, uint8_t * buf,
index 2e5aedc4f98ba2bfaddc8156593789a1575e8eaa..7028e8507887e8a97d57a04fd9f74cbe528d579f 100644 (file)
@@ -223,7 +223,8 @@ static bool smb_write_func(void * handle, uint8_t * buf, uint64_t wanted,
 static struct smbcli_state * init_smb_session(struct resolve_context *resolve_ctx,
                                              const char * host,
                                              const char **ports,
-                                             const char * share)
+                                             const char * share,
+                                             struct smbcli_options *options)
 {
        NTSTATUS                ret;
        struct smbcli_state *   cli = NULL;
@@ -233,7 +234,7 @@ static struct smbcli_state * init_smb_session(struct resolve_context *resolve_ct
         */
        ret = smbcli_full_connection(NULL, &cli, host, ports, share,
                         NULL /* devtype */, cmdline_credentials, resolve_ctx, 
-                        NULL /* events */);
+                        NULL /* events */, options);
 
        if (!NT_STATUS_IS_OK(ret)) {
                fprintf(stderr, "%s: connecting to //%s/%s: %s\n",
@@ -297,7 +298,8 @@ static struct dd_iohandle * open_cifs_handle(struct resolve_context *resolve_ctx
                                        const char * share,
                                        const char * path,
                                        uint64_t io_size,
-                                       int options)
+                                       int options,
+                                       struct smbcli_options *smb_options)
 {
        struct cifs_handle * smbh;
 
@@ -317,7 +319,8 @@ static struct dd_iohandle * open_cifs_handle(struct resolve_context *resolve_ctx
        smbh->h.io_write = smb_write_func;
        smbh->h.io_seek = smb_seek_func;
 
-       if ((smbh->cli = init_smb_session(resolve_ctx, host, ports, share)) == NULL) {
+       if ((smbh->cli = init_smb_session(resolve_ctx, host, ports, share,
+                                         smb_options)) == NULL) {
                return(NULL);
        }
 
@@ -336,7 +339,8 @@ struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx,
                                  const char * path,
                                  const char **ports,
                                uint64_t io_size,
-                               int options)
+                               int options,
+                               struct smbcli_options *smb_options)
 {
        if (file_exist(path)) {
                return(open_fd_handle(path, io_size, options));
@@ -353,7 +357,7 @@ struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx,
 
                        return(open_cifs_handle(resolve_ctx, host, ports, 
                                                share, remain,
-                                               io_size, options));
+                                               io_size, options, smb_options));
                }
 
                return(open_fd_handle(path, io_size, options));
index 259966ddaa2d190ae7fcaa1d3c02211f7434976a..d9478a3a8ad45f3b87e4df665ca59cb57c3021b5 100644 (file)
@@ -3021,7 +3021,10 @@ return a connection to a server
 *******************************************************/
 static bool do_connect(struct smbclient_context *ctx, 
                       struct resolve_context *resolve_ctx,
-                      const char *specified_server, const char **ports, const char *specified_share, struct cli_credentials *cred)
+                      const char *specified_server, const char **ports, 
+                      const char *specified_share, 
+                      struct cli_credentials *cred, 
+                      struct smbcli_options *options)
 {
        NTSTATUS status;
        char *server, *share;
@@ -3040,7 +3043,8 @@ static bool do_connect(struct smbclient_context *ctx,
        
        status = smbcli_full_connection(ctx, &ctx->cli, server, ports,
                                        share, NULL, cred, resolve_ctx, 
-                                       cli_credentials_get_event_context(cred));
+                                       cli_credentials_get_event_context(cred),
+                                       options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("Connection to \\\\%s\\%s failed - %s\n", 
                         server, share, nt_errstr(status));
@@ -3065,7 +3069,7 @@ static int do_host_query(struct loadparm_context *lp_ctx, const char *query_host
 /****************************************************************************
 handle a message operation
 ****************************************************************************/
-static int do_message_op(const char *netbios_name, const char *desthost, const char **destports, const char *destip, int name_type, struct resolve_context *resolve_ctx, int max_xmit, int max_mux, bool use_spnego, enum smb_signing_state signing)
+static int do_message_op(const char *netbios_name, const char *desthost, const char **destports, const char *destip, int name_type, struct resolve_context *resolve_ctx, struct smbcli_options *options)
 {
        struct nbt_name called, calling;
        const char *server_name;
@@ -3077,7 +3081,7 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
 
        server_name = destip ? destip : desthost;
 
-       if (!(cli=smbcli_state_init(NULL)) || !smbcli_socket_connect(cli, server_name, destports, resolve_ctx, max_xmit, max_mux, use_spnego, signing)) {
+       if (!(cli=smbcli_state_init(NULL)) || !smbcli_socket_connect(cli, server_name, destports, resolve_ctx, options)) {
                d_printf("Connection to %s failed\n", server_name);
                return 1;
        }
@@ -3120,6 +3124,7 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
        TALLOC_CTX *mem_ctx;
        struct smbclient_context *ctx;
        const char *cmdstr = NULL;
+       struct smbcli_options smb_options;
 
        struct poptOption long_options[] = {
                POPT_AUTOHELP
@@ -3212,6 +3217,8 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
 
        poptFreeContext(pc);
 
+       lp_smbcli_options(cmdline_lp_ctx, &smb_options);
+
        DEBUG( 3, ( "Client started (version %s).\n", SAMBA_VERSION_STRING ) );
 
        if (query_host && (p=strchr_m(query_host,'#'))) {
@@ -3225,10 +3232,10 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
        }
 
        if (message) {
-               return do_message_op(lp_netbios_name(cmdline_lp_ctx), desthost, lp_smb_ports(cmdline_lp_ctx), dest_ip, name_type, lp_resolve_context(cmdline_lp_ctx), lp_max_xmit(cmdline_lp_ctx), lp_maxmux(cmdline_lp_ctx), lp_nt_status_support(cmdline_lp_ctx) && lp_use_spnego(cmdline_lp_ctx), lp_client_signing(cmdline_lp_ctx));
+               return do_message_op(lp_netbios_name(cmdline_lp_ctx), desthost, lp_smb_ports(cmdline_lp_ctx), dest_ip, name_type, lp_resolve_context(cmdline_lp_ctx), &smb_options);
        }
        
-       if (!do_connect(ctx, lp_resolve_context(cmdline_lp_ctx), desthost, lp_smb_ports(cmdline_lp_ctx), service, cmdline_credentials))
+       if (!do_connect(ctx, lp_resolve_context(cmdline_lp_ctx), desthost, lp_smb_ports(cmdline_lp_ctx), service, cmdline_credentials, &smb_options))
                return 1;
 
        if (base_directory) 
index 614e50bb0bf118f3ef2eb297f2f0273e90cd65b5..df867d5fefcff7741ff2b2a63ebcc0f99b79f57e 100644 (file)
@@ -270,8 +270,8 @@ smb_connect(const char *workgroup,          /* I - Workgroup */
 
   myname = get_myname();  
        
-  nt_status = smbcli_full_connection(NULL, &c, myname, server, ports, share, NULL,
-                                    username, workgroup, password, NULL);
+  nt_status = smbcli_full_connection(NULL, &c, myname, server, ports, share, 
+                                    NULL, username, workgroup, password, NULL);
   
   free(myname);
   if (!NT_STATUS_IS_OK(nt_status)) {
index b956441793c18b6ee3257ace139189187e46f2bd..9bc51c676ee3dc266cd5d02738e049168db2cea2 100644 (file)
@@ -939,8 +939,7 @@ static WERROR dsdb_syntax_DN_BINARY_drsuapi_to_ldb(const struct dsdb_schema *sch
                }
 
                ndr_err = ndr_pull_struct_blob_all(in->value_ctr.values[i].blob,
-                                                  out->values, 
-                                                  lp_iconv_convenience(global_loadparm), &id3b,
+                                                  out->values, NULL, &id3b,
                                                   (ndr_pull_flags_fn_t)ndr_pull_drsuapi_DsReplicaObjectIdentifier3Binary);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
@@ -998,7 +997,7 @@ static WERROR dsdb_syntax_DN_BINARY_ldb_to_drsuapi(const struct dsdb_schema *sch
                id3b.dn         = (const char *)in->values[i].data;
                id3b.binary     = data_blob(NULL, 0);
 
-               ndr_err = ndr_push_struct_blob(&blobs[i], blobs, lp_iconv_convenience(global_loadparm), &id3b,
+               ndr_err = ndr_push_struct_blob(&blobs[i], blobs, NULL, &id3b,
                                               (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3Binary);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
index c1fadaa6797daba0f05cef626963b28b67b5bda2..666dfe84460ae0c57ebc5b8dd6a86473ecbb2b64 100644 (file)
@@ -33,8 +33,7 @@
 bool smbcli_socket_connect(struct smbcli_state *cli, const char *server, 
                           const char **ports, 
                           struct resolve_context *resolve_ctx,
-                          int max_xmit, int max_mux, bool use_spnego,
-                          enum smb_signing_state signing)
+                          struct smbcli_options *options)
 {
        struct smbcli_socket *sock;
 
@@ -43,8 +42,7 @@ bool smbcli_socket_connect(struct smbcli_state *cli, const char *server,
 
        if (sock == NULL) return false;
        
-       cli->transport = smbcli_transport_init(sock, cli, true, max_xmit,
-                                              max_mux, use_spnego, signing);
+       cli->transport = smbcli_transport_init(sock, cli, true, options);
        if (!cli->transport) {
                return false;
        }
@@ -143,7 +141,8 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
                                const char *devtype,
                                struct cli_credentials *credentials,
                                struct resolve_context *resolve_ctx,
-                               struct event_context *ev)
+                               struct event_context *ev,
+                               struct smbcli_options *options)
 {
        struct smbcli_tree *tree;
        NTSTATUS status;
@@ -153,7 +152,8 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
        status = smbcli_tree_full_connection(parent_ctx,
                                             &tree, host, ports, 
                                             sharename, devtype,
-                                            credentials, resolve_ctx, ev);
+                                            credentials, resolve_ctx, ev,
+                                            options);
        if (!NT_STATUS_IS_OK(status)) {
                goto done;
        }
index 3ca828d46b5ae150327a2edc60f6326ac12190a4..62c32d305845908c9780278bd6845b322bad8131 100644 (file)
@@ -74,10 +74,7 @@ static NTSTATUS smbcli_transport_finish_recv(void *private, DATA_BLOB blob);
 struct smbcli_transport *smbcli_transport_init(struct smbcli_socket *sock,
                                               TALLOC_CTX *parent_ctx, 
                                               bool primary, 
-                                              int max_xmit,
-                                              int max_mux,
-                                              bool use_spnego,
-                                              enum smb_signing_state signing)
+                                              struct smbcli_options *options)
 {
        struct smbcli_transport *transport;
 
@@ -90,12 +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 = use_spnego;
-       transport->options.max_xmit = max_xmit;
-       transport->options.max_mux = max_mux;
-       transport->options.request_timeout = SMB_REQUEST_TIMEOUT;
-       transport->options.signing = signing;
-
+       transport->options = *options;
        transport->negotiate.max_xmit = transport->options.max_xmit;
 
        /* setup the stream -> packet parser */
index 3d8a6760a19f9a792e6a8e1c55ef854f1440d978..ae63d94acd86e609ca1e80797114d3aba1d79abb 100644 (file)
@@ -175,7 +175,8 @@ NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx,
                                     const char *service, const char *service_type,
                                     struct cli_credentials *credentials,
                                     struct resolve_context *resolve_ctx,
-                                    struct event_context *ev)
+                                    struct event_context *ev,
+                                    struct smbcli_options *options)
 {
        struct smb_composite_connect io;
        NTSTATUS status;
@@ -191,14 +192,7 @@ NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx,
        io.in.service_type = service_type;
        io.in.credentials = credentials;
        io.in.fallback_to_anonymous = false;
-       io.in.workgroup = lp_workgroup(global_loadparm);
-       io.in.max_xmit = lp_max_xmit(global_loadparm);
-       io.in.max_mux = lp_maxmux(global_loadparm);
-       io.in.ntstatus_support = lp_nt_status_support(global_loadparm);
-       io.in.max_protocol = lp_cli_maxprotocol(global_loadparm);
-       io.in.unicode = lp_unicode(global_loadparm);
-       io.in.use_spnego = lp_use_spnego(global_loadparm) && lp_nt_status_support(global_loadparm);
-       io.in.signing = lp_client_signing(global_loadparm);
+       io.in.options = *options;
        
        status = smb_composite_connect(&io, parent_ctx, resolve_ctx, ev);
        if (NT_STATUS_IS_OK(status)) {
index dd6904dec2d14e407573047bcdf942fd7386ba0f..0032eb4e948a7412f7bde5cf17221b93d5ff034e 100644 (file)
@@ -94,6 +94,9 @@ struct smbcli_options {
        uint_t use_oplocks:1;
        uint_t use_level2_oplocks:1;
        uint_t use_spnego:1;
+       uint_t unicode:1;
+       uint_t ntstatus_support:1;
+       int max_protocol;
        uint32_t max_xmit;
        uint16_t max_mux;
        int request_timeout;
index e45a8a25f9d0d39854f424a82de32ea990730004..a44765e9809f5fe2162379e5a4dbcef6838dbd29 100644 (file)
@@ -63,7 +63,7 @@ static NTSTATUS connect_send_negprot(struct composite_context *c,
 {
        struct connect_state *state = talloc_get_type(c->private_data, struct connect_state);
 
-       state->req = smb_raw_negotiate_send(state->transport, io->in.unicode, io->in.max_protocol);
+       state->req = smb_raw_negotiate_send(state->transport, io->in.options.unicode, io->in.options.max_protocol);
        NT_STATUS_HAVE_NO_MEMORY(state->req);
 
        state->req->async.fn = request_handler;
@@ -307,10 +307,7 @@ static NTSTATUS connect_socket(struct composite_context *c,
 
        /* the socket is up - we can initialise the smbcli transport layer */
        state->transport = smbcli_transport_init(state->sock, state, true, 
-                                                io->in.max_xmit,
-                                                io->in.max_mux,
-                                                io->in.use_spnego,
-                                                io->in.signing);
+                                                &io->in.options);
        NT_STATUS_HAVE_NO_MEMORY(state->transport);
 
        if (is_ipaddress(state->sock->hostname) &&
index 5fa48b4863915ce9d0ca23745abdf884519d8134..c7d02e323c21dc1ce826a2919230af5387cf2e01 100644 (file)
@@ -147,14 +147,7 @@ struct composite_context *smb_composite_fetchfile_send(struct smb_composite_fetc
        state->connect->in.fallback_to_anonymous = false;
        state->connect->in.workgroup    = io->in.workgroup;
 
-       state->connect->in.max_xmit = lp_max_xmit(global_loadparm);
-       state->connect->in.max_mux = lp_maxmux(global_loadparm);
-       state->connect->in.ntstatus_support = lp_nt_status_support(global_loadparm);
-       state->connect->in.max_protocol = lp_cli_maxprotocol(global_loadparm);
-       state->connect->in.unicode = lp_unicode(global_loadparm);
-       state->connect->in.use_spnego = lp_use_spnego(global_loadparm) && 
-               lp_nt_status_support(global_loadparm);
-       state->connect->in.signing = lp_client_signing(global_loadparm);
+       lp_smbcli_options(global_loadparm, &state->connect->in.options);
        
        state->creq = smb_composite_connect_send(state->connect, state, 
                                                 lp_resolve_context(global_loadparm), event_ctx);
index b6a5a5f2ccaddfa396c2b05a68f64b026366d155..26b19e87594d8710ac49ddd552d8f57e174aa707 100644 (file)
@@ -153,14 +153,7 @@ struct composite_context *smb_composite_fsinfo_send(struct smbcli_tree *tree,
        state->connect->in.fallback_to_anonymous = false;
        state->connect->in.workgroup    = io->in.workgroup;
 
-       state->connect->in.max_xmit = lp_max_xmit(global_loadparm);
-       state->connect->in.max_mux = lp_maxmux(global_loadparm);
-       state->connect->in.ntstatus_support = lp_nt_status_support(global_loadparm);
-       state->connect->in.max_protocol = lp_cli_maxprotocol(global_loadparm);
-       state->connect->in.unicode = lp_unicode(global_loadparm);
-       state->connect->in.use_spnego = lp_use_spnego(global_loadparm) && 
-               lp_nt_status_support(global_loadparm);
-       state->connect->in.signing = lp_client_signing(global_loadparm);
+       lp_smbcli_options(global_loadparm, &state->connect->in.options);
 
        c->state = COMPOSITE_STATE_IN_PROGRESS;
        state->stage = FSINFO_CONNECT;
index dd193fc82069ff354490db540995dcde96a2d46b..a732617f80808b02b39d0bf45f6efc0308c5f2cb 100644 (file)
@@ -28,6 +28,7 @@
 */
 
 #include "libcli/raw/signing.h"
+#include "libcli/raw/libcliraw.h"
 
 
 /*
@@ -93,13 +94,7 @@ struct smb_composite_connect {
                struct cli_credentials *credentials;
                bool fallback_to_anonymous;
                const char *workgroup;
-               bool use_spnego;
-               bool ntstatus_support;
-               bool unicode;
-               int max_xmit;
-               int max_mux;
-               int max_protocol;
-               enum smb_signing_state signing;
+               struct smbcli_options options;
        } in;
        struct {
                struct smbcli_tree *tree;
index 9bd503c6258fd98069a2fd6339a0cf1ade794b5b..361be4adcd01d9ca93e83638253365f64720ee92 100644 (file)
@@ -119,13 +119,7 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CT
        conn->in.service_type           = NULL;
        conn->in.workgroup              = lp_workgroup(lp_ctx);
 
-       conn->in.max_xmit = lp_max_xmit(lp_ctx);
-       conn->in.max_mux = lp_maxmux(lp_ctx);
-       conn->in.ntstatus_support = lp_nt_status_support(lp_ctx);
-       conn->in.max_protocol = lp_cli_maxprotocol(lp_ctx);
-       conn->in.unicode = lp_unicode(lp_ctx);
-       conn->in.use_spnego = lp_use_spnego(lp_ctx) && lp_nt_status_support(lp_ctx);
-       conn->in.signing = lp_client_signing(lp_ctx);
+       lp_smbcli_options(lp_ctx, &conn->in.options);
 
        /*
         * provide proper credentials - user supplied, but allow a
index 0b0c9b10372a079abf53de9a79c4e2b428a8d76c..910401f15765ea30fbbae25b30080f3c2cf920b4 100644 (file)
@@ -202,13 +202,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
        io.in.workgroup = lp_workgroup(ntvfs->ctx->lp_ctx);
        io.in.service = remote_share;
        io.in.service_type = "?????";
-       io.in.max_xmit = lp_max_xmit(ntvfs->ctx->lp_ctx);
-       io.in.max_mux = lp_maxmux(ntvfs->ctx->lp_ctx);
-       io.in.ntstatus_support = lp_nt_status_support(ntvfs->ctx->lp_ctx);
-       io.in.max_protocol = lp_cli_maxprotocol(ntvfs->ctx->lp_ctx);
-       io.in.unicode = lp_unicode(ntvfs->ctx->lp_ctx);
-       io.in.use_spnego = lp_use_spnego(ntvfs->ctx->lp_ctx) && lp_nt_status_support(ntvfs->ctx->lp_ctx);
-       io.in.signing = lp_client_signing(ntvfs->ctx->lp_ctx);
+       lp_smbcli_options(ntvfs->ctx->lp_ctx, &io.in.options);
        
        creq = smb_composite_connect_send(&io, private, 
                                          lp_resolve_context(ntvfs->ctx->lp_ctx),
index 66bb44dc3cbdfa14c78cec60d316c56d61763599..2b7b9dd7dacaecdaf40c56174fc6086686750123 100644 (file)
@@ -63,6 +63,7 @@
 #include "lib/util/dlinklist.h"
 #include "param/param.h"
 #include "param/loadparm.h"
+#include "libcli/raw/libcliraw.h"
 
 #define standard_sub_basic talloc_strdup
 
@@ -2605,3 +2606,18 @@ _PUBLIC_ void reload_charcnv(struct loadparm_context *lp_ctx)
        talloc_free(lp_ctx->iconv_convenience);
        lp_ctx->iconv_convenience = smb_iconv_convenience_init_lp(lp_ctx, lp_ctx);
 }
+
+void lp_smbcli_options(struct loadparm_context *lp_ctx, 
+                        struct smbcli_options *options)
+{
+       options->max_xmit = lp_max_xmit(lp_ctx); 
+       options->max_mux = lp_maxmux(lp_ctx);
+       options->use_spnego = lp_nt_status_support(lp_ctx) && lp_use_spnego(lp_ctx); 
+       options->signing = lp_client_signing(lp_ctx);
+       options->request_timeout = SMB_REQUEST_TIMEOUT;
+       options->ntstatus_support = lp_nt_status_support(lp_ctx);
+       options->max_protocol = lp_cli_maxprotocol(lp_ctx);
+       options->unicode = lp_unicode(lp_ctx);
+       options->use_oplocks = false;
+       options->use_level2_oplocks = false;
+}
index 210b21d9a003c41ead72df7760e5552afc144cdc..098a73deec5126fb7bf510847119dc3164c97a30 100644 (file)
@@ -59,6 +59,7 @@ enum announce_as {/* Types of machine we can announce as. */
 
 struct loadparm_context;
 struct loadparm_service;
+struct smbcli_options;
 
 #include "param/proto.h"
 
index 5e61a4df212a73efbd679b5a6d572236a8b31580..8295a0879fd462a60715a668e355a293fcb6f518 100644 (file)
@@ -445,13 +445,7 @@ static int ejs_tree_connect(MprVarHandle eid, int argc, char **argv)
        io.in.credentials            = creds;
        io.in.fallback_to_anonymous  = false;
        io.in.workgroup              = lp_workgroup(global_loadparm);
-       io.in.max_xmit = lp_max_xmit(global_loadparm);
-       io.in.max_mux = lp_maxmux(global_loadparm);
-       io.in.ntstatus_support = lp_nt_status_support(global_loadparm);
-       io.in.max_protocol = lp_cli_maxprotocol(global_loadparm);
-       io.in.unicode = lp_unicode(global_loadparm);
-       io.in.use_spnego = lp_use_spnego(global_loadparm) && lp_nt_status_support(global_loadparm);
-       io.in.signing = lp_client_signing(global_loadparm);
+       lp_smbcli_options(global_loadparm, &io.in.options);
 
        result = smb_composite_connect(&io, mem_ctx, 
                                       lp_resolve_context(global_loadparm), 
index fcd788481b393c4cb9d12a59344d452bc73fcabc..aa729ec0dff6617f19e7ce32312bd3be0fec1e1f 100644 (file)
@@ -40,6 +40,7 @@ static struct smbcli_state *open_nbt_connection(struct torture_context *tctx)
        struct nbt_name called, calling;
        struct smbcli_state *cli;
        const char *host = torture_setting_string(tctx, "host", NULL);
+       struct smbcli_options options;
 
        make_nbt_name_client(&calling, lp_netbios_name(tctx->lp_ctx));
 
@@ -51,7 +52,9 @@ static struct smbcli_state *open_nbt_connection(struct torture_context *tctx)
                goto failed;
        }
 
-       if (!smbcli_socket_connect(cli, host, lp_smb_ports(tctx->lp_ctx), lp_resolve_context(tctx->lp_ctx), lp_max_xmit(tctx->lp_ctx), lp_maxmux(tctx->lp_ctx), lp_nt_status_support(tctx->lp_ctx) && lp_use_spnego(tctx->lp_ctx), lp_client_signing(tctx->lp_ctx))) {
+       lp_smbcli_options(tctx->lp_ctx, &options);
+
+       if (!smbcli_socket_connect(cli, host, lp_smb_ports(tctx->lp_ctx), lp_resolve_context(tctx->lp_ctx), &options)) {
                torture_comment(tctx, "Failed to connect with %s\n", host);
                goto failed;
        }
index 986a4574a9a136bb3bae297cbb707a3a70f33752..d991f117cdc8f9a733fcb92e33060fa4c8f8be26 100644 (file)
@@ -821,13 +821,7 @@ static struct composite_context *torture_connect_async(
        smb->in.credentials=cmdline_credentials;
        smb->in.fallback_to_anonymous=false;
        smb->in.workgroup=workgroup;
-       smb->in.max_xmit = lp_max_xmit(tctx->lp_ctx);
-       smb->in.max_mux = lp_maxmux(tctx->lp_ctx);
-       smb->in.ntstatus_support = lp_nt_status_support(tctx->lp_ctx);
-       smb->in.max_protocol = lp_cli_maxprotocol(tctx->lp_ctx);
-       smb->in.unicode = lp_unicode(tctx->lp_ctx);
-       smb->in.use_spnego = lp_use_spnego(tctx->lp_ctx) && lp_nt_status_support(tctx->lp_ctx);
-       smb->in.signing = lp_client_signing(tctx->lp_ctx);
+       lp_smbcli_options(tctx->lp_ctx, &smb->in.options);
        
        return smb_composite_connect_send(smb,mem_ctx,
                                          lp_resolve_context(tctx->lp_ctx),ev);
index 9e5ef73ea6a306525b37fe6cf6461ea1f3452d5c..c9e36b7e4ed4df37fbbe2e94acb20e9b30338601 100644 (file)
@@ -176,6 +176,7 @@ static bool connect_servers(struct loadparm_context *lp_ctx)
 
        for (i=0;i<NSERVERS;i++) {
                for (j=0;j<NINSTANCES;j++) {
+                       struct smbcli_options smb_options;
                        NTSTATUS status;
                        printf("Connecting to \\\\%s\\%s as %s - instance %d\n",
                               servers[i].server_name, servers[i].share_name, 
@@ -184,13 +185,14 @@ static bool connect_servers(struct loadparm_context *lp_ctx)
                        cli_credentials_set_workstation(servers[i].credentials, 
                                                        "gentest", CRED_SPECIFIED);
 
+                       lp_smbcli_options(lp_ctx, &smb_options);
                        status = smbcli_full_connection(NULL, &servers[i].cli[j],
                                                        servers[i].server_name, 
                                                        lp_smb_ports(lp_ctx),
                                                        servers[i].share_name, NULL, 
                                                        servers[i].credentials, 
                                                        lp_resolve_context(lp_ctx), 
-                                                       NULL);
+                                                       NULL, &smb_options);
                        if (!NT_STATUS_IS_OK(status)) {
                                printf("Failed to connect to \\\\%s\\%s - %s\n",
                                       servers[i].server_name, servers[i].share_name,
index 08313b6d57a3f35a1abbd95a89eaff93552bbc08..90e2eec2be748d46454e3c0c62be7efcc218897f 100644 (file)
@@ -113,6 +113,9 @@ static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx,
        fstring server, myname;
        NTSTATUS status;
        int retries = 10;
+       struct smbcli_options options;
+
+       lp_smbcli_options(lp_ctx, &options);
 
        printf("connect_one(%s, %d, %d)\n", share, snum, conn);
 
@@ -158,7 +161,7 @@ static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx,
                                                share, NULL,
                                                servers[snum], 
                                                lp_resolve_context(lp_ctx),
-                                               NULL);
+                                               NULL, &options);
                if (!NT_STATUS_IS_OK(status)) {
                        sleep(2);
                }
index db323e139169b38ef988b57ac168414a3ee6c443..0fe37253859fea62ab9e23471e5d62b1541c5c2a 100644 (file)
@@ -136,7 +136,8 @@ static bool try_unlock(struct smbcli_state *c, int fstype,
 /***************************************************** 
 return a connection to a server
 *******************************************************/
-static struct smbcli_state *connect_one(char *share, const char **ports)
+static struct smbcli_state *connect_one(char *share, const char **ports,
+                                       struct smb_options *options)
 {
        struct smbcli_state *c;
        char *server_n;
@@ -163,8 +164,9 @@ static struct smbcli_state *connect_one(char *share, const char **ports)
        slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), count++);
 
        nt_status = smbcli_full_connection(NULL, 
-                                          &c, myname, server_n, ports, share, NULL,
-                                          username, lp_workgroup(), password, NULL);
+                          &c, myname, server_n, ports, share, NULL,
+                          username, lp_workgroup(), password, NULL,
+                          options);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("smbcli_full_connection failed with error %s\n", nt_errstr(nt_status)));
                return NULL;
@@ -180,6 +182,7 @@ static void reconnect(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
                      char *nfs[NSERVERS], 
                      int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES],
                      const char **ports,
+                     struct smbcli_options *options,
                      char *share1, char *share2)
 {
        int server, conn, f, fstype;
@@ -198,7 +201,7 @@ static void reconnect(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
                        smbcli_ulogoff(cli[server][conn]);
                        talloc_free(cli[server][conn]);
                }
-               cli[server][conn] = connect_one(share[server], ports);
+               cli[server][conn] = connect_one(share[server], ports, options);
                if (!cli[server][conn]) {
                        DEBUG(0,("Failed to connect to %s\n", share[server]));
                        exit(1);
@@ -344,7 +347,7 @@ static int retest(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
    we then do random locking ops in tamdem on the 4 fnums from each
    server and ensure that the results match
  */
-static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath2, const char **ports)
+static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath2, const char **ports, struct smbcli_options *options)
 {
        struct smbcli_state *cli[NSERVERS][NCONNECTIONS];
        char *nfs[NSERVERS];
@@ -373,7 +376,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath
                recorded[n].needed = true;
        }
 
-       reconnect(cli, nfs, fnum, share1, share2, ports);
+       reconnect(cli, nfs, fnum, ports, options, share1, share2);
        open_files(cli, nfs, fnum);
        n = retest(cli, nfs, fnum, numops);
 
@@ -384,7 +387,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath
                n1 = n;
 
                close_files(cli, nfs, fnum);
-               reconnect(cli, nfs, fnum, share1, share2, ports);
+               reconnect(cli, nfs, fnum, ports, options, share1, share2);
                open_files(cli, nfs, fnum);
 
                for (i=0;i<n-1;i++) {
@@ -411,7 +414,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath
        }
 
        close_files(cli, nfs, fnum);
-       reconnect(cli, nfs, fnum, share1, share2, ports);
+       reconnect(cli, nfs, fnum, ports, options, share1, share2);
        open_files(cli, nfs, fnum);
        showall = true;
        n1 = retest(cli, nfs, fnum, n);
@@ -458,6 +461,7 @@ static void usage(void)
        char *share1, *share2, *nfspath1, *nfspath2;
        extern char *optarg;
        extern int optind;
+       struct smbcli_options options;
        int opt;
        char *p;
        int seed;
@@ -539,7 +543,9 @@ static void usage(void)
        srandom(seed);
 
        locking_init(1);
-       test_locks(share1, share2, nfspath1, nfspath2, lp_smb_ports(lp_ctx));
+       lp_smbcli_options(lp_ctx, &options);
+       test_locks(share1, share2, nfspath1, nfspath2, lp_smb_ports(lp_ctx),
+                  &options);
 
        return(0);
 }
index 28dfe27960eb70e2b2181771204734e0add4a0cc..d1b853de72569861e87f5695b7c913f726a8c86b 100644 (file)
@@ -74,7 +74,8 @@ static char *reg_test(struct smbcli_state *cli, char *pattern, char *long_name,
 return a connection to a server
 *******************************************************/
 static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx, 
-                                       char *share, const char **ports)
+                                       char *share, const char **ports,
+                                       struct smbcli_options *options)
 {
        struct smbcli_state *c;
        fstring server;
@@ -92,7 +93,8 @@ static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx,
                                        server, 
                                        ports,
                                        share, NULL,
-                                       credentials, resolve_ctx, NULL);
+                                       credentials, resolve_ctx, NULL,
+                                       options);
 
        if (!NT_STATUS_IS_OK(status)) {
                return NULL;
@@ -303,6 +305,7 @@ static void usage(void)
        int opt;
        int seed;
        struct loadparm_context *lp_ctx;
+       struct smbcli_options options;
 
        setlinebuf(stdout);
 
@@ -382,7 +385,10 @@ static void usage(void)
        argc -= optind;
        argv += optind;
 
-       cli = connect_one(lp_resolve_context(lp_ctx), share, lp_smb_ports(lp_ctx));
+       lp_smbcli_options(lp_ctx, &options);
+
+       cli = connect_one(lp_resolve_context(lp_ctx), share, 
+                         lp_smb_ports(lp_ctx), &options);
        if (!cli) {
                DEBUG(0,("Failed to connect to %s\n", share));
                exit(1);
index 5093816a3135ffe858094a6309d480c8e09c5092..16e9f0ec759e4fd6e184cfd863c4f6ddba35ffa1 100644 (file)
@@ -193,13 +193,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
        io->in.credentials  = cmdline_credentials;
        io->in.fallback_to_anonymous = false;
        io->in.workgroup    = lp_workgroup(state->tctx->lp_ctx);
-       io->in.max_xmit = lp_max_xmit(state->tctx->lp_ctx);
-       io->in.max_mux = lp_maxmux(state->tctx->lp_ctx);
-       io->in.ntstatus_support = lp_nt_status_support(state->tctx->lp_ctx);
-       io->in.max_protocol = lp_cli_maxprotocol(state->tctx->lp_ctx);
-       io->in.unicode = lp_unicode(state->tctx->lp_ctx);
-       io->in.use_spnego = lp_use_spnego(state->tctx->lp_ctx) && lp_nt_status_support(state->tctx->lp_ctx);
-       io->in.signing = lp_client_signing(state->tctx->lp_ctx);
+       lp_smbcli_options(state->tctx->lp_ctx, &io->in.options);
 
        /* kill off the remnants of the old connection */
        talloc_free(state->tree);
index 7f4752cdf7c3ec4761e4ae88b01a8be2e621b853..87b27d072837e42cd16e1b22b116adf96bcaf5a9 100644 (file)
@@ -131,13 +131,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
        io->in.credentials  = cmdline_credentials;
        io->in.fallback_to_anonymous = false;
        io->in.workgroup    = lp_workgroup(state->tctx->lp_ctx);
-       io->in.max_xmit = lp_max_xmit(state->tctx->lp_ctx);
-       io->in.max_mux = lp_maxmux(state->tctx->lp_ctx);
-       io->in.ntstatus_support = lp_nt_status_support(state->tctx->lp_ctx);
-       io->in.max_protocol = lp_cli_maxprotocol(state->tctx->lp_ctx);
-       io->in.unicode = lp_unicode(state->tctx->lp_ctx);
-       io->in.use_spnego = lp_use_spnego(state->tctx->lp_ctx) && lp_nt_status_support(state->tctx->lp_ctx);
-       io->in.signing = lp_client_signing(state->tctx->lp_ctx);
+       lp_smbcli_options(state->tctx->lp_ctx, &io->in.options);
 
        /* kill off the remnants of the old connection */
        talloc_free(state->tree);
index dd2912380d2c5c058bc96be87e3816cbbabeef14..849b9fd1e99904c243a74b2ddee693901f8c10e5 100644 (file)
@@ -18,6 +18,7 @@ bool torture_rpc_join(struct torture_context *torture)
        struct cli_credentials *machine_account;
        struct smbcli_state *cli;
        const char *host = torture_setting_string(torture, "host", NULL);
+       struct smbcli_options options;
 
        /* Join domain as a member server. */
        tj = torture_join_domain(torture,
@@ -31,12 +32,14 @@ bool torture_rpc_join(struct torture_context *torture)
                return false;
        }
 
+       lp_smbcli_options(torture->lp_ctx, &options);
+
        status = smbcli_full_connection(tj, &cli, host,
                                        lp_smb_ports(torture->lp_ctx),
                                        "IPC$", NULL,
                                        machine_account,
                                        lp_resolve_context(torture->lp_ctx),
-                                       NULL);
+                                       NULL, &options);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
                          TORTURE_NETBIOS_NAME));
@@ -62,7 +65,7 @@ bool torture_rpc_join(struct torture_context *torture)
                                        "IPC$", NULL,
                                        machine_account,
                                        lp_resolve_context(torture->lp_ctx),
-                                       NULL);
+                                       NULL, &options);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
                          TORTURE_NETBIOS_NAME));
index fd8236544e56b6f21bedae78219a4302d7f16eaa..3b96140fb232fc2d786f5ba58e8296f16724bf7a 100644 (file)
@@ -71,6 +71,7 @@ bool torture_bind_authcontext(struct torture_context *torture)
        struct dcerpc_pipe *lsa_pipe;
        struct cli_credentials *anon_creds;
        struct smb_composite_sesssetup setup;
+       struct smbcli_options options;
 
        mem_ctx = talloc_init("torture_bind_authcontext");
 
@@ -79,12 +80,14 @@ bool torture_bind_authcontext(struct torture_context *torture)
                return false;
        }
 
+       lp_smbcli_options(torture->lp_ctx, &options);
+
        status = smbcli_full_connection(mem_ctx, &cli,
                                        torture_setting_string(torture, "host", NULL),
                                        lp_smb_ports(torture->lp_ctx),
                                        "IPC$", NULL, cmdline_credentials,
                                        lp_resolve_context(torture->lp_ctx),
-                                       NULL);
+                                       NULL, &options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("smbcli_full_connection failed: %s\n",
                         nt_errstr(status));
@@ -282,6 +285,7 @@ bool torture_bind_samba3(struct torture_context *torture)
        NTSTATUS status;
        bool ret = false;
        struct smbcli_state *cli;
+       struct smbcli_options options;
 
        mem_ctx = talloc_init("torture_bind_authcontext");
 
@@ -290,12 +294,14 @@ bool torture_bind_samba3(struct torture_context *torture)
                return false;
        }
 
+       lp_smbcli_options(torture->lp_ctx, &options);
+
        status = smbcli_full_connection(mem_ctx, &cli,
                                        torture_setting_string(torture, "host", NULL),
                                        lp_smb_ports(torture->lp_ctx),
                                        "IPC$", NULL, cmdline_credentials,
                                        lp_resolve_context(torture->lp_ctx),
-                                       NULL);
+                                       NULL, &options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("smbcli_full_connection failed: %s\n",
                         nt_errstr(status));
@@ -1134,6 +1140,7 @@ bool torture_netlogon_samba3(struct torture_context *torture)
        struct cli_credentials *wks_creds;
        const char *wks_name;
        int i;
+       struct smbcli_options options;
 
        wks_name = torture_setting_string(torture, "wksname", NULL);
        if (wks_name == NULL) {
@@ -1152,12 +1159,14 @@ bool torture_netlogon_samba3(struct torture_context *torture)
                goto done;
        }
 
+       lp_smbcli_options(torture->lp_ctx, &options);
+
        status = smbcli_full_connection(mem_ctx, &cli,
                                        torture_setting_string(torture, "host", NULL),
                                        lp_smb_ports(torture->lp_ctx),
                                        "IPC$", NULL, anon_creds, 
                                        lp_resolve_context(torture->lp_ctx),
-                                       NULL);
+                                       NULL, &options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("smbcli_full_connection failed: %s\n",
                         nt_errstr(status));
@@ -1235,13 +1244,16 @@ static bool test_join3(struct torture_context *tctx,
        bool ret = false;
        struct smbcli_state *cli;
        struct cli_credentials *wks_creds;
+       struct smbcli_options options;
+
+       lp_smbcli_options(tctx->lp_ctx, &options);
 
        status = smbcli_full_connection(tctx, &cli,
                                        torture_setting_string(tctx, "host", NULL),
                                        lp_smb_ports(tctx->lp_ctx),
                                        "IPC$", NULL, smb_creds, 
                                        lp_resolve_context(tctx->lp_ctx),
-                                       NULL);
+                                       NULL, &options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("smbcli_full_connection failed: %s\n",
                         nt_errstr(status));
@@ -1598,17 +1610,20 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
        struct cli_credentials *anon_creds;
        struct cli_credentials *user_creds;
        char *domain_name;
+       struct smbcli_options options;
 
        if (!(mem_ctx = talloc_new(torture))) {
                return false;
        }
 
+       lp_smbcli_options(torture->lp_ctx, &options);
+
        status = smbcli_full_connection(
                mem_ctx, &cli, torture_setting_string(torture, "host", NULL),
                lp_smb_ports(torture->lp_ctx),
                "IPC$", NULL, cmdline_credentials, 
                lp_resolve_context(torture->lp_ctx),
-               NULL);
+               NULL, &options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("(%s) smbcli_full_connection failed: %s\n",
                         __location__, nt_errstr(status));
@@ -1635,7 +1650,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
                lp_smb_ports(torture->lp_ctx),
                "IPC$", NULL, anon_creds, 
                lp_resolve_context(torture->lp_ctx),
-               NULL);
+               NULL, &options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("(%s) anon smbcli_full_connection failed: %s\n",
                         __location__, nt_errstr(status));
index 9fa0d55c9ed888581423aced8a45bab81c4633b1..c14be9e2d0726c38ce735d948f1af848db9b3def 100644 (file)
@@ -55,12 +55,16 @@ static struct smbcli_state *connect_to_server(struct torture_context *tctx)
 
        const char *host = torture_setting_string(tctx, "host", NULL);
        const char *share = torture_setting_string(tctx, "share", NULL);
+       struct smbcli_options options;
+
+       lp_smbcli_options(tctx->lp_ctx, &options);
 
        status = smbcli_full_connection(tctx, &cli, host, 
                                        lp_smb_ports(tctx->lp_ctx),
                                        share, NULL,
                                        cmdline_credentials, 
-                                       lp_resolve_context(tctx->lp_ctx), NULL);
+                                       lp_resolve_context(tctx->lp_ctx), NULL, 
+                                       &options);
 
        if (!NT_STATUS_IS_OK(status)) {
                printf("failed to connect to //%s/%s: %s\n",
index 4477713bfedaef3a32f9cff26d48bd4a0c1ca0c8..3203f91bc03df05372471c329388678c8d495342 100644 (file)
@@ -75,12 +75,15 @@ static struct smbcli_state *connect_to_server(struct torture_context *tctx,
 
        const char *host = torture_setting_string(tctx, "host", NULL);
        const char *share = torture_setting_string(tctx, "share", NULL);
+       struct smbcli_options options;
+
+       lp_smbcli_options(tctx->lp_ctx, &options);
 
        status = smbcli_full_connection(tctx, &cli, host, 
                                        lp_smb_ports(tctx->lp_ctx),
                                        share, NULL,
                                        creds, lp_resolve_context(tctx->lp_ctx),
-                                       NULL);
+                                       NULL, &options);
 
        if (!NT_STATUS_IS_OK(status)) {
                printf("failed to connect to //%s/%s: %s\n",
index 7d35b1296e0205e9a254dc5530c3c9c90ab0dc92..6621b68b6e91dab46cccbb092361077fc3fc7d11 100644 (file)
@@ -474,12 +474,16 @@ _PUBLIC_ bool torture_open_connection_share(TALLOC_CTX *mem_ctx,
 {
        NTSTATUS status;
 
+       struct smbcli_options options;
+
+       lp_smbcli_options(tctx->lp_ctx, &options);
+
        status = smbcli_full_connection(mem_ctx, c, hostname, 
                                        lp_smb_ports(tctx->lp_ctx),
                                        sharename, NULL,
                                        cmdline_credentials, 
                                        lp_resolve_context(tctx->lp_ctx),
-                                       ev);
+                                       ev, &options);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Failed to open connection - %s\n", nt_errstr(status));
                return false;