From dcc282590b34537fc1ead61c3300172528273b44 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 3 Jan 2008 17:22:12 -0600 Subject: 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) --- source4/torture/basic/base.c | 5 ++++- source4/torture/basic/misc.c | 8 +------- source4/torture/gentest.c | 4 +++- source4/torture/locktest.c | 5 ++++- source4/torture/locktest2.c | 24 +++++++++++++++--------- source4/torture/masktest.c | 12 +++++++++--- source4/torture/raw/lockbench.c | 8 +------- source4/torture/raw/openbench.c | 8 +------- source4/torture/rpc/join.c | 7 +++++-- source4/torture/rpc/samba3rpc.c | 27 +++++++++++++++++++++------ source4/torture/unix/unix_info2.c | 6 +++++- source4/torture/unix/whoami.c | 5 ++++- source4/torture/util_smb.c | 6 +++++- 13 files changed, 78 insertions(+), 47 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index fcd788481b..aa729ec0df 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -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; } diff --git a/source4/torture/basic/misc.c b/source4/torture/basic/misc.c index 986a4574a9..d991f117cd 100644 --- a/source4/torture/basic/misc.c +++ b/source4/torture/basic/misc.c @@ -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); diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index 9e5ef73ea6..c9e36b7e4e 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -176,6 +176,7 @@ static bool connect_servers(struct loadparm_context *lp_ctx) for (i=0;iin.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); diff --git a/source4/torture/raw/openbench.c b/source4/torture/raw/openbench.c index 7f4752cdf7..87b27d0728 100644 --- a/source4/torture/raw/openbench.c +++ b/source4/torture/raw/openbench.c @@ -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); diff --git a/source4/torture/rpc/join.c b/source4/torture/rpc/join.c index dd2912380d..849b9fd1e9 100644 --- a/source4/torture/rpc/join.c +++ b/source4/torture/rpc/join.c @@ -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)); diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index fd8236544e..3b96140fb2 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -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)); diff --git a/source4/torture/unix/unix_info2.c b/source4/torture/unix/unix_info2.c index 9fa0d55c9e..c14be9e2d0 100644 --- a/source4/torture/unix/unix_info2.c +++ b/source4/torture/unix/unix_info2.c @@ -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", diff --git a/source4/torture/unix/whoami.c b/source4/torture/unix/whoami.c index 4477713bfe..3203f91bc0 100644 --- a/source4/torture/unix/whoami.c +++ b/source4/torture/unix/whoami.c @@ -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", diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c index 7d35b1296e..6621b68b6e 100644 --- a/source4/torture/util_smb.c +++ b/source4/torture/util_smb.c @@ -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; -- cgit