diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-01-03 17:21:58 -0600 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2008-01-03 12:33:36 -0600 |
commit | 425732f688865ebe2bfe568c8278edec50cbdedf (patch) | |
tree | 6b8a847c85af4edc38b4e58cd3e82a9baeb8ed18 /source4 | |
parent | 5d0e4f2147d4d1d0104d55756e91ffc13d25c1f3 (diff) | |
download | samba-425732f688865ebe2bfe568c8278edec50cbdedf.tar.gz samba-425732f688865ebe2bfe568c8278edec50cbdedf.tar.bz2 samba-425732f688865ebe2bfe568c8278edec50cbdedf.zip |
r26651: libsmb: Allow specifying signing policy from higher up.
The number of arguments is getting a bit excessive now, so it
probably makes sense to pass in the smbcli_options struct rather than
all members individually and add a convenience function for obtaining a
smbcli_options struct from a loadparm context.
(This used to be commit 9f64213463b5bf3bcbf36913139e9a5042e967a2)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/client/client.c | 6 | ||||
-rw-r--r-- | source4/libcli/cliconnect.c | 8 | ||||
-rw-r--r-- | source4/libcli/raw/clitransport.c | 4 | ||||
-rw-r--r-- | source4/libcli/raw/clitree.c | 3 | ||||
-rw-r--r-- | source4/libcli/raw/libcliraw.h | 1 | ||||
-rw-r--r-- | source4/libcli/raw/smb_signing.c | 2 | ||||
-rw-r--r-- | source4/libcli/smb_composite/connect.c | 3 | ||||
-rw-r--r-- | source4/libcli/smb_composite/fetchfile.c | 3 | ||||
-rw-r--r-- | source4/libcli/smb_composite/fsinfo.c | 1 | ||||
-rw-r--r-- | source4/libcli/smb_composite/smb_composite.h | 3 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_connect.c | 1 | ||||
-rw-r--r-- | source4/ntvfs/cifs/vfs_cifs.c | 1 | ||||
-rw-r--r-- | source4/scripting/ejs/smbcalls_cli.c | 1 | ||||
-rw-r--r-- | source4/torture/basic/base.c | 2 | ||||
-rw-r--r-- | source4/torture/basic/misc.c | 1 | ||||
-rw-r--r-- | source4/torture/raw/lockbench.c | 1 | ||||
-rw-r--r-- | source4/torture/raw/openbench.c | 1 |
17 files changed, 29 insertions, 13 deletions
diff --git a/source4/client/client.c b/source4/client/client.c index 7ce3268d3a..259966ddaa 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -3065,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, bool use_spnego) +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) { struct nbt_name called, calling; const char *server_name; @@ -3077,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, use_spnego)) { + if (!(cli=smbcli_state_init(NULL)) || !smbcli_socket_connect(cli, server_name, destports, resolve_ctx, max_xmit, max_mux, use_spnego, signing)) { d_printf("Connection to %s failed\n", server_name); return 1; } @@ -3225,7 +3225,7 @@ 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)); + 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)); } if (!do_connect(ctx, lp_resolve_context(cmdline_lp_ctx), desthost, lp_smb_ports(cmdline_lp_ctx), service, cmdline_credentials)) diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index c13dde9711..c1fadaa679 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -31,8 +31,10 @@ wrapper around smbcli_sock_connect() */ 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) + const char **ports, + struct resolve_context *resolve_ctx, + int max_xmit, int max_mux, bool use_spnego, + enum smb_signing_state signing) { struct smbcli_socket *sock; @@ -42,7 +44,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); + max_mux, use_spnego, signing); if (!cli->transport) { return false; } diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c index bdaeaeb58a..3ca828d46b 100644 --- a/source4/libcli/raw/clitransport.c +++ b/source4/libcli/raw/clitransport.c @@ -76,7 +76,8 @@ struct smbcli_transport *smbcli_transport_init(struct smbcli_socket *sock, bool primary, int max_xmit, int max_mux, - bool use_spnego) + bool use_spnego, + enum smb_signing_state signing) { struct smbcli_transport *transport; @@ -93,6 +94,7 @@ struct smbcli_transport *smbcli_transport_init(struct smbcli_socket *sock, transport->options.max_xmit = max_xmit; transport->options.max_mux = max_mux; transport->options.request_timeout = SMB_REQUEST_TIMEOUT; + transport->options.signing = signing; transport->negotiate.max_xmit = transport->options.max_xmit; diff --git a/source4/libcli/raw/clitree.c b/source4/libcli/raw/clitree.c index 94fa37383b..3d8a6760a1 100644 --- a/source4/libcli/raw/clitree.c +++ b/source4/libcli/raw/clitree.c @@ -198,8 +198,7 @@ NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx, 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); status = smb_composite_connect(&io, parent_ctx, resolve_ctx, ev); if (NT_STATUS_IS_OK(status)) { diff --git a/source4/libcli/raw/libcliraw.h b/source4/libcli/raw/libcliraw.h index 6c97e61f04..dd6904dec2 100644 --- a/source4/libcli/raw/libcliraw.h +++ b/source4/libcli/raw/libcliraw.h @@ -97,6 +97,7 @@ struct smbcli_options { uint32_t max_xmit; uint16_t max_mux; int request_timeout; + enum smb_signing_state signing; }; /* this is the context for the client transport layer */ diff --git a/source4/libcli/raw/smb_signing.c b/source4/libcli/raw/smb_signing.c index e19e81af7e..0053710aaf 100644 --- a/source4/libcli/raw/smb_signing.c +++ b/source4/libcli/raw/smb_signing.c @@ -383,7 +383,7 @@ bool smbcli_init_signing(struct smbcli_transport *transport) return false; } - switch (lp_client_signing(global_loadparm)) { + switch (transport->options.signing) { case SMB_SIGNING_OFF: transport->negotiate.sign_info.allow_smb_signing = false; break; diff --git a/source4/libcli/smb_composite/connect.c b/source4/libcli/smb_composite/connect.c index bdefe39b71..e45a8a25f9 100644 --- a/source4/libcli/smb_composite/connect.c +++ b/source4/libcli/smb_composite/connect.c @@ -309,7 +309,8 @@ static NTSTATUS connect_socket(struct composite_context *c, state->transport = smbcli_transport_init(state->sock, state, true, io->in.max_xmit, io->in.max_mux, - io->in.use_spnego); + io->in.use_spnego, + io->in.signing); NT_STATUS_HAVE_NO_MEMORY(state->transport); if (is_ipaddress(state->sock->hostname) && diff --git a/source4/libcli/smb_composite/fetchfile.c b/source4/libcli/smb_composite/fetchfile.c index 893eb854f5..5fa48b4863 100644 --- a/source4/libcli/smb_composite/fetchfile.c +++ b/source4/libcli/smb_composite/fetchfile.c @@ -154,7 +154,8 @@ struct composite_context *smb_composite_fetchfile_send(struct smb_composite_fetc 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); + state->creq = smb_composite_connect_send(state->connect, state, lp_resolve_context(global_loadparm), event_ctx); if (state->creq == NULL) goto failed; diff --git a/source4/libcli/smb_composite/fsinfo.c b/source4/libcli/smb_composite/fsinfo.c index bf425ad7c8..b6a5a5f2cc 100644 --- a/source4/libcli/smb_composite/fsinfo.c +++ b/source4/libcli/smb_composite/fsinfo.c @@ -160,6 +160,7 @@ struct composite_context *smb_composite_fsinfo_send(struct smbcli_tree *tree, 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); c->state = COMPOSITE_STATE_IN_PROGRESS; state->stage = FSINFO_CONNECT; diff --git a/source4/libcli/smb_composite/smb_composite.h b/source4/libcli/smb_composite/smb_composite.h index 41ce4b03bd..dd193fc820 100644 --- a/source4/libcli/smb_composite/smb_composite.h +++ b/source4/libcli/smb_composite/smb_composite.h @@ -27,6 +27,8 @@ particularly designed to be used in async applications */ +#include "libcli/raw/signing.h" + /* a composite open/read(s)/close request that loads a whole file @@ -97,6 +99,7 @@ struct smb_composite_connect { int max_xmit; int max_mux; int max_protocol; + enum smb_signing_state signing; } in; struct { struct smbcli_tree *tree; diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c index 26bccbbad7..9bd503c625 100644 --- a/source4/librpc/rpc/dcerpc_connect.c +++ b/source4/librpc/rpc/dcerpc_connect.c @@ -125,6 +125,7 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CT 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); /* * provide proper credentials - user supplied, but allow a diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c index 0b4cbb8a13..0b0c9b1037 100644 --- a/source4/ntvfs/cifs/vfs_cifs.c +++ b/source4/ntvfs/cifs/vfs_cifs.c @@ -208,6 +208,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs, 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); creq = smb_composite_connect_send(&io, private, lp_resolve_context(ntvfs->ctx->lp_ctx), diff --git a/source4/scripting/ejs/smbcalls_cli.c b/source4/scripting/ejs/smbcalls_cli.c index b66318dc3d..5e61a4df21 100644 --- a/source4/scripting/ejs/smbcalls_cli.c +++ b/source4/scripting/ejs/smbcalls_cli.c @@ -451,6 +451,7 @@ static int ejs_tree_connect(MprVarHandle eid, int argc, char **argv) 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); result = smb_composite_connect(&io, mem_ctx, lp_resolve_context(global_loadparm), diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index 9820a02f27..fcd788481b 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -51,7 +51,7 @@ 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))) { + 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))) { 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 f4cb47e7ba..986a4574a9 100644 --- a/source4/torture/basic/misc.c +++ b/source4/torture/basic/misc.c @@ -827,6 +827,7 @@ static struct composite_context *torture_connect_async( 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); return smb_composite_connect_send(smb,mem_ctx, lp_resolve_context(tctx->lp_ctx),ev); diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index ea570e5bf5..5093816a31 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -199,6 +199,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te, 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); /* 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 0582905816..7f4752cdf7 100644 --- a/source4/torture/raw/openbench.c +++ b/source4/torture/raw/openbench.c @@ -137,6 +137,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te, 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); /* kill off the remnants of the old connection */ talloc_free(state->tree); |