Remove use of global_loadparm for SMB2 client connections.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 2 Nov 2008 15:20:00 +0000 (16:20 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 2 Nov 2008 15:20:00 +0000 (16:20 +0100)
source4/client/cifsdd.c
source4/libcli/smb2/connect.c
source4/librpc/rpc/dcerpc_connect.c
source4/ntvfs/smb2/vfs_smb2.c
source4/torture/gentest.c
source4/torture/smb2/scan.c
source4/torture/smb2/util.c

index 3e0ab7af78263820b3d8872df3700ebccc0b9571..8d0b87d722b3296382710fad91c209b82027314d 100644 (file)
@@ -360,7 +360,8 @@ static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx,
                                      struct smbcli_options *smb_options,
                                      const char *socket_options,
                                      struct smbcli_session_options *smb_session_options,
                                      struct smbcli_options *smb_options,
                                      const char *socket_options,
                                      struct smbcli_session_options *smb_session_options,
-                                     struct smb_iconv_convenience *iconv_convenience)
+                                     struct smb_iconv_convenience *iconv_convenience,
+                                     struct gensec_settings *gensec_settings)
 {
        int                     options = 0;
        const char *            path = NULL;
 {
        int                     options = 0;
        const char *            path = NULL;
@@ -384,7 +385,8 @@ static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx,
                                      check_arg_numeric("ibs"), options,
                                      socket_options,
                                      smb_options, smb_session_options,
                                      check_arg_numeric("ibs"), options,
                                      socket_options,
                                      smb_options, smb_session_options,
-                                     iconv_convenience);
+                                     iconv_convenience,
+                                     gensec_settings);
        } else if (strcmp(which, "of") == 0) {
                options |= DD_WRITE;
                path = check_arg_pathname("of");
        } else if (strcmp(which, "of") == 0) {
                options |= DD_WRITE;
                path = check_arg_pathname("of");
@@ -392,7 +394,8 @@ static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx,
                                      check_arg_numeric("obs"), options,
                                      socket_options,
                                      smb_options, smb_session_options,
                                      check_arg_numeric("obs"), options,
                                      socket_options,
                                      smb_options, smb_session_options,
-                                     iconv_convenience);
+                                     iconv_convenience,
+                                     gensec_settings);
        } else {
                SMB_ASSERT(0);
                return(NULL);
        } else {
                SMB_ASSERT(0);
                return(NULL);
@@ -447,7 +450,8 @@ static int copy_files(struct event_context *ev, struct loadparm_context *lp_ctx)
        if (!(ifile = open_file(lp_resolve_context(lp_ctx), ev, "if",
                                lp_smb_ports(lp_ctx), &options,
                                lp_socket_options(lp_ctx),
        if (!(ifile = open_file(lp_resolve_context(lp_ctx), ev, "if",
                                lp_smb_ports(lp_ctx), &options,
                                lp_socket_options(lp_ctx),
-                               &session_options, lp_iconv_convenience(lp_ctx)))) {
+                               &session_options, lp_iconv_convenience(lp_ctx),
+                               lp_gensec_settings(lp_ctx, lp_ctx)))) {
                return(FILESYS_EXIT_CODE);
        }
 
                return(FILESYS_EXIT_CODE);
        }
 
@@ -455,7 +459,8 @@ static int copy_files(struct event_context *ev, struct loadparm_context *lp_ctx)
                                lp_smb_ports(lp_ctx), &options,
                                lp_socket_options(lp_ctx),
                                &session_options,
                                lp_smb_ports(lp_ctx), &options,
                                lp_socket_options(lp_ctx),
                                &session_options,
-                               lp_iconv_convenience(lp_ctx)))) {
+                               lp_iconv_convenience(lp_ctx),
+                               lp_gensec_settings(lp_ctx, lp_ctx)))) {
                return(FILESYS_EXIT_CODE);
        }
 
                return(FILESYS_EXIT_CODE);
        }
 
