diff options
Diffstat (limited to 'source4/client')
-rw-r--r-- | source4/client/cifsdd.c | 18 | ||||
-rw-r--r-- | source4/client/cifsdd.h | 3 | ||||
-rw-r--r-- | source4/client/cifsddio.c | 17 | ||||
-rw-r--r-- | source4/client/client.c | 13 |
4 files changed, 31 insertions, 20 deletions
diff --git a/source4/client/cifsdd.c b/source4/client/cifsdd.c index 08c152c3a5..8749a82573 100644 --- a/source4/client/cifsdd.c +++ b/source4/client/cifsdd.c @@ -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); } diff --git a/source4/client/cifsdd.h b/source4/client/cifsdd.h index 994c209103..0c44b91581 100644 --- a/source4/client/cifsdd.h +++ b/source4/client/cifsdd.h @@ -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, diff --git a/source4/client/cifsddio.c b/source4/client/cifsddio.c index c30bf53196..2e5aedc4f9 100644 --- a/source4/client/cifsddio.c +++ b/source4/client/cifsddio.c @@ -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)); } diff --git a/source4/client/client.c b/source4/client/client.c index 2f6a7abcc0..7ce3268d3a 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -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) |