Janitorial: Pass resolve_context explicitly to various SMB functions, should help...
authorjelmer <jelmer@0c0555d6-39d7-0310-84fc-f1cc0bd64818>
Wed, 2 Jan 2008 18:39:01 +0000 (18:39 +0000)
committerjelmer <jelmer@0c0555d6-39d7-0310-84fc-f1cc0bd64818>
Wed, 2 Jan 2008 18:39:01 +0000 (18:39 +0000)
git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/SAMBA_4_0@26644 0c0555d6-39d7-0310-84fc-f1cc0bd64818

29 files changed:
source/auth/auth_winbind.c
source/client/cifsdd.c
source/client/cifsdd.h
source/client/cifsddio.c
source/client/client.c
source/libcli/cliconnect.c
source/libcli/raw/clisocket.c
source/libcli/raw/clitransport.c
source/libcli/raw/clitree.c
source/libcli/smb2/connect.c
source/libcli/smb_composite/connect.c
source/libcli/smb_composite/fetchfile.c
source/libcli/smb_composite/fsinfo.c
source/libcli/smb_composite/smb_composite.h
source/librpc/rpc/dcerpc_connect.c
source/ntvfs/cifs/vfs_cifs.c
source/scripting/ejs/smbcalls_cli.c
source/torture/basic/base.c
source/torture/basic/misc.c
source/torture/gentest.c
source/torture/locktest.c
source/torture/masktest.c
source/torture/raw/lockbench.c
source/torture/raw/openbench.c
source/torture/rpc/join.c
source/torture/rpc/samba3rpc.c
source/torture/unix/unix_info2.c
source/torture/unix/whoami.c
source/torture/util_smb.c

index bfbcbbfd5dd545d598be5add08762f0ac6e2e870..89ae3195dfd95b84d8630b3ae06f5b31a807f471 100644 (file)
@@ -29,7 +29,7 @@
 #include "lib/messaging/irpc.h"
 #include "param/param.h"
 