index e7aa8c753de8c38ef83ce5a744864438f02f1d3a..c7613841b88fa131e7356684eb630803c432b936 100644 (file)
@@ -35,6 +35,7 @@ struct smb2_connect_state {
        const char *share;
        const char **ports;
        const char *socket_options;
        const char *share;
        const char **ports;
        const char *socket_options;
+       struct gensec_settings *gensec_settings;
        struct smbcli_options options;
        struct smb2_negprot negprot;
        struct smb2_tree_connect tcon;
        struct smbcli_options options;
        struct smb2_negprot negprot;
        struct smb2_tree_connect tcon;
@@ -140,7 +141,7 @@ static void continue_negprot(struct smb2_request *req)
                break;
        }
 
                break;
        }
 
-       state->session = smb2_session_init(transport, lp_gensec_settings(transport, global_loadparm), state, true);
+       state->session = smb2_session_init(transport, state->gensec_settings, state, true);
        if (composite_nomem(state->session, c)) return;
 
        creq = smb2_session_setup_spnego_send(state->session, state->credentials);
        if (composite_nomem(state->session, c)) return;
 
        creq = smb2_session_setup_spnego_send(state->session, state->credentials);
@@ -236,7 +237,8 @@ struct composite_context *smb2_connect_send(TALLOC_CTX *mem_ctx,
                                            struct cli_credentials *credentials,
                                            struct event_context *ev,
                                            struct smbcli_options *options,
                                            struct cli_credentials *credentials,
                                            struct event_context *ev,
                                            struct smbcli_options *options,
-                                               const char *socket_options)
+                                               const char *socket_options,
+                                               struct gensec_settings *gensec_settings)
 {
        struct composite_context *c;
        struct smb2_connect_state *state;
 {
        struct composite_context *c;
        struct smb2_connect_state *state;
@@ -259,7 +261,7 @@ struct composite_context *smb2_connect_send(TALLOC_CTX *mem_ctx,
        if (composite_nomem(state->share, c)) return c;
        state->resolve_ctx = talloc_reference(state, resolve_ctx);
        state->socket_options = talloc_reference(state, socket_options);
        if (composite_nomem(state->share, c)) return c;
        state->resolve_ctx = talloc_reference(state, resolve_ctx);
        state->socket_options = talloc_reference(state, socket_options);
-       if (composite_nomem(state->socket_options, c)) return c;
+       state->gensec_settings = talloc_reference(state, gensec_settings);
 
        ZERO_STRUCT(name);
        name.name = host;
 
        ZERO_STRUCT(name);
        name.name = host;
@@ -297,11 +299,13 @@ NTSTATUS smb2_connect(TALLOC_CTX *mem_ctx,
                      struct smb2_tree **tree,
                      struct event_context *ev,
                      struct smbcli_options *options,
                      struct smb2_tree **tree,
                      struct event_context *ev,
                      struct smbcli_options *options,
-                         const char *socket_options)
+                         const char *socket_options,
+                         struct gensec_settings *gensec_settings)
 {
        struct composite_context *c = smb2_connect_send(mem_ctx, host, ports, 
                                                                                                        share, resolve_ctx, 
                                                                                                        credentials, ev, options,
 {
        struct composite_context *c = smb2_connect_send(mem_ctx, host, ports, 
                                                                                                        share, resolve_ctx, 
                                                                                                        credentials, ev, options,
-                                                                                                       socket_options);
+                                                                                                       socket_options,
+                                                                                                       gensec_settings);
        return smb2_connect_recv(c, mem_ctx, tree);
 }
        return smb2_connect_recv(c, mem_ctx, tree);
 }
index 8d03f9cde32a33d988c178afc2f548dfde128a3f..59bcca0046b74493fbe312698ad7963d9ad66a21 100644 (file)
@@ -255,7 +255,8 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb2_send(
                                     s->io.creds,
                                     c->event_ctx,
                                     &options,
                                     s->io.creds,
                                     c->event_ctx,
                                     &options,
-                                        lp_socket_options(lp_ctx)
+                                        lp_socket_options(lp_ctx),
+                                        lp_gensec_settings(mem_ctx, lp_ctx)
                                         );
        composite_continue(c, conn_req, continue_smb2_connect, c);
        return c;
                                         );
        composite_continue(c, conn_req, continue_smb2_connect, c);
        return c;
index 8e3219293d2e2bdf08e6422c26bb6714038e6e21..ebb17e28068b634841695a2a31f157f82a557610 100644 (file)
@@ -232,7 +232,8 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
                                 lp_resolve_context(ntvfs->ctx->lp_ctx),
                                 credentials,
                                 ntvfs->ctx->event_ctx, &options,
                                 lp_resolve_context(ntvfs->ctx->lp_ctx),
                                 credentials,
                                 ntvfs->ctx->event_ctx, &options,
-                                lp_socket_options(ntvfs->ctx->lp_ctx)
+                                lp_socket_options(ntvfs->ctx->lp_ctx),
+                                lp_gensec_settings(private, ntvfs->ctx->lp_ctx)
                                 );
 
        status = smb2_connect_recv(creq, private, &tree);
                                 );
 
        status = smb2_connect_recv(creq, private, &tree);
