Author: jelmer
Date: 2008-01-03 17:21:58 +0000 (Thu, 03 Jan 2008)
New Revision: 26651

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=26651

Log:
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.

Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/client/client.c
   branches/SAMBA_4_0/source/libcli/cliconnect.c
   branches/SAMBA_4_0/source/libcli/raw/clitransport.c
   branches/SAMBA_4_0/source/libcli/raw/clitree.c
   branches/SAMBA_4_0/source/libcli/raw/libcliraw.h
   branches/SAMBA_4_0/source/libcli/raw/smb_signing.c
   branches/SAMBA_4_0/source/libcli/smb_composite/connect.c
   branches/SAMBA_4_0/source/libcli/smb_composite/fetchfile.c
   branches/SAMBA_4_0/source/libcli/smb_composite/fsinfo.c
   branches/SAMBA_4_0/source/libcli/smb_composite/smb_composite.h
   branches/SAMBA_4_0/source/librpc/rpc/dcerpc_connect.c
   branches/SAMBA_4_0/source/ntvfs/cifs/vfs_cifs.c
   branches/SAMBA_4_0/source/scripting/ejs/smbcalls_cli.c
   branches/SAMBA_4_0/source/torture/basic/base.c
   branches/SAMBA_4_0/source/torture/basic/misc.c
   branches/SAMBA_4_0/source/torture/raw/lockbench.c
   branches/SAMBA_4_0/source/torture/raw/openbench.c


Changeset:

Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/client/client.c
===================================================================
--- branches/SAMBA_4_0/source/client/client.c   2008-01-03 17:21:50 UTC (rev 
26650)
+++ branches/SAMBA_4_0/source/client/client.c   2008-01-03 17:21:58 UTC (rev 
26651)
@@ -3065,7 +3065,7 @@
 /****************************************************************************
 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 @@
 
        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 @@
        }
 
        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))

Modified: branches/SAMBA_4_0/source/libcli/cliconnect.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/cliconnect.c       2008-01-03 17:21:50 UTC 
(rev 26650)
+++ branches/SAMBA_4_0/source/libcli/cliconnect.c       2008-01-03 17:21:58 UTC 
(rev 26651)
@@ -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 @@
        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;
        }

Modified: branches/SAMBA_4_0/source/libcli/raw/clitransport.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/clitransport.c 2008-01-03 17:21:50 UTC 
(rev 26650)
+++ branches/SAMBA_4_0/source/libcli/raw/clitransport.c 2008-01-03 17:21:58 UTC 
(rev 26651)
@@ -76,7 +76,8 @@
                                               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 @@
        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;
 

Modified: branches/SAMBA_4_0/source/libcli/raw/clitree.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/clitree.c      2008-01-03 17:21:50 UTC 
(rev 26650)
+++ branches/SAMBA_4_0/source/libcli/raw/clitree.c      2008-01-03 17:21:58 UTC 
(rev 26651)
@@ -198,8 +198,7 @@
        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)) {

Modified: branches/SAMBA_4_0/source/libcli/raw/libcliraw.h
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/libcliraw.h    2008-01-03 17:21:50 UTC 
(rev 26650)
+++ branches/SAMBA_4_0/source/libcli/raw/libcliraw.h    2008-01-03 17:21:58 UTC 
(rev 26651)
@@ -97,6 +97,7 @@
        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 */

Modified: branches/SAMBA_4_0/source/libcli/raw/smb_signing.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/smb_signing.c  2008-01-03 17:21:50 UTC 
(rev 26650)
+++ branches/SAMBA_4_0/source/libcli/raw/smb_signing.c  2008-01-03 17:21:58 UTC 
(rev 26651)
@@ -383,7 +383,7 @@
                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;

Modified: branches/SAMBA_4_0/source/libcli/smb_composite/connect.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/smb_composite/connect.c    2008-01-03 
17:21:50 UTC (rev 26650)
+++ branches/SAMBA_4_0/source/libcli/smb_composite/connect.c    2008-01-03 
17:21:58 UTC (rev 26651)
@@ -309,7 +309,8 @@
        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) &&

