mirror of
https://github.com/samba-team/samba.git
synced 2025-01-21 18:04:06 +03:00
r26654: libcli/smb_composite: Rather than specifying each of the gazillion options for SMB individually, just specify the smbcli_options struct.
(This used to be commit 8a97886e24a4b969aa91409c06f423b71a45f6eb)
This commit is contained in:
parent
dc8ccffed4
commit
dcc282590b
@ -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;;) {
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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));
|
||||
|
@ -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)
|
||||
|
@ -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)) {
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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)) {
|
||||
|
@ -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;
|
||||
|
@ -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) &&
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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),
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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),
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
@ -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));
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user