index c9cb715a8b48c028b7b65da74ec94751d5a48840..02eecd7f408307b92f9a48fc1d868b441eb617db 100644 (file)
@@ -233,7 +233,8 @@ static bool connect_servers(struct event_context *ev,
                                                      servers[i].credentials,
                                                      &servers[i].smb2_tree[j],
                                                      ev, &smb_options,
                                                      servers[i].credentials,
                                                      &servers[i].smb2_tree[j],
                                                      ev, &smb_options,
-                                                         lp_socket_options(lp_ctx)
+                                                         lp_socket_options(lp_ctx),
+                                                         lp_gensec_settings(lp_ctx, lp_ctx)
                                                          );
                        } else {
                                status = smbcli_tree_full_connection(NULL,
                                                          );
                        } else {
                                status = smbcli_tree_full_connection(NULL,
index f0d25017c6d33c0eb87572215e8c674f8e56bedc..a5e682c11145bb80417ce55af127e719836fd653 100644 (file)
@@ -209,7 +209,8 @@ bool torture_smb2_scan(struct torture_context *torture)
                                                  share, 
                                                  lp_resolve_context(torture->lp_ctx), 
                                                  credentials, &tree, torture->ev, &options,
                                                  share, 
                                                  lp_resolve_context(torture->lp_ctx), 
                                                  credentials, &tree, torture->ev, &options,
-                                                 lp_socket_options(torture->lp_ctx));
+                                                 lp_socket_options(torture->lp_ctx),
+                                                 lp_gensec_settings(torture, torture->lp_ctx));
        if (!NT_STATUS_IS_OK(status)) {
                printf("Connection failed - %s\n", nt_errstr(status));
                return false;
        if (!NT_STATUS_IS_OK(status)) {
                printf("Connection failed - %s\n", nt_errstr(status));
                return false;
@@ -228,7 +229,8 @@ bool torture_smb2_scan(struct torture_context *torture)
                                                                  share, 
                                                                  lp_resolve_context(torture->lp_ctx), 
                                                                  credentials, &tree, torture->ev, &options,
                                                                  share, 
                                                                  lp_resolve_context(torture->lp_ctx), 
                                                                  credentials, &tree, torture->ev, &options,
-                                                                 lp_socket_options(torture->lp_ctx));
+                                                                 lp_socket_options(torture->lp_ctx),
+                                                                 lp_gensec_settings(mem_ctx, torture->lp_ctx));
                        if (!NT_STATUS_IS_OK(status)) {
                                printf("Connection failed - %s\n", nt_errstr(status));
                                return false;
                        if (!NT_STATUS_IS_OK(status)) {
                                printf("Connection failed - %s\n", nt_errstr(status));
                                return false;
index e53b6cddacf384532ba7380bc693ac5560b62e81..b17dc246e3b34cce910c7114784ba0fbf7b2ccca 100644 (file)
@@ -280,7 +280,8 @@ bool torture_smb2_connection(struct torture_context *tctx, struct smb2_tree **tr
                              lp_resolve_context(tctx->lp_ctx),
                              credentials, tree, 
                              tctx->ev, &options,
                              lp_resolve_context(tctx->lp_ctx),
                              credentials, tree, 
                              tctx->ev, &options,
-                                 lp_socket_options(tctx->lp_ctx)
+                                 lp_socket_options(tctx->lp_ctx),
+                                 lp_gensec_settings(tctx, tctx->lp_ctx)
                                  );
        if (!NT_STATUS_IS_OK(status)) {
                printf("Failed to connect to SMB2 share \\\\%s\\%s - %s\n",
                                  );
        if (!NT_STATUS_IS_OK(status)) {
                printf("Failed to connect to SMB2 share \\\\%s\\%s - %s\n",