r26264: pass name resolve order explicitly, use torture context for settings in dssyn...
authorJelmer Vernooij <jelmer@samba.org>
Mon, 3 Dec 2007 17:47:35 +0000 (18:47 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:47:39 +0000 (05:47 +0100)
(This used to be commit c7eae1c7842f9ff8b70cce9e5d6f3ebbbe78e83b)

19 files changed:
source4/auth/auth_server.c
source4/auth/auth_simple.c
source4/auth/gensec/gensec_gssapi.c
source4/auth/gensec/gensec_krb5.c
source4/auth/ntlmssp/ntlmssp_server.c
source4/auth/session.c
source4/client/cifsdd.c
source4/lib/charset/tests/iconv.c
source4/libcli/finddcs.c
source4/libcli/raw/clisocket.c
source4/libcli/resolve/resolve.c
source4/libnet/libnet_site.c
source4/scripting/ejs/smbcalls_auth.c
source4/scripting/ejs/smbcalls_nbt.c
source4/smb_server/smb/sesssetup.c
source4/torture/ldap/cldapbench.c
source4/torture/nbt/dgram.c
source4/torture/nbt/nbt.c
source4/torture/rpc/dssync.c

index 900ca8d05e91c2c7e985d050a84561f58f4145a6..1e2570267137118a193428f388b79779572ab4a7 100644 (file)
@@ -45,7 +45,7 @@ static struct smbcli_state *server_cryptkey(TALLOC_CTX *mem_ctx, bool unicode, i
         while(next_token( &p, desthost, LIST_SEP, sizeof(desthost))) {
                strupper(desthost);
 
-               if(!resolve_name( desthost, &dest_ip, 0x20)) {
+               if(!resolve_name( desthost, &dest_ip, 0x20, lp_name_resolve_order(global_loadparm))) {
                        DEBUG(1,("server_cryptkey: Can't resolve address for %s\n",desthost));
                        continue;
                }
index cde170482ad3e5e978c394369ea80e3c606f0b7c..3c7bf5433a22d516687ecc429cc2e8f53c2b8cdf 100644 (file)
@@ -89,7 +89,7 @@ _PUBLIC_ NTSTATUS authenticate_username_pw(TALLOC_CTX *mem_ctx,
        }
 
        if (session_info) {
-               nt_status = auth_generate_session_info(tmp_ctx, server_info, session_info);
+               nt_status = auth_generate_session_info(tmp_ctx, lp_ctx, server_info, session_info);
 
                if (NT_STATUS_IS_OK(nt_status)) {
                        talloc_steal(mem_ctx, *session_info);
index c91da6d1a0a5fed5aea7616412830e716c6540c9..a0b42db1412797dceaa3ae28196e7a47f96cc72d 100644 (file)
@@ -1336,7 +1336,7 @@ static NTSTATUS gensec_gssapi_session_info(struct gensec_security *gensec_securi
        }
 
        /* references the server_info into the session_info */
-       nt_status = auth_generate_session_info(mem_ctx, server_info, &session_info);
+       nt_status = auth_generate_session_info(mem_ctx, gensec_security->lp_ctx, server_info, &session_info);
        if (!NT_STATUS_IS_OK(nt_status)) {
                talloc_free(mem_ctx);
                return nt_status;
index 26cc66a21360d43ec93d652f9d58124aba556dd6..282be5a00142a6f02e0d933898df37fc88da42f4 100644 (file)
@@ -641,7 +641,7 @@ static NTSTATUS gensec_krb5_session_info(struct gensec_security *gensec_security
        }
 
        /* references the server_info into the session_info */
-       nt_status = auth_generate_session_info(mem_ctx, server_info, &session_info);
+       nt_status = auth_generate_session_info(mem_ctx, gensec_security->lp_ctx, server_info, &session_info);
 
        if (!NT_STATUS_IS_OK(nt_status)) {
                talloc_free(mem_ctx);
index 52c027baac4354639ecabed197e629f539da58ab..1ee05cf66a33344542729179df1f610451c8d54f 100644 (file)
@@ -717,7 +717,7 @@ NTSTATUS gensec_ntlmssp_session_info(struct gensec_security *gensec_security,
        NTSTATUS nt_status;
        struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data;
 
-       nt_status = auth_generate_session_info(gensec_ntlmssp_state, gensec_ntlmssp_state->server_info, session_info);
+       nt_status = auth_generate_session_info(gensec_ntlmssp_state, gensec_security->lp_ctx, gensec_ntlmssp_state->server_info, session_info);
        NT_STATUS_NOT_OK_RETURN(nt_status);
 
        (*session_info)->session_key = data_blob_talloc(*session_info, 
index 70cfc1a101621ac990f172b89e8fe0cbc2ae016a..c86fff90df5a4f7724c9bb6d20e3af3a879792f5 100644 (file)
@@ -59,7 +59,7 @@ NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx,
        }
 
        /* references the server_info into the session_info */
-       nt_status = auth_generate_session_info(parent_ctx, server_info, &session_info);
+       nt_status = auth_generate_session_info(parent_ctx, lp_ctx, server_info, &session_info);
        talloc_free(mem_ctx);
 
        NT_STATUS_NOT_OK_RETURN(nt_status);
@@ -150,6 +150,7 @@ NTSTATUS auth_anonymous_server_info(TALLOC_CTX *mem_ctx,
 }
 
 NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx, 
+                                   struct loadparm_context *lp_ctx,
                                    struct auth_serversupplied_info *server_info, 
                                    struct auth_session_info **_session_info) 
 {
@@ -166,7 +167,7 @@ NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx,
        session_info->session_key = server_info->user_session_key;
 
        nt_status = security_token_create(session_info,
-                                         global_loadparm,
+                                         lp_ctx,
                                          server_info->account_sid,
                                          server_info->primary_group_sid,
                                          server_info->n_domain_groups,
index a48235d047862ce33bf441c5b4c1cfb6fde07799..6c3edeb89240c2bae7f2d32a321d4719cc477658 100644 (file)
@@ -390,12 +390,12 @@ static struct dd_iohandle * open_file(const char * which)
        return(handle);
 }
 
-static void set_max_xmit(uint64_t iomax)
+static void set_max_xmit(struct loadparm_context *lp_ctx, uint64_t iomax)
 {
        char buf[64];
 
        snprintf(buf, sizeof(buf), "%llu", (unsigned long long)iomax);
-       lp_set_cmdline(global_loadparm, "max xmit", buf);
+       lp_set_cmdline(lp_ctx, "max xmit", buf);
 }
 
 static int copy_files(void)
@@ -426,7 +426,7 @@ static int copy_files(void)
                return(EOM_EXIT_CODE);
        }
 
-       set_max_xmit(MAX(ibs, obs));
+       set_max_xmit(global_loadparm, MAX(ibs, obs));
 
        DEBUG(4, ("IO buffer size is %llu, max xmit is %d\n",
                        (unsigned long long)iomax, lp_max_xmit(global_loadparm)));
index 259769d60f286b96bae5f941952cb69b8c76c962..9080dda40e46e71e6e73914b2b41ef1f870667e7 100644 (file)
@@ -34,7 +34,7 @@ static bool iconv_untestable(struct torture_context *tctx)
 {
        iconv_t cd;
 
-       if (!lp_parm_bool(global_loadparm, NULL, "iconv", "native", true))
+       if (!lp_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true))
                torture_skip(tctx, "system iconv disabled - skipping test");
 
        cd = iconv_open("UTF-16LE", "UCS-4LE");
index e00697fe17ae21cae1e66a07248e85490ddff00e..75dc14e3f4c18298b986832afe34504b6a3f3bda 100644 (file)
@@ -93,8 +93,7 @@ struct composite_context *finddcs_send(TALLOC_CTX *mem_ctx,
        state->msg_ctx = msg_ctx;
 
        make_nbt_name(&name, state->domain_name, name_type);
-       creq = resolve_name_send(&name, event_ctx,
-                                methods);
+       creq = resolve_name_send(&name, event_ctx, methods);
        composite_continue(c, creq, finddcs_name_resolved, state);
        return c;
 }
index a748b40a322f5677a77722aa564330dba3cac245..e3420313c512bbf1ef05b4c3c8fb6c3bcaff47b6 100644 (file)
@@ -239,7 +239,7 @@ struct smbcli_socket *smbcli_sock_connect_byname(const char *host, int port,
 
        make_nbt_name(&nbt_name, host, name_type);
        
-       status = resolve_name(&nbt_name, tmp_ctx, &address, event_ctx);
+       status = resolve_name(&nbt_name, tmp_ctx, &address, event_ctx, lp_name_resolve_order(global_loadparm));
        if (!NT_STATUS_IS_OK(status)) {
                talloc_free(tmp_ctx);
                return NULL;
index 24113db9f068761b57056e0aef40b9f9a4aa910e..0f8839a3b7553577ca32194a60ce0c4c4d7aab39 100644 (file)
@@ -187,11 +187,9 @@ NTSTATUS resolve_name_recv(struct composite_context *c,
 /*
   general name resolution - sync call
  */
-NTSTATUS resolve_name(struct nbt_name *name, TALLOC_CTX *mem_ctx, const char **reply_addr, 
-                     struct event_context *ev)
+NTSTATUS resolve_name(struct nbt_name *name, TALLOC_CTX *mem_ctx, const char **reply_addr, struct event_context *ev, const char **name_resolve_order)
 {
-       struct composite_context *c = resolve_name_send(name, ev, 
-                                               lp_name_resolve_order(global_loadparm));
+       struct composite_context *c = resolve_name_send(name, ev, name_resolve_order); 
        return resolve_name_recv(c, mem_ctx, reply_addr);
 }
 
index cbb4bcdae3478ac0f306b2b483c36e34fea801d1..251cecb3b097a7a5dceb3d9b4026a37e9b0c8614 100644 (file)
@@ -24,8 +24,9 @@
 #include "lib/ldb/include/ldb_errors.h"
 #include "librpc/rpc/dcerpc.h"
 #include "libcli/resolve/resolve.h"
+#include "param/param.h"
 
-/*
+/**
  * 1. Setup a CLDAP socket.
  * 2. Lookup the default Site-Name.
  */
@@ -145,7 +146,7 @@ NTSTATUS libnet_JoinSite(struct ldb_context *remote_ldb,
        }
 
        make_nbt_name_client(&name, libnet_r->out.samr_binding->host);
-       status = resolve_name(&name, r, &dest_addr, NULL);
+       status = resolve_name(&name, r, &dest_addr, NULL, lp_name_resolve_order(global_loadparm));
        if (!NT_STATUS_IS_OK(status)) {
                libnet_r->out.error_string = NULL;
                talloc_free(tmp_ctx);
index 236edbd64de41ccd9df25a8e0f0fcb90228bc7fb..7747bb14c647e55875d185fb2b7b231a5cb522ba 100644 (file)
@@ -108,7 +108,7 @@ static int ejs_doauth(MprVarHandle eid,
                goto done;
        }
 
-       nt_status = auth_generate_session_info(tmp_ctx, server_info, &session_info);
+       nt_status = auth_generate_session_info(tmp_ctx, global_loadparm, server_info, &session_info);
        if (!NT_STATUS_IS_OK(nt_status)) {
                mprSetPropertyValue(auth, "report", mprString("Session Info generation failed"));
                mprSetPropertyValue(auth, "result", mprCreateBoolVar(false));
index 4a7ef682f8fa7a36a4c322c9e31ab7ee9e9f1497..5eaf458f340012c380062935e7576b08e3f6daeb 100644 (file)
@@ -70,7 +70,7 @@ static int ejs_resolve_name(MprVarHandle eid, int argc, struct MprVar **argv)
 
        result = 0;
 
-       nt_status = resolve_name(&name, tmp_ctx, &reply_addr, event_context_find(tmp_ctx));
+       nt_status = resolve_name(&name, tmp_ctx, &reply_addr, event_context_find(tmp_ctx), lp_name_resolve_order(global_loadparm));
 
        if (NT_STATUS_IS_OK(nt_status)) {
                mprSetPropertyValue(argv[0], "value", mprString(reply_addr));
index d78f4050cf70f8b65bb73dfa87d9d0984a515067..8cc16aaa682841073ba0b9f4aaf6d030e938cf78 100644 (file)
@@ -69,7 +69,7 @@ static void sesssetup_old_send(struct auth_check_password_request *areq,
        if (!NT_STATUS_IS_OK(status)) goto failed;
 
        /* This references server_info into session_info */
-       status = auth_generate_session_info(req, server_info, &session_info);
+       status = auth_generate_session_info(req, global_loadparm, server_info, &session_info);
        if (!NT_STATUS_IS_OK(status)) goto failed;
 
        /* allocate a new session */
@@ -164,7 +164,7 @@ static void sesssetup_nt1_send(struct auth_check_password_request *areq,
        if (!NT_STATUS_IS_OK(status)) goto failed;
 
        /* This references server_info into session_info */
-       status = auth_generate_session_info(req, server_info, &session_info);
+       status = auth_generate_session_info(req, global_loadparm, server_info, &session_info);
        if (!NT_STATUS_IS_OK(status)) goto failed;
 
        /* allocate a new session */
index 9f860f98d91d42395f41398c3cb95a2a88a556ee..21fe3849b13bf3931f6001e70b7b9e92b3737cb2 100644 (file)
@@ -24,6 +24,7 @@
 #include "libcli/cldap/cldap.h"
 #include "libcli/resolve/resolve.h"
 #include "torture/torture.h"
+#include "param/param.h"
 
 struct bench_state {
        int pass_count, fail_count;
@@ -114,7 +115,7 @@ bool torture_bench_cldap(struct torture_context *torture)
        make_nbt_name_server(&name, torture_setting_string(torture, "host", NULL));
 
        /* do an initial name resolution to find its IP */
-       status = resolve_name(&name, torture, &address, event_context_find(torture));
+       status = resolve_name(&name, torture, &address, event_context_find(torture), lp_name_resolve_order(torture->lp_ctx));
        if (!NT_STATUS_IS_OK(status)) {
                printf("Failed to resolve %s - %s\n",
                       name.name, nt_errstr(status));
index 82d061769653f5ca1b46f16bf92f26883c619be1..ff1a7b97cb6fdc20121efe7df2ece6ac8f8088e9 100644 (file)
@@ -84,7 +84,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
 
        /* do an initial name resolution to find its IP */
        torture_assert_ntstatus_ok(tctx, 
-                                  resolve_name(&name, tctx, &address, event_context_find(tctx)),
+                                  resolve_name(&name, tctx, &address, event_context_find(tctx), lp_name_resolve_order(global_loadparm)),
                                   talloc_asprintf(tctx, "Failed to resolve %s", name.name));
 
        myaddress = talloc_strdup(dgmsock, iface_best_ip(address));
@@ -163,7 +163,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
 
        /* do an initial name resolution to find its IP */
        torture_assert_ntstatus_ok(tctx, 
-                                  resolve_name(&name, tctx, &address, event_context_find(tctx)),
+                                  resolve_name(&name, tctx, &address, event_context_find(tctx), lp_name_resolve_order(tctx->lp_ctx)),
                                   talloc_asprintf(tctx, "Failed to resolve %s", name.name));
 
        myaddress = talloc_strdup(dgmsock, iface_best_ip(address));
@@ -272,7 +272,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
 
        /* do an initial name resolution to find its IP */
        torture_assert_ntstatus_ok(tctx, 
-                                  resolve_name(&name, tctx, &address, event_context_find(tctx)),
+                                  resolve_name(&name, tctx, &address, event_context_find(tctx), lp_name_resolve_order(tctx->lp_ctx)), 
                                   talloc_asprintf(tctx, "Failed to resolve %s", name.name));
 
        myaddress = talloc_strdup(dgmsock, iface_best_ip(address));
index 2a3678ee75da34faa7b0ec1011d2b3b98d4fdd74..7cf2a48c4e47921586edf399e9025b18e3939724 100644 (file)
@@ -23,6 +23,7 @@
 #include "torture/nbt/proto.h"
 #include "torture/ui.h"
 #include "libcli/resolve/resolve.h"
+#include "param/param.h"
 
 bool torture_nbt_get_name(struct torture_context *tctx, 
                          struct nbt_name *name, 
@@ -33,7 +34,7 @@ bool torture_nbt_get_name(struct torture_context *tctx,
 
        /* do an initial name resolution to find its IP */
        torture_assert_ntstatus_ok(tctx, 
-                                  resolve_name(name, tctx, address, NULL), 
+                                  resolve_name(name, tctx, address, NULL, lp_name_resolve_order(tctx->lp_ctx)), 
                                   talloc_asprintf(tctx, 
                                                   "Failed to resolve %s", name->name));
        
index 7c56a5220328bd15e9142c8f9bbc7382bf626abc..738a049e73d8ec12bbcacf76d9af9a4d85a06c7d 100644 (file)
@@ -78,14 +78,14 @@ struct DsSyncTest {
        } old_dc;
 };
 
-static struct DsSyncTest *test_create_context(TALLOC_CTX *mem_ctx)
+static struct DsSyncTest *test_create_context(struct torture_context *tctx)
 {
        NTSTATUS status;
        struct DsSyncTest *ctx;
        struct drsuapi_DsBindInfo28 *our_bind_info28;
        struct drsuapi_DsBindInfoCtr *our_bind_info_ctr;
-       const char *binding = lp_parm_string(global_loadparm, NULL, "torture", "binding");
-       ctx = talloc_zero(mem_ctx, struct DsSyncTest);
+       const char *binding = torture_setting_string(tctx, "binding", NULL);
+       ctx = talloc_zero(tctx, struct DsSyncTest);
        if (!ctx) return NULL;
 
        status = dcerpc_parse_binding(ctx, binding, &ctx->drsuapi_binding);
@@ -149,7 +149,7 @@ static struct DsSyncTest *test_create_context(TALLOC_CTX *mem_ctx)
        our_bind_info28->supported_extensions   |= DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3;
        our_bind_info28->supported_extensions   |= DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7;
        our_bind_info28->supported_extensions   |= DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT;
-       if (lp_parm_bool(global_loadparm, NULL, "dssync", "xpress", false)) {
+       if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "xpress", false)) {
                our_bind_info28->supported_extensions   |= DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS;
        }
        our_bind_info28->site_guid              = GUID_zero();
@@ -246,7 +246,7 @@ static bool test_LDAPBind(struct DsSyncTest *ctx, struct cli_credentials *creden
        return ret;
 }
 
-static bool test_GetInfo(struct DsSyncTest *ctx)
+static bool test_GetInfo(struct torture_context *tctx, struct DsSyncTest *ctx)
 {
        NTSTATUS status;
        struct drsuapi_DsCrackNames r;
@@ -265,7 +265,7 @@ static bool test_GetInfo(struct DsSyncTest *ctx)
        r.in.req.req1.format_flags      = DRSUAPI_DS_NAME_FLAG_NO_FLAGS;                
        r.in.req.req1.format_offered    = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT;
        r.in.req.req1.format_desired    = DRSUAPI_DS_NAME_FORMAT_FQDN_1779;
-       names[0].str = talloc_asprintf(ctx, "%s\\", lp_workgroup(global_loadparm));
+       names[0].str = talloc_asprintf(ctx, "%s\\", lp_workgroup(tctx->lp_ctx));
 
        status = dcerpc_drsuapi_DsCrackNames(ctx->admin.drsuapi.pipe, ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
@@ -413,18 +413,19 @@ static DATA_BLOB decrypt_blob(TALLOC_CTX *mem_ctx,
        return plain_buffer;
 }
 
-static void test_analyse_objects(struct DsSyncTest *ctx,
+static void test_analyse_objects(struct torture_context *tctx, 
+                                struct DsSyncTest *ctx,
                                 const DATA_BLOB *gensec_skey,
                                 struct drsuapi_DsReplicaObjectListItemEx *cur)
 {
        static uint32_t object_id;
        const char *save_values_dir;
 
-       if (!lp_parm_bool(global_loadparm, NULL, "dssync", "print_pwd_blobs", false)) {
+       if (!lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "print_pwd_blobs", false)) {
                return; 
        }
 
-       save_values_dir = lp_parm_string(global_loadparm, NULL, "dssync", "save_pwd_blobs_dir");
+       save_values_dir = lp_parm_string(tctx->lp_ctx, NULL, "dssync", "save_pwd_blobs_dir");
 
        for (; cur; cur = cur->next_object) {
                const char *dn;
@@ -531,7 +532,7 @@ static void test_analyse_objects(struct DsSyncTest *ctx,
        }
 }
 
-static bool test_FetchData(struct DsSyncTest *ctx)
+static bool test_FetchData(struct torture_context *tctx, struct DsSyncTest *ctx)
 {
        NTSTATUS status;
        bool ret = true;
@@ -560,17 +561,17 @@ static bool test_FetchData(struct DsSyncTest *ctx)
        ZERO_STRUCT(null_guid);
        ZERO_STRUCT(null_sid);
 
-       partition = lp_parm_string(global_loadparm, NULL, "dssync", "partition");
+       partition = lp_parm_string(tctx->lp_ctx, NULL, "dssync", "partition");
        if (partition == NULL) {
                partition = ctx->domain_dn;
                printf("dssync:partition not specified, defaulting to %s.\n", ctx->domain_dn);
        }
 
-       highest_usn = lp_parm_int(global_loadparm, NULL, "dssync", "highest_usn", 0);
+       highest_usn = lp_parm_int(tctx->lp_ctx, NULL, "dssync", "highest_usn", 0);
 
-       array[0].level = lp_parm_int(global_loadparm, NULL, "dssync", "get_nc_changes_level", array[0].level);
+       array[0].level = lp_parm_int(tctx->lp_ctx, NULL, "dssync", "get_nc_changes_level", array[0].level);
 
-       if (lp_parm_bool(global_loadparm, NULL, "dssync", "print_pwd_blobs", false)) {
+       if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "print_pwd_blobs", false)) {
                const struct samr_Password *nthash;
                nthash = cli_credentials_get_nt_hash(ctx->new_dc.credentials, ctx);
                if (nthash) {
@@ -605,10 +606,10 @@ static bool test_FetchData(struct DsSyncTest *ctx)
                        r.in.req.req5.highwatermark.highest_usn         = highest_usn;
                        r.in.req.req5.uptodateness_vector               = NULL;
                        r.in.req.req5.replica_flags                     = 0;
-                       if (lp_parm_bool(global_loadparm, NULL, "dssync", "compression", false)) {
+                       if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "compression", false)) {
                                r.in.req.req5.replica_flags             |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
                        }
-                       if (lp_parm_bool(global_loadparm, NULL, "dssync", "neighbour_writeable", true)) {
+                       if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "neighbour_writeable", true)) {
                                r.in.req.req5.replica_flags             |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE;
                        }
                        r.in.req.req5.replica_flags                     |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
@@ -636,10 +637,10 @@ static bool test_FetchData(struct DsSyncTest *ctx)
                        r.in.req.req8.highwatermark.highest_usn         = highest_usn;
                        r.in.req.req8.uptodateness_vector               = NULL;
                        r.in.req.req8.replica_flags                     = 0;
-                       if (lp_parm_bool(global_loadparm, NULL, "dssync", "compression", false)) {
+                       if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "compression", false)) {
                                r.in.req.req8.replica_flags             |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
                        }
-                       if (lp_parm_bool(global_loadparm, NULL, "dssync", "neighbour_writeable", true)) {
+                       if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "neighbour_writeable", true)) {
                                r.in.req.req8.replica_flags             |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE;
                        }
                        r.in.req.req8.replica_flags                     |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
@@ -704,7 +705,7 @@ static bool test_FetchData(struct DsSyncTest *ctx)
                                        (long long)ctr1->new_highwatermark.tmp_highest_usn,
                                        (long long)ctr1->new_highwatermark.highest_usn));
 
-                               test_analyse_objects(ctx, &gensec_skey, ctr1->first_object);
+                               test_analyse_objects(tctx, ctx, &gensec_skey, ctr1->first_object);
 
                                if (ctr1->new_highwatermark.tmp_highest_usn > ctr1->new_highwatermark.highest_usn) {
                                        r.in.req.req5.highwatermark = ctr1->new_highwatermark;
@@ -727,7 +728,7 @@ static bool test_FetchData(struct DsSyncTest *ctx)
                                        (long long)ctr6->new_highwatermark.tmp_highest_usn,
                                        (long long)ctr6->new_highwatermark.highest_usn));
 
-                               test_analyse_objects(ctx, &gensec_skey, ctr6->first_object);
+                               test_analyse_objects(tctx, ctx, &gensec_skey, ctr6->first_object);
 
                                if (ctr6->new_highwatermark.tmp_highest_usn > ctr6->new_highwatermark.highest_usn) {
                                        r.in.req.req8.highwatermark = ctr6->new_highwatermark;
@@ -742,7 +743,8 @@ static bool test_FetchData(struct DsSyncTest *ctx)
        return ret;
 }
 
-static bool test_FetchNT4Data(struct DsSyncTest *ctx)
+static bool test_FetchNT4Data(struct torture_context *tctx, 
+                             struct DsSyncTest *ctx)
 {
        NTSTATUS status;
        bool ret = true;
@@ -759,8 +761,8 @@ static bool test_FetchNT4Data(struct DsSyncTest *ctx)
        r.in.bind_handle        = &ctx->new_dc.drsuapi.bind_handle;
        r.in.level              = 1;
 
-       r.in.req.req1.unknown1  = lp_parm_int(global_loadparm, NULL, "dssync", "nt4-1", 3);
-       r.in.req.req1.unknown2  = lp_parm_int(global_loadparm, NULL, "dssync", "nt4-2", 0x00004000);
+       r.in.req.req1.unknown1  = lp_parm_int(tctx->lp_ctx, NULL, "dssync", "nt4-1", 3);
+       r.in.req.req1.unknown2  = lp_parm_int(tctx->lp_ctx, NULL, "dssync", "nt4-2", 0x00004000);
 
        while (1) {
                r.in.req.req1.length    = cookie.length;
@@ -806,7 +808,7 @@ bool torture_rpc_dssync(struct torture_context *torture)
        struct DsSyncTest *ctx;
        
        mem_ctx = talloc_init("torture_rpc_dssync");
-       ctx = test_create_context(mem_ctx);
+       ctx = test_create_context(torture);
        
        ret &= _test_DsBind(ctx, ctx->admin.credentials, &ctx->admin.drsuapi);
        if (!ret) {
@@ -816,13 +818,13 @@ bool torture_rpc_dssync(struct torture_context *torture)
        if (!ret) {
                return ret;
        }
-       ret &= test_GetInfo(ctx);
+       ret &= test_GetInfo(torture, ctx);
        ret &= _test_DsBind(ctx, ctx->new_dc.credentials, &ctx->new_dc.drsuapi);
        if (!ret) {
                return ret;
        }
-       ret &= test_FetchData(ctx);
-       ret &= test_FetchNT4Data(ctx);
+       ret &= test_FetchData(torture, ctx);
+       ret &= test_FetchNT4Data(torture, ctx);
 
        return ret;
 }