lname = talloc_strdup(ctx, args[1]);
- if (args[2])
- rname = talloc_strdup(ctx, args[2]);
- else
+ if (args[2]) {
+ if (args[2][0]=='\\')
+ rname = talloc_strdup(ctx, args[2]);
+ else
+ rname = talloc_asprintf(ctx, "%s\\%s", ctx->remote_cur_dir, args[2]);
+ } else {
rname = talloc_asprintf(ctx, "%s\\%s", ctx->remote_cur_dir, lname);
+ }
dos_clean_name(rname);
try and browse available shares on a host
****************************************************************************/
static bool browse_host(struct loadparm_context *lp_ctx,
- struct event_context *ev_ctx,
+ struct tevent_context *ev_ctx,
const char *query_host)
{
struct dcerpc_pipe *p;
return a connection to a server
*******************************************************/
static bool do_connect(struct smbclient_context *ctx,
- struct event_context *ev_ctx,
+ struct tevent_context *ev_ctx,
struct resolve_context *resolve_ctx,
const char *specified_server, const char **ports,
const char *specified_share,
struct cli_credentials *cred,
struct smbcli_options *options,
struct smbcli_session_options *session_options,
- struct smb_iconv_convenience *iconv_convenience)
+ struct smb_iconv_convenience *iconv_convenience,
+ struct gensec_settings *gensec_settings)
{
NTSTATUS status;
char *server, *share;
socket_options,
cred, resolve_ctx,
ev_ctx, options, session_options,
- iconv_convenience);
+ iconv_convenience,
+ gensec_settings);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Connection to \\\\%s\\%s failed - %s\n",
server, share, nt_errstr(status));
handle a -L query
****************************************************************************/
static int do_host_query(struct loadparm_context *lp_ctx,
- struct event_context *ev_ctx,
+ struct tevent_context *ev_ctx,
const char *query_host,
const char *workgroup)
{
static int do_message_op(const char *netbios_name, const char *desthost,
const char **destports, const char *destip,
int name_type,
- struct event_context *ev_ctx,
+ struct tevent_context *ev_ctx,
struct resolve_context *resolve_ctx,
struct smbcli_options *options,
struct smb_iconv_convenience *iconv_convenience,
int rc = 0;
int name_type = 0x20;
TALLOC_CTX *mem_ctx;
- struct event_context *ev_ctx;
+ struct tevent_context *ev_ctx;
struct smbclient_context *ctx;
const char *cmdstr = NULL;
struct smbcli_options smb_options;
exit(1);
}
- ctx = talloc(mem_ctx, struct smbclient_context);
+ ctx = talloc_zero(mem_ctx, struct smbclient_context);
ctx->io_bufsize = 64512;
pc = poptGetContext("smbclient", argc, (const char **) argv, long_options, 0);
desthost, lp_smb_ports(cmdline_lp_ctx), service,
lp_socket_options(cmdline_lp_ctx),
cmdline_credentials, &smb_options, &smb_session_options,
- lp_iconv_convenience(cmdline_lp_ctx)))
+ lp_iconv_convenience(cmdline_lp_ctx),
+ lp_gensec_settings(ctx, cmdline_lp_ctx)))
return 1;
- if (base_directory)
+ if (base_directory) {
do_cd(ctx, base_directory);
+ free(base_directory);
+ }
if (cmdstr) {
rc = process_command_string(ctx, cmdstr);
} else {
rc = process_stdin(ctx);
}
-
+
+ free(desthost);
talloc_free(mem_ctx);
return rc;