r26250: Avoid global_loadparm in a couple more places.
authorJelmer Vernooij <jelmer@samba.org>
Mon, 3 Dec 2007 14:53:17 +0000 (15:53 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:47:28 +0000 (05:47 +0100)
(This used to be commit 2c6b755309fdf685cd0b0564272bf83038574a43)

22 files changed:
source4/auth/auth_anonymous.c
source4/auth/gensec/schannel.c
source4/auth/sam.c
source4/auth/session.c
source4/ldap_server/ldap_server.c
source4/param/secrets.c
source4/param/secrets.h
source4/param/share.c
source4/param/share_classic.c
source4/rpc_server/service_rpc.c
source4/smb_server/smb_server.c
source4/smbd/server.c
source4/torture/libnet/libnet_BecomeDC.c
source4/torture/raw/lockbench.c
source4/torture/raw/openbench.c
source4/torture/rpc/drsuapi.c
source4/torture/rpc/lsa.c
source4/torture/rpc/samr.c
source4/torture/rpc/testjoin.c
source4/torture/smb2/getinfo.c
source4/utils/ntlm_auth.c
source4/winbind/wb_server.c

index 986fe0e4f5745074e5d889a52ef0c9735adccb92..2dd0be5a0485fdfa5a78676388486b289d4acdd8 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "includes.h"
 #include "auth/auth.h"
+#include "param/param.h"
 
 /**
  * Return a anonymous logon for anonymous users (username = "")
@@ -52,7 +53,7 @@ static NTSTATUS anonymous_check_password(struct auth_method_context *ctx,
                                         const struct auth_usersupplied_info *user_info, 
                                         struct auth_serversupplied_info **_server_info)
 {
-       return auth_anonymous_server_info(mem_ctx, _server_info);
+       return auth_anonymous_server_info(mem_ctx, lp_netbios_name(ctx->auth_ctx->lp_ctx), _server_info);
 }
 
 static struct auth_operations anonymous_auth_ops = {
index a5e8c60ae34bcfd997648f6c63885ed4a06b4c1f..462fb26ba2355b90d5402c3c573699af9ee89385 100644 (file)
@@ -183,7 +183,7 @@ static NTSTATUS schannel_session_info(struct gensec_security *gensec_security,
                                         struct auth_session_info **_session_info) 
 {
        struct schannel_state *state = talloc_get_type(gensec_security->private_data, struct schannel_state);
-       return auth_anonymous_session_info(state, _session_info);
+       return auth_anonymous_session_info(state, global_loadparm, _session_info);
 }
 
 static NTSTATUS schannel_start(struct gensec_security *gensec_security)
index ce02821e8322850dbac3328e2ea34354ffb0bd03..47d091065025a5ffc39210fe55e0cd7182b0c766 100644 (file)
@@ -253,10 +253,11 @@ _PUBLIC_ NTSTATUS authsam_account_ok(TALLOC_CTX *mem_ctx,
 }
 
 _PUBLIC_ NTSTATUS authsam_make_server_info(TALLOC_CTX *mem_ctx, struct ldb_context *sam_ctx,
-                                 struct ldb_message *msg,
-                                 struct ldb_message *msg_domain_ref,
-                                 DATA_BLOB user_sess_key, DATA_BLOB lm_sess_key,
-                                 struct auth_serversupplied_info **_server_info)
+                                          const char *netbios_name,
+                                          struct ldb_message *msg,
+                                          struct ldb_message *msg_domain_ref,
+                                          DATA_BLOB user_sess_key, DATA_BLOB lm_sess_key,
+                                          struct auth_serversupplied_info **_server_info)
 {
        struct auth_serversupplied_info *server_info;
        struct ldb_message **group_msgs;
@@ -345,7 +346,7 @@ _PUBLIC_ NTSTATUS authsam_make_server_info(TALLOC_CTX *mem_ctx, struct ldb_conte
        server_info->home_drive = talloc_strdup(server_info, str);
        NT_STATUS_HAVE_NO_MEMORY(server_info->home_drive);
 
-       server_info->logon_server = talloc_strdup(server_info, lp_netbios_name(global_loadparm));
+       server_info->logon_server = talloc_strdup(server_info, netbios_name);
        NT_STATUS_HAVE_NO_MEMORY(server_info->logon_server);
 
        server_info->last_logon = samdb_result_nttime(msg, "lastLogon", 0);
@@ -423,7 +424,9 @@ _PUBLIC_ NTSTATUS sam_get_results_principal(struct ldb_context *sam_ctx,
 }
                                   
 /* Used in the gensec_gssapi and gensec_krb5 server-side code, where the PAC isn't available */
-NTSTATUS sam_get_server_info_principal(TALLOC_CTX *mem_ctx, const char *principal,
+NTSTATUS sam_get_server_info_principal(TALLOC_CTX *mem_ctx, 
+                                      struct loadparm_context *lp_ctx,
+                                      const char *principal,
                                       struct auth_serversupplied_info **server_info)
 {
        NTSTATUS nt_status;
@@ -439,7 +442,7 @@ NTSTATUS sam_get_server_info_principal(TALLOC_CTX *mem_ctx, const char *principa
                return NT_STATUS_NO_MEMORY;
        }
 
-       sam_ctx = samdb_connect(tmp_ctx, global_loadparm, system_session(tmp_ctx));
+       sam_ctx = samdb_connect(tmp_ctx, lp_ctx, system_session(tmp_ctx));
        if (sam_ctx == NULL) {
                talloc_free(tmp_ctx);
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
@@ -451,7 +454,8 @@ NTSTATUS sam_get_server_info_principal(TALLOC_CTX *mem_ctx, const char *principa
                return nt_status;
        }
 
-       nt_status = authsam_make_server_info(tmp_ctx, sam_ctx, msgs[0], msgs_domain_ref[0],
+       nt_status = authsam_make_server_info(tmp_ctx, sam_ctx, lp_netbios_name(lp_ctx),
+                                            msgs[0], msgs_domain_ref[0],
                                             user_sess_key, lm_sess_key,
                                             server_info);
        if (NT_STATUS_IS_OK(nt_status)) {
index 259f52ac5cd9c559e7afa19b1d3078cf7b968af0..0557187199a27a9ab398e686545cdec4d5499ea7 100644 (file)
@@ -33,7 +33,7 @@ struct auth_session_info *anonymous_session(TALLOC_CTX *mem_ctx)
 {
        NTSTATUS nt_status;
        struct auth_session_info *session_info = NULL;
-       nt_status = auth_anonymous_session_info(mem_ctx, &session_info);
+       nt_status = auth_anonymous_session_info(mem_ctx, global_loadparm, &session_info);
        if (!NT_STATUS_IS_OK(nt_status)) {
                return NULL;
        }
@@ -41,6 +41,7 @@ struct auth_session_info *anonymous_session(TALLOC_CTX *mem_ctx)
 }
 
 NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx, 
+                                    struct loadparm_context *lp_ctx,
                                     struct auth_session_info **_session_info) 
 {
        NTSTATUS nt_status;
@@ -49,6 +50,7 @@ NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx,
        TALLOC_CTX *mem_ctx = talloc_new(parent_ctx);
        
        nt_status = auth_anonymous_server_info(mem_ctx,
+                                              lp_netbios_name(lp_ctx),
                                               &server_info);
        if (!NT_STATUS_IS_OK(nt_status)) {
                talloc_free(mem_ctx);
@@ -66,7 +68,7 @@ NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx,
                return NT_STATUS_NO_MEMORY;
        }
 
-       cli_credentials_set_conf(session_info->credentials, global_loadparm);
+       cli_credentials_set_conf(session_info->credentials, lp_ctx);
        cli_credentials_set_anonymous(session_info->credentials);
        
        *_session_info = session_info;
@@ -74,7 +76,9 @@ NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx,
        return NT_STATUS_OK;
 }
 
-NTSTATUS auth_anonymous_server_info(TALLOC_CTX *mem_ctx, struct auth_serversupplied_info **_server_info) 
+NTSTATUS auth_anonymous_server_info(TALLOC_CTX *mem_ctx, 
+                                   const char *netbios_name,
+                                   struct auth_serversupplied_info **_server_info) 
 {
        struct auth_serversupplied_info *server_info;
        server_info = talloc(mem_ctx, struct auth_serversupplied_info);
@@ -122,7 +126,7 @@ NTSTATUS auth_anonymous_server_info(TALLOC_CTX *mem_ctx, struct auth_serversuppl
        server_info->home_drive = talloc_strdup(server_info, "");
        NT_STATUS_HAVE_NO_MEMORY(server_info->home_drive);
 
-       server_info->logon_server = talloc_strdup(server_info, lp_netbios_name(global_loadparm));
+       server_info->logon_server = talloc_strdup(server_info, netbios_name);
        NT_STATUS_HAVE_NO_MEMORY(server_info->logon_server);
 
        server_info->last_logon = 0;
index a15b81707cee54dcafea862ee3be6a7b3d2e1d40..fc22b34b2d1c366f687f2d48843f074327bf0c6b 100644 (file)
@@ -404,7 +404,7 @@ static void ldapsrv_accept(struct stream_connection *c)
        conn->server_credentials = server_credentials;
 
        /* Connections start out anonymous */
-       if (!NT_STATUS_IS_OK(auth_anonymous_session_info(conn, &conn->session_info))) {
+       if (!NT_STATUS_IS_OK(auth_anonymous_session_info(conn, global_loadparm, &conn->session_info))) {
                ldapsrv_terminate_connection(conn, "failed to setup anonymous session info");
                return;
        }
index eeced9ddbe85fd0af22c45f968e0a4f6f06f8f87..5a6df3174a0c949b464cde8fb1e0b811bf8e142e 100644 (file)
@@ -61,7 +61,7 @@ void secrets_shutdown(void)
 /**
  * open up the secrets database
  */
-bool secrets_init(void)
+bool secrets_init(struct loadparm_context *lp_ctx)
 {
        char *fname;
        uint8_t dummy;
@@ -69,8 +69,7 @@ bool secrets_init(void)
        if (tdb != NULL)
                return true;
 
-       fname = private_path(NULL, global_loadparm,
-                                                "secrets.tdb");
+       fname = private_path(NULL, lp_ctx, "secrets.tdb");
 
        tdb = tdb_wrap_open(talloc_autofree_context(), fname, 0, TDB_DEFAULT, 
                                                O_RDWR|O_CREAT, 0600);
@@ -141,6 +140,7 @@ struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_cont
  * @return pointer to a SID object if the SID could be obtained, NULL otherwise
  */
 struct dom_sid *secrets_get_domain_sid(TALLOC_CTX *mem_ctx,
+                                      struct loadparm_context *lp_ctx,
                                       const char *domain)
 {
        struct ldb_context *ldb;
@@ -149,7 +149,7 @@ struct dom_sid *secrets_get_domain_sid(TALLOC_CTX *mem_ctx,
        const char *attrs[] = { "objectSid", NULL };
        struct dom_sid *result = NULL;
 
-       ldb = secrets_db_connect(mem_ctx, global_loadparm);
+       ldb = secrets_db_connect(mem_ctx, lp_ctx);
        if (ldb == NULL) {
                DEBUG(5, ("secrets_db_connect failed\n"));
                return NULL;
index 9d98db0d084c3ca721a45bf69dc8e98724ce1a1a..4a9eb25e7e034939a12795c55d387d09609de3bf 100644 (file)
@@ -42,11 +42,11 @@ struct machine_acct_pass {
  * 
  * @note Not called by systems with a working /dev/urandom.
  */
-void secrets_shutdown(void);
-bool secrets_init(void);
 struct loadparm_context;
+void secrets_shutdown(void);
+bool secrets_init(struct loadparm_context *lp_ctx);
 struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx);
-struct dom_sid *secrets_get_domain_sid(TALLOC_CTX *mem_ctx, const char *domain);
+struct dom_sid *secrets_get_domain_sid(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *domain);
 
 
 #endif /* _SECRETS_H */
index 6c0269d5fc28e50fa40cbc2e748e6ac250803582..5bf587929050e90b391003f3c115dcce43dd685a 100644 (file)
@@ -134,7 +134,7 @@ NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx,
 
        ops = share_backend_by_name(backend_name);
        if (!ops) {
-               DEBUG(0, ("share_init_connection: share backend [%s] not found!\n", lp_share_backend(global_loadparm)));
+               DEBUG(0, ("share_init_connection: share backend [%s] not found!\n", backend_name));
                return NT_STATUS_INTERNAL_ERROR;
        }
 
index cf140f0d32b26aae7cd8d3bb73a63c237b141c1e..2dc40e3e251af1814158a92cfae7c2915909bfa0 100644 (file)
@@ -32,7 +32,7 @@ static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops,
        }
 
        (*ctx)->ops = ops;
-       (*ctx)->priv_data = NULL;
+       (*ctx)->priv_data = global_loadparm;
 
        return NT_STATUS_OK;
 }
@@ -268,7 +268,7 @@ static NTSTATUS sclassic_list_all(TALLOC_CTX *mem_ctx,
        int num_services;
        const char **n;
        
-       num_services = lp_numservices(global_loadparm);
+       num_services = lp_numservices((struct loadparm_context *)ctx->priv_data);
 
        n = talloc_array(mem_ctx, const char *, num_services);
        if (!n) {
@@ -277,7 +277,7 @@ static NTSTATUS sclassic_list_all(TALLOC_CTX *mem_ctx,
        }
 
        for (i = 0; i < num_services; i++) {
-               n[i] = talloc_strdup(n, lp_servicename(lp_servicebynum(global_loadparm, i)));
+               n[i] = talloc_strdup(n, lp_servicename(lp_servicebynum((struct loadparm_context *)ctx->priv_data, i)));
                if (!n[i]) {
                        DEBUG(0,("ERROR: Out of memory!\n"));
                        talloc_free(n);
@@ -299,7 +299,7 @@ static NTSTATUS sclassic_get_config(TALLOC_CTX *mem_ctx,
        struct share_config *s;
        struct loadparm_service *service;
 
-       service = lp_service(global_loadparm, name);
+       service = lp_service((struct loadparm_context *)ctx->priv_data, name);
 
        if (service == NULL) {
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
index b9cf4887fb4479caadccc05f489cb6c9e1f4eeb8..f06a7dce8ff7bb1f3ee9a4c7a14a036e67e4959d 100644 (file)
@@ -107,7 +107,7 @@ static void dcesrv_sock_accept(struct stream_connection *srv_conn)
        struct dcesrv_connection *dcesrv_conn = NULL;
        struct auth_session_info *session_info = NULL;
 
-       status = auth_anonymous_session_info(srv_conn, &session_info);
+       status = auth_anonymous_session_info(srv_conn, global_loadparm, &session_info);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("dcesrv_sock_accept: auth_anonymous_session_info failed: %s\n", 
                        nt_errstr(status)));
@@ -414,13 +414,13 @@ static void dcesrv_task_init(struct task_server *task)
        task_server_set_title(task, "task[dcesrv]");
 
        status = dcesrv_init_context(task->event_ctx,
-                                    lp_dcerpc_endpoint_servers(global_loadparm),
+                                    lp_dcerpc_endpoint_servers(task->lp_ctx),
                                     &dce_ctx);
        if (!NT_STATUS_IS_OK(status)) goto failed;
 
        /* Make sure the directory for NCALRPC exists */
-       if (!directory_exist(lp_ncalrpc_dir(global_loadparm))) {
-               mkdir(lp_ncalrpc_dir(global_loadparm), 0755);
+       if (!directory_exist(lp_ncalrpc_dir(task->lp_ctx))) {
+               mkdir(lp_ncalrpc_dir(task->lp_ctx), 0755);
        }
 
        for (e=dce_ctx->endpoint_list;e;e=e->next) {
index 57a6e8ea1114dab40ed6f270738a32e86b399c28..8ba93b9a594f60b5d584eb6724dbfa4d02f0b62c 100644 (file)
@@ -204,7 +204,7 @@ static void smbsrv_preopen_ldb(struct task_server *task)
        /* yes, this looks strange. It is a hack to preload the
           schema. I'd like to share most of the ldb context with the
           child too. That will come later */
-       talloc_free(samdb_connect(task, global_loadparm, NULL));
+       talloc_free(samdb_connect(task, task->lp_ctx, NULL));
 }
 
 /*
index 87bab39bd1dabb8ac550855f1b7b4a1813858a4d..faddd23937cfd65ffaa643aff93cb99cde8c64ec 100644 (file)
@@ -278,7 +278,7 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[
        /* Do *not* remove this, until you have removed
         * passdb/secrets.c, and proved that Samba still builds... */
        /* Setup the SECRETS subsystem */
-       if (!secrets_init()) {
+       if (!secrets_init(global_loadparm)) {
                exit(1);
        }
 
index cf07c9c611979be667b4d2e7cb68fbb45769679e..22decc474de175b1b65bf68cc08500ce7de61d94 100644 (file)
@@ -726,7 +726,7 @@ bool torture_net_become_dc(struct torture_context *torture)
        s = talloc_zero(torture, struct test_become_dc_state);
        if (!s) return false;
 
-       s->netbios_name = lp_parm_string(global_loadparm, NULL, "become dc", "smbtorture dc");
+       s->netbios_name = lp_parm_string(torture->lp_ctx, NULL, "become dc", "smbtorture dc");
        if (!s->netbios_name || !s->netbios_name[0]) {
                s->netbios_name = "smbtorturedc";
        }
@@ -745,7 +745,7 @@ bool torture_net_become_dc(struct torture_context *torture)
        if (!s->path.secrets_keytab) return false;
 
        /* Join domain as a member server. */
-       s->tj = torture_join_domain(s->netbios_name,
+       s->tj = torture_join_domain(torture, s->netbios_name,
                                 ACB_WSTRUST,
                                 &s->machine_account);
        if (!s->tj) {
index 81016fc563f5abf154bf37590fb646512f3a3daa..113634f26436fe3c2b7c8741783398d0711c19a7 100644 (file)
@@ -191,7 +191,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
        io->in.service_type = state->service_type;
        io->in.credentials  = cmdline_credentials;
        io->in.fallback_to_anonymous = false;
-       io->in.workgroup    = lp_workgroup(global_loadparm);
+       io->in.workgroup    = lp_workgroup(state->tctx->lp_ctx);
 
        /* kill off the remnants of the old connection */
        talloc_free(state->tree);
index 3eec9fbb134af257bc7a75576f55b8cb026e25db..8f9803fa4dbf03b0b0b773c99c51382cc2844ee3 100644 (file)
@@ -129,7 +129,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
        io->in.service_type = state->service_type;
        io->in.credentials  = cmdline_credentials;
        io->in.fallback_to_anonymous = false;
-       io->in.workgroup    = lp_workgroup(global_loadparm);
+       io->in.workgroup    = lp_workgroup(state->tctx->lp_ctx);
 
        /* kill off the remnants of the old connection */
        talloc_free(state->tree);
index ee752c656888c5b0554db853f3a9b37c57ec7876..7fc2406bbf7b1fa6aa0be963928685eb9b3f9954 100644 (file)
@@ -544,7 +544,7 @@ static bool test_DsGetNCChanges(struct dcerpc_pipe *p, struct torture_context *t
                        r.in.req.req5.highwatermark.highest_usn         = 0;
                        r.in.req.req5.uptodateness_vector               = NULL;
                        r.in.req.req5.replica_flags                     = 0;
-                       if (lp_parm_bool(global_loadparm, NULL, "drsuapi","compression", false)) {
+                       if (lp_parm_bool(tctx->lp_ctx, NULL, "drsuapi","compression", false)) {
                                r.in.req.req5.replica_flags             |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
                        }
                        r.in.req.req5.max_object_count                  = 0;
@@ -566,10 +566,10 @@ static bool test_DsGetNCChanges(struct dcerpc_pipe *p, struct torture_context *t
                        r.in.req.req8.highwatermark.highest_usn         = 0;
                        r.in.req.req8.uptodateness_vector               = NULL;
                        r.in.req.req8.replica_flags                     = 0;
-                       if (lp_parm_bool(global_loadparm, NULL, "drsuapi", "compression", false)) {
+                       if (lp_parm_bool(tctx->lp_ctx, NULL, "drsuapi", "compression", false)) {
                                r.in.req.req8.replica_flags             |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
                        }
-                       if (lp_parm_bool(global_loadparm, NULL, "drsuapi", "neighbour_writeable", true)) {
+                       if (lp_parm_bool(tctx->lp_ctx, NULL, "drsuapi", "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
@@ -699,7 +699,7 @@ bool torture_rpc_drsuapi(struct torture_context *torture)
 
        ZERO_STRUCT(priv);
 
-       priv.join = torture_join_domain(TEST_MACHINE_NAME, ACB_SVRTRUST, 
+       priv.join = torture_join_domain(torture, TEST_MACHINE_NAME, ACB_SVRTRUST, 
                                       &machine_credentials);
        if (!priv.join) {
                torture_fail(torture, "Failed to join as BDC");
@@ -751,7 +751,7 @@ bool torture_rpc_drsuapi_cracknames(struct torture_context *torture)
 
        ZERO_STRUCT(priv);
 
-       priv.join = torture_join_domain(TEST_MACHINE_NAME, ACB_SVRTRUST, 
+       priv.join = torture_join_domain(torture, TEST_MACHINE_NAME, ACB_SVRTRUST, 
                                       &machine_credentials);
        if (!priv.join) {
                torture_fail(torture, "Failed to join as BDC\n");
index 1250743955e75ea70c27e6d474b8337c87bd5741..f40f034ec32631089282667555507a21ee237f45 100644 (file)
@@ -1305,14 +1305,14 @@ static bool test_EnumAccountRights(struct dcerpc_pipe *p,
 
 
 static bool test_QuerySecurity(struct dcerpc_pipe *p, 
-                            TALLOC_CTX *mem_ctx, 
+                            struct torture_context *tctx, 
                             struct policy_handle *handle,
                             struct policy_handle *acct_handle)
 {
        NTSTATUS status;
        struct lsa_QuerySecurity r;
 
-       if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+       if (torture_setting_bool(tctx, "samba4", false)) {
                printf("skipping QuerySecurity test against Samba4\n");
                return true;
        }
@@ -1322,7 +1322,7 @@ static bool test_QuerySecurity(struct dcerpc_pipe *p,
        r.in.handle = acct_handle;
        r.in.sec_info = 7;
 
-       status = dcerpc_lsa_QuerySecurity(p, mem_ctx, &r);
+       status = dcerpc_lsa_QuerySecurity(p, tctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                printf("QuerySecurity failed - %s\n", nt_errstr(status));
                return false;
@@ -1539,7 +1539,7 @@ static bool test_EnumPrivs(struct dcerpc_pipe *p,
 }
 
 static bool test_QueryForestTrustInformation(struct dcerpc_pipe *p, 
-                                            TALLOC_CTX *mem_ctx, 
+                                            struct torture_context *tctx, 
                                             struct policy_handle *handle,
                                             const char *trusted_domain_name)
 {
@@ -1551,7 +1551,7 @@ static bool test_QueryForestTrustInformation(struct dcerpc_pipe *p,
 
        printf("\nTesting lsaRQueryForestTrustInformation\n");
 
-       if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+       if (torture_setting_bool(tctx, "samba4", false)) {
                printf("skipping QueryForestTrustInformation against Samba4\n");
                return true;
        }
@@ -1569,7 +1569,7 @@ static bool test_QueryForestTrustInformation(struct dcerpc_pipe *p,
        r.in.unknown = 0;
        r.out.forest_trust_info = &info_ptr;
 
-       status = dcerpc_lsa_lsaRQueryForestTrustInformation(p, mem_ctx, &r);
+       status = dcerpc_lsa_lsaRQueryForestTrustInformation(p, tctx, &r);
 
        if (!NT_STATUS_IS_OK(status)) {
                printf("lsaRQueryForestTrustInformation failed - %s\n", nt_errstr(status));
@@ -1911,14 +1911,14 @@ static bool test_CreateTrustedDomain(struct dcerpc_pipe *p,
 }
 
 static bool test_QueryDomainInfoPolicy(struct dcerpc_pipe *p, 
-                                TALLOC_CTX *mem_ctx, 
+                                struct torture_context *tctx, 
                                 struct policy_handle *handle)
 {
        struct lsa_QueryDomainInformationPolicy r;
        NTSTATUS status;
        int i;
        bool ret = true;
-       if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+       if (torture_setting_bool(tctx, "samba4", false)) {
                printf("skipping QueryDomainInformationPolicy test against Samba4\n");
                return true;
        }
@@ -1931,7 +1931,7 @@ static bool test_QueryDomainInfoPolicy(struct dcerpc_pipe *p,
 
                printf("\ntrying QueryDomainInformationPolicy level %d\n", i);
 
-               status = dcerpc_lsa_QueryDomainInformationPolicy(p, mem_ctx, &r);
+               status = dcerpc_lsa_QueryDomainInformationPolicy(p, tctx, &r);
 
                if (!NT_STATUS_IS_OK(status)) {
                        printf("QueryDomainInformationPolicy failed - %s\n", nt_errstr(status));
@@ -1945,7 +1945,7 @@ static bool test_QueryDomainInfoPolicy(struct dcerpc_pipe *p,
 
 
 static bool test_QueryInfoPolicy(struct dcerpc_pipe *p, 
-                                TALLOC_CTX *mem_ctx, 
+                                struct torture_context *tctx, 
                                 struct policy_handle *handle)
 {
        struct lsa_QueryInfoPolicy r;
@@ -1954,7 +1954,7 @@ static bool test_QueryInfoPolicy(struct dcerpc_pipe *p,
        bool ret = true;
        printf("\nTesting QueryInfoPolicy\n");
 
-       if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+       if (torture_setting_bool(tctx, "samba4", false)) {
                printf("skipping QueryInfoPolicy against Samba4\n");
                return true;
        }
@@ -1965,7 +1965,7 @@ static bool test_QueryInfoPolicy(struct dcerpc_pipe *p,
 
                printf("\ntrying QueryInfoPolicy level %d\n", i);
 
-               status = dcerpc_lsa_QueryInfoPolicy(p, mem_ctx, &r);
+               status = dcerpc_lsa_QueryInfoPolicy(p, tctx, &r);
 
                switch (i) {
                case LSA_POLICY_INFO_DB:
@@ -1985,7 +1985,7 @@ static bool test_QueryInfoPolicy(struct dcerpc_pipe *p,
                        }
                        break;
                default:
-                       if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+                       if (torture_setting_bool(tctx, "samba4", false)) {
                                /* Other levels not implemented yet */
                                if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS)) {
                                        printf("QueryInfoPolicy failed - %s\n", nt_errstr(status));
@@ -2003,18 +2003,18 @@ static bool test_QueryInfoPolicy(struct dcerpc_pipe *p,
 
                        struct lsa_TransNameArray tnames;
                        tnames.count = 10;
-                       tnames.names = talloc_array(mem_ctx, struct lsa_TranslatedName, tnames.count);
+                       tnames.names = talloc_array(tctx, struct lsa_TranslatedName, tnames.count);
                        tnames.names[0].name.string = r.out.info->dns.name.string;
                        tnames.names[1].name.string = r.out.info->dns.dns_domain.string;
-                       tnames.names[2].name.string = talloc_asprintf(mem_ctx, "%s\\", r.out.info->dns.name.string);
-                       tnames.names[3].name.string = talloc_asprintf(mem_ctx, "%s\\", r.out.info->dns.dns_domain.string);
-                       tnames.names[4].name.string = talloc_asprintf(mem_ctx, "%s\\guest", r.out.info->dns.name.string);
-                       tnames.names[5].name.string = talloc_asprintf(mem_ctx, "%s\\krbtgt", r.out.info->dns.name.string);
-                       tnames.names[6].name.string = talloc_asprintf(mem_ctx, "%s\\guest", r.out.info->dns.dns_domain.string);
-                       tnames.names[7].name.string = talloc_asprintf(mem_ctx, "%s\\krbtgt", r.out.info->dns.dns_domain.string);
-                       tnames.names[8].name.string = talloc_asprintf(mem_ctx, "krbtgt@%s", r.out.info->dns.name.string);
-                       tnames.names[9].name.string = talloc_asprintf(mem_ctx, "krbtgt@%s", r.out.info->dns.dns_domain.string);
-                       ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
+                       tnames.names[2].name.string = talloc_asprintf(tctx, "%s\\", r.out.info->dns.name.string);
+                       tnames.names[3].name.string = talloc_asprintf(tctx, "%s\\", r.out.info->dns.dns_domain.string);
+                       tnames.names[4].name.string = talloc_asprintf(tctx, "%s\\guest", r.out.info->dns.name.string);
+                       tnames.names[5].name.string = talloc_asprintf(tctx, "%s\\krbtgt", r.out.info->dns.name.string);
+                       tnames.names[6].name.string = talloc_asprintf(tctx, "%s\\guest", r.out.info->dns.dns_domain.string);
+                       tnames.names[7].name.string = talloc_asprintf(tctx, "%s\\krbtgt", r.out.info->dns.dns_domain.string);
+                       tnames.names[8].name.string = talloc_asprintf(tctx, "krbtgt@%s", r.out.info->dns.name.string);
+                       tnames.names[9].name.string = talloc_asprintf(tctx, "krbtgt@%s", r.out.info->dns.dns_domain.string);
+                       ret &= test_LookupNames(p, tctx, handle, &tnames);
                }
        }
 
@@ -2022,7 +2022,7 @@ static bool test_QueryInfoPolicy(struct dcerpc_pipe *p,
 }
 
 static bool test_QueryInfoPolicy2(struct dcerpc_pipe *p, 
-                                 TALLOC_CTX *mem_ctx, 
+                                 struct torture_context *tctx, 
                                  struct policy_handle *handle)
 {
        struct lsa_QueryInfoPolicy2 r;
@@ -2036,7 +2036,7 @@ static bool test_QueryInfoPolicy2(struct dcerpc_pipe *p,
 
                printf("\ntrying QueryInfoPolicy2 level %d\n", i);
 
-               status = dcerpc_lsa_QueryInfoPolicy2(p, mem_ctx, &r);
+               status = dcerpc_lsa_QueryInfoPolicy2(p, tctx, &r);
                
                switch (i) {
                case LSA_POLICY_INFO_DB:
@@ -2056,7 +2056,7 @@ static bool test_QueryInfoPolicy2(struct dcerpc_pipe *p,
                        }
                        break;
                default:
-                       if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+                       if (torture_setting_bool(tctx, "samba4", false)) {
                                /* Other levels not implemented yet */
                                if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS)) {
                                        printf("QueryInfoPolicy2 failed - %s\n", nt_errstr(status));
@@ -2128,99 +2128,93 @@ bool test_lsa_Close(struct dcerpc_pipe *p,
        return true;
 }
 
-bool torture_rpc_lsa(struct torture_context *torture)
+bool torture_rpc_lsa(struct torture_context *tctx)
 {
         NTSTATUS status;
         struct dcerpc_pipe *p;
-       TALLOC_CTX *mem_ctx;
        bool ret = true;
        struct policy_handle *handle;
 
-       mem_ctx = talloc_init("torture_rpc_lsa");
-
-       status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc);
+       status = torture_rpc_connection(tctx, &p, &ndr_table_lsarpc);
        if (!NT_STATUS_IS_OK(status)) {
-               talloc_free(mem_ctx);
                return false;
        }
 
-       if (!test_OpenPolicy(p, mem_ctx)) {
+       if (!test_OpenPolicy(p, tctx)) {
                ret = false;
        }
 
-       if (!test_lsa_OpenPolicy2(p, mem_ctx, &handle)) {
+       if (!test_lsa_OpenPolicy2(p, tctx, &handle)) {
                ret = false;
        }
 
        if (handle) {
-               if (!test_LookupNames_wellknown(p, mem_ctx, handle)) {
+               if (!test_LookupNames_wellknown(p, tctx, handle)) {
                        ret = false;
                }               
 
-               if (!test_LookupNames_bogus(p, mem_ctx, handle)) {
+               if (!test_LookupNames_bogus(p, tctx, handle)) {
                        ret = false;
                }               
 
-               if (!test_LookupSids_async(p, mem_ctx, handle)) {
+               if (!test_LookupSids_async(p, tctx, handle)) {
                        ret = false;
                }
 
-               if (!test_QueryDomainInfoPolicy(p, mem_ctx, handle)) {
+               if (!test_QueryDomainInfoPolicy(p, tctx, handle)) {
                        ret = false;
                }
                
-               if (!test_CreateAccount(p, mem_ctx, handle)) {
+               if (!test_CreateAccount(p, tctx, handle)) {
                        ret = false;
                }
                
-               if (!test_CreateSecret(p, mem_ctx, handle)) {
+               if (!test_CreateSecret(p, tctx, handle)) {
                        ret = false;
                }
                
-               if (!test_CreateTrustedDomain(p, mem_ctx, handle)) {
+               if (!test_CreateTrustedDomain(p, tctx, handle)) {
                        ret = false;
                }
                
-               if (!test_EnumAccounts(p, mem_ctx, handle)) {
+               if (!test_EnumAccounts(p, tctx, handle)) {
                        ret = false;
                }
                
-               if (!test_EnumPrivs(p, mem_ctx, handle)) {
+               if (!test_EnumPrivs(p, tctx, handle)) {
                        ret = false;
                }
                
-               if (!test_QueryInfoPolicy(p, mem_ctx, handle)) {
+               if (!test_QueryInfoPolicy(p, tctx, handle)) {
                        ret = false;
                }
                
-               if (!test_QueryInfoPolicy2(p, mem_ctx, handle)) {
+               if (!test_QueryInfoPolicy2(p, tctx, handle)) {
                        ret = false;
                }
                
 #if 0
-               if (!test_Delete(p, mem_ctx, handle)) {
+               if (!test_Delete(p, tctx, handle)) {
                        ret = false;
                }
 #endif
                
-               if (!test_many_LookupSids(p, mem_ctx, handle)) {
+               if (!test_many_LookupSids(p, tctx, handle)) {
                        ret = false;
                }
                
-               if (!test_lsa_Close(p, mem_ctx, handle)) {
+               if (!test_lsa_Close(p, tctx, handle)) {
                        ret = false;
                }
        } else {
-               if (!test_many_LookupSids(p, mem_ctx, handle)) {
+               if (!test_many_LookupSids(p, tctx, handle)) {
                        ret = false;
                }
        }
 
-       if (!test_GetUserName(p, mem_ctx)) {
+       if (!test_GetUserName(p, tctx)) {
                ret = false;
        }
-               
-       talloc_free(mem_ctx);
 
        return ret;
 }
index ec70c91570e304615e6b14ccd312edefc594d275..6a8ff58fb0b87e6c51bf10775d24969bf2ca3ed1 100644 (file)
@@ -78,13 +78,13 @@ bool test_samr_handle_Close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        return true;
 }
 
-static bool test_Shutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
+static bool test_Shutdown(struct dcerpc_pipe *p, struct torture_context *tctx,
                       struct policy_handle *handle)
 {
        NTSTATUS status;
        struct samr_Shutdown r;
 
-       if (!lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", false)) {
+       if (!torture_setting_bool(tctx, "dangerous", false)) {
                printf("samr_Shutdown disabled - enable dangerous tests to use\n");
                return true;
        }
@@ -93,7 +93,7 @@ static bool test_Shutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
 
        printf("testing samr_Shutdown\n");
 
-       status = dcerpc_samr_Shutdown(p, mem_ctx, &r);
+       status = dcerpc_samr_Shutdown(p, tctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                printf("samr_Shutdown failed - %s\n", nt_errstr(status));
                return false;
@@ -102,7 +102,7 @@ static bool test_Shutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        return true;
 }
 
-static bool test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
+static bool test_SetDsrmPassword(struct dcerpc_pipe *p, struct torture_context *tctx,
                                 struct policy_handle *handle)
 {
        NTSTATUS status;
@@ -110,7 +110,7 @@ static bool test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        struct lsa_String string;
        struct samr_Password hash;
 
-       if (!lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", false)) {
+       if (!torture_setting_bool(tctx, "dangerous", false)) {
                printf("samr_SetDsrmPassword disabled - enable dangerous tests to use\n");
                return true;
        }
@@ -125,7 +125,7 @@ static bool test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
 
        printf("testing samr_SetDsrmPassword\n");
 
-       status = dcerpc_samr_SetDsrmPassword(p, mem_ctx, &r);
+       status = dcerpc_samr_SetDsrmPassword(p, tctx, &r);
        if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
                printf("samr_SetDsrmPassword failed - %s\n", nt_errstr(status));
                return false;
@@ -135,7 +135,7 @@ static bool test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
 }
 
 
-static bool test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
+static bool test_QuerySecurity(struct dcerpc_pipe *p, struct torture_context *tctx, 
                               struct policy_handle *handle)
 {
        NTSTATUS status;
@@ -145,7 +145,7 @@ static bool test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        r.in.handle = handle;
        r.in.sec_info = 7;
 
-       status = dcerpc_samr_QuerySecurity(p, mem_ctx, &r);
+       status = dcerpc_samr_QuerySecurity(p, tctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                printf("QuerySecurity failed - %s\n", nt_errstr(status));
                return false;
@@ -159,18 +159,18 @@ static bool test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        s.in.sec_info = 7;
        s.in.sdbuf = r.out.sdbuf;
 
-       if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+       if (torture_setting_bool(tctx, "samba4", false)) {
                printf("skipping SetSecurity test against Samba4\n");
                return true;
        }
 
-       status = dcerpc_samr_SetSecurity(p, mem_ctx, &s);
+       status = dcerpc_samr_SetSecurity(p, tctx, &s);
        if (!NT_STATUS_IS_OK(status)) {
                printf("SetSecurity failed - %s\n", nt_errstr(status));
                return false;
        }
 
-       status = dcerpc_samr_QuerySecurity(p, mem_ctx, &r);
+       status = dcerpc_samr_QuerySecurity(p, tctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                printf("QuerySecurity failed - %s\n", nt_errstr(status));
                return false;
@@ -180,7 +180,7 @@ static bool test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
 }
 
 
-static bool test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
+static bool test_SetUserInfo(struct dcerpc_pipe *p, struct torture_context *tctx, 
                             struct policy_handle *handle, uint32_t base_acct_flags,
                             const char *base_account_name)
 {
@@ -210,7 +210,7 @@ static bool test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        q0 = q;
 
 #define TESTCALL(call, r) \
-               status = dcerpc_samr_ ##call(p, mem_ctx, &r); \
+               status = dcerpc_samr_ ##call(p, tctx, &r); \
                if (!NT_STATUS_IS_OK(status)) { \
                        printf(#call " level %u failed - %s (%s)\n", \
                               r.in.level, nt_errstr(status), __location__); \
@@ -299,17 +299,17 @@ static bool test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        TEST_USERINFO_STRING(21, comment, 21, comment, "xx21-21 comment", 
                           SAMR_FIELD_COMMENT);
 
-       test_account_name = talloc_asprintf(mem_ctx, "%sxx7-1", base_account_name);
+       test_account_name = talloc_asprintf(tctx, "%sxx7-1", base_account_name);
        TEST_USERINFO_STRING(7, account_name,  1, account_name, base_account_name, 0);
-       test_account_name = talloc_asprintf(mem_ctx, "%sxx7-3", base_account_name);
+       test_account_name = talloc_asprintf(tctx, "%sxx7-3", base_account_name);
        TEST_USERINFO_STRING(7, account_name,  3, account_name, base_account_name, 0);
-       test_account_name = talloc_asprintf(mem_ctx, "%sxx7-5", base_account_name);
+       test_account_name = talloc_asprintf(tctx, "%sxx7-5", base_account_name);
        TEST_USERINFO_STRING(7, account_name,  5, account_name, base_account_name, 0);
-       test_account_name = talloc_asprintf(mem_ctx, "%sxx7-6", base_account_name);
+       test_account_name = talloc_asprintf(tctx, "%sxx7-6", base_account_name);
        TEST_USERINFO_STRING(7, account_name,  6, account_name, base_account_name, 0);
-       test_account_name = talloc_asprintf(mem_ctx, "%sxx7-7", base_account_name);
+       test_account_name = talloc_asprintf(tctx, "%sxx7-7", base_account_name);
        TEST_USERINFO_STRING(7, account_name,  7, account_name, base_account_name, 0);
-       test_account_name = talloc_asprintf(mem_ctx, "%sxx7-21", base_account_name);
+       test_account_name = talloc_asprintf(tctx, "%sxx7-21", base_account_name);
        TEST_USERINFO_STRING(7, account_name, 21, account_name, base_account_name, 0);
        test_account_name = base_account_name;
        TEST_USERINFO_STRING(21, account_name, 21, account_name, base_account_name, 
@@ -415,7 +415,7 @@ static bool test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        TEST_USERINFO_INT(21, logon_hours.bits[3], 21, logon_hours.bits[3], 4, 
                          SAMR_FIELD_LOGON_HOURS);
 
-       if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+       if (torture_setting_bool(tctx, "samba4", false)) {
                printf("skipping Set Account Flag tests against Samba4\n");
                return ret;
        }
@@ -2099,34 +2099,34 @@ static bool test_user_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        return ret;
 }
 
-static bool test_alias_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+static bool test_alias_ops(struct dcerpc_pipe *p, struct torture_context *tctx,
                           struct policy_handle *alias_handle,
                           const struct dom_sid *domain_sid)
 {
        bool ret = true;
 
-       if (!test_QuerySecurity(p, mem_ctx, alias_handle)) {
+       if (!test_QuerySecurity(p, tctx, alias_handle)) {
                ret = false;
        }
 
-       if (!test_QueryAliasInfo(p, mem_ctx, alias_handle)) {
+       if (!test_QueryAliasInfo(p, tctx, alias_handle)) {
                ret = false;
        }
 
-       if (!test_SetAliasInfo(p, mem_ctx, alias_handle)) {
+       if (!test_SetAliasInfo(p, tctx, alias_handle)) {
                ret = false;
        }
 
-       if (!test_AddMemberToAlias(p, mem_ctx, alias_handle, domain_sid)) {
+       if (!test_AddMemberToAlias(p, tctx, alias_handle, domain_sid)) {
                ret = false;
        }
 
-       if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+       if (torture_setting_bool(tctx, "samba4", false)) {
                printf("skipping MultipleMembers Alias tests against Samba4\n");
                return ret;
        }
 
-       if (!test_AddMultipleMembersToAlias(p, mem_ctx, alias_handle)) {
+       if (!test_AddMultipleMembersToAlias(p, tctx, alias_handle)) {
                ret = false;
        }
 
@@ -2284,7 +2284,7 @@ static bool test_DeleteAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        return ret;
 }
 
-static bool test_CreateAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+static bool test_CreateAlias(struct dcerpc_pipe *p, struct torture_context *tctx,
                            struct policy_handle *domain_handle, 
                             struct policy_handle *alias_handle, 
                             const struct dom_sid *domain_sid)
@@ -2304,7 +2304,7 @@ static bool test_CreateAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
 
        printf("Testing CreateAlias (%s)\n", r.in.alias_name->string);
 
-       status = dcerpc_samr_CreateDomAlias(p, mem_ctx, &r);
+       status = dcerpc_samr_CreateDomAlias(p, tctx, &r);
 
        if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
                printf("Server refused create of '%s'\n", r.in.alias_name->string);
@@ -2312,10 +2312,10 @@ static bool test_CreateAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        }
 
        if (NT_STATUS_EQUAL(status, NT_STATUS_ALIAS_EXISTS)) {
-               if (!test_DeleteAlias_byname(p, mem_ctx, domain_handle, r.in.alias_name->string)) {
+               if (!test_DeleteAlias_byname(p, tctx, domain_handle, r.in.alias_name->string)) {
                        return false;
                }
-               status = dcerpc_samr_CreateDomAlias(p, mem_ctx, &r);
+               status = dcerpc_samr_CreateDomAlias(p, tctx, &r);
        }
 
        if (!NT_STATUS_IS_OK(status)) {
@@ -2323,7 +2323,7 @@ static bool test_CreateAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                return false;
        }
 
-       if (!test_alias_ops(p, mem_ctx, alias_handle, domain_sid)) {
+       if (!test_alias_ops(p, tctx, alias_handle, domain_sid)) {
                ret = false;
        }
 
@@ -3170,7 +3170,7 @@ static bool test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
 /*
   try blasting the server with a bunch of sync requests
 */
-static bool test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
+static bool test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *tctx, 
                                       struct policy_handle *handle)
 {
        NTSTATUS status;
@@ -3180,7 +3180,7 @@ static bool test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct
 #define ASYNC_COUNT 100
        struct rpc_request *req[ASYNC_COUNT];
 
-       if (!lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", false)) {
+       if (!torture_setting_bool(tctx, "dangerous", false)) {
                printf("samr async test disabled - enable dangerous tests to use\n");
                return true;
        }
@@ -3194,7 +3194,7 @@ static bool test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct
        r.out.resume_handle = &resume_handle;
 
        for (i=0;i<ASYNC_COUNT;i++) {
-               req[i] = dcerpc_samr_EnumDomainUsers_send(p, mem_ctx, &r);
+               req[i] = dcerpc_samr_EnumDomainUsers_send(p, tctx, &r);
        }
 
        for (i=0;i<ASYNC_COUNT;i++) {
@@ -4020,7 +4020,7 @@ static bool test_GetBootKeyInformation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct
        return ret;
 }
 
-static bool test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
+static bool test_AddGroupMember(struct dcerpc_pipe *p, struct torture_context *tctx, 
                                struct policy_handle *domain_handle,
                                struct policy_handle *group_handle)
 {
@@ -4032,7 +4032,7 @@ static bool test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        bool ret = true;
        uint32_t rid;
 
-       status = test_LookupName(p, mem_ctx, domain_handle, TEST_ACCOUNT_NAME, &rid);
+       status = test_LookupName(p, tctx, domain_handle, TEST_ACCOUNT_NAME, &rid);
        if (!NT_STATUS_IS_OK(status)) {
                printf("test_AddGroupMember looking up name " TEST_ACCOUNT_NAME " failed - %s\n", nt_errstr(status));
                return false;
@@ -4047,27 +4047,27 @@ static bool test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        d.in.group_handle = group_handle;
        d.in.rid = rid;
 
-       status = dcerpc_samr_DeleteGroupMember(p, mem_ctx, &d);
+       status = dcerpc_samr_DeleteGroupMember(p, tctx, &d);
        if (!NT_STATUS_EQUAL(NT_STATUS_MEMBER_NOT_IN_GROUP, status)) {
                printf("DeleteGroupMember gave %s - should be NT_STATUS_MEMBER_NOT_IN_GROUP\n", 
                       nt_errstr(status));
                return false;
        }
 
-       status = dcerpc_samr_AddGroupMember(p, mem_ctx, &r);
+       status = dcerpc_samr_AddGroupMember(p, tctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                printf("AddGroupMember failed - %s\n", nt_errstr(status));
                return false;
        }
 
-       status = dcerpc_samr_AddGroupMember(p, mem_ctx, &r);
+       status = dcerpc_samr_AddGroupMember(p, tctx, &r);
        if (!NT_STATUS_EQUAL(NT_STATUS_MEMBER_IN_GROUP, status)) {
                printf("AddGroupMember gave %s - should be NT_STATUS_MEMBER_IN_GROUP\n", 
                       nt_errstr(status));
                return false;
        }
 
-       if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+       if (torture_setting_bool(tctx, "samba4", false)) {
                printf("skipping SetMemberAttributesOfGroup test against Samba4\n");
        } else {
                /* this one is quite strange. I am using random inputs in the
@@ -4077,7 +4077,7 @@ static bool test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                s.in.unknown1 = random();
                s.in.unknown2 = random();
 
-               status = dcerpc_samr_SetMemberAttributesOfGroup(p, mem_ctx, &s);
+               status = dcerpc_samr_SetMemberAttributesOfGroup(p, tctx, &s);
                if (!NT_STATUS_IS_OK(status)) {
                        printf("SetMemberAttributesOfGroup failed - %s\n", nt_errstr(status));
                        return false;
@@ -4086,19 +4086,19 @@ static bool test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
 
        q.in.group_handle = group_handle;
 
-       status = dcerpc_samr_QueryGroupMember(p, mem_ctx, &q);
+       status = dcerpc_samr_QueryGroupMember(p, tctx, &q);
        if (!NT_STATUS_IS_OK(status)) {
                printf("QueryGroupMember failed - %s\n", nt_errstr(status));
                return false;
        }
 
-       status = dcerpc_samr_DeleteGroupMember(p, mem_ctx, &d);
+       status = dcerpc_samr_DeleteGroupMember(p, tctx, &d);
        if (!NT_STATUS_IS_OK(status)) {
                printf("DeleteGroupMember failed - %s\n", nt_errstr(status));
                return false;
        }
 
-       status = dcerpc_samr_AddGroupMember(p, mem_ctx, &r);
+       status = dcerpc_samr_AddGroupMember(p, tctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                printf("AddGroupMember failed - %s\n", nt_errstr(status));
                return false;
@@ -4198,7 +4198,7 @@ static bool test_RemoveMemberFromForeignDomain(struct dcerpc_pipe *p,
 static bool test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
                         struct policy_handle *handle);
 
-static bool test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
+static bool test_OpenDomain(struct dcerpc_pipe *p, struct torture_context *tctx, 
                            struct policy_handle *handle, struct dom_sid *sid,
                            enum torture_samr_choice which_ops)
 {
@@ -4222,7 +4222,7 @@ static bool test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        r.in.sid = sid;
        r.out.domain_handle = &domain_handle;
 
-       status = dcerpc_samr_OpenDomain(p, mem_ctx, &r);
+       status = dcerpc_samr_OpenDomain(p, tctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                printf("OpenDomain failed - %s\n", nt_errstr(status));
                return false;
@@ -4230,67 +4230,67 @@ static bool test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
 
        /* run the domain tests with the main handle closed - this tests
           the servers reference counting */
-       ret &= test_samr_handle_Close(p, mem_ctx, handle);
+       ret &= test_samr_handle_Close(p, tctx, handle);
 
        switch (which_ops) {
        case TORTURE_SAMR_USER_ATTRIBUTES:
        case TORTURE_SAMR_PASSWORDS:
-               ret &= test_CreateUser2(p, mem_ctx, &domain_handle, which_ops);
-               ret &= test_CreateUser(p, mem_ctx, &domain_handle, &user_handle, which_ops);
+               ret &= test_CreateUser2(p, tctx, &domain_handle, which_ops);
+               ret &= test_CreateUser(p, tctx, &domain_handle, &user_handle, which_ops);
                /* This test needs 'complex' users to validate */
-               ret &= test_QueryDisplayInfo(p, mem_ctx, &domain_handle);
+               ret &= test_QueryDisplayInfo(p, tctx, &domain_handle);
                break;
        case TORTURE_SAMR_OTHER:
-               ret &= test_CreateUser(p, mem_ctx, &domain_handle, &user_handle, which_ops);
-               ret &= test_QuerySecurity(p, mem_ctx, &domain_handle);
-               ret &= test_RemoveMemberFromForeignDomain(p, mem_ctx, &domain_handle);
-               ret &= test_CreateAlias(p, mem_ctx, &domain_handle, &alias_handle, sid);
-               ret &= test_CreateDomainGroup(p, mem_ctx, &domain_handle, &group_handle);
-               ret &= test_QueryDomainInfo(p, mem_ctx, &domain_handle);
-               ret &= test_QueryDomainInfo2(p, mem_ctx, &domain_handle);
-               ret &= test_EnumDomainUsers(p, mem_ctx, &domain_handle);
-               ret &= test_EnumDomainUsers_async(p, mem_ctx, &domain_handle);
-               ret &= test_EnumDomainGroups(p, mem_ctx, &domain_handle);
-               ret &= test_EnumDomainAliases(p, mem_ctx, &domain_handle);
-               ret &= test_QueryDisplayInfo2(p, mem_ctx, &domain_handle);
-               ret &= test_QueryDisplayInfo3(p, mem_ctx, &domain_handle);
-               ret &= test_QueryDisplayInfo_continue(p, mem_ctx, &domain_handle);
+               ret &= test_CreateUser(p, tctx, &domain_handle, &user_handle, which_ops);
+               ret &= test_QuerySecurity(p, tctx, &domain_handle);
+               ret &= test_RemoveMemberFromForeignDomain(p, tctx, &domain_handle);
+               ret &= test_CreateAlias(p, tctx, &domain_handle, &alias_handle, sid);
+               ret &= test_CreateDomainGroup(p, tctx, &domain_handle, &group_handle);
+               ret &= test_QueryDomainInfo(p, tctx, &domain_handle);
+               ret &= test_QueryDomainInfo2(p, tctx, &domain_handle);
+               ret &= test_EnumDomainUsers(p, tctx, &domain_handle);
+               ret &= test_EnumDomainUsers_async(p, tctx, &domain_handle);
+               ret &= test_EnumDomainGroups(p, tctx, &domain_handle);
+               ret &= test_EnumDomainAliases(p, tctx, &domain_handle);
+               ret &= test_QueryDisplayInfo2(p, tctx, &domain_handle);
+               ret &= test_QueryDisplayInfo3(p, tctx, &domain_handle);
+               ret &= test_QueryDisplayInfo_continue(p, tctx, &domain_handle);
                
-               if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+               if (torture_setting_bool(tctx, "samba4", false)) {
                        printf("skipping GetDisplayEnumerationIndex test against Samba4\n");
                } else {
-                       ret &= test_GetDisplayEnumerationIndex(p, mem_ctx, &domain_handle);
-                       ret &= test_GetDisplayEnumerationIndex2(p, mem_ctx, &domain_handle);
+                       ret &= test_GetDisplayEnumerationIndex(p, tctx, &domain_handle);
+                       ret &= test_GetDisplayEnumerationIndex2(p, tctx, &domain_handle);
                }
-               ret &= test_GroupList(p, mem_ctx, &domain_handle);
-               ret &= test_TestPrivateFunctionsDomain(p, mem_ctx, &domain_handle);
-               ret &= test_RidToSid(p, mem_ctx, sid, &domain_handle);
-               ret &= test_GetBootKeyInformation(p, mem_ctx, &domain_handle);
+               ret &= test_GroupList(p, tctx, &domain_handle);
+               ret &= test_TestPrivateFunctionsDomain(p, tctx, &domain_handle);
+               ret &= test_RidToSid(p, tctx, sid, &domain_handle);
+               ret &= test_GetBootKeyInformation(p, tctx, &domain_handle);
                break;
        }
 
        if (!policy_handle_empty(&user_handle) &&
-           !test_DeleteUser(p, mem_ctx, &user_handle)) {
+           !test_DeleteUser(p, tctx, &user_handle)) {
                ret = false;
        }
 
        if (!policy_handle_empty(&alias_handle) &&
-           !test_DeleteAlias(p, mem_ctx, &alias_handle)) {
+           !test_DeleteAlias(p, tctx, &alias_handle)) {
                ret = false;
        }
 
        if (!policy_handle_empty(&group_handle) &&
-           !test_DeleteDomainGroup(p, mem_ctx, &group_handle)) {
+           !test_DeleteDomainGroup(p, tctx, &group_handle)) {
                ret = false;
        }
 
-       ret &= test_samr_handle_Close(p, mem_ctx, &domain_handle);
+       ret &= test_samr_handle_Close(p, tctx, &domain_handle);
 
        /* reconnect the main handle */
-       ret &= test_Connect(p, mem_ctx, handle);
+       ret &= test_Connect(p, tctx, handle);
 
        if (!ret) {
-               printf("Testing domain %s failed!\n", dom_sid_string(mem_ctx, sid));
+               printf("Testing domain %s failed!\n", dom_sid_string(tctx, sid));
        }
 
        return ret;
index edffe539d76eea2127987bbf3ae4d26a6af095f0..23a737c042f9631c952e92f1dfcc3b15d32c3bf0 100644 (file)
@@ -299,7 +299,8 @@ failed:
 }
 
 
-_PUBLIC_ struct test_join *torture_join_domain(const char *machine_name, 
+_PUBLIC_ struct test_join *torture_join_domain(struct torture_context *tctx,
+                                              const char *machine_name, 
                                      uint32_t acct_flags,
                                      struct cli_credentials **machine_credentials)
 {
@@ -328,9 +329,9 @@ _PUBLIC_ struct test_join *torture_join_domain(const char *machine_name,
        tj->libnet_r = libnet_r;
                
        libnet_ctx->cred = cmdline_credentials;
-       libnet_r->in.binding = lp_parm_string(global_loadparm, NULL, "torture", "binding");
+       libnet_r->in.binding = torture_setting_string(tctx, "binding", NULL);
        if (!libnet_r->in.binding) {
-               libnet_r->in.binding = talloc_asprintf(libnet_r, "ncacn_np:%s", lp_parm_string(global_loadparm, NULL, "torture", "host"));
+               libnet_r->in.binding = talloc_asprintf(libnet_r, "ncacn_np:%s", torture_setting_string(tctx, "host", NULL));
        }
        libnet_r->in.level = LIBNET_JOINDOMAIN_SPECIFIED;
        libnet_r->in.netbios_name = machine_name;
@@ -383,7 +384,7 @@ _PUBLIC_ struct test_join *torture_join_domain(const char *machine_name,
        
        u.info21.description.string = talloc_asprintf(tj, 
                                                      "Samba4 torture account created by host %s: %s", 
-                                                     lp_netbios_name(global_loadparm), timestring(tj, time(NULL)));
+                                                     lp_netbios_name(tctx->lp_ctx), timestring(tj, time(NULL)));
 
        status = dcerpc_samr_SetUserInfo(tj->p, tj, &s);
        if (!NT_STATUS_IS_OK(status)) {
@@ -391,7 +392,7 @@ _PUBLIC_ struct test_join *torture_join_domain(const char *machine_name,
        }
 
        *machine_credentials = cli_credentials_init(tj);
-       cli_credentials_set_conf(*machine_credentials, global_loadparm);
+       cli_credentials_set_conf(*machine_credentials, tctx->lp_ctx);
        cli_credentials_set_workstation(*machine_credentials, machine_name, CRED_SPECIFIED);
        cli_credentials_set_domain(*machine_credentials, libnet_r->out.domain_name, CRED_SPECIFIED);
        if (libnet_r->out.realm) {
index 73107a52174237c535a62471b878eba8269d05b1..f561b62d47becae55ac3cf56c4e0eefd938182e3 100644 (file)
@@ -77,7 +77,7 @@ static struct {
 /*
   test fileinfo levels
 */
-static bool torture_smb2_fileinfo(struct smb2_tree *tree)
+static bool torture_smb2_fileinfo(struct torture_context *tctx, struct smb2_tree *tree)
 {
        struct smb2_handle hfile, hdir;
        NTSTATUS status;
@@ -105,7 +105,7 @@ static bool torture_smb2_fileinfo(struct smb2_tree *tree)
                        file_levels[i].dinfo.query_secdesc.in.secinfo_flags = 0x7;
                }
                if (file_levels[i].level == RAW_FILEINFO_SMB2_ALL_EAS) {
-                       if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
+                       if (torture_setting_bool(tctx, "samba4", false)) {
                                continue;
                        }
                        file_levels[i].finfo.all_eas.in.continue_flags = 
@@ -192,7 +192,7 @@ bool torture_smb2_getinfo(struct torture_context *torture)
        }
        torture_setup_complex_file(tree, DNAME ":streamtwo");
 
-       ret &= torture_smb2_fileinfo(tree);
+       ret &= torture_smb2_fileinfo(torture, tree);
        ret &= torture_smb2_fsinfo(tree);
 
        talloc_free(mem_ctx);
index 8b767c8436a43200b3d526bf0e1ed204023e1177..f76eb8390adeefb8b1f7a1bae2836ccb782af94d 100644 (file)
@@ -226,7 +226,7 @@ static NTSTATUS local_pw_check_specified(struct loadparm_context *lp_ctx,
                        if (unix_name) {
                                asprintf(unix_name, 
                                         "%s%c%s", domain,
-                                        *lp_winbind_separator(global_loadparm), 
+                                        *lp_winbind_separator(lp_ctx), 
                                         username);
                        }
                } else {
index 6eb3d1513b1b2aa098a20da08eaaa2c4d305e8be..0b3ebc461fc5d52c8b3d74f522c8b6d2fd0c6783 100644 (file)
@@ -140,6 +140,7 @@ static void winbind_task_init(struct task_server *task)
        service->task   = task;
 
        service->primary_sid = secrets_get_domain_sid(service,
+                                                     task->lp_ctx,
                                                      lp_workgroup(task->lp_ctx));
        if (service->primary_sid == NULL) {
                task_server_terminate(