Merge branch 'master' of ssh://git.samba.org/data/git/samba
authorJelmer Vernooij <jelmer@samba.org>
Tue, 30 Sep 2008 12:57:51 +0000 (14:57 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Tue, 30 Sep 2008 12:57:51 +0000 (14:57 +0200)
53 files changed:
.gitignore
pidl/lib/Parse/Pidl/Samba4/Python.pm
source4/auth/ntlm/auth_server.c
source4/client/cifsdd.c
source4/client/cifsdd.h
source4/client/cifsddio.c
source4/client/client.c
source4/client/smbmount.c
source4/lib/wmi/wmi.h
source4/lib/wmi/wmicore.c
source4/libcli/cliconnect.c
source4/libcli/raw/clisession.c
source4/libcli/raw/clitree.c
source4/libcli/smb_composite/connect.c
source4/libcli/smb_composite/fetchfile.c
source4/libcli/smb_composite/fsinfo.c
source4/libcli/smb_composite/smb_composite.h
source4/libnet/libnet_samdump_keytab.c
source4/libnet/libnet_site.c
source4/librpc/rpc/dcerpc.c
source4/librpc/rpc/dcerpc_connect.c
source4/librpc/rpc/dcerpc_secondary.c
source4/librpc/rpc/dcerpc_sock.c
source4/ntvfs/cifs/vfs_cifs.c
source4/param/loadparm.c
source4/param/param.h
source4/rpc_server/service_rpc.c
source4/smbd/process_model.h
source4/smbd/process_prefork.c
source4/smbd/process_single.c
source4/smbd/process_standard.c
source4/smbd/process_thread.c
source4/smbd/service_stream.c
source4/smbd/service_task.c
source4/torture/basic/misc.c
source4/torture/basic/secleak.c
source4/torture/gentest.c
source4/torture/locktest.c
source4/torture/locktest2.c
source4/torture/masktest.c
source4/torture/raw/composite.c
source4/torture/raw/context.c
source4/torture/raw/lock.c
source4/torture/raw/lockbench.c
source4/torture/raw/openbench.c
source4/torture/raw/oplock.c
source4/torture/raw/tconrate.c
source4/torture/rpc/join.c
source4/torture/rpc/samba3rpc.c
source4/torture/rpc/samlogon.c
source4/torture/unix/unix_info2.c
source4/torture/unix/whoami.c
source4/torture/util_smb.c

index b87f786678e7ac0496a7975063141b2985213415..e585504ce5e3c575a804d4a0725f5864226342c6 100644 (file)
@@ -252,10 +252,10 @@ source4/param/proto.h
 source4/param/secrets_proto.h
 source4/param/share_proto.h
 source4/passdb/proto.h
-source4/pidl/blib
-source4/pidl/cover_db
-source4/pidl/Makefile
-source4/pidl/pm_to_blib
+pidl/blib
+pidl/cover_db
+pidl/Makefile
+pidl/pm_to_blib
 source4/rpc_server/common/proto.h
 source4/rpc_server/dcerpc_server_proto.h
 source4/rpc_server/lsa/proto.h
index 74cec5a8274c3427371f61f29d3777fa1e354770..fc64c35fca1858da2f57f42cf684c4e316d6f26b 100644 (file)
@@ -1173,6 +1173,7 @@ sub Parse($$$$$)
        $self->pidl("{");
        $self->indent;
        $self->pidl("PyObject *m;");
+       $self->pidl("NTSTATUS status;");
        $self->pidl("");
 
        foreach (@{$self->{ready_types}}) {
@@ -1208,6 +1209,15 @@ sub Parse($$$$$)
                $self->pidl("PyModule_AddObject(m, \"$object_name\", $c_name);");
        }
 
+       $self->pidl("");
+       $self->pidl("status = dcerpc_init();");
+       $self->pidl("if (!NT_STATUS_IS_OK(status)) {");
+       $self->indent;
+       $self->pidl("PyErr_SetNTSTATUS(status);");
+       $self->pidl("return;");
+       $self->deindent;
+       $self->pidl("}");
+
        $self->deindent;
        $self->pidl("}");
     return ($self->{res_hdr}, $self->{res});
index bb8773e75e536677d91aaa8937c153d82e8108ba..539ae6aa80a1e9181cf3974dda437012415cc502 100644 (file)
@@ -80,6 +80,7 @@ static NTSTATUS server_get_challenge(struct auth_method_context *ctx, TALLOC_CTX
        io.in.workgroup = ""; /* only used with SPNEGO, disabled above */
 
        io.in.options = smb_options;
+       lp_smbcli_session_options(ctx->auth_ctx->lp_ctx, &io.in.session_options);
 
        status = smb_composite_connect(&io, mem_ctx, lp_resolve_context(ctx->auth_ctx->lp_ctx),
                                       ctx->auth_ctx->event_ctx);
index 141b165ad44808e68f61011137720593411afa16..5f07826d06eb7381ffcbc8759053163882731cf6 100644 (file)
@@ -357,7 +357,8 @@ static void print_transfer_stats(void)
 static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx, 
                                      struct event_context *ev,
                                      const char * which, const char **ports,
-                                     struct smbcli_options *smb_options)
+                                     struct smbcli_options *smb_options,
+                                     struct smbcli_session_options *smb_session_options)
 {
        int                     options = 0;
        const char *            path = NULL;
@@ -379,13 +380,13 @@ static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx,
                path = check_arg_pathname("if");
                handle = dd_open_path(resolve_ctx, ev, path, ports,
                                      check_arg_numeric("ibs"), options,
-                                     smb_options);
+                                     smb_options, smb_session_options);
        } else if (strcmp(which, "of") == 0) {
                options |= DD_WRITE;
                path = check_arg_pathname("of");
                handle = dd_open_path(resolve_ctx, ev, path, ports,
                                      check_arg_numeric("obs"), options,
-                                     smb_options);
+                                     smb_options, smb_session_options);
        } else {
                SMB_ASSERT(0);
                return(NULL);
@@ -412,12 +413,14 @@ static int copy_files(struct event_context *ev, struct loadparm_context *lp_ctx)
        struct dd_iohandle *    ofile;
 
        struct smbcli_options options;
+       struct smbcli_session_options session_options;
 
        ibs = check_arg_numeric("ibs");
        obs = check_arg_numeric("obs");
        count = check_arg_numeric("count");
 
        lp_smbcli_options(lp_ctx, &options);
+       lp_smbcli_session_options(lp_ctx, &session_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.
@@ -436,12 +439,14 @@ static int copy_files(struct event_context *ev, struct loadparm_context *lp_ctx)
                        (unsigned long long)iomax, options.max_xmit));
 
        if (!(ifile = open_file(lp_resolve_context(lp_ctx), ev, "if",
-                               lp_smb_ports(lp_ctx), &options))) {
+                               lp_smb_ports(lp_ctx), &options,
+                               &session_options))) {
                return(FILESYS_EXIT_CODE);
        }
 
        if (!(ofile = open_file(lp_resolve_context(lp_ctx), ev, "of",
-                               lp_smb_ports(lp_ctx), &options))) {
+                               lp_smb_ports(lp_ctx), &options,
+                               &session_options))) {
                return(FILESYS_EXIT_CODE);
        }
 
index 21a4ad488222048da96c650a219b3ab6533fb7e1..3195e4334f3bc4938fa97ad1bf6e4293465784f8 100644 (file)
@@ -89,6 +89,7 @@ struct dd_iohandle
 #define DD_OPLOCK              0x00000008
 
 struct smbcli_options;
+struct smbcli_session_options;
 struct event_context;
 
 struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx, 
@@ -96,7 +97,8 @@ struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx,
                                  const char * path,
                                  const char **ports,
                                uint64_t io_size, int options, 
-                               struct smbcli_options *smb_options);
+                               struct smbcli_options *smb_options,
+                               struct smbcli_session_options *smb_session_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,
index 4297c300121ef6c4f57b379caa9005975619efb8..25194a621a82472db63e02fc7b60964978cee21e 100644 (file)
@@ -225,7 +225,8 @@ static struct smbcli_state * init_smb_session(struct resolve_context *resolve_ct
                                              const char * host,
                                              const char **ports,
                                              const char * share,
-                                             struct smbcli_options *options)
+                                             struct smbcli_options *options,
+                                             struct smbcli_session_options *session_options)
 {
        NTSTATUS                ret;
        struct smbcli_state *   cli = NULL;
@@ -236,7 +237,8 @@ static struct smbcli_state * init_smb_session(struct resolve_context *resolve_ct
        ret = smbcli_full_connection(NULL, &cli, host, ports, share,
                                     NULL /* devtype */,
                                     cmdline_credentials, resolve_ctx,
-                                    ev, options);
+                                    ev, options,
+                                    session_options);
 
        if (!NT_STATUS_IS_OK(ret)) {
                fprintf(stderr, "%s: connecting to //%s/%s: %s\n",
@@ -302,7 +304,8 @@ static struct dd_iohandle * open_cifs_handle(struct resolve_context *resolve_ctx
                                        const char * path,
                                        uint64_t io_size,
                                        int options,
-                                       struct smbcli_options *smb_options)
+                                       struct smbcli_options *smb_options,
+                                       struct smbcli_session_options *smb_session_options)
 {
        struct cifs_handle * smbh;
 
@@ -323,7 +326,7 @@ static struct dd_iohandle * open_cifs_handle(struct resolve_context *resolve_ctx
        smbh->h.io_seek = smb_seek_func;
 
        if ((smbh->cli = init_smb_session(resolve_ctx, ev, host, ports, share,
-                                         smb_options)) == NULL) {
+                                         smb_options, smb_session_options)) == NULL) {
                return(NULL);
        }
 
@@ -344,7 +347,8 @@ struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx,
                                  const char **ports,
                                uint64_t io_size,
                                int options,
-                               struct smbcli_options *smb_options)
+                               struct smbcli_options *smb_options,
+                               struct smbcli_session_options *smb_session_options)
 {
        if (file_exist(path)) {
                return(open_fd_handle(path, io_size, options));
@@ -361,7 +365,8 @@ struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx,
 
                        return(open_cifs_handle(resolve_ctx, ev, host, ports,
                                                share, remain,
-                                               io_size, options, smb_options));
+                                               io_size, options, smb_options,
+                                               smb_session_options));
                }
 
                return(open_fd_handle(path, io_size, options));
