#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"
}
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;
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);
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. */
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.
*/
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);
}
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;;) {
#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,
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;
*/
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",
const char * share,
const char * path,
uint64_t io_size,
- int options)
+ int options,
+ struct smbcli_options *smb_options)
{
struct cifs_handle * smbh;
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);
}
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));
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));
*******************************************************/
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;
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));
/****************************************************************************
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;
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;
}
TALLOC_CTX *mem_ctx;
struct smbclient_context *ctx;
const char *cmdstr = NULL;
+ struct smbcli_options smb_options;
struct poptOption long_options[] = {
POPT_AUTOHELP
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,'#'))) {
}
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)
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)) {
}
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);
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);
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;
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;
}
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;
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;
}
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;
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 */
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;
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)) {
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;
{
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;
/* 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) &&
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);
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;
*/
#include "libcli/raw/signing.h"
+#include "libcli/raw/libcliraw.h"
/*
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;
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
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),
#include "lib/util/dlinklist.h"
#include "param/param.h"
#include "param/loadparm.h"
+#include "libcli/raw/libcliraw.h"
#define standard_sub_basic talloc_strdup
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;
+}
struct loadparm_context;
struct loadparm_service;
+struct smbcli_options;
#include "param/proto.h"
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),
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));
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;
}
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);
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,
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,
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);
share, NULL,
servers[snum],
lp_resolve_context(lp_ctx),
- NULL);
+ NULL, &options);
if (!NT_STATUS_IS_OK(status)) {
sleep(2);
}
/*****************************************************
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;
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;
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;
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);
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];
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);
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++) {
}
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);
char *share1, *share2, *nfspath1, *nfspath2;
extern char *optarg;
extern int optind;
+ struct smbcli_options options;
int opt;
char *p;
int seed;
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);
}
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;
server,
ports,
share, NULL,
- credentials, resolve_ctx, NULL);
+ credentials, resolve_ctx, NULL,
+ options);
if (!NT_STATUS_IS_OK(status)) {
return NULL;
int opt;
int seed;
struct loadparm_context *lp_ctx;
+ struct smbcli_options options;
setlinebuf(stdout);
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);
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);
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);
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,
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));
"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));
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");
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));
NTSTATUS status;
bool ret = false;
struct smbcli_state *cli;
+ struct smbcli_options options;
mem_ctx = talloc_init("torture_bind_authcontext");
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));
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) {
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));
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));
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));
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));
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",
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",
{
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;