summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-03 15:53:17 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:47:28 +0100
commitab69eb8d8901d23794c6a298718e67656ef4820e (patch)
treecd415ecd2aee4caa9e47f6c442d0d23b2f443b9c
parent0a2f1a46a02d2c9497d05d7e534829dc6e9430dc (diff)
downloadsamba-ab69eb8d8901d23794c6a298718e67656ef4820e.tar.gz
samba-ab69eb8d8901d23794c6a298718e67656ef4820e.tar.bz2
samba-ab69eb8d8901d23794c6a298718e67656ef4820e.zip
r26250: Avoid global_loadparm in a couple more places.
(This used to be commit 2c6b755309fdf685cd0b0564272bf83038574a43)
-rw-r--r--source4/auth/auth_anonymous.c3
-rw-r--r--source4/auth/gensec/schannel.c2
-rw-r--r--source4/auth/sam.c20
-rw-r--r--source4/auth/session.c12
-rw-r--r--source4/ldap_server/ldap_server.c2
-rw-r--r--source4/param/secrets.c8
-rw-r--r--source4/param/secrets.h6
-rw-r--r--source4/param/share.c2
-rw-r--r--source4/param/share_classic.c8
-rw-r--r--source4/rpc_server/service_rpc.c8
-rw-r--r--source4/smb_server/smb_server.c2
-rw-r--r--source4/smbd/server.c2
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c4
-rw-r--r--source4/torture/raw/lockbench.c2
-rw-r--r--source4/torture/raw/openbench.c2
-rw-r--r--source4/torture/rpc/drsuapi.c10
-rw-r--r--source4/torture/rpc/lsa.c98
-rw-r--r--source4/torture/rpc/samr.c156
-rw-r--r--source4/torture/rpc/testjoin.c11
-rw-r--r--source4/torture/smb2/getinfo.c6
-rw-r--r--source4/utils/ntlm_auth.c2
-rw-r--r--source4/winbind/wb_server.c1
22 files changed, 186 insertions, 181 deletions
diff --git a/source4/auth/auth_anonymous.c b/source4/auth/auth_anonymous.c
index 986fe0e4f5..2dd0be5a04 100644
--- a/source4/auth/auth_anonymous.c
+++ b/source4/auth/auth_anonymous.c
@@ -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 = {
diff --git a/source4/auth/gensec/schannel.c b/source4/auth/gensec/schannel.c
index a5e8c60ae3..462fb26ba2 100644
--- a/source4/auth/gensec/schannel.c
+++ b/source4/auth/gensec/schannel.c
@@ -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)
diff --git a/source4/auth/sam.c b/source4/auth/sam.c
index ce02821e83..47d0910650 100644
--- a/source4/auth/sam.c
+++ b/source4/auth/sam.c
@@ -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)) {
diff --git a/source4/auth/session.c b/source4/auth/session.c
index 259f52ac5c..0557187199 100644
--- a/source4/auth/session.c
+++ b/source4/auth/session.c
@@ -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;
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
index a15b81707c..fc22b34b2d 100644
--- a/source4/ldap_server/ldap_server.c
+++ b/source4/ldap_server/ldap_server.c
@@ -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;
}
diff --git a/source4/param/secrets.c b/source4/param/secrets.c
index eeced9ddbe..5a6df3174a 100644
--- a/source4/param/secrets.c
+++ b/source4/param/secrets.c
@@ -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;
diff --git a/source4/param/secrets.h b/source4/param/secrets.h
index 9d98db0d08..4a9eb25e7e 100644
--- a/source4/param/secrets.h
+++ b/source4/param/secrets.h
@@ -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 */
diff --git a/source4/param/share.c b/source4/param/share.c
index 6c0269d5fc..5bf5879290 100644
--- a/source4/param/share.c
+++ b/source4/param/share.c
@@ -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;
}
diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c
index cf140f0d32..2dc40e3e25 100644
--- a/source4/param/share_classic.c
+++ b/source4/param/share_classic.c
@@ -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;
diff --git a/source4/rpc_server/service_rpc.c b/source4/rpc_server/service_rpc.c
index b9cf4887fb..f06a7dce8f 100644
--- a/source4/rpc_server/service_rpc.c
+++ b/source4/rpc_server/service_rpc.c
@@ -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) {
diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c
index 57a6e8ea11..8ba93b9a59 100644
--- a/source4/smb_server/smb_server.c
+++ b/source4/smb_server/smb_server.c
@@ -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));
}
/*
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index 87bab39bd1..faddd23937 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -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);
}
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index cf07c9c611..22decc474d 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -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) {
diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c
index 81016fc563..113634f264 100644
--- a/source4/torture/raw/lockbench.c
+++ b/source4/torture/raw/lockbench.c
@@ -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);
diff --git a/source4/torture/raw/openbench.c b/source4/torture/raw/openbench.c
index 3eec9fbb13..8f9803fa4d 100644
--- a/source4/torture/raw/openbench.c
+++ b/source4/torture/raw/openbench.c
@@ -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);
diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c
index ee752c6568..7fc2406bbf 100644
--- a/source4/torture/rpc/drsuapi.c
+++ b/source4/torture/rpc/drsuapi.c
@@ -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");
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index 1250743955..f40f034ec3 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -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;
}
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index ec70c91570..6a8ff58fb0 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -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;
diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c
index edffe539d7..23a737c042 100644
--- a/source4/torture/rpc/testjoin.c
+++ b/source4/torture/rpc/testjoin.c
@@ -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) {
diff --git a/source4/torture/smb2/getinfo.c b/source4/torture/smb2/getinfo.c
index 73107a5217..f561b62d47 100644
--- a/source4/torture/smb2/getinfo.c
+++ b/source4/torture/smb2/getinfo.c
@@ -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);
diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c
index 8b767c8436..f76eb8390a 100644
--- a/source4/utils/ntlm_auth.c
+++ b/source4/utils/ntlm_auth.c
@@ -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 {
diff --git a/source4/winbind/wb_server.c b/source4/winbind/wb_server.c
index 6eb3d1513b..0b3ebc461f 100644
--- a/source4/winbind/wb_server.c
+++ b/source4/winbind/wb_server.c
@@ -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(