-static NTSTATUS get_info3_from_ndr(TALLOC_CTX *mem_ctx, struct winbindd_response *response, struct netr_SamInfo3 *info3)
+static NTSTATUS get_info3_from_ndr(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, struct winbindd_response *response, struct netr_SamInfo3 *info3)
 {
        size_t len = response->length - sizeof(struct winbindd_response);
        if (len > 4) {
@@ -39,7 +39,7 @@ static NTSTATUS get_info3_from_ndr(TALLOC_CTX *mem_ctx, struct winbindd_response
                blob.data = (uint8_t *)(((char *)response->extra_data.data) + 4);
 
                ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, 
-                              lp_iconv_convenience(global_loadparm), info3,
+                              iconv_convenience, info3,
                              (ndr_pull_flags_fn_t)ndr_pull_netr_SamInfo3);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        return ndr_map_error2ntstatus(ndr_err);
@@ -122,7 +122,7 @@ static NTSTATUS winbind_check_password_samba3(struct auth_method_context *ctx,
        if (result == NSS_STATUS_SUCCESS && response.extra_data.data) {
                union netr_Validation validation;
 
-               nt_status = get_info3_from_ndr(mem_ctx, &response, &info3);
+               nt_status = get_info3_from_ndr(mem_ctx, lp_iconv_convenience(ctx->auth_ctx->lp_ctx), &response, &info3);
                SAFE_FREE(response.extra_data.data);
                NT_STATUS_NOT_OK_RETURN(nt_status); 
 
index 08c152c3a5cf01ae591a05ee289de31184be2348..8749a82573cf1161201eb5f3a2fe663621c04fc4 100644 (file)
@@ -22,6 +22,7 @@
 #include "system/filesys.h"
 #include "auth/gensec/gensec.h"
 #include "lib/cmdline/popt_common.h"
+#include "libcli/resolve/resolve.h"
 
 #include "cifsdd.h"
 #include "param/param.h"
@@ -351,7 +352,8 @@ static void print_transfer_stats(void)
        }
 }
 
-static struct dd_iohandle * open_file(const char * which, const char **ports)
+static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx, 
+                                     const char * which, const char **ports)
 {
        int                     options = 0;
        const char *            path = NULL;
@@ -371,13 +373,13 @@ static struct dd_iohandle * open_file(const char * which, const char **ports)
 
        if (strcmp(which, "if") == 0) {
                path = check_arg_pathname("if");
-               handle = dd_open_path(path, ports, check_arg_numeric("ibs"),
-                                       options);
+               handle = dd_open_path(resolve_ctx, path, ports, 
+                                     check_arg_numeric("ibs"), options);
        } else if (strcmp(which, "of") == 0) {
                options |= DD_WRITE;
                path = check_arg_pathname("of");
-               handle = dd_open_path(path, ports, check_arg_numeric("obs"),
-                                       options);
+               handle = dd_open_path(resolve_ctx, path, ports, 
+                                     check_arg_numeric("obs"), options);
        } else {
                SMB_ASSERT(0);
                return(NULL);
@@ -431,11 +433,13 @@ static int copy_files(struct loadparm_context *lp_ctx)
        DEBUG(4, ("IO buffer size is %llu, max xmit is %d\n",
                        (unsigned long long)iomax, lp_max_xmit(lp_ctx)));
 
-       if (!(ifile = open_file("if", lp_smb_ports(lp_ctx)))) {
+       if (!(ifile = open_file(lp_resolve_context(lp_ctx), "if", 
+                               lp_smb_ports(lp_ctx)))) {
                return(FILESYS_EXIT_CODE);
        }
 
-       if (!(ofile = open_file("of", lp_smb_ports(lp_ctx)))) {
+       if (!(ofile = open_file(lp_resolve_context(lp_ctx), "of", 
+                               lp_smb_ports(lp_ctx)))) {
                return(FILESYS_EXIT_CODE);
        }
 
index 994c2091030ea2c786c139c57d304e3f4aa3ef24..0c44b9158192a84b306f6e398fcf1fdfcbac1b16 100644 (file)
@@ -88,7 +88,8 @@ struct dd_iohandle
 #define DD_WRITE               0x00000004
 #define DD_OPLOCK              0x00000008
 
-struct dd_iohandle * dd_open_path(const char * path,
+struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx, 
+                                 const char * path,
                                  const char **ports,
                                uint64_t io_size, int options);
 bool dd_fill_block(struct dd_iohandle * h, uint8_t * buf,
index c30bf53196985ecd54c1580329fd7910cd385738..2e5aedc4f98ba2bfaddc8156593789a1575e8eaa 100644 (file)
@@ -220,7 +220,8 @@ static bool smb_write_func(void * handle, uint8_t * buf, uint64_t wanted,
        return(true);
 }
 
-static struct smbcli_state * init_smb_session(const char * host,
+static struct smbcli_state * init_smb_session(struct resolve_context *resolve_ctx,
+                                             const char * host,
                                              const char **ports,
                                              const char * share)
 {
@@ -231,7 +232,8 @@ static struct smbcli_state * init_smb_session(const char * host,
         * each connection, but for now, we just use the same one for both.
         */
        ret = smbcli_full_connection(NULL, &cli, host, ports, share,
-                        NULL /* devtype */, cmdline_credentials, NULL /* events */);
+                        NULL /* devtype */, cmdline_credentials, resolve_ctx, 
+                        NULL /* events */);
 
        if (!NT_STATUS_IS_OK(ret)) {
                fprintf(stderr, "%s: connecting to //%s/%s: %s\n",
@@ -289,7 +291,8 @@ static int open_smb_file(struct smbcli_state * cli,
        return(o.ntcreatex.out.file.fnum);
 }
 
-static struct dd_iohandle * open_cifs_handle(const char * host,
+static struct dd_iohandle * open_cifs_handle(struct resolve_context *resolve_ctx,
+                                            const char * host,
                                        const char **ports,
                                        const char * share,
                                        const char * path,
@@ -314,7 +317,7 @@ static struct dd_iohandle * open_cifs_handle(const char * host,
        smbh->h.io_write = smb_write_func;
        smbh->h.io_seek = smb_seek_func;
 
-       if ((smbh->cli = init_smb_session(host, ports, share)) == NULL) {
+       if ((smbh->cli = init_smb_session(resolve_ctx, host, ports, share)) == NULL) {
                return(NULL);
        }
 
@@ -329,7 +332,8 @@ static struct dd_iohandle * open_cifs_handle(const char * host,
 /* Abstract IO interface.                                                   */
 /* ------------------------------------------------------------------------- */
 
-struct dd_iohandle * dd_open_path(const char * path,
+struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx, 
+                                 const char * path,
                                  const char **ports,
                                uint64_t io_size,
                                int options)
@@ -347,7 +351,8 @@ struct dd_iohandle * dd_open_path(const char * path,
                        /* Skip over leading directory separators. */
                        while (*remain == '/' || *remain == '\\') { remain++; }
 
-                       return(open_cifs_handle(host, ports, share, remain,
+                       return(open_cifs_handle(resolve_ctx, host, ports, 
+                                               share, remain,
                                                io_size, options));
                }
 
index 2f6a7abcc0e033d226590e9d947b2b5e4357c91a..7ce3268d3a4dfd0ef6a5562302b64a794990d83d 100644 (file)
@@ -3019,7 +3019,8 @@ static int process_stdin(struct smbclient_context *ctx)
 /***************************************************** 
 return a connection to a server
 *******************************************************/
-static bool do_connect(struct smbclient_context *ctx,
+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)
 {
        NTSTATUS status;
@@ -3038,7 +3039,7 @@ static bool do_connect(struct smbclient_context *ctx,
        ctx->remote_cur_dir = talloc_strdup(ctx, "\\");
        
        status = smbcli_full_connection(ctx, &ctx->cli, server, ports,
-                                       share, NULL, cred, 
+                                       share, NULL, cred, resolve_ctx, 
                                        cli_credentials_get_event_context(cred));
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("Connection to \\\\%s\\%s failed - %s\n", 
@@ -3064,7 +3065,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)
+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)
 {
        struct nbt_name called, calling;
        const char *server_name;
@@ -3076,7 +3077,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)) {
+       if (!(cli=smbcli_state_init(NULL)) || !smbcli_socket_connect(cli, server_name, destports, resolve_ctx, max_xmit, max_mux, use_spnego)) {
                d_printf("Connection to %s failed\n", server_name);
                return 1;
        }
@@ -3224,10 +3225,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));
+               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));
        }
        
-       if (!do_connect(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))
                return 1;
 
        if (base_directory) 
index 7ec914e831946371e83f42d2f1a87798a658e74f..c13dde97112dadbcf9e45d7b123e279b7271dc96 100644 (file)
@@ -32,7 +32,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)
+                          int max_xmit, int max_mux, bool use_spnego)
 {
        struct smbcli_socket *sock;
 
@@ -42,7 +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);
+                                              max_mux, use_spnego);
        if (!cli->transport) {
                return false;
        }
@@ -140,6 +140,7 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
                                const char *sharename,
                                const char *devtype,
                                struct cli_credentials *credentials,
+                               struct resolve_context *resolve_ctx,
                                struct event_context *ev)
 {
        struct smbcli_tree *tree;
@@ -150,7 +151,7 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
        status = smbcli_tree_full_connection(parent_ctx,
                                             &tree, host, ports, 
                                             sharename, devtype,
-                                            credentials, ev);
+                                            credentials, resolve_ctx, ev);
        if (!NT_STATUS_IS_OK(status)) {
                goto done;
        }
index 9732ab16381a0896523ef456472c92a091f592f9..8beaef3daabdf752f6a78f8e4f66e5026f5c1b10 100644 (file)
@@ -47,6 +47,7 @@ struct composite_context *smbcli_sock_connect_send(TALLOC_CTX *mem_ctx,
                                                   const char *host_addr,
                                                   const char **ports,
                                                   const char *host_name,
+                                                  struct resolve_context *resolve_ctx,
                                                   struct event_context *event_ctx)
 {
        struct composite_context *result, *ctx;
@@ -152,11 +153,13 @@ NTSTATUS smbcli_sock_connect_recv(struct composite_context *c,
 NTSTATUS smbcli_sock_connect(TALLOC_CTX *mem_ctx,
                             const char *host_addr, const char **ports,
                             const char *host_name,
+                            struct resolve_context *resolve_ctx,
                             struct event_context *event_ctx,
                             struct smbcli_socket **result)
 {
        struct composite_context *c =
                smbcli_sock_connect_send(mem_ctx, host_addr, ports, host_name,
+                                        resolve_ctx,
                                         event_ctx);
        return smbcli_sock_connect_recv(c, mem_ctx, result);
 }
@@ -233,8 +236,8 @@ struct smbcli_socket *smbcli_sock_connect_byname(const char *host, const char **
                return NULL;
        }
 
-       status = smbcli_sock_connect(mem_ctx, address, ports, name, event_ctx,
-                                    &result);
+       status = smbcli_sock_connect(mem_ctx, address, ports, name, resolve_ctx,
+                                    event_ctx, &result);
 
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(9, ("smbcli_sock_connect failed: %s\n",
index 11df6c6c96ba02ecc4ccd36de8470c609f43e64c..bdaeaeb58a310bd542df7b7bb9ee3808b42ecefd 100644 (file)
@@ -75,7 +75,8 @@ struct smbcli_transport *smbcli_transport_init(struct smbcli_socket *sock,
                                               TALLOC_CTX *parent_ctx, 
                                               bool primary, 
                                               int max_xmit,
-                                              int max_mux)
+                                              int max_mux,
+                                              bool use_spnego)
 {
        struct smbcli_transport *transport;
 
@@ -88,8 +89,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(global_loadparm) && 
-                                       lp_nt_status_support(global_loadparm);
+       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;
index 890d5470da16c88ceceec7e8b9ab3647ed69b94e..6b14893c4e9da34bb999de5caed737d4438c08a7 100644 (file)
@@ -174,6 +174,7 @@ NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx,
                                     const char *dest_host, const char **dest_ports,
                                     const char *service, const char *service_type,
                                     struct cli_credentials *credentials,
+                                    struct resolve_context *resolve_ctx,
                                     struct event_context *ev)
 {
        struct smb_composite_connect io;
@@ -192,7 +193,7 @@ NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx,
        io.in.fallback_to_anonymous = false;
        io.in.workgroup = lp_workgroup(global_loadparm);
        
-       status = smb_composite_connect(&io, parent_ctx, ev);
+       status = smb_composite_connect(&io, parent_ctx, resolve_ctx, ev);
        if (NT_STATUS_IS_OK(status)) {
                *ret_tree = io.out.tree;
        }
index 4d250fdded47c15b630a1c04463c96b6ee205485..4518203183294f467b8de599b8f9241fc9104616 100644 (file)
@@ -29,6 +29,7 @@
 
 struct smb2_connect_state {
        struct cli_credentials *credentials;
+       struct resolve_context *resolve_ctx;
        const char *host;
        const char *share;
        struct smb2_negprot negprot;
@@ -152,7 +153,7 @@ static void continue_resolve(struct composite_context *creq)
        c->status = resolve_name_recv(creq, state, &addr);
        if (!composite_is_ok(c)) return;
 
-       creq = smbcli_sock_connect_send(state, addr, ports, state->host, c->event_ctx);
+       creq = smbcli_sock_connect_send(state, addr, ports, state->host, state->resolve_ctx, c->event_ctx);
 
        composite_continue(c, creq, continue_socket, c);
 }
@@ -185,6 +186,7 @@ struct composite_context *smb2_connect_send(TALLOC_CTX *mem_ctx,
        if (composite_nomem(state->host, c)) return c;
        state->share = talloc_strdup(c, share);
        if (composite_nomem(state->share, c)) return c;
+       state->resolve_ctx = talloc_reference(state, resolve_ctx);
 
        ZERO_STRUCT(name);
        name.name = host;
index fafd3b0173c5b99b2ca58d1bcd1a38b9fedb7c45..b71cfc2c19b05c6dfc193ea074873852cf2f63c2 100644 (file)
@@ -309,7 +309,8 @@ 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, 
                                                 lp_max_xmit(global_loadparm),
-                                                lp_maxmux(global_loadparm));
+                                                lp_maxmux(global_loadparm),
+                                                lp_use_spnego(global_loadparm) && lp_nt_status_support(global_loadparm));
        NT_STATUS_HAVE_NO_MEMORY(state->transport);
 
        if (is_ipaddress(state->sock->hostname) &&
@@ -362,7 +363,8 @@ static NTSTATUS connect_resolve(struct composite_context *c,
 
        state->creq = smbcli_sock_connect_send(state, address, 
                                               io->in.dest_ports,
-                                              io->in.dest_host, c->event_ctx);
+                                              io->in.dest_host, 
+                                              NULL, c->event_ctx);
        NT_STATUS_HAVE_NO_MEMORY(state->creq);
 
        state->stage = CONNECT_SOCKET;
@@ -440,6 +442,7 @@ static void composite_handler(struct composite_context *creq)
 */
 struct composite_context *smb_composite_connect_send(struct smb_composite_connect *io,
                                                     TALLOC_CTX *mem_ctx,
+                                                    struct resolve_context *resolve_ctx,
                                                     struct event_context *event_ctx)
 {
        struct composite_context *c;
@@ -464,7 +467,7 @@ struct composite_context *smb_composite_connect_send(struct smb_composite_connec
 
        state->stage = CONNECT_RESOLVE;
        make_nbt_name_server(&name, io->in.dest_host);
-       state->creq = resolve_name_send(lp_resolve_context(global_loadparm), &name, c->event_ctx);
+       state->creq = resolve_name_send(resolve_ctx, &name, c->event_ctx);
 
        if (state->creq == NULL) goto failed;
        state->creq->async.private_data = c;
@@ -498,8 +501,9 @@ NTSTATUS smb_composite_connect_recv(struct composite_context *c, TALLOC_CTX *mem
   sync version of smb_composite_connect 
 */
 NTSTATUS smb_composite_connect(struct smb_composite_connect *io, TALLOC_CTX *mem_ctx,
+                              struct resolve_context *resolve_ctx,
                               struct event_context *ev)
 {
-       struct composite_context *c = smb_composite_connect_send(io, mem_ctx, ev);
+       struct composite_context *c = smb_composite_connect_send(io, mem_ctx, resolve_ctx, ev);
        return smb_composite_connect_recv(c, mem_ctx);
 }
index a4f73ffd7015dacca96197b9a30aacf52d537ed7..f3934a212321237a42af6e1035a1c2ea229fbb06 100644 (file)
@@ -23,6 +23,8 @@
 #include "includes.h"
 #include "libcli/composite/composite.h"
 #include "libcli/smb_composite/smb_composite.h"
+#include "param/param.h"
+#include "libcli/resolve/resolve.h"
 
 enum fetchfile_stage {FETCHFILE_CONNECT,
                      FETCHFILE_READ};
@@ -145,7 +147,8 @@ 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->creq = smb_composite_connect_send(state->connect, state, event_ctx);
+       state->creq = smb_composite_connect_send(state->connect, state, 
+                                                lp_resolve_context(global_loadparm), event_ctx);
        if (state->creq == NULL) goto failed;
 
        state->creq->async.private_data = c;
index f37213e2f9b1c70367e092ae8ad96362eaa4c488..2d8240572e4500fe6b568462d4775bd3f1e6275c 100644 (file)
@@ -6,6 +6,8 @@
 #include "libcli/raw/libcliraw.h"
 #include "libcli/composite/composite.h"
 #include "libcli/smb_composite/smb_composite.h"
+#include "param/param.h"
+#include "libcli/resolve/resolve.h"
 
 /* the stages of this call */
 enum fsinfo_stage {FSINFO_CONNECT, FSINFO_QUERY};
@@ -157,7 +159,7 @@ struct composite_context *smb_composite_fsinfo_send(struct smbcli_tree *tree,
        c->private_data = state;
 
        state->creq = smb_composite_connect_send(state->connect, state,
-                                                c->event_ctx);
+                        lp_resolve_context(global_loadparm), c->event_ctx);
 
        if (state->creq == NULL) goto failed;
   
index a3188c4fe24e542dcaf1f39472ed5a361067aaec..5574495079d861f216b6d11c182db63a3239215d 100644 (file)
@@ -171,5 +171,6 @@ struct smb_composite_connectmulti {
 };
 
 struct smbcli_session;
+struct resolve_context;
 
 #include "libcli/smb_composite/proto.h"
index c0f61e0141d3d1bfa78c3f2cd1e5745e174d921f..4c11a56272bfa69f202bd4b0915c605cc7ddfbc5 100644 (file)
@@ -133,7 +133,9 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CT
        }
 
        /* send smb connect request */
-       conn_req = smb_composite_connect_send(conn, s->io.pipe->conn, s->io.pipe->conn->event_ctx);
+       conn_req = smb_composite_connect_send(conn, s->io.pipe->conn, 
+                                             lp_resolve_context(lp_ctx), 
+                                             s->io.pipe->conn->event_ctx);
        if (composite_nomem(conn_req, c)) return c;
 
        composite_continue(c, conn_req, continue_smb_connect, c);
index 9426355ecb03e9f8c368a9b666f930b4fd07962d..adfea6d2a2806a5c089b0dd790fd7a195ef5c57c 100644 (file)
@@ -32,6 +32,7 @@
 #include "ntvfs/ntvfs.h"
 #include "lib/util/dlinklist.h"
 #include "param/param.h"
+#include "libcli/resolve/resolve.h"
 
 struct cvfs_file {
        struct cvfs_file *prev, *next;
@@ -202,7 +203,9 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
        io.in.service = remote_share;
        io.in.service_type = "?????";
        
-       creq = smb_composite_connect_send(&io, private, ntvfs->ctx->event_ctx);
+       creq = smb_composite_connect_send(&io, private, 
+                                         lp_resolve_context(ntvfs->ctx->lp_ctx),
+                                         ntvfs->ctx->event_ctx);
        status = smb_composite_connect_recv(creq, private);
        NT_STATUS_NOT_OK_RETURN(status);
 
index a7210eb0fb7eb7954cfed0f2473902596d6508f5..bb1e445d04c6bf81151892d6d646b918407a2b74 100644 (file)
@@ -26,6 +26,7 @@
 #include "libcli/composite/composite.h"
 #include "libcli/smb_composite/smb_composite.h"
 #include "libcli/libcli.h"
+#include "libcli/resolve/resolve.h"
 #include "auth/credentials/credentials.h"
 #include "param/param.h"
 
@@ -445,7 +446,9 @@ static int ejs_tree_connect(MprVarHandle eid, int argc, char **argv)
        io.in.fallback_to_anonymous  = false;
        io.in.workgroup              = lp_workgroup(global_loadparm);
 
-       result = smb_composite_connect(&io, mem_ctx, NULL);
+       result = smb_composite_connect(&io, mem_ctx, 
+                                      lp_resolve_context(global_loadparm), 
+                                      NULL);
        tree = io.out.tree;
 
        talloc_free(mem_ctx);
index cba57ac4130bebc5a6445babd18b9fb586e9ace4..9820a02f2746fb968c291f32bd9d92a162e1ec5b 100644 (file)
@@ -51,7 +51,7 @@ 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))) {
+       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))) {
                torture_comment(tctx, "Failed to connect with %s\n", host);
                goto failed;
        }
index 0832556b53e7118704fdead5ac85deaa38d28dba..ccff18bfc491734e4331142bcf6c29f6fcdaac28 100644 (file)
@@ -822,7 +822,8 @@ static struct composite_context *torture_connect_async(
        smb->in.fallback_to_anonymous=false;
        smb->in.workgroup=workgroup;
        
-       return smb_composite_connect_send(smb,mem_ctx,ev);
+       return smb_composite_connect_send(smb,mem_ctx,
+                                         lp_resolve_context(tctx->lp_ctx),ev);
 }
 
 bool run_benchrw(struct torture_context *tctx)
index b257f1dc351348e441af2c5fed1d1dec3f3ccfc7..9e5ef73ea6a306525b37fe6cf6461ea1f3452d5c 100644 (file)
@@ -25,6 +25,7 @@
 #include "libcli/raw/libcliraw.h"
 #include "librpc/gen_ndr/security.h"
 #include "auth/credentials/credentials.h"
+#include "libcli/resolve/resolve.h"
 #include "auth/gensec/gensec.h"
 #include "param/param.h"
 #include "dynconfig.h"
@@ -187,7 +188,9 @@ static bool connect_servers(struct loadparm_context *lp_ctx)
                                                        servers[i].server_name, 
                                                        lp_smb_ports(lp_ctx),
                                                        servers[i].share_name, NULL, 
-                                                       servers[i].credentials, NULL);
+                                                       servers[i].credentials, 
+                                                       lp_resolve_context(lp_ctx), 
+                                                       NULL);
                        if (!NT_STATUS_IS_OK(status)) {
                                printf("Failed to connect to \\\\%s\\%s - %s\n",
                                       servers[i].server_name, servers[i].share_name,
index 9758cd2cf666f14178eceab384138b50a3cd757b..08313b6d57a3f35a1abbd95a89eaff93552bbc08 100644 (file)
@@ -26,6 +26,7 @@
 #include "libcli/libcli.h"
 #include "param/param.h"
 #include "dynconfig.h"
+#include "libcli/resolve/resolve.h"
 
 static int numops = 1000;
 static bool showall;
@@ -155,7 +156,9 @@ static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx,
                                                server, 
                                                lp_smb_ports(lp_ctx),
                                                share, NULL,
-                                               servers[snum], NULL);
+                                               servers[snum], 
+                                               lp_resolve_context(lp_ctx),
+                                               NULL);
                if (!NT_STATUS_IS_OK(status)) {
                        sleep(2);
                }
index c88b4f704bc94cf071f579b7b5dcddca01d95bf3..28dfe27960eb70e2b2181771204734e0add4a0cc 100644 (file)
@@ -28,6 +28,7 @@
 #include "auth/gensec/gensec.h"
 #include "param/param.h"
 #include "dynconfig.h"
+#include "libcli/resolve/resolve.h"
 
 static struct cli_credentials *credentials;
 static bool showall = false;
@@ -72,7 +73,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(char *share, const char **ports)
+static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx, 
+                                       char *share, const char **ports)
 {
        struct smbcli_state *c;
        fstring server;
@@ -90,7 +92,7 @@ static struct smbcli_state *connect_one(char *share, const char **ports)
                                        server, 
                                        ports,
                                        share, NULL,
-                                       credentials, NULL);
+                                       credentials, resolve_ctx, NULL);
 
        if (!NT_STATUS_IS_OK(status)) {
                return NULL;
@@ -380,7 +382,7 @@ static void usage(void)
        argc -= optind;
        argv += optind;
 
-       cli = connect_one(share, lp_smb_ports(lp_ctx));
+       cli = connect_one(lp_resolve_context(lp_ctx), share, lp_smb_ports(lp_ctx));
        if (!cli) {
                DEBUG(0,("Failed to connect to %s\n", share));
                exit(1);
index 744aab66b1d6b4488bf59b5e585dc61e7e4913d8..9131128f81d26b0cd14f404007d14d422ec08bc6 100644 (file)
@@ -30,6 +30,7 @@
 #include "lib/cmdline/popt_common.h"
 #include "libcli/composite/composite.h"
 #include "libcli/smb_composite/smb_composite.h"
+#include "libcli/resolve/resolve.h"
 #include "param/param.h"
 
 #define BASEDIR "\\benchlock"
@@ -197,7 +198,9 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
        talloc_free(state->tree);
        state->tree = NULL;
 
-       ctx = smb_composite_connect_send(io, state->mem_ctx, state->ev);
+       ctx = smb_composite_connect_send(io, state->mem_ctx, 
+                                        lp_resolve_context(state->tctx->lp_ctx),
+                                        state->ev);
        if (ctx == NULL) {
                DEBUG(0,("Failed to setup async reconnect\n"));
                exit(1);
index ceb52cdfcf19d4dd0d3d8a2065457dbe2561060d..881f487cb061ae96ea334db8019a7a85ae03d7d9 100644 (file)
@@ -30,6 +30,7 @@
 #include "lib/cmdline/popt_common.h"
 #include "libcli/composite/composite.h"
 #include "libcli/smb_composite/smb_composite.h"
+#include "libcli/resolve/resolve.h"
 #include "param/param.h"
 
 #define BASEDIR "\\benchopen"
@@ -136,7 +137,9 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
        state->tree = NULL;
        state->fnum = -1;
 
-       ctx = smb_composite_connect_send(io, state->mem_ctx, state->ev);
+       ctx = smb_composite_connect_send(io, state->mem_ctx, 
+                                        lp_resolve_context(state->tctx->lp_ctx), 
+                                        state->ev);
        if (ctx == NULL) {
                DEBUG(0,("Failed to setup async reconnect\n"));
                exit(1);
index 8ab6ae03ead1a5f84877fdbda3be5e04cbfac489..dd2912380d2c5c058bc96be87e3816cbbabeef14 100644 (file)
@@ -5,6 +5,7 @@
 #include "auth/credentials/credentials.h"
 #include "torture/rpc/rpc.h"
 
+#include "libcli/resolve/resolve.h"
 #include "param/param.h"
 
 #define TORTURE_NETBIOS_NAME "smbtorturejoin"
@@ -34,6 +35,7 @@ bool torture_rpc_join(struct torture_context *torture)
                                        lp_smb_ports(torture->lp_ctx),
                                        "IPC$", NULL,
                                        machine_account,
+                                       lp_resolve_context(torture->lp_ctx),
                                        NULL);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
@@ -59,6 +61,7 @@ bool torture_rpc_join(struct torture_context *torture)
                                        lp_smb_ports(torture->lp_ctx),
                                        "IPC$", NULL,
                                        machine_account,
+                                       lp_resolve_context(torture->lp_ctx),
                                        NULL);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
index 36461ad6291dc70cb183d55bb10eec080b10fecc..fd8236544e56b6f21bedae78219a4302d7f16eaa 100644 (file)
@@ -50,6 +50,7 @@
 #include "libcli/security/proto.h"
 #include "param/param.h"
 #include "lib/registry/registry.h"
+#include "libcli/resolve/resolve.h"
 
 /*
  * This tests a RPC call using an invalid vuid
@@ -82,6 +83,7 @@ bool torture_bind_authcontext(struct torture_context *torture)
                                        torture_setting_string(torture, "host", NULL),
                                        lp_smb_ports(torture->lp_ctx),
                                        "IPC$", NULL, cmdline_credentials,
+                                       lp_resolve_context(torture->lp_ctx),
                                        NULL);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("smbcli_full_connection failed: %s\n",
@@ -292,6 +294,7 @@ bool torture_bind_samba3(struct torture_context *torture)
                                        torture_setting_string(torture, "host", NULL),
                                        lp_smb_ports(torture->lp_ctx),
                                        "IPC$", NULL, cmdline_credentials,
+                                       lp_resolve_context(torture->lp_ctx),
                                        NULL);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("smbcli_full_connection failed: %s\n",
@@ -1152,7 +1155,9 @@ bool torture_netlogon_samba3(struct torture_context *torture)
        status = smbcli_full_connection(mem_ctx, &cli,
                                        torture_setting_string(torture, "host", NULL),
                                        lp_smb_ports(torture->lp_ctx),
-                                       "IPC$", NULL, anon_creds, NULL);
+                                       "IPC$", NULL, anon_creds, 
+                                       lp_resolve_context(torture->lp_ctx),
+                                       NULL);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("smbcli_full_connection failed: %s\n",
                         nt_errstr(status));
@@ -1234,7 +1239,9 @@ static bool test_join3(struct torture_context *tctx,
        status = smbcli_full_connection(tctx, &cli,
                                        torture_setting_string(tctx, "host", NULL),
                                        lp_smb_ports(tctx->lp_ctx),
-                                       "IPC$", NULL, smb_creds, NULL);
+                                       "IPC$", NULL, smb_creds, 
+                                       lp_resolve_context(tctx->lp_ctx),
+                                       NULL);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("smbcli_full_connection failed: %s\n",
                         nt_errstr(status));
@@ -1599,7 +1606,9 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
        status = smbcli_full_connection(
                mem_ctx, &cli, torture_setting_string(torture, "host", NULL),
                lp_smb_ports(torture->lp_ctx),
-               "IPC$", NULL, cmdline_credentials, NULL);
+               "IPC$", NULL, cmdline_credentials, 
+               lp_resolve_context(torture->lp_ctx),
+               NULL);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("(%s) smbcli_full_connection failed: %s\n",
                         __location__, nt_errstr(status));
@@ -1624,7 +1633,9 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
        status = smbcli_full_connection(
                mem_ctx, &cli, torture_setting_string(torture, "host", NULL),
                lp_smb_ports(torture->lp_ctx),
-               "IPC$", NULL, anon_creds, NULL);
+               "IPC$", NULL, anon_creds, 
+               lp_resolve_context(torture->lp_ctx),
+               NULL);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("(%s) anon smbcli_full_connection failed: %s\n",
                         __location__, nt_errstr(status));
index d5fe8bc2604d22a31bb60e3750f461e770b10283..9fa0d55c9ed888581423aced8a45bab81c4633b1 100644 (file)
@@ -26,6 +26,7 @@
 #include "torture/basic/proto.h"
 #include "lib/cmdline/popt_common.h"
 #include "auth/credentials/credentials.h"
+#include "libcli/resolve/resolve.h"
 #include "param/param.h"
 
 struct unix_info2 {
@@ -58,7 +59,8 @@ static struct smbcli_state *connect_to_server(struct torture_context *tctx)
        status = smbcli_full_connection(tctx, &cli, host, 
                                        lp_smb_ports(tctx->lp_ctx),
                                        share, NULL,
-                                       cmdline_credentials, NULL);
+                                       cmdline_credentials, 
+                                       lp_resolve_context(tctx->lp_ctx), NULL);
 
        if (!NT_STATUS_IS_OK(status)) {
                printf("failed to connect to //%s/%s: %s\n",
index 412a256da7c46e48355bb4477062674c02837751..4477713bfedaef3a32f9cff26d48bd4a0c1ca0c8 100644 (file)
@@ -25,6 +25,7 @@
 #include "lib/cmdline/popt_common.h"
 #include "auth/credentials/credentials.h"
 #include "param/param.h"
+#include "libcli/resolve/resolve.h"
 
 /* Size (in bytes) of the required fields in the SMBwhoami response. */
 #define WHOAMI_REQUIRED_SIZE   40
@@ -78,7 +79,8 @@ static struct smbcli_state *connect_to_server(struct torture_context *tctx,
        status = smbcli_full_connection(tctx, &cli, host, 
                                        lp_smb_ports(tctx->lp_ctx),
                                        share, NULL,
-                                       creds, NULL);
+                                       creds, lp_resolve_context(tctx->lp_ctx),
+                                       NULL);
 
        if (!NT_STATUS_IS_OK(status)) {
                printf("failed to connect to //%s/%s: %s\n",
index 1168f316793b8e30582ccbf4bcbc38e6c45e07d5..7d35b1296e0205e9a254dc5530c3c9c90ab0dc92 100644 (file)
@@ -31,6 +31,7 @@
 #include "torture/torture.h"
 #include "util/dlinklist.h"
 #include "auth/credentials/credentials.h"
+#include "libcli/resolve/resolve.h"
 #include "param/param.h"
 
 
@@ -476,7 +477,9 @@ _PUBLIC_ bool torture_open_connection_share(TALLOC_CTX *mem_ctx,
        status = smbcli_full_connection(mem_ctx, c, hostname, 
                                        lp_smb_ports(tctx->lp_ctx),
                                        sharename, NULL,
-                                       cmdline_credentials, ev);
+                                       cmdline_credentials, 
+                                       lp_resolve_context(tctx->lp_ctx),
+                                       ev);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Failed to open connection - %s\n", nt_errstr(status));
                return false;