index e05e195372f2ca362d54b7e52321e2caf6a79861..266bd670250da182465ef41b04f58789c3920eb9 100644 (file)
@@ -3032,7 +3032,8 @@ static bool do_connect(struct smbclient_context *ctx,
                       const char *specified_server, const char **ports, 
                       const char *specified_share, 
                       struct cli_credentials *cred, 
-                      struct smbcli_options *options)
+                      struct smbcli_options *options,
+                      struct smbcli_session_options *session_options)
 {
        NTSTATUS status;
        char *server, *share;
@@ -3051,7 +3052,7 @@ static bool do_connect(struct smbclient_context *ctx,
        
        status = smbcli_full_connection(ctx, &ctx->cli, server, ports,
                                        share, NULL, cred, resolve_ctx, 
-                                       ev_ctx, options);
+                                       ev_ctx, options, session_options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("Connection to \\\\%s\\%s failed - %s\n", 
                         server, share, nt_errstr(status));
@@ -3138,6 +3139,7 @@ static int do_message_op(const char *netbios_name, const char *desthost,
        struct smbclient_context *ctx;
        const char *cmdstr = NULL;
        struct smbcli_options smb_options;
+       struct smbcli_session_options smb_session_options;
 
        struct poptOption long_options[] = {
                POPT_AUTOHELP
@@ -3227,6 +3229,7 @@ static int do_message_op(const char *netbios_name, const char *desthost,
        poptFreeContext(pc);
 
        lp_smbcli_options(cmdline_lp_ctx, &smb_options);
+       lp_smbcli_session_options(cmdline_lp_ctx, &smb_session_options);
 
        ev_ctx = s4_event_context_init(talloc_autofree_context());
 
@@ -3255,7 +3258,7 @@ static int do_message_op(const char *netbios_name, const char *desthost,
        
        if (!do_connect(ctx, ev_ctx, lp_resolve_context(cmdline_lp_ctx),
                        desthost, lp_smb_ports(cmdline_lp_ctx), service,
-                       cmdline_credentials, &smb_options))
+                       cmdline_credentials, &smb_options, &smb_session_options))
                return 1;
 
        if (base_directory) 
index 9ab6c375f25d07174a4b3236a237fd4e36eb5177..37c9eaadc47b3c2f541a46e6c614ba5ed02e1577 100644 (file)
@@ -111,7 +111,8 @@ static void usr1_handler(int x)
 /***************************************************** 
 return a connection to a server
 *******************************************************/
-static struct smbcli_state *do_connection(const char *the_service, bool unicode, int maxprotocol)
+static struct smbcli_state *do_connection(const char *the_service, bool unicode, int maxprotocol,
+                                         struct smbcli_session_options session_options)
 {
        struct smbcli_state *c;
        struct nmb_name called, calling;
@@ -210,11 +211,12 @@ static struct smbcli_state *do_connection(const char *the_service, bool unicode,
        if (!smbcli_session_setup(c, username, 
                               password, strlen(password),
                               password, strlen(password),
-                              workgroup)) {
+                              workgroup, session_options)) {
                /* if a password was not supplied then try again with a
                        null username */
                if (password[0] || !username[0] ||
-                               !smbcli_session_setup(c, "", "", 0, "", 0, workgroup)) {
+                               !smbcli_session_setup(c, "", "", 0, "", 0, workgroup, 
+                                                     session_options)) {
                        DEBUG(0,("%d: session setup failed: %s\n",
                                sys_getpid(), smbcli_errstr(c)));
                        talloc_free(c);
@@ -329,6 +331,9 @@ static void send_fs_socket(struct loadparm_context *lp_ctx,
        int fd, closed = 0, res = 1;
        pid_t parentpid = getppid();
        struct smb_conn_opt conn_options;
+       struct smbcli_session_options session_options;
+
+       lp_smbcli_session_options(lp_ctx, &session_options);
 
        memset(&conn_options, 0, sizeof(conn_options));
 
@@ -409,7 +414,8 @@ static void send_fs_socket(struct loadparm_context *lp_ctx,
                        DEBUG(2,("mount.smbfs[%d]: got signal, getting new socket\n", sys_getpid()));
                        c = do_connection(the_service, 
                                          lp_unicode(lp_ctx), 
-                                         lp_cli_maxprotocol(lp_ctx));
+                                         lp_cli_maxprotocol(lp_ctx),
+                                         session_options);
                }
        }
 
@@ -430,14 +436,17 @@ static void init_mount(struct loadparm_context *lp_ctx)
        struct smbcli_state *c;
        char *args[20];
        int i, status;
+       struct smbcli_session_options session_options;
 
        if (realpath(mpoint, mount_point) == NULL) {
                fprintf(stderr, "Could not resolve mount point %s\n", mpoint);
                return;
        }
 
+       lp_smbcli_session_options(lp_ctx, &session_options);
 
-       c = do_connection(service, lp_unicode(lp_ctx), lp_cli_maxprotocol(lp_ctx));
+       c = do_connection(service, lp_unicode(lp_ctx), lp_cli_maxprotocol(lp_ctx),
+                         session_options);
        if (!c) {
                fprintf(stderr,"SMB connection failed\n");
                exit(1);
index 32543a8ca7fcc6bd409cf04164079359b923181e..46c9b70cdbccf2a00b426b3bd38d81f2207eb154 100644 (file)
@@ -27,7 +27,7 @@
 
 /** FIXME: Use credentials struct rather than user/password here */
 WERROR WBEM_ConnectServer(struct com_context *ctx, const char *server, const char *nspace, 
-                         const char *user, const char *password, 
+                         struct cli_credentials *credentials,
                          const char *locale, uint32_t flags, const char *authority, 
                          struct IWbemContext* wbem_ctx, struct IWbemServices** services);
 const char *wmi_errstr(WERROR werror);
index 49c1e033125e27dd8cbecf6714c2c7f0979b2e7d..3ac6c89292b9a8ce000580d440b04696be27401a 100644 (file)
@@ -51,7 +51,7 @@ void wmi_init(struct com_context **ctx, struct cli_credentials *credentials)
 
 /** FIXME: Use credentials struct rather than user/password here */
 WERROR WBEM_ConnectServer(struct com_context *ctx, const char *server, const uint16_t *nspace, 
-                         const char *user, const char *password, 
+                         struct cli_credentials *credentials,
                          const char *locale, uint32_t flags, const char *authority, 
                          struct IWbemContext* wbem_ctx, struct IWbemServices** services)
 {
@@ -61,18 +61,6 @@ WERROR WBEM_ConnectServer(struct com_context *ctx, const char *server, const uin
         struct IUnknown **mqi;
         struct IWbemLevel1Login *pL;
 
-        if (user) {
-                char *cred;
-                struct cli_credentials *cc;
-
-                cred = talloc_asprintf(NULL, "%s%%%s", user, password);
-                cc = cli_credentials_init(cred);
-                cli_credentials_set_conf(cc, global_loadparm);
-                cli_credentials_parse_string(cc, cred, CRED_SPECIFIED);
-                dcom_add_server_credentials(ctx, server, cc);
-                talloc_free(cred);
-        }
-
         GUID_from_string(CLSID_WBEMLEVEL1LOGIN, &clsid);
         GUID_from_string(COM_IWBEMLEVEL1LOGIN_UUID, &iid);
         result = dcom_create_object(ctx, &clsid, server, 1, &iid, &mqi, &coresult);
index c20a7fd9353f9572f804c394463bbe939aaebbb9..e42b04cdc57426027a8d45e32d5fcac796f32dd1 100644 (file)
@@ -69,12 +69,14 @@ NTSTATUS smbcli_negprot(struct smbcli_state *cli, bool unicode, int maxprotocol)
 /* wrapper around smb_raw_sesssetup() */
 NTSTATUS smbcli_session_setup(struct smbcli_state *cli, 
                              struct cli_credentials *credentials,
-                             const char *workgroup)
+                             const char *workgroup,
+                             struct smbcli_session_options options)
 {
        struct smb_composite_sesssetup setup;
        NTSTATUS status;
 
-       cli->session = smbcli_session_init(cli->transport, cli, true);
+       cli->session = smbcli_session_init(cli->transport, cli, true,
+                                          options);
        if (!cli->session) return NT_STATUS_UNSUCCESSFUL;
 
        setup.in.sesskey = cli->transport->negotiate.sesskey;
@@ -144,7 +146,8 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
                                struct cli_credentials *credentials,
                                struct resolve_context *resolve_ctx,
                                struct event_context *ev,
-                               struct smbcli_options *options)
+                               struct smbcli_options *options,
+                               struct smbcli_session_options *session_options)
 {
        struct smbcli_tree *tree;
        NTSTATUS status;
@@ -155,7 +158,8 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
                                             &tree, host, ports, 
                                             sharename, devtype,
                                             credentials, resolve_ctx, ev,
-                                            options);
+                                            options,
+                                            session_options);
        if (!NT_STATUS_IS_OK(status)) {
                goto done;
        }
index ad4ca7b4718acd597aa58081cb2fdbb2891b118e..38d8f700f234d04849c3c87ce0f0158beba0dd6a 100644 (file)
@@ -35,7 +35,8 @@
  Initialize the session context
 ****************************************************************************/
 struct smbcli_session *smbcli_session_init(struct smbcli_transport *transport, 
-                                          TALLOC_CTX *parent_ctx, bool primary)
+                                          TALLOC_CTX *parent_ctx, bool primary,
+                                          struct smbcli_session_options options)
 {
        struct smbcli_session *session;
        uint16_t flags2;
@@ -53,9 +54,7 @@ struct smbcli_session *smbcli_session_init(struct smbcli_transport *transport,
        }
        session->pid = (uint16_t)getpid();
        session->vuid = UID_FIELD_INVALID;
-       session->options.lanman_auth = lp_client_lanman_auth(global_loadparm);
-       session->options.ntlmv2_auth = lp_client_ntlmv2_auth(global_loadparm);
-       session->options.plaintext_auth = lp_client_plaintext_auth(global_loadparm);
+       session->options = options;
        
        capabilities = transport->negotiate.capabilities;
 
index 15cd70833c7c0b13810525ef7dfa4e632cde958a..4b5d2dc39787baa1dd3cad6869adb38189043ca4 100644 (file)
@@ -177,7 +177,8 @@ NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx,
                                     struct cli_credentials *credentials,
                                     struct resolve_context *resolve_ctx,
                                     struct event_context *ev,
-                                    struct smbcli_options *options)
+                                    struct smbcli_options *options,
+                                    struct smbcli_session_options *session_options)
 {
        struct smb_composite_connect io;
        NTSTATUS status;
@@ -200,6 +201,7 @@ NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx,
         * is complete -- abartlet 2008-04-28 */
        io.in.workgroup = lp_workgroup(global_loadparm);
        io.in.options = *options;
+       io.in.session_options = *session_options;
        
        status = smb_composite_connect(&io, parent_ctx, resolve_ctx, ev);
        if (NT_STATUS_IS_OK(status)) {
index e56339f96bf2d6a8b624ab437a1ee0604ab979fd..a4137290bbcb714c44689d62964cc1d478c06a9d 100644 (file)
@@ -234,7 +234,7 @@ static NTSTATUS connect_negprot(struct composite_context *c,
        NT_STATUS_NOT_OK_RETURN(status);
 
        /* next step is a session setup */
-       state->session = smbcli_session_init(state->transport, state, true);
+       state->session = smbcli_session_init(state->transport, state, true, io->in.session_options);
        NT_STATUS_HAVE_NO_MEMORY(state->session);
        
        /* setup for a tconx (or at least have the structure ready to
index 9cd02a51f457b5f45299b2147418b0e52ac428fd..ff4f0e793026e4c8e8ff1e2cd3c9d4f74ca2c77e 100644 (file)
@@ -147,6 +147,7 @@ struct composite_context *smb_composite_fetchfile_send(struct smb_composite_fetc
        state->connect->in.workgroup    = io->in.workgroup;
 
        state->connect->in.options      = io->in.options;
+       state->connect->in.session_options = io->in.session_options;
 
        state->creq = smb_composite_connect_send(state->connect, state, 
                                                 io->in.resolve_ctx, event_ctx);
index 270d71f5185be629951f6e1ca588010e6971a054..dc5327a29cac4b424c0c58c183e073e2190240de 100644 (file)
@@ -127,7 +127,8 @@ static void fsinfo_composite_handler(struct composite_context *creq)
   composite fsinfo call - connects to a tree and queries a file system information
 */
 struct composite_context *smb_composite_fsinfo_send(struct smbcli_tree *tree, 
-                                                   struct smb_composite_fsinfo *io)
+                                                   struct smb_composite_fsinfo *io,
+                                                   struct resolve_context *resolve_ctx)
 {
        struct composite_context *c;
        struct fsinfo_state *state;
@@ -154,13 +155,14 @@ struct composite_context *smb_composite_fsinfo_send(struct smbcli_tree *tree,
        state->connect->in.workgroup    = io->in.workgroup;
 
        state->connect->in.options = tree->session->transport->options;
+       state->connect->in.session_options = tree->session->options;
 
        c->state = COMPOSITE_STATE_IN_PROGRESS;
        state->stage = FSINFO_CONNECT;
        c->private_data = state;
 
        state->creq = smb_composite_connect_send(state->connect, state,
-                        lp_resolve_context(global_loadparm), c->event_ctx);
+                        resolve_ctx, c->event_ctx);
 
        if (state->creq == NULL) goto failed;
   
@@ -197,9 +199,10 @@ NTSTATUS smb_composite_fsinfo_recv(struct composite_context *c, TALLOC_CTX *mem_
 */
 NTSTATUS smb_composite_fsinfo(struct smbcli_tree *tree, 
                              TALLOC_CTX *mem_ctx,
-                             struct smb_composite_fsinfo *io)
+                             struct smb_composite_fsinfo *io,
+                             struct resolve_context *resolve_ctx)
 {
-       struct composite_context *c = smb_composite_fsinfo_send(tree, io);
+       struct composite_context *c = smb_composite_fsinfo_send(tree, io, resolve_ctx);
        return smb_composite_fsinfo_recv(c, mem_ctx);
 }
 
index 7f4b9d73e4b48da338817e9558b39018119b6a25..08ca40c833072ce4260e8b619f3f97762186a70b 100644 (file)
@@ -57,6 +57,7 @@ struct smb_composite_fetchfile {
                const char *workgroup;
                const char *filename;
                struct smbcli_options options;
+               struct smbcli_session_options session_options;
                struct resolve_context *resolve_ctx;
        } in;
        struct {
@@ -98,6 +99,7 @@ struct smb_composite_connect {
                bool fallback_to_anonymous;
                const char *workgroup;
                struct smbcli_options options;
+               struct smbcli_session_options session_options;
        } in;
        struct {
                struct smbcli_tree *tree;
index 0c4d3e5c595342720675227f4988f63a43a297f8..4b71b0c24da47a8ec32a7ee2f55d52621bdc1176 100644 (file)
@@ -68,6 +68,11 @@ static NTSTATUS samdump_keytab_handle_user(TALLOC_CTX *mem_ctx,
        return NT_STATUS_OK;
 }
 
+struct libnet_samdump_keytab_data {
+       const char *keytab_name;
+       struct loadparm_context *lp_ctx;
+};
+
 static NTSTATUS libnet_samdump_keytab_fn(TALLOC_CTX *mem_ctx,          
                                         void *private,                         
                                         enum netr_SamDatabaseID database,
@@ -75,8 +80,7 @@ static NTSTATUS libnet_samdump_keytab_fn(TALLOC_CTX *mem_ctx,
                                         char **error_string)
 {
        NTSTATUS nt_status = NT_STATUS_OK;
-       const char *keytab_name = private;
-
+       struct libnet_samdump_keytab_data *data = private; 
        *error_string = NULL;
        switch (delta->delta_type) {
        case NETR_DELTA_USER:
@@ -85,8 +89,8 @@ static NTSTATUS libnet_samdump_keytab_fn(TALLOC_CTX *mem_ctx,
                if (database == SAM_DATABASE_DOMAIN) {
                        nt_status = samdump_keytab_handle_user(mem_ctx, 
                                                               event_context_find(mem_ctx),
-                                                              global_loadparm,
-                                                              keytab_name,
+                                                              data->lp_ctx,
+                                                              data->keytab_name,
                                                               delta);
                        break;
                }
@@ -101,14 +105,18 @@ static NTSTATUS libnet_samdump_keytab_fn(TALLOC_CTX *mem_ctx,
 NTSTATUS libnet_SamDump_keytab(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_SamDump_keytab *r)
 {
        NTSTATUS nt_status;
+       struct libnet_samdump_keytab_data data;
        struct libnet_SamSync r2;
 
+       data.keytab_name = r->in.keytab_name;
+       data.lp_ctx = ctx->lp_ctx;
+
        r2.out.error_string            = NULL;
        r2.in.binding_string           = r->in.binding_string;
        r2.in.rid_crypt                = true;
        r2.in.init_fn                  = NULL;
        r2.in.delta_fn                 = libnet_samdump_keytab_fn;
-       r2.in.fn_ctx                   = discard_const(r->in.keytab_name);
+       r2.in.fn_ctx                   = &data;
        r2.in.machine_account          = r->in.machine_account;
        nt_status                      = libnet_SamSync_netlogon(ctx, mem_ctx, &r2);
        r->out.error_string            = r2.out.error_string;
index bb65de1f54be4837d24ae67df656f1d11a42a15e..5647a93b8d283a75d08a96268af9175283338239 100644 (file)
@@ -56,7 +56,7 @@ NTSTATUS libnet_FindSite(TALLOC_CTX *ctx, struct libnet_context *lctx, struct li
        search.in.version = NETLOGON_NT_VERSION_5 | NETLOGON_NT_VERSION_5EX;
        search.in.map_response = true;
 
-       cldap = cldap_socket_init(tmp_ctx, lctx->event_ctx, lp_iconv_convenience(global_loadparm));
+       cldap = cldap_socket_init(tmp_ctx, lctx->event_ctx, lp_iconv_convenience(lctx->lp_ctx));
        status = cldap_netlogon(cldap, tmp_ctx, &search);
        if (!NT_STATUS_IS_OK(status) || !search.out.netlogon.nt5_ex.client_site) {
                /*
index c1e3e26ee988be9107fe0e4d1ccf7573ca76f8cd..4e07cc7b57c89e4233da1df00f7fdca70131de8e 100644 (file)
@@ -33,9 +33,7 @@
 
 _PUBLIC_ NTSTATUS dcerpc_init(void)
 {
-       gensec_init(global_loadparm);
-
-       return NT_STATUS_OK;
+       return gensec_init(global_loadparm);
 }
 
 static void dcerpc_connection_dead(struct dcerpc_connection *conn, NTSTATUS status);
index 318b8fe36d19cf78a49435ccc85657cbbcb62ddb..b117a98270a1f912e006c8be92284d51395900ed 100644 (file)
@@ -121,6 +121,7 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CT
        conn->in.workgroup              = lp_workgroup(lp_ctx);
 
        lp_smbcli_options(lp_ctx, &conn->in.options);
+       lp_smbcli_session_options(lp_ctx, &conn->in.session_options);
 
        /*
         * provide proper credentials - user supplied, but allow a
@@ -137,7 +138,7 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CT
 
        /* send smb connect request */
        conn_req = smb_composite_connect_send(conn, s->io.pipe->conn, 
-                                             lp_resolve_context(lp_ctx), 
+                                             s->io.resolve_ctx,
                                              s->io.pipe->conn->event_ctx);
        if (composite_nomem(conn_req, c)) return c;
 
index abc67ad38bb4d63625889dedab65065b75439393..b4d5d05b617407432a4e6658183afad301f63107 100644 (file)
@@ -95,13 +95,14 @@ _PUBLIC_ struct composite_context* dcerpc_secondary_connection_send(struct dcerp
                                                         s->binding->host,
                                                         s->binding->target_hostname,
                                                         atoi(s->binding->endpoint),
-                                                        lp_resolve_context(global_loadparm));
+                                                        dcerpc_resolve_ctx(s->pipe->conn));
                composite_continue(c, pipe_tcp_req, continue_open_tcp, c);
                return c;
 
        case NCALRPC:
-               pipe_ncalrpc_req = dcerpc_pipe_open_pipe_send(s->pipe2->conn, lp_ncalrpc_dir(global_loadparm), 
-                                                             s->binding->endpoint);
+       case NCACN_UNIX_STREAM:
+               pipe_ncalrpc_req = dcerpc_pipe_open_unix_stream_send(s->pipe2->conn, 
+                                                             dcerpc_unix_socket_path(s->pipe->conn));
                composite_continue(c, pipe_ncalrpc_req, continue_open_pipe, c);
                return c;
 
index 7480beae33eab4428d18f2eb29aaa21df531fc8e..1e2b4cde484769a8ee375d72185a2686178b0090 100644 (file)
@@ -39,6 +39,9 @@ struct sock_private {
 
        struct packet_context *packet;
        uint32_t pending_reads;
+
+       struct resolve_context *resolve_ctx;
+       const char *path; /* For ncacn_unix_sock and ncalrpc */
 };
 
 
@@ -307,6 +310,7 @@ static struct composite_context *dcerpc_pipe_open_socket_send(TALLOC_CTX *mem_ct
                                                       struct resolve_context *resolve_context,
                                                       struct socket_address *server,
                                                       const char *target_hostname,
+                                                      const char *full_path,
                                                       enum dcerpc_transport_t transport)
 {
        struct composite_context *c;
@@ -334,6 +338,9 @@ static struct composite_context *dcerpc_pipe_open_socket_send(TALLOC_CTX *mem_ct
 
        talloc_steal(s->sock, s->socket_ctx);
 
+       s->sock->resolve_ctx = resolve_context;
+       s->sock->path = talloc_reference(s->sock, full_path);
+
        conn_req = socket_connect_send(s->socket_ctx, NULL, s->server, 0, 
                                       resolve_context, 
                                       c->event_ctx);
@@ -386,6 +393,7 @@ static void continue_ip_resolve_name(struct composite_context *ctx)
        sock_ipv4_req = dcerpc_pipe_open_socket_send(c, s->conn,
                                                     s->resolve_ctx,
                                                     s->srvaddr, s->target_hostname,
+                                                    NULL,
                                                     NCACN_IP_TCP);
        composite_continue(c, sock_ipv4_req, continue_ipv4_open_socket, c);
 }
@@ -561,6 +569,7 @@ struct composite_context *dcerpc_pipe_open_unix_stream_send(struct dcerpc_connec
        sock_unix_req = dcerpc_pipe_open_socket_send(c, s->conn, 
                                                     NULL,
                                                     s->srvaddr, NULL,
+                                                    s->path,
                                                     NCALRPC);
        composite_continue(c, sock_unix_req, continue_unix_open_socket, c);
        return c;
@@ -579,13 +588,6 @@ NTSTATUS dcerpc_pipe_open_unix_stream_recv(struct composite_context *c)
 }
 
 
-struct pipe_np_state {
-       char *full_path;
-       struct socket_address *srvaddr;
-       struct dcerpc_connection *conn;
-};
-
-
 /*
   Stage 2 of dcerpc_pipe_open_pipe_send: receive socket open request
 */
@@ -612,13 +614,13 @@ struct composite_context* dcerpc_pipe_open_pipe_send(struct dcerpc_connection *c
 
        struct composite_context *c;
        struct composite_context *sock_np_req;
-       struct pipe_np_state *s;
+       struct pipe_unix_state *s;
 
        /* composite context allocation and setup */
        c = composite_create(conn, conn->event_ctx);
        if (c == NULL) return NULL;
 
-       s = talloc_zero(c, struct pipe_np_state);
+       s = talloc_zero(c, struct pipe_unix_state);
        if (composite_nomem(s, c)) return c;
        c->private_data = s;
 
@@ -628,15 +630,15 @@ struct composite_context* dcerpc_pipe_open_pipe_send(struct dcerpc_connection *c
        s->conn = conn;
 
        string_replace(canon, '/', '\\');
-       s->full_path = talloc_asprintf(canon, "%s/%s", ncalrpc_dir, canon);
-       if (composite_nomem(s->full_path, c)) return c;
+       s->path = talloc_asprintf(canon, "%s/%s", ncalrpc_dir, canon);
+       if (composite_nomem(s->path, c)) return c;
 
        /* prepare server address using path and transport name */
-       s->srvaddr = socket_address_from_strings(conn, "unix", s->full_path, 0);
+       s->srvaddr = socket_address_from_strings(conn, "unix", s->path, 0);
        if (composite_nomem(s->srvaddr, c)) return c;
 
        /* send socket open request */
-       sock_np_req = dcerpc_pipe_open_socket_send(c, s->conn, NULL, s->srvaddr, NULL, NCALRPC);
+       sock_np_req = dcerpc_pipe_open_socket_send(c, s->conn, NULL, s->srvaddr, NULL, s->path, NCALRPC);
        composite_continue(c, sock_np_req, continue_np_open_socket, c);
        return c;
 }
@@ -662,3 +664,15 @@ NTSTATUS dcerpc_pipe_open_pipe(struct dcerpc_connection *conn, const char *ncalr
        struct composite_context *c = dcerpc_pipe_open_pipe_send(conn, ncalrpc_dir, identifier);
        return dcerpc_pipe_open_pipe_recv(c);
 }
+
+const char *dcerpc_unix_socket_path(struct dcerpc_connection *p)
+{
+       struct sock_private *sock = (struct sock_private *)p->transport.private_data;
+       return sock->path;
+}
+
+struct resolve_context *dcerpc_resolve_ctx(struct dcerpc_connection *p)
+{
+       struct sock_private *sock = (struct sock_private *)p->transport.private_data;
+       return sock->resolve_ctx;
+}
index 844fa11cc5f584df597b0c791386b07354d08c98..9bc36a176266d61510db9cc668b51ae946681faf 100644 (file)
@@ -206,6 +206,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
        io.in.service = remote_share;
        io.in.service_type = "?????";
        lp_smbcli_options(ntvfs->ctx->lp_ctx, &io.in.options);
+       lp_smbcli_session_options(ntvfs->ctx->lp_ctx, &io.in.session_options);
 
        if (!(ntvfs->ctx->client_caps & NTVFS_CLIENT_CAP_LEVEL_II_OPLOCKS)) {
                io.in.options.use_level2_oplocks = false;
index 15edbd1f89c737239ffb71f38be03724e88f7559..0042dbd876b80738a3f867118826a66b28d7dcbf 100644 (file)
@@ -2629,3 +2629,11 @@ void lp_smbcli_options(struct loadparm_context *lp_ctx,
        options->use_oplocks = true;
        options->use_level2_oplocks = true;
 }
+
+void lp_smbcli_session_options(struct loadparm_context *lp_ctx,
+                                struct smbcli_session_options *options)
+{
+       options->lanman_auth = lp_client_lanman_auth(lp_ctx);
+       options->ntlmv2_auth = lp_client_ntlmv2_auth(lp_ctx);
+       options->plaintext_auth = lp_client_plaintext_auth(lp_ctx);
+}
index 4ed2654692ea6dbff3b039cb60a797686b3a977f..4c6e8b79a2283eabed1ed18ef3833445f04d6a22 100644 (file)
@@ -60,6 +60,7 @@ enum announce_as {/* Types of machine we can announce as. */
 struct loadparm_context;
 struct loadparm_service;
 struct smbcli_options;
+struct smbcli_session_options;
 
 void reload_charcnv(struct loadparm_context *lp_ctx);
 
@@ -318,6 +319,8 @@ int lp_maxprintjobs(struct loadparm_service *service, struct loadparm_service *s
 struct smb_iconv_convenience *lp_iconv_convenience(struct loadparm_context *lp_ctx);
 void lp_smbcli_options(struct loadparm_context *lp_ctx,
                         struct smbcli_options *options);
+void lp_smbcli_session_options(struct loadparm_context *lp_ctx,
+                                struct smbcli_session_options *options);
 
 /* The following definitions come from param/generic.c  */
 
index b68cec4c7dba190167099a55e498e66319e75eaa..2ef8591c320a97144d7a737a7e040479f9125a28 100644 (file)
@@ -436,6 +436,25 @@ static void dcesrv_task_init(struct task_server *task)
        NTSTATUS status;
        struct dcesrv_context *dce_ctx;
        struct dcesrv_endpoint *e;
+       extern NTSTATUS dcerpc_server_wkssvc_init(void);
+       extern NTSTATUS dcerpc_server_drsuapi_init(void);
+       extern NTSTATUS dcerpc_server_winreg_init(void);
+       extern NTSTATUS dcerpc_server_spoolss_init(void);
+       extern NTSTATUS dcerpc_server_epmapper_init(void);
+       extern NTSTATUS dcerpc_server_srvsvc_init(void);
+       extern NTSTATUS dcerpc_server_netlogon_init(void);
+       extern NTSTATUS dcerpc_server_rpcecho_init(void);
+       extern NTSTATUS dcerpc_server_unixinfo_init(void);
+       extern NTSTATUS dcerpc_server_samr_init(void);
+       extern NTSTATUS dcerpc_server_remote_init(void);
+       extern NTSTATUS dcerpc_server_lsa_init(void);
+       init_module_fn static_init[] = { STATIC_DCESRV_MODULES };
+       init_module_fn *shared_init = load_samba_modules(NULL, task->lp_ctx, "dcerpc_server");
+
+       run_init_functions(static_init);
+       run_init_functions(shared_init);
+
+       talloc_free(shared_init);
 
        task_server_set_title(task, "task[dcesrv]");
 
@@ -462,25 +481,6 @@ failed:
 
 NTSTATUS server_service_rpc_init(void)
 {
-       extern NTSTATUS dcerpc_server_wkssvc_init(void);
-       extern NTSTATUS dcerpc_server_drsuapi_init(void);
-       extern NTSTATUS dcerpc_server_winreg_init(void);
-       extern NTSTATUS dcerpc_server_spoolss_init(void);
-       extern NTSTATUS dcerpc_server_epmapper_init(void);
-       extern NTSTATUS dcerpc_server_srvsvc_init(void);
-       extern NTSTATUS dcerpc_server_netlogon_init(void);
-       extern NTSTATUS dcerpc_server_rpcecho_init(void);
-       extern NTSTATUS dcerpc_server_unixinfo_init(void);
-       extern NTSTATUS dcerpc_server_samr_init(void);
-       extern NTSTATUS dcerpc_server_remote_init(void);
-       extern NTSTATUS dcerpc_server_lsa_init(void);
-       init_module_fn static_init[] = { STATIC_DCESRV_MODULES };
-       init_module_fn *shared_init = load_samba_modules(NULL, global_loadparm, "dcerpc_server");
 
-       run_init_functions(static_init);
-       run_init_functions(shared_init);
-
-       talloc_free(shared_init);
-       
        return register_server_service("rpc", dcesrv_task_init);
 }
index a9b33a4725017fdbc36588677108c08312e8070b..6afb66ff20284c8e92734ed841e99c89e63e6999 100644 (file)
@@ -63,7 +63,8 @@ struct model_ops {
                         void *);
 
        /* function to terminate a connection or task */
-       void (*terminate)(struct event_context *, const char *reason);
+       void (*terminate)(struct event_context *, struct loadparm_context *lp_ctx, 
+                         const char *reason);
 
        /* function to set a title for the connection or task */
        void (*set_title)(struct event_context *, const char *title);
index 0d17e5301d44e6a7444cfaa5785bf9f6177424aa..1b369613ffd71eb23a4b4e07f082aaac296cdece 100644 (file)
@@ -189,7 +189,7 @@ static void prefork_new_task(struct event_context *ev,
 
 
 /* called when a task goes down */
-_NORETURN_ static void prefork_terminate(struct event_context *ev, const char *reason) 
+_NORETURN_ static void prefork_terminate(struct event_context *ev, struct loadparm_context *lp_ctx, const char *reason) 
 {
        DEBUG(2,("prefork_terminate: reason[%s]\n",reason));
 }
index a7a27ef9e0a5f34b713c7aab1a331bf80e0c6497..26afff99301549c6e3ef29dd8fac7b2b35652b6a 100644 (file)
@@ -95,7 +95,7 @@ static void single_new_task(struct event_context *ev,
 
 
 /* called when a task goes down */
-static void single_terminate(struct event_context *ev, const char *reason) 
+static void single_terminate(struct event_context *ev, struct loadparm_context *lp_ctx, const char *reason) 
 {
        DEBUG(2,("single_terminate: reason[%s]\n",reason));
 }
index c8f90209b66022bcfd69161ce01ac3b7d149ed2f..0a864dabb2a27d88684e6ca5f4fb56b24021cfc4 100644 (file)
@@ -196,13 +196,14 @@ static void standard_new_task(struct event_context *ev,
 
 
 /* called when a task goes down */
-_NORETURN_ static void standard_terminate(struct event_context *ev, const char *reason) 
+_NORETURN_ static void standard_terminate(struct event_context *ev, struct loadparm_context *lp_ctx, 
+                                         const char *reason) 
 {
        DEBUG(2,("standard_terminate: reason[%s]\n",reason));
 
        /* this reload_charcnv() has the effect of freeing the iconv context memory,
           which makes leak checking easier */
-       reload_charcnv(global_loadparm);
+       reload_charcnv(lp_ctx);
 
        talloc_free(ev);
 
index 540d956420045771be1bf83e30a1689d0f1df4b9..597cf587f13f7406980dc80b07e91a3e5b8a9cc4 100644 (file)
@@ -188,7 +188,7 @@ static void thread_new_task(struct event_context *ev,
 }
 
 /* called when a task goes down */
-static void thread_terminate(struct event_context *event_ctx, const char *reason) 
+static void thread_terminate(struct event_context *event_ctx, struct loadparm_context *lp_ctx, const char *reason) 
 {
        DEBUG(10,("thread_terminate: reason[%s]\n",reason));
 
index 48eda46dc74b055a39033e4311590a2c389e7643..ce5b6519a11ddb493caceb64be0de93a04003651 100644 (file)
@@ -78,8 +78,8 @@ void stream_terminate_connection(struct stream_connection *srv_conn, const char
 
        talloc_free(srv_conn->event.fde);
        srv_conn->event.fde = NULL;
+       model_ops->terminate(event_ctx, srv_conn->lp_ctx, reason);
        talloc_free(srv_conn);
-       model_ops->terminate(event_ctx, reason);
 }
 
 /**
index 22746850590af7125de16f5506274551d0000246..9a2903e281ee2ee71dbf252c2de2c24c3a21d281 100644 (file)
@@ -35,7 +35,7 @@ void task_server_terminate(struct task_server *task, const char *reason)
        struct event_context *event_ctx = task->event_ctx;
        const struct model_ops *model_ops = task->model_ops;
        DEBUG(0,("task_server_terminate: [%s]\n", reason));
-       model_ops->terminate(event_ctx, reason);
+       model_ops->terminate(event_ctx, task->lp_ctx, reason);
        
        /* don't free this above, it might contain the 'reason' being printed */
        talloc_free(task);
index 24e0324bc3e303bbe5fc6554b2565e2de3527d44..c129fd586be03a1435c2123d5e3e26671f6d98e9 100644 (file)
@@ -823,6 +823,7 @@ static struct composite_context *torture_connect_async(
        smb->in.fallback_to_anonymous=false;
        smb->in.workgroup=workgroup;
        lp_smbcli_options(tctx->lp_ctx, &smb->in.options);
+       lp_smbcli_session_options(tctx->lp_ctx, &smb->in.session_options);
        
        return smb_composite_connect_send(smb,mem_ctx,
                                          lp_resolve_context(tctx->lp_ctx),ev);
index 4caeee72a47ae65188fc92b5fde42445228d5c31..ca1fd444d9e1494b55efc51f233b133b619ff9f4 100644 (file)
@@ -36,8 +36,11 @@ static bool try_failed_login(struct torture_context *tctx, struct smbcli_state *
        NTSTATUS status;
        struct smb_composite_sesssetup setup;
        struct smbcli_session *session;
+       struct smbcli_session_options options;
 
-       session = smbcli_session_init(cli->transport, cli, false);
+       lp_smbcli_session_options(tctx->lp_ctx, &options);
+
+       session = smbcli_session_init(cli->transport, cli, false, options);
        setup.in.sesskey = cli->transport->negotiate.sesskey;
        setup.in.capabilities = cli->transport->negotiate.capabilities;
        setup.in.workgroup = lp_workgroup(tctx->lp_ctx);
index fecdfda56ef288ab3fc2a21cdb7b48896d3d695c..3bf3ad8b1bf550f0346134b1be1129d36b89a75e 100644 (file)
@@ -214,7 +214,9 @@ static bool connect_servers(struct event_context *ev,
                for (j=0;j<NINSTANCES;j++) {
                        NTSTATUS status;
                        struct smbcli_options smb_options;
+                       struct smbcli_session_options smb_session_options;
                        lp_smbcli_options(lp_ctx, &smb_options);
+                       lp_smbcli_session_options(lp_ctx, &smb_session_options);
 
                        printf("Connecting to \\\\%s\\%s as %s - instance %d\n",
                               servers[i].server_name, servers[i].share_name, 
@@ -238,7 +240,8 @@ static bool connect_servers(struct event_context *ev,
                                                                     servers[i].share_name, "A:",
                                                                     servers[i].credentials,
                                                                     lp_resolve_context(lp_ctx), ev,
-                                                                    &smb_options);
+                                                                    &smb_options,
+                                                                    &smb_session_options);
                        }
                        if (!NT_STATUS_IS_OK(status)) {
                                printf("Failed to connect to \\\\%s\\%s - %s\n",
index 9c7bffb6f4c99ce286fa084b7e46de7da57de0ff..a511e261cb9606dd74718ef9bf4179b6cf96351e 100644 (file)
@@ -117,8 +117,10 @@ static struct smbcli_state *connect_one(struct event_context *ev,
        NTSTATUS status;
        int retries = 10;
        struct smbcli_options options;
+       struct smbcli_session_options session_options;
 
        lp_smbcli_options(lp_ctx, &options);
+       lp_smbcli_session_options(lp_ctx, &session_options);
 
        printf("connect_one(%s, %d, %d)\n", share, snum, conn);
 
@@ -164,7 +166,7 @@ static struct smbcli_state *connect_one(struct event_context *ev,
                                                share, NULL,
                                                servers[snum], 
                                                lp_resolve_context(lp_ctx),
-                                               ev, &options);
+                                               ev, &options, &session_options);
                if (!NT_STATUS_IS_OK(status)) {
                        sleep(2);
                }
index e6c4728f0ddf854aba43b39ff2af1371a6a86f8b..b49b8d256ab164d33d3c3d079d5793870b96c51d 100644 (file)
@@ -138,7 +138,8 @@ static bool try_unlock(struct smbcli_state *c, int fstype,
 return a connection to a server
 *******************************************************/
 static struct smbcli_state *connect_one(char *share, const char **ports,
-                                       struct smb_options *optionsi,
+                                       struct smb_options *options,
+                                       struct smb_options *session_options,
                                        struct event_context *ev)
 {
        struct smbcli_state *c;
@@ -168,7 +169,7 @@ static struct smbcli_state *connect_one(char *share, const char **ports,
        nt_status = smbcli_full_connection(NULL, 
                           &c, myname, server_n, ports, share, NULL,
                           username, lp_workgroup(), password, ev,
-                          options);
+                          options, session_options);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("smbcli_full_connection failed with error %s\n", nt_errstr(nt_status)));
                return NULL;
@@ -185,6 +186,7 @@ static void reconnect(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
                      int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES],
                      const char **ports,
                      struct smbcli_options *options,
+                     struct smbcli_session_options *session_options,
                      struct event_context *ev,
                      char *share1, char *share2)
 {
@@ -204,7 +206,7 @@ static void reconnect(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
                        smbcli_ulogoff(cli[server][conn]);
                        talloc_free(cli[server][conn]);
                }
-               cli[server][conn] = connect_one(share[server], ports, options, ev);
+               cli[server][conn] = connect_one(share[server], ports, options, session_options, ev);
                if (!cli[server][conn]) {
                        DEBUG(0,("Failed to connect to %s\n", share[server]));
                        exit(1);
@@ -354,6 +356,7 @@ static void test_locks(char *share1, char *share2,
                        char *nfspath1, char *nfspath2,
                        const char **ports,
                        struct smbcli_options *options,
+                       struct smbcli_session_options *session_options,
                        struct event_context *ev)
 {
        struct smbcli_state *cli[NSERVERS][NCONNECTIONS];
@@ -383,7 +386,7 @@ static void test_locks(char *share1, char *share2,
                recorded[n].needed = true;
        }
 
-       reconnect(cli, nfs, fnum, ports, options, ev, share1, share2);
+       reconnect(cli, nfs, fnum, ports, options, session_options, ev, share1, share2);
        open_files(cli, nfs, fnum);
        n = retest(cli, nfs, fnum, numops);
 
@@ -394,7 +397,7 @@ static void test_locks(char *share1, char *share2,
                n1 = n;
 
                close_files(cli, nfs, fnum);
-               reconnect(cli, nfs, fnum, ports, options, ev, share1, share2);
+               reconnect(cli, nfs, fnum, ports, options, session_options, ev, share1, share2);
                open_files(cli, nfs, fnum);
 
                for (i=0;i<n-1;i++) {
@@ -421,7 +424,7 @@ static void test_locks(char *share1, char *share2,
        }
 
        close_files(cli, nfs, fnum);
-       reconnect(cli, nfs, fnum, ports, options, ev, share1, share2);
+       reconnect(cli, nfs, fnum, ports, options, session_options, ev, share1, share2);
        open_files(cli, nfs, fnum);
        showall = true;
        n1 = retest(cli, nfs, fnum, n);
@@ -469,6 +472,7 @@ static void usage(void)
        extern char *optarg;
        extern int optind;
        struct smbcli_options options;
+       struct smbcli_session_options session_options;
        int opt;
        char *p;
        int seed;
@@ -554,8 +558,9 @@ static void usage(void)
 
        locking_init(1);
        lp_smbcli_options(lp_ctx, &options);
+       lp_smbcli_session_options(lp_ctx, &session_options);
        test_locks(share1, share2, nfspath1, nfspath2, lp_smb_ports(lp_ctx),
-                  &options, ev);
+                  &options, &session_options, ev);
 
        return(0);
 }
index 35e9a57fe82bd1fcb8956bf142cfbfd65e32e3a2..a739a1e1b5b6baa66ba3196e87ab6d15d6f406dc 100644 (file)
@@ -76,7 +76,8 @@ return a connection to a server
 static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx, 
                                        struct event_context *ev,
                                        char *share, const char **ports,
-                                       struct smbcli_options *options)
+                                       struct smbcli_options *options,
+                                       struct smbcli_session_options *session_options)
 {
        struct smbcli_state *c;
        fstring server;
@@ -95,7 +96,7 @@ static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx,
                                        ports,
                                        share, NULL,
                                        cmdline_credentials, resolve_ctx, ev,
-                                       options);
+                                       options, session_options);
 
        if (!NT_STATUS_IS_OK(status)) {
                return NULL;
@@ -296,6 +297,7 @@ static void usage(poptContext pc)
        struct event_context *ev;
        struct loadparm_context *lp_ctx;
        struct smbcli_options options;
+       struct smbcli_session_options session_options;
        poptContext pc;
        int argc_new, i;
        char **argv_new;
@@ -360,9 +362,10 @@ static void usage(poptContext pc)
        gensec_init(lp_ctx);
 
        lp_smbcli_options(lp_ctx, &options);
+       lp_smbcli_session_options(lp_ctx, &session_options);
 
        cli = connect_one(lp_resolve_context(lp_ctx), ev, share, 
-                         lp_smb_ports(lp_ctx), &options);
+                         lp_smb_ports(lp_ctx), &options, &session_options);
        if (!cli) {
                DEBUG(0,("Failed to connect to %s\n", share));
                exit(1);
index d73ac1327e1b80c6556a7d7613846cb4b41688e5..7f1f5943e1c95fca65bf91c6c618d5145f74f3ae 100644 (file)
@@ -164,6 +164,7 @@ static bool test_fetchfile(struct smbcli_state *cli, struct torture_context *tct
        io2.in.filename = fname;
        io2.in.resolve_ctx = lp_resolve_context(tctx->lp_ctx);
        lp_smbcli_options(tctx->lp_ctx, &io2.in.options);
+       lp_smbcli_session_options(tctx->lp_ctx, &io2.in.session_options);
 
        printf("testing parallel fetchfile with %d ops\n", torture_numops);
 
@@ -358,7 +359,7 @@ static bool test_fsinfo(struct smbcli_state *cli, struct torture_context *tctx)
        c = talloc_array(tctx, struct composite_context *, torture_numops);
 
        for (i=0; i<torture_numops; i++) {
-               c[i] = smb_composite_fsinfo_send(cli->tree,&io1);
+               c[i] = smb_composite_fsinfo_send(cli->tree, &io1, lp_resolve_context(tctx->lp_ctx));
                c[i]->async.fn = loadfile_complete;
                c[i]->async.private_data = count;
        }
index 15e736fff51be6ae951eb995c1d00922ddcbeb6c..450ad0f2605b9eb66c53558084123e4ad7ade6b8 100644 (file)
@@ -81,6 +81,7 @@ static bool test_session(struct smbcli_state *cli, struct torture_context *tctx)
        const char *fname = BASEDIR "\\test.txt";
        uint8_t c = 1;
        int i;
+       struct smbcli_session_options options;
 
        printf("TESTING SESSION HANDLING\n");
 
@@ -89,7 +90,10 @@ static bool test_session(struct smbcli_state *cli, struct torture_context *tctx)
        }
 
        printf("create a second security context on the same transport\n");
-       session = smbcli_session_init(cli->transport, tctx, false);
+
+       lp_smbcli_session_options(tctx->lp_ctx, &options);
+
+       session = smbcli_session_init(cli->transport, tctx, false, options);
 
        setup.in.sesskey = cli->transport->negotiate.sesskey;
        setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */
@@ -103,7 +107,7 @@ static bool test_session(struct smbcli_state *cli, struct torture_context *tctx)
        session->vuid = setup.out.vuid;
 
        printf("create a third security context on the same transport, with vuid set\n");
-       session2 = smbcli_session_init(cli->transport, tctx, false);
+       session2 = smbcli_session_init(cli->transport, tctx, false, options);
 
        session2->vuid = session->vuid;
        setup.in.sesskey = cli->transport->negotiate.sesskey;
@@ -130,7 +134,7 @@ static bool test_session(struct smbcli_state *cli, struct torture_context *tctx)
 
        if (cli->transport->negotiate.capabilities & CAP_EXTENDED_SECURITY) {
                printf("create a fourth security context on the same transport, without extended security\n");
-               session3 = smbcli_session_init(cli->transport, tctx, false);
+               session3 = smbcli_session_init(cli->transport, tctx, false, options);
 
                session3->vuid = session->vuid;
                setup.in.sesskey = cli->transport->negotiate.sesskey;
@@ -144,7 +148,7 @@ static bool test_session(struct smbcli_state *cli, struct torture_context *tctx)
                CHECK_STATUS(status, NT_STATUS_LOGON_FAILURE);
 
                printf("create a fouth anonymous security context on the same transport, without extended security\n");
-               session4 = smbcli_session_init(cli->transport, tctx, false);
+               session4 = smbcli_session_init(cli->transport, tctx, false, options);
 
                session4->vuid = session->vuid;
                setup.in.sesskey = cli->transport->negotiate.sesskey;
@@ -230,7 +234,7 @@ static bool test_session(struct smbcli_state *cli, struct torture_context *tctx)
                
                setups[i].in.credentials = cmdline_credentials;
 
-               sessions[i] = smbcli_session_init(cli->transport, tctx, false);
+               sessions[i] = smbcli_session_init(cli->transport, tctx, false, options);
                composite_contexts[i] = smb_composite_sesssetup_send(sessions[i], &setups[i]);
 
        }
@@ -379,6 +383,7 @@ static bool test_tree_ulogoff(struct smbcli_state *cli, struct torture_context *
        const char *fname1 = BASEDIR "\\test1.txt";
        const char *fname2 = BASEDIR "\\test2.txt";
        uint8_t c = 1;
+       struct smbcli_session_options options;
 
        printf("TESTING TREE with ulogoff\n");
 
@@ -389,8 +394,10 @@ static bool test_tree_ulogoff(struct smbcli_state *cli, struct torture_context *
        share = torture_setting_string(tctx, "share", NULL);
        host  = torture_setting_string(tctx, "host", NULL);
 
+       lp_smbcli_session_options(tctx->lp_ctx, &options);
+
        printf("create the first new sessions\n");
-       session1 = smbcli_session_init(cli->transport, tctx, false);
+       session1 = smbcli_session_init(cli->transport, tctx, false, options);
        setup.in.sesskey = cli->transport->negotiate.sesskey;
        setup.in.capabilities = cli->transport->negotiate.capabilities;
        setup.in.workgroup = lp_workgroup(tctx->lp_ctx);
@@ -446,7 +453,7 @@ static bool test_tree_ulogoff(struct smbcli_state *cli, struct torture_context *
        CHECK_STATUS(status, NT_STATUS_OK);
 
        printf("create the second new sessions\n");
-       session2 = smbcli_session_init(cli->transport, tctx, false);
+       session2 = smbcli_session_init(cli->transport, tctx, false, options);
        setup.in.sesskey = cli->transport->negotiate.sesskey;
        setup.in.capabilities = cli->transport->negotiate.capabilities;
        setup.in.workgroup = lp_workgroup(tctx->lp_ctx);
@@ -634,6 +641,7 @@ static bool test_pid_2sess(struct smbcli_state *cli, struct torture_context *tct
        const char *fname = BASEDIR "\\test.txt";
        uint8_t c = 1;
        uint16_t vuid1, vuid2;
+       struct smbcli_session_options options;
 
        printf("TESTING PID HANDLING WITH 2 SESSIONS\n");
 
@@ -641,8 +649,10 @@ static bool test_pid_2sess(struct smbcli_state *cli, struct torture_context *tct
                return false;
        }
 
+       lp_smbcli_session_options(tctx->lp_ctx, &options);
+
        printf("create a second security context on the same transport\n");
-       session = smbcli_session_init(cli->transport, tctx, false);
+       session = smbcli_session_init(cli->transport, tctx, false, options);
 
        setup.in.sesskey = cli->transport->negotiate.sesskey;
        setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */
index cd8d60679520258a21ab96e28e5f63d53ca73e49..dbe071c9adf5cac7a709c12679ebe4777b7d7864 100644 (file)
@@ -456,11 +456,14 @@ static bool test_async(struct torture_context *tctx,
        const char *fname = BASEDIR "\\test.txt";
        time_t t;
        struct smbcli_request *req;
+       struct smbcli_session_options options;
 
        if (!torture_setup_dir(cli, BASEDIR)) {
                return false;
        }
 
+       lp_smbcli_session_options(tctx->lp_ctx, &options);
+
        printf("Testing LOCKING_ANDX_CANCEL_LOCK\n");
        io.generic.level = RAW_LOCK_LOCKX;
 
@@ -590,7 +593,7 @@ static bool test_async(struct torture_context *tctx,
        }
 
        printf("create a new sessions\n");
-       session = smbcli_session_init(cli->transport, tctx, false);
+       session = smbcli_session_init(cli->transport, tctx, false, options);
        setup.in.sesskey = cli->transport->negotiate.sesskey;
        setup.in.capabilities = cli->transport->negotiate.capabilities;
        setup.in.workgroup = lp_workgroup(tctx->lp_ctx);
index 21541d003b18eb9ad4ee13b496199eeb8881e8f7..26fad4235e9e793ae097d6fe1e248e43f047c7f5 100644 (file)
@@ -195,6 +195,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
        io->in.fallback_to_anonymous = false;
        io->in.workgroup    = lp_workgroup(state->tctx->lp_ctx);
        lp_smbcli_options(state->tctx->lp_ctx, &io->in.options);
+       lp_smbcli_session_options(state->tctx->lp_ctx, &io->in.session_options);
 
        /* kill off the remnants of the old connection */
        talloc_free(state->tree);
index 26b862c33f1d1255387ab0fae2e27049e6dcee75..ec94637445a3b0f73a3488342ff4be7b0c1237ce 100644 (file)
@@ -137,6 +137,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
        io->in.fallback_to_anonymous = false;
        io->in.workgroup    = lp_workgroup(state->tctx->lp_ctx);
        lp_smbcli_options(state->tctx->lp_ctx, &io->in.options);
+       lp_smbcli_session_options(state->tctx->lp_ctx, &io->in.session_options);
 
        /* kill off the remnants of the old connection */
        talloc_free(state->tree);
index fd8d292980aa48c13eaf735440b1c7bfa31e2560..7e964b4d426ed66f83e1c445233855972da93d6d 100644 (file)
@@ -175,10 +175,11 @@ static bool open_connection_no_level2_oplocks(struct torture_context *tctx,
                                              struct smbcli_state **c)
 {
        NTSTATUS status;
-
        struct smbcli_options options;
+       struct smbcli_session_options session_options;
 
        lp_smbcli_options(tctx->lp_ctx, &options);
+       lp_smbcli_session_options(tctx->lp_ctx, &session_options);
 
        options.use_level2_oplocks = false;
 
@@ -188,7 +189,7 @@ static bool open_connection_no_level2_oplocks(struct torture_context *tctx,
                                        torture_setting_string(tctx, "share", NULL),
                                        NULL, cmdline_credentials,
                                        lp_resolve_context(tctx->lp_ctx),
-                                       tctx->ev, &options);
+                                       tctx->ev, &options, &session_options);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Failed to open connection - %s\n", nt_errstr(status));
                return false;
index 6f0ba0d617e62ce2359563005a3a2fb752577527..66ef2ae2dde8e761a7459b7d635a1995dfc3cf42 100644 (file)
@@ -69,8 +69,10 @@ static int fork_tcon_client(struct torture_context *tctx,
        struct timeval end;
        struct timeval now;
        struct smbcli_options options;
+       struct smbcli_session_options session_options;
 
        lp_smbcli_options(tctx->lp_ctx, &options);
+       lp_smbcli_session_options(tctx->lp_ctx, &session_options);
 
        child = fork();
        if (child == -1) {
@@ -100,7 +102,7 @@ static int fork_tcon_client(struct torture_context *tctx,
                                host, lp_smb_ports(tctx->lp_ctx), share,
                                NULL, cmdline_credentials,
                                lp_resolve_context(tctx->lp_ctx),
-                               tctx->ev, &options);
+                               tctx->ev, &options, &session_options);
 
                if (!NT_STATUS_IS_OK(status)) {
                        printf("failed to connect to //%s/%s: %s\n",
index 77da32d5725ab6a08a63d9cc11854c0bda78f14c..ee0c05360fcd47af039a12c65450edc2c04a0044 100644 (file)
@@ -19,6 +19,7 @@ bool torture_rpc_join(struct torture_context *torture)
        struct smbcli_state *cli;
        const char *host = torture_setting_string(torture, "host", NULL);
        struct smbcli_options options;
+       struct smbcli_session_options session_options;
 
        /* Join domain as a member server. */
        tj = torture_join_domain(torture,
@@ -33,13 +34,14 @@ bool torture_rpc_join(struct torture_context *torture)
        }
 
        lp_smbcli_options(torture->lp_ctx, &options);
+       lp_smbcli_session_options(torture->lp_ctx, &session_options);
 
        status = smbcli_full_connection(tj, &cli, host,
                                        lp_smb_ports(torture->lp_ctx),
                                        "IPC$", NULL,
                                        machine_account,
                                        lp_resolve_context(torture->lp_ctx),
-                                       torture->ev, &options);
+                                       torture->ev, &options, &session_options);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
                          TORTURE_NETBIOS_NAME));
@@ -65,7 +67,7 @@ bool torture_rpc_join(struct torture_context *torture)
                                        "IPC$", NULL,
                                        machine_account,
                                        lp_resolve_context(torture->lp_ctx),
-                                       torture->ev, &options);
+                                       torture->ev, &options, &session_options);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
                          TORTURE_NETBIOS_NAME));
index 3bbf6cf22309d0a0445920c50c8c29c548fc4c00..260c1cc1499bc6baeb74f19b8c940352e00e0d49 100644 (file)
@@ -74,6 +74,7 @@ bool torture_bind_authcontext(struct torture_context *torture)
        struct cli_credentials *anon_creds;
        struct smb_composite_sesssetup setup;
        struct smbcli_options options;
+       struct smbcli_session_options session_options;
 
        mem_ctx = talloc_init("torture_bind_authcontext");
 
@@ -83,13 +84,14 @@ bool torture_bind_authcontext(struct torture_context *torture)
        }
 
        lp_smbcli_options(torture->lp_ctx, &options);
+       lp_smbcli_session_options(torture->lp_ctx, &session_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),
-                                       torture->ev, &options);
+                                       torture->ev, &options, &session_options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("smbcli_full_connection failed: %s\n",
                         nt_errstr(status));
@@ -142,7 +144,7 @@ bool torture_bind_authcontext(struct torture_context *torture)
                goto done;
        }
 
-       session2 = smbcli_session_init(cli->transport, mem_ctx, false);
+       session2 = smbcli_session_init(cli->transport, mem_ctx, false, session_options);
        if (session2 == NULL) {
                d_printf("smbcli_session_init failed\n");
                goto done;
@@ -288,6 +290,7 @@ bool torture_bind_samba3(struct torture_context *torture)
        bool ret = false;
        struct smbcli_state *cli;
        struct smbcli_options options;
+       struct smbcli_session_options session_options;
 
        mem_ctx = talloc_init("torture_bind_authcontext");
 
@@ -297,13 +300,14 @@ bool torture_bind_samba3(struct torture_context *torture)
        }
 
        lp_smbcli_options(torture->lp_ctx, &options);
+       lp_smbcli_session_options(torture->lp_ctx, &session_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),
-                                       torture->ev, &options);
+                                       torture->ev, &options, &session_options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("smbcli_full_connection failed: %s\n",
                         nt_errstr(status));
@@ -1195,6 +1199,7 @@ bool torture_netlogon_samba3(struct torture_context *torture)
        const char *wks_name;
        int i;
        struct smbcli_options options;
+       struct smbcli_session_options session_options;
 
        wks_name = torture_setting_string(torture, "wksname", NULL);
        if (wks_name == NULL) {
@@ -1214,13 +1219,14 @@ bool torture_netlogon_samba3(struct torture_context *torture)
        }
 
        lp_smbcli_options(torture->lp_ctx, &options);
+       lp_smbcli_session_options(torture->lp_ctx, &session_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),
-                                       torture->ev, &options);
+                                       torture->ev, &options, &session_options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("smbcli_full_connection failed: %s\n",
                         nt_errstr(status));
@@ -1299,15 +1305,17 @@ static bool test_join3(struct torture_context *tctx,
        struct smbcli_state *cli;
        struct cli_credentials *wks_creds;
        struct smbcli_options options;
+       struct smbcli_session_options session_options;
 
        lp_smbcli_options(tctx->lp_ctx, &options);
+       lp_smbcli_session_options(tctx->lp_ctx, &session_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),
-                                       tctx->ev, &options);
+                                       tctx->ev, &options, &session_options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("smbcli_full_connection failed: %s\n",
                         nt_errstr(status));
@@ -1670,19 +1678,21 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
        struct cli_credentials *user_creds;
        char *domain_name;
        struct smbcli_options options;
+       struct smbcli_session_options session_options;
 
        if (!(mem_ctx = talloc_new(torture))) {
                return false;
        }
 
        lp_smbcli_options(torture->lp_ctx, &options);
+       lp_smbcli_session_options(torture->lp_ctx, &session_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),
-               torture->ev, &options);
+               torture->ev, &options, &session_options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("(%s) smbcli_full_connection failed: %s\n",
                         __location__, nt_errstr(status));
@@ -1709,7 +1719,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),
-               torture->ev, &options);
+               torture->ev, &options, &session_options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("(%s) anon smbcli_full_connection failed: %s\n",
                         __location__, nt_errstr(status));
@@ -1762,7 +1772,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
                struct smb_composite_sesssetup setup;
                struct smbcli_tree *tree;
 
-               session2 = smbcli_session_init(cli->transport, mem_ctx, false);
+               session2 = smbcli_session_init(cli->transport, mem_ctx, false, session_options);
                if (session2 == NULL) {
                        d_printf("(%s) smbcli_session_init failed\n",
                                 __location__);
index 4fbffee41ed830bb591f17a8f78e699377dd1282..b7028e660959d5e74d46ea0fa6db585ab742c206 100644 (file)
@@ -53,7 +53,9 @@ struct samlogon_state {
        const char *comment;
        const char *account_name;
        const char *account_domain;
+       const char *netbios_name;
        const char *password;
+       const char *workgroup;
        struct dcerpc_pipe *p;
        int function_level;
        uint32_t parameter_control;
@@ -593,7 +595,7 @@ static bool test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state,
        DATA_BLOB lmv2_response = data_blob(NULL, 0);
        DATA_BLOB lmv2_session_key = data_blob(NULL, 0);
        DATA_BLOB ntlmv2_session_key = data_blob(NULL, 0);
-       DATA_BLOB names_blob = NTLMv2_generate_names_blob(samlogon_state->mem_ctx, samlogon_state->iconv_convenience, TEST_MACHINE_NAME, lp_workgroup(global_loadparm));
+       DATA_BLOB names_blob = NTLMv2_generate_names_blob(samlogon_state->mem_ctx, samlogon_state->iconv_convenience, TEST_MACHINE_NAME, samlogon_state->workgroup);
 
        uint8_t lm_session_key[8];
        uint8_t user_session_key[16];
@@ -741,7 +743,7 @@ static bool test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state,
        DATA_BLOB lmv2_response = data_blob(NULL, 0);
        DATA_BLOB lmv2_session_key = data_blob(NULL, 0);
        DATA_BLOB ntlmv2_session_key = data_blob(NULL, 0);
-       DATA_BLOB names_blob = NTLMv2_generate_names_blob(samlogon_state->mem_ctx, samlogon_state->iconv_convenience, lp_netbios_name(global_loadparm), lp_workgroup(global_loadparm));
+       DATA_BLOB names_blob = NTLMv2_generate_names_blob(samlogon_state->mem_ctx, samlogon_state->iconv_convenience, samlogon_state->netbios_name, samlogon_state->workgroup);
 
        DATA_BLOB ntlm_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24);
        DATA_BLOB ntlm_session_key = data_blob_talloc(samlogon_state->mem_ctx, NULL, 16);
@@ -1337,6 +1339,8 @@ static bool test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        samlogon_state.account_name = account_name;
        samlogon_state.account_domain = account_domain;
        samlogon_state.password = plain_pass;
+       samlogon_state.workgroup = lp_workgroup(tctx->lp_ctx);
+       samlogon_state.netbios_name = lp_netbios_name(tctx->lp_ctx);
        samlogon_state.p = p;
        samlogon_state.creds = creds;
        samlogon_state.expected_error = expected_error;
index d7482ddcf1f5e98b035435dedce835ce2b098da1..3bddde2a97ce5a78565e6f3f559d1c14cb77acdd 100644 (file)
@@ -56,15 +56,17 @@ 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;
+       struct smbcli_session_options session_options;
 
        lp_smbcli_options(tctx->lp_ctx, &options);
+       lp_smbcli_session_options(tctx->lp_ctx, &session_options);
 
        status = smbcli_full_connection(tctx, &cli, host, 
                                        lp_smb_ports(tctx->lp_ctx),
                                        share, NULL,
                                        cmdline_credentials, 
                                        lp_resolve_context(tctx->lp_ctx),
-                                       tctx->ev, &options);
+                                       tctx->ev, &options, &session_options);
 
        if (!NT_STATUS_IS_OK(status)) {
                printf("failed to connect to //%s/%s: %s\n",
index 39d0a12ab1f640cfc9ab5d7919c9d722bc3789b0..d742e23e829de59e1f1ea09e13edb466b6d8874c 100644 (file)
@@ -77,14 +77,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;
+       struct smbcli_session_options session_options;
 
        lp_smbcli_options(tctx->lp_ctx, &options);
+       lp_smbcli_session_options(tctx->lp_ctx, &session_options);
 
        status = smbcli_full_connection(tctx, &cli, host, 
                                        lp_smb_ports(tctx->lp_ctx),
                                        share, NULL,
                                        creds, lp_resolve_context(tctx->lp_ctx),
-                                       tctx->ev, &options);
+                                       tctx->ev, &options, &session_options);
 
        if (!NT_STATUS_IS_OK(status)) {
                printf("failed to connect to //%s/%s: %s\n",
index 938e7d6c038f9b9af6a6fadd32fdd7990edaa7c0..32e4453acad9ce81f3c9688587df8dad92299efd 100644 (file)
@@ -475,8 +475,10 @@ _PUBLIC_ bool torture_open_connection_share(TALLOC_CTX *mem_ctx,
        NTSTATUS status;
 
        struct smbcli_options options;
+       struct smbcli_session_options session_options;
 
        lp_smbcli_options(tctx->lp_ctx, &options);
+       lp_smbcli_session_options(tctx->lp_ctx, &session_options);
 
        options.use_oplocks = torture_setting_bool(tctx, "use_oplocks", true);
        options.use_level2_oplocks = torture_setting_bool(tctx, "use_level2_oplocks", true);
@@ -486,7 +488,7 @@ _PUBLIC_ bool torture_open_connection_share(TALLOC_CTX *mem_ctx,
                                        sharename, NULL,
                                        cmdline_credentials, 
                                        lp_resolve_context(tctx->lp_ctx),
-                                       ev, &options);
+                                       ev, &options, &session_options);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Failed to open connection - %s\n", nt_errstr(status));
                return false;