Modified: branches/SAMBA_4_0/source/libcli/smb_composite/fetchfile.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/smb_composite/fetchfile.c  2008-01-03 
17:21:50 UTC (rev 26650)
+++ branches/SAMBA_4_0/source/libcli/smb_composite/fetchfile.c  2008-01-03 
17:21:58 UTC (rev 26651)
@@ -154,7 +154,8 @@
        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;

Modified: branches/SAMBA_4_0/source/libcli/smb_composite/fsinfo.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/smb_composite/fsinfo.c     2008-01-03 
17:21:50 UTC (rev 26650)
+++ branches/SAMBA_4_0/source/libcli/smb_composite/fsinfo.c     2008-01-03 
17:21:58 UTC (rev 26651)
@@ -160,6 +160,7 @@
        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;

Modified: branches/SAMBA_4_0/source/libcli/smb_composite/smb_composite.h
===================================================================
--- branches/SAMBA_4_0/source/libcli/smb_composite/smb_composite.h      
2008-01-03 17:21:50 UTC (rev 26650)
+++ branches/SAMBA_4_0/source/libcli/smb_composite/smb_composite.h      
2008-01-03 17:21:58 UTC (rev 26651)
@@ -27,7 +27,9 @@
   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
   into memory. Used as a demo of the composite system.
@@ -97,6 +99,7 @@
                int max_xmit;
                int max_mux;
                int max_protocol;
+               enum smb_signing_state signing;
        } in;
        struct {
                struct smbcli_tree *tree;

Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc_connect.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/rpc/dcerpc_connect.c       2008-01-03 
17:21:50 UTC (rev 26650)
+++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc_connect.c       2008-01-03 
17:21:58 UTC (rev 26651)
@@ -125,6 +125,7 @@
        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

Modified: branches/SAMBA_4_0/source/ntvfs/cifs/vfs_cifs.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/cifs/vfs_cifs.c     2008-01-03 17:21:50 UTC 
(rev 26650)
+++ branches/SAMBA_4_0/source/ntvfs/cifs/vfs_cifs.c     2008-01-03 17:21:58 UTC 
(rev 26651)
@@ -208,6 +208,7 @@
        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),

Modified: branches/SAMBA_4_0/source/scripting/ejs/smbcalls_cli.c
===================================================================
--- branches/SAMBA_4_0/source/scripting/ejs/smbcalls_cli.c      2008-01-03 
17:21:50 UTC (rev 26650)
+++ branches/SAMBA_4_0/source/scripting/ejs/smbcalls_cli.c      2008-01-03 
17:21:58 UTC (rev 26651)
@@ -451,6 +451,7 @@
        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), 

Modified: branches/SAMBA_4_0/source/torture/basic/base.c
===================================================================
--- branches/SAMBA_4_0/source/torture/basic/base.c      2008-01-03 17:21:50 UTC 
(rev 26650)
+++ branches/SAMBA_4_0/source/torture/basic/base.c      2008-01-03 17:21:58 UTC 
(rev 26651)
@@ -51,7 +51,7 @@
                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;
        }

Modified: branches/SAMBA_4_0/source/torture/basic/misc.c
===================================================================
--- branches/SAMBA_4_0/source/torture/basic/misc.c      2008-01-03 17:21:50 UTC 
(rev 26650)
+++ branches/SAMBA_4_0/source/torture/basic/misc.c      2008-01-03 17:21:58 UTC 
(rev 26651)
@@ -827,6 +827,7 @@
        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);

Modified: branches/SAMBA_4_0/source/torture/raw/lockbench.c
===================================================================
--- branches/SAMBA_4_0/source/torture/raw/lockbench.c   2008-01-03 17:21:50 UTC 
(rev 26650)
+++ branches/SAMBA_4_0/source/torture/raw/lockbench.c   2008-01-03 17:21:58 UTC 
(rev 26651)
@@ -199,6 +199,7 @@
        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);

Modified: branches/SAMBA_4_0/source/torture/raw/openbench.c
===================================================================
--- branches/SAMBA_4_0/source/torture/raw/openbench.c   2008-01-03 17:21:50 UTC 
(rev 26650)
+++ branches/SAMBA_4_0/source/torture/raw/openbench.c   2008-01-03 17:21:58 UTC 
(rev 26651)
@@ -137,6 +137,7 @@
        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);

Reply via email to