summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--source4/dsdb/samdb/ldb_modules/normalise.c1
-rw-r--r--source4/dsdb/schema/schema.h2
-rw-r--r--source4/dsdb/schema/schema_init.c14
-rw-r--r--source4/dsdb/schema/schema_syntax.c17
-rw-r--r--source4/samba4-quick64
-rw-r--r--source4/torture/config.mk19
-rw-r--r--source4/torture/rpc/samba3rpc.c73
-rw-r--r--source4/torture/rpc/samsync.c13
9 files changed, 110 insertions, 94 deletions
diff --git a/.gitignore b/.gitignore
index b0786b66d6..6076ddc9cd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -115,7 +115,6 @@ source/smb_server/smb2/smb2_proto.h
source/smbd/process_model_proto.h
source/smbd/service_proto.h
source/torture/proto.h
-source/torture/util.h
source/torture/auth/proto.h
source/torture/basic/proto.h
source/torture/ldap/proto.h
diff --git a/source4/dsdb/samdb/ldb_modules/normalise.c b/source4/dsdb/samdb/ldb_modules/normalise.c
index efc9bb29e8..7e3b63a145 100644
--- a/source4/dsdb/samdb/ldb_modules/normalise.c
+++ b/source4/dsdb/samdb/ldb_modules/normalise.c
@@ -105,6 +105,7 @@ static int normalise_search_callback(struct ldb_context *ldb, void *context, str
if (!attribute) {
continue;
}
+ /* Look to see if this attributeSyntax is a DN */
if ((strcmp(attribute->attributeSyntax_oid, "2.5.5.1") != 0) &&
(strcmp(attribute->attributeSyntax_oid, "2.5.5.7") != 0)) {
continue;
diff --git a/source4/dsdb/schema/schema.h b/source4/dsdb/schema/schema.h
index 1379ddee9f..bb34235465 100644
--- a/source4/dsdb/schema/schema.h
+++ b/source4/dsdb/schema/schema.h
@@ -149,6 +149,8 @@ struct dsdb_schema {
struct dsdb_attribute *attributes;
struct dsdb_class *classes;
+
+ struct smb_iconv_convenience *iconv_convenience;
};
#include "dsdb/schema/proto.h"
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c
index 6a7463951e..30d0adeda7 100644
--- a/source4/dsdb/schema/schema_init.c
+++ b/source4/dsdb/schema/schema_init.c
@@ -88,8 +88,7 @@ WERROR dsdb_load_oid_mappings_ldb(struct dsdb_schema *schema,
TALLOC_CTX *mem_ctx = talloc_new(schema);
W_ERROR_HAVE_NO_MEMORY(mem_ctx);
- ndr_err = ndr_pull_struct_blob(prefixMap, mem_ctx, lp_iconv_convenience(global_loadparm), &pfm,
- (ndr_pull_flags_fn_t)ndr_pull_prefixMapBlob);
+ ndr_err = ndr_pull_struct_blob(prefixMap, mem_ctx, schema->iconv_convenience, &pfm, (ndr_pull_flags_fn_t)ndr_pull_prefixMapBlob);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err);
talloc_free(mem_ctx);
@@ -181,8 +180,7 @@ WERROR dsdb_get_oid_mappings_ldb(const struct dsdb_schema *schema,
pfm.reserved = 0;
pfm.ctr.dsdb = *ctr;
- ndr_err = ndr_push_struct_blob(prefixMap, mem_ctx, lp_iconv_convenience(global_loadparm), &pfm,
- (ndr_push_flags_fn_t)ndr_push_prefixMapBlob);
+ ndr_err = ndr_push_struct_blob(prefixMap, mem_ctx, schema->iconv_convenience, &pfm, (ndr_push_flags_fn_t)ndr_push_prefixMapBlob);
talloc_free(ctr);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err);
@@ -628,7 +626,7 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb
} \
if (_a && _a->value_ctr.num_values >= 1) { \
ssize_t _ret; \
- _ret = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX, \
+ _ret = convert_string_talloc(mem_ctx, s->iconv_convenience, CH_UTF16, CH_UNIX, \
_a->value_ctr.values[0].blob->data, \
_a->value_ctr.values[0].blob->length, \
(void **)discard_const(&(p)->elem)); \
@@ -665,7 +663,7 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb
struct drsuapi_DsReplicaObjectIdentifier3 _id3; \
enum ndr_err_code _ndr_err; \
_ndr_err = ndr_pull_struct_blob_all(_a->value_ctr.values[0].blob, \
- mem_ctx, lp_iconv_convenience(global_loadparm), &_id3,\
+ mem_ctx, s->iconv_convenience, &_id3,\
(ndr_pull_flags_fn_t)ndr_pull_drsuapi_DsReplicaObjectIdentifier3);\
if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
NTSTATUS _nt_status = ndr_map_error2ntstatus(_ndr_err); \
@@ -727,7 +725,7 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb
&& _a->value_ctr.values[0].blob->length == 16) { \
enum ndr_err_code _ndr_err; \
_ndr_err = ndr_pull_struct_blob_all(_a->value_ctr.values[0].blob, \
- mem_ctx, lp_iconv_convenience(global_loadparm), &(p)->elem, \
+ mem_ctx, s->iconv_convenience, &(p)->elem, \
(ndr_pull_flags_fn_t)ndr_pull_GUID); \
if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
NTSTATUS _nt_status = ndr_map_error2ntstatus(_ndr_err); \
@@ -1157,6 +1155,8 @@ WERROR dsdb_attach_schema_from_ldif_file(struct ldb_context *ldb, const char *pf
goto nomem;
}
+ schema->iconv_convenience = lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm"));
+
/*
* load the prefixMap attribute from pf
*/
diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c
index 2c133b6424..beacfc49c2 100644
--- a/source4/dsdb/schema/schema_syntax.c
+++ b/source4/dsdb/schema/schema_syntax.c
@@ -767,7 +767,8 @@ static WERROR dsdb_syntax_UNICODE_drsuapi_to_ldb(const struct dsdb_schema *schem
return WERR_FOOBAR;
}
- ret = convert_string_talloc(out->values, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX,
+ ret = convert_string_talloc(out->values, schema->iconv_convenience,
+ CH_UTF16, CH_UNIX,
in->value_ctr.values[i].blob->data,
in->value_ctr.values[i].blob->length,
(void **)&str);
@@ -809,7 +810,7 @@ static WERROR dsdb_syntax_UNICODE_ldb_to_drsuapi(const struct dsdb_schema *schem
out->value_ctr.values[i].blob = &blobs[i];
- ret = convert_string_talloc(blobs, lp_iconv_convenience(global_loadparm), CH_UNIX, CH_UTF16,
+ ret = convert_string_talloc(blobs, schema->iconv_convenience, CH_UNIX, CH_UTF16,
in->values[i].data,
in->values[i].length,
(void **)&blobs[i].data);
@@ -851,7 +852,7 @@ static WERROR dsdb_syntax_DN_drsuapi_to_ldb(const struct dsdb_schema *schema,
}
ndr_err = ndr_pull_struct_blob_all(in->value_ctr.values[i].blob,
- out->values, lp_iconv_convenience(global_loadparm), &id3,
+ out->values, schema->iconv_convenience, &id3,
(ndr_pull_flags_fn_t)ndr_pull_drsuapi_DsReplicaObjectIdentifier3);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
@@ -898,7 +899,7 @@ static WERROR dsdb_syntax_DN_ldb_to_drsuapi(const struct dsdb_schema *schema,
ZERO_STRUCT(id3);
id3.dn = (const char *)in->values[i].data;
- ndr_err = ndr_push_struct_blob(&blobs[i], blobs, lp_iconv_convenience(global_loadparm), &id3, (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
+ ndr_err = ndr_push_struct_blob(&blobs[i], blobs, schema->iconv_convenience, &id3, (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
return ntstatus_to_werror(status);
@@ -939,7 +940,7 @@ static WERROR dsdb_syntax_DN_BINARY_drsuapi_to_ldb(const struct dsdb_schema *sch
}
ndr_err = ndr_pull_struct_blob_all(in->value_ctr.values[i].blob,
- out->values, lp_iconv_convenience(global_loadparm), &id3b,
+ out->values, schema->iconv_convenience, &id3b,
(ndr_pull_flags_fn_t)ndr_pull_drsuapi_DsReplicaObjectIdentifier3Binary);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
@@ -997,7 +998,7 @@ static WERROR dsdb_syntax_DN_BINARY_ldb_to_drsuapi(const struct dsdb_schema *sch
id3b.dn = (const char *)in->values[i].data;
id3b.binary = data_blob(NULL, 0);
- ndr_err = ndr_push_struct_blob(&blobs[i], blobs, lp_iconv_convenience(global_loadparm), &id3b,
+ ndr_err = ndr_push_struct_blob(&blobs[i], blobs, schema->iconv_convenience, &id3b,
(ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3Binary);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
@@ -1043,7 +1044,7 @@ static WERROR dsdb_syntax_PRESENTATION_ADDRESS_drsuapi_to_ldb(const struct dsdb_
return WERR_FOOBAR;
}
- ret = convert_string_talloc(out->values, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX,
+ ret = convert_string_talloc(out->values, schema->iconv_convenience, CH_UTF16, CH_UNIX,
in->value_ctr.values[i].blob->data+4,
in->value_ctr.values[i].blob->length-4,
(void **)&str);
@@ -1086,7 +1087,7 @@ static WERROR dsdb_syntax_PRESENTATION_ADDRESS_ldb_to_drsuapi(const struct dsdb_
out->value_ctr.values[i].blob = &blobs[i];
- ret = convert_string_talloc(blobs, lp_iconv_convenience(global_loadparm), CH_UNIX, CH_UTF16,
+ ret = convert_string_talloc(blobs, schema->iconv_convenience, CH_UNIX, CH_UTF16,
in->values[i].data,
in->values[i].length,
(void **)&data);
diff --git a/source4/samba4-quick b/source4/samba4-quick
index 796435ee16..aec9098854 100644
--- a/source4/samba4-quick
+++ b/source4/samba4-quick
@@ -1,32 +1,32 @@
-BASE-UNLINK
-BASE-ATTR
-BASE-DELETE
-BASE-TCON
-BASE-OPEN
-BASE-CHKPATH
-RAW-QFSINFO
-RAW-QFILEINFO
-RAW-SFILEINFO
-RAW-MKDIR
-RAW-SEEK
-RAW-OPEN
-RAW-WRITE
-RAW-UNLINK
-RAW-READ
-RAW-CLOSE
-RAW-IOCTL
-RAW-RENAME
-RAW-EAS
-RAW-STREAMS
-BASE-OPEN
-RPC-ALTERCONTEXT
-RPC-JOIN
-RPC-ECHO
-RPC-SCHANNEL
-RPC-NETLOGON
-RPC-UNIXINFO
-RPC-HANDLES
-RPC-ALTERCONTEXT
-RPC-JOIN
-RPC-HANDLES
-RPC-ECHO
+base.unlink
+base.attr
+base.delete
+base.tcon
+base.open
+base.chkpath
+raw.qfsinfo
+raw.qfileinfo
+raw.sfileinfo
+raw.mkdir
+raw.seek
+raw.open
+raw.write
+raw.unlink
+raw.read
+raw.close
+raw.ioctl
+raw.rename
+raw.eas
+raw.streams
+base.open
+rpc.altercontext
+rpc.join
+rpc.echo
+rpc.schannel
+rpc.netlogon
+rpc.unixinfo
+rpc.handles
+rpc.altercontext
+rpc.join
+rpc.handles
+rpc.echo
diff --git a/source4/torture/config.mk b/source4/torture/config.mk
index cc9340e6b9..82e32e1ece 100644
--- a/source4/torture/config.mk
+++ b/source4/torture/config.mk
@@ -370,21 +370,20 @@ MANPAGE = man/locktest.1
# End BINARY locktest
#################################
-GCOV_CFLAGS = -ftest-coverage -fprofile-arcs
-GCOV_LDFLAGS = $(GCOV_CFLAGS) -lgcov
+GCOV_FLAGS = --coverage
COV_TARGET = test
COV_VARS = \
- CFLAGS="$(CFLAGS) $(GCOV_CFLAGS)" \
- BNLD_FLAGS="$(BNLD_FLAGS) $(GCOV_LDFLAGS)" \
- SHLD_FLAGS="$(SHLD_FLAGS) $(GCOV_LDFLAGS)" \
- MDLD_FLAGS="$(MDLD_FLAGS) $(GCOV_LDFLAGS)" \
- HOSTCC_FLAGS="$(HOSTCC_FLAGS) $(GCOV_CFLAGS)" \
- HOSTLD_FLAGS="$(HOSTLD_FLAGS) $(GCOV_LDFLAGS)"
+ CFLAGS="$(CFLAGS) $(GCOV_FLAGS)" \
+ BNLD_FLAGS="$(BNLD_FLAGS) $(GCOV_FLAGS)" \
+ SHLD_FLAGS="$(SHLD_FLAGS) $(GCOV_FLAGS)" \
+ MDLD_FLAGS="$(MDLD_FLAGS) $(GCOV_FLAGS)" \
+ HOSTCC_FLAGS="$(HOSTCC_FLAGS) $(GCOV_FLAGS)" \
+ HOSTLD_FLAGS="$(HOSTLD_FLAGS) $(GCOV_FLAGS)"
test_cov:
- @$(MAKE) $(COV_TARGET) $(COV_VARS)
+ -$(MAKE) $(COV_TARGET) $(COV_VARS)
gcov: test_cov
for I in $(sort $(dir $(ALL_OBJS))); \
@@ -396,10 +395,12 @@ lcov-split:
@$(MAKE) $(COV_TARGET) $(COV_VARS) \
TEST_OPTIONS="--analyse-cmd=\"lcov --base-directory `pwd` --directory . --capture --output-file samba.info -t\""
-rm heimdal/lib/*/{lex,parse}.{gcda,gcno}
+ -rm lib/policy/*/{lex,parse}.{gcda,gcno}
genhtml -o coverage samba.info
lcov: test_cov
-rm heimdal/lib/*/{lex,parse}.{gcda,gcno}
+ -rm lib/policy/*/{lex,parse}.{gcda,gcno}
lcov --base-directory `pwd` --directory . --capture --output-file samba.info
genhtml -o coverage samba.info
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index b08cd05bdb..779a28e126 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -806,6 +806,7 @@ static bool join3(struct smbcli_state *cli,
*/
static bool auth2(struct smbcli_state *cli,
+ struct loadparm_context *lp_ctx,
struct cli_credentials *wks_cred)
{
TALLOC_CTX *mem_ctx;
@@ -829,7 +830,7 @@ static bool auth2(struct smbcli_state *cli,
net_pipe = dcerpc_pipe_init(mem_ctx,
cli->transport->socket->event.ctx,
- lp_iconv_convenience(global_loadparm));
+ lp_iconv_convenience(lp_ctx));
if (net_pipe == NULL) {
d_printf("dcerpc_pipe_init failed\n");
goto done;
@@ -1204,7 +1205,7 @@ bool torture_netlogon_samba3(struct torture_context *torture)
int j;
- if (!auth2(cli, wks_creds)) {
+ if (!auth2(cli, torture->lp_ctx, wks_creds)) {
d_printf("auth2 failed\n");
goto done;
}
@@ -1283,7 +1284,7 @@ static bool test_join3(struct torture_context *tctx,
cmdline_credentials, cli_credentials_get_domain(wks_creds),
CRED_SPECIFIED);
- if (!auth2(cli, wks_creds)) {
+ if (!auth2(cli, tctx->lp_ctx, wks_creds)) {
d_printf("auth2 failed\n");
goto done;
}
@@ -1381,6 +1382,7 @@ bool torture_samba3_sessionkey(struct torture_context *torture)
*/
static NTSTATUS pipe_bind_smb(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
struct smbcli_tree *tree,
const char *pipe_name,
const struct ndr_interface_table *iface,
@@ -1391,7 +1393,7 @@ static NTSTATUS pipe_bind_smb(TALLOC_CTX *mem_ctx,
if (!(result = dcerpc_pipe_init(
mem_ctx, tree->session->transport->socket->event.ctx,
- lp_iconv_convenience(global_loadparm)))) {
+ lp_iconv_convenience(lp_ctx)))) {
return NT_STATUS_NO_MEMORY;
}
@@ -1507,7 +1509,9 @@ static struct dom_sid *name2sid(TALLOC_CTX *mem_ctx,
* Find out the user SID on this connection
*/
-static struct dom_sid *whoami(TALLOC_CTX *mem_ctx, struct smbcli_tree *tree)
+static struct dom_sid *whoami(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
+ struct smbcli_tree *tree)
{
struct dcerpc_pipe *lsa;
struct lsa_GetUserName r;
@@ -1515,7 +1519,7 @@ static struct dom_sid *whoami(TALLOC_CTX *mem_ctx, struct smbcli_tree *tree)
struct lsa_StringPointer authority_name_p;
struct dom_sid *result;
- status = pipe_bind_smb(mem_ctx, tree, "\\pipe\\lsarpc",
+ status = pipe_bind_smb(mem_ctx, lp_ctx, tree, "\\pipe\\lsarpc",
&ndr_table_lsarpc, &lsa);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) Could not bind to LSA: %s\n",
@@ -1631,7 +1635,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
goto done;
}
- if (!(user_sid = whoami(mem_ctx, cli->tree))) {
+ if (!(user_sid = whoami(mem_ctx, torture->lp_ctx, cli->tree))) {
d_printf("(%s) whoami on auth'ed connection failed\n",
__location__);
ret = false;
@@ -1658,7 +1662,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
goto done;
}
- if (!(user_sid = whoami(mem_ctx, cli->tree))) {
+ if (!(user_sid = whoami(mem_ctx, torture->lp_ctx, cli->tree))) {
d_printf("(%s) whoami on anon connection failed\n",
__location__);
ret = false;
@@ -1732,7 +1736,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
goto done;
}
- if (!(user_sid = whoami(mem_ctx, tree))) {
+ if (!(user_sid = whoami(mem_ctx, torture->lp_ctx, tree))) {
d_printf("(%s) whoami on user connection failed\n",
__location__);
ret = false;
@@ -1870,8 +1874,8 @@ bool torture_samba3_rpc_srvsvc(struct torture_context *torture)
return false;
}
- status = pipe_bind_smb(mem_ctx, cli->tree, "\\pipe\\srvsvc",
- &ndr_table_srvsvc, &p);
+ status = pipe_bind_smb(mem_ctx, torture->lp_ctx, cli->tree,
+ "\\pipe\\srvsvc", &ndr_table_srvsvc, &p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) could not bind to srvsvc pipe: %s\n",
__location__, nt_errstr(status));
@@ -2007,6 +2011,7 @@ bool torture_samba3_rpc_randomauth2(struct torture_context *torture)
}
static struct security_descriptor *get_sharesec(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
struct smbcli_session *sess,
const char *sharename)
{
@@ -2028,7 +2033,7 @@ static struct security_descriptor *get_sharesec(TALLOC_CTX *mem_ctx,
return NULL;
}
- status = pipe_bind_smb(mem_ctx, tree, "\\pipe\\srvsvc",
+ status = pipe_bind_smb(mem_ctx, lp_ctx, tree, "\\pipe\\srvsvc",
&ndr_table_srvsvc, &p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) could not bind to srvsvc pipe: %s\n",
@@ -2060,6 +2065,7 @@ static struct security_descriptor *get_sharesec(TALLOC_CTX *mem_ctx,
}
static NTSTATUS set_sharesec(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
struct smbcli_session *sess,
const char *sharename,
struct security_descriptor *sd)
@@ -2083,7 +2089,7 @@ static NTSTATUS set_sharesec(TALLOC_CTX *mem_ctx,
return NT_STATUS_UNSUCCESSFUL;
}
- status = pipe_bind_smb(mem_ctx, tree, "\\pipe\\srvsvc",
+ status = pipe_bind_smb(mem_ctx, lp_ctx, tree, "\\pipe\\srvsvc",
&ndr_table_srvsvc, &p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) could not bind to srvsvc pipe: %s\n",
@@ -2115,6 +2121,7 @@ static NTSTATUS set_sharesec(TALLOC_CTX *mem_ctx,
}
bool try_tcon(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
struct security_descriptor *orig_sd,
struct smbcli_session *session,
const char *sharename, const struct dom_sid *user_sid,
@@ -2162,7 +2169,7 @@ bool try_tcon(TALLOC_CTX *mem_ctx,
return false;
}
- status = set_sharesec(mem_ctx, session, sharename, sd);
+ status = set_sharesec(mem_ctx, lp_ctx, session, sharename, sd);
if (!NT_STATUS_IS_OK(status)) {
d_printf("custom set_sharesec failed: %s\n",
nt_errstr(status));
@@ -2193,7 +2200,7 @@ bool try_tcon(TALLOC_CTX *mem_ctx,
done:
smbcli_rmdir(rmdir_tree, "sharesec_testdir");
- status = set_sharesec(mem_ctx, session, sharename, orig_sd);
+ status = set_sharesec(mem_ctx, lp_ctx, session, sharename, orig_sd);
if (!NT_STATUS_IS_OK(status)) {
d_printf("custom set_sharesec failed: %s\n",
nt_errstr(status));
@@ -2225,25 +2232,25 @@ bool torture_samba3_rpc_sharesec(struct torture_context *torture)
return false;
}
- if (!(user_sid = whoami(mem_ctx, cli->tree))) {
+ if (!(user_sid = whoami(mem_ctx, torture->lp_ctx, cli->tree))) {
d_printf("whoami failed\n");
talloc_free(mem_ctx);
return false;
}
- sd = get_sharesec(mem_ctx, cli->session, torture_setting_string(torture,
- "share", NULL));
+ sd = get_sharesec(mem_ctx, torture->lp_ctx, cli->session,
+ torture_setting_string(torture, "share", NULL));
- ret &= try_tcon(mem_ctx, sd, cli->session,
+ ret &= try_tcon(mem_ctx, torture->lp_ctx, sd, cli->session,
torture_setting_string(torture, "share", NULL),
user_sid, 0, NT_STATUS_ACCESS_DENIED, NT_STATUS_OK);
- ret &= try_tcon(mem_ctx, sd, cli->session,
+ ret &= try_tcon(mem_ctx, torture->lp_ctx, sd, cli->session,
torture_setting_string(torture, "share", NULL),
user_sid, SEC_FILE_READ_DATA, NT_STATUS_OK,
NT_STATUS_MEDIA_WRITE_PROTECTED);
- ret &= try_tcon(mem_ctx, sd, cli->session,
+ ret &= try_tcon(mem_ctx, torture->lp_ctx, sd, cli->session,
torture_setting_string(torture, "share", NULL),
user_sid, SEC_FILE_ALL, NT_STATUS_OK, NT_STATUS_OK);
@@ -2273,7 +2280,7 @@ bool torture_samba3_rpc_lsa(struct torture_context *torture)
return false;
}
- status = pipe_bind_smb(mem_ctx, cli->tree, "\\lsarpc",
+ status = pipe_bind_smb(mem_ctx, torture->lp_ctx, cli->tree, "\\lsarpc",
&ndr_table_lsarpc, &p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) pipe_bind_smb failed: %s\n", __location__,
@@ -2356,7 +2363,8 @@ static NTSTATUS get_servername(TALLOC_CTX *mem_ctx, struct smbcli_tree *tree,
}
-static NTSTATUS find_printers(TALLOC_CTX *ctx, struct smbcli_tree *tree,
+static NTSTATUS find_printers(TALLOC_CTX *ctx, struct loadparm_context *lp_ctx,
+ struct smbcli_tree *tree,
const char ***printers, int *num_printers)
{
TALLOC_CTX *mem_ctx;
@@ -2372,7 +2380,8 @@ static NTSTATUS find_printers(TALLOC_CTX *ctx, struct smbcli_tree *tree,
return NT_STATUS_NO_MEMORY;
}
- status = pipe_bind_smb(mem_ctx, tree, "\\srvsvc", &ndr_table_srvsvc,
+ status = pipe_bind_smb(mem_ctx, lp_ctx,
+ tree, "\\srvsvc", &ndr_table_srvsvc,
&p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("could not bind to srvsvc pipe\n");
@@ -2560,7 +2569,7 @@ bool torture_samba3_rpc_spoolss(struct torture_context *torture)
return false;
}
- if (!NT_STATUS_IS_OK(find_printers(mem_ctx, cli->tree,
+ if (!NT_STATUS_IS_OK(find_printers(mem_ctx, torture->lp_ctx, cli->tree,
&printers, &num_printers))) {
talloc_free(mem_ctx);
return false;
@@ -2572,7 +2581,7 @@ bool torture_samba3_rpc_spoolss(struct torture_context *torture)
return true;
}
- status = pipe_bind_smb(mem_ctx, cli->tree, "\\spoolss",
+ status = pipe_bind_smb(mem_ctx, torture->lp_ctx, cli->tree, "\\spoolss",
&ndr_table_spoolss, &p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) pipe_bind_smb failed: %s\n", __location__,
@@ -2746,7 +2755,7 @@ bool torture_samba3_rpc_wkssvc(struct torture_context *torture)
return false;
}
- status = pipe_bind_smb(mem_ctx, cli->tree, "\\wkssvc",
+ status = pipe_bind_smb(mem_ctx, torture->lp_ctx, cli->tree, "\\wkssvc",
&ndr_table_wkssvc, &p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) pipe_bind_smb failed: %s\n", __location__,
@@ -2995,6 +3004,7 @@ bool torture_samba3_rpc_winreg(struct torture_context *torture)
}
static NTSTATUS get_shareinfo(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
struct smbcli_state *cli,
const char *share,
struct srvsvc_NetShareInfo502 **info)
@@ -3006,7 +3016,7 @@ static NTSTATUS get_shareinfo(TALLOC_CTX *mem_ctx,
if (!(p = dcerpc_pipe_init(cli,
cli->transport->socket->event.ctx,
- lp_iconv_convenience(global_loadparm)))) {
+ lp_iconv_convenience(lp_ctx)))) {
status = NT_STATUS_NO_MEMORY;
goto fail;
}
@@ -3176,7 +3186,8 @@ static NTSTATUS torture_samba3_createshare(struct smbcli_state *cli,
return status;
}
-static NTSTATUS torture_samba3_deleteshare(struct smbcli_state *cli,
+static NTSTATUS torture_samba3_deleteshare(struct torture_context *torture,
+ struct smbcli_state *cli,
const char *sharename)
{
struct dcerpc_pipe *p;
@@ -3301,7 +3312,7 @@ bool torture_samba3_regconfig(struct torture_context *torture)
goto done;
}
- status = get_shareinfo(torture, cli, "blubber", &i);
+ status = get_shareinfo(torture, torture->lp_ctx, cli, "blubber", &i);
if (!NT_STATUS_IS_OK(status)) {
torture_warning(torture, "get_shareinfo failed: "
"%s\n", nt_errstr(status));
@@ -3314,7 +3325,7 @@ bool torture_samba3_regconfig(struct torture_context *torture)
goto done;
}
- status = torture_samba3_deleteshare(cli, "blubber");
+ status = torture_samba3_deleteshare(torture, cli, "blubber");
if (!NT_STATUS_IS_OK(status)) {
torture_warning(torture, "torture_samba3_deleteshare failed: "
"%s\n", nt_errstr(status));
diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c
index 1f7f9f463e..865ebf9fd2 100644
--- a/source4/torture/rpc/samsync.c
+++ b/source4/torture/rpc/samsync.c
@@ -398,7 +398,7 @@ static bool samsync_handle_policy(TALLOC_CTX *mem_ctx, struct samsync_state *sam
return true;
}
-static bool samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state,
+static bool samsync_handle_user(struct torture_context *tctx, TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state,
int database_id, struct netr_DELTA_ENUM *delta)
{
uint32_t rid = delta->delta_id_union.rid;
@@ -548,7 +548,7 @@ static bool samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy
data.data = user->user_private_info.SensitiveData;
data.length = user->user_private_info.DataLength;
creds_arcfour_crypt(samsync_state->creds, data.data, data.length);
- ndr_err = ndr_pull_struct_blob(&data, mem_ctx, lp_iconv_convenience(global_loadparm), &keys, (ndr_pull_flags_fn_t)ndr_pull_netr_USER_KEYS);
+ ndr_err = ndr_pull_struct_blob(&data, mem_ctx, lp_iconv_convenience(tctx->lp_ctx), &keys, (ndr_pull_flags_fn_t)ndr_pull_netr_USER_KEYS);
if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
if (keys.keys.keys2.lmpassword.length == 16) {
sam_rid_crypt(rid, keys.keys.keys2.lmpassword.pwd.hash, lm_hash.hash, 0);
@@ -1101,8 +1101,9 @@ static bool samsync_handle_account(TALLOC_CTX *mem_ctx, struct samsync_state *sa
/*
try a netlogon DatabaseSync
*/
-static bool test_DatabaseSync(struct samsync_state *samsync_state,
- TALLOC_CTX *mem_ctx)
+static bool test_DatabaseSync(struct torture_context *tctx,
+ struct samsync_state *samsync_state,
+ TALLOC_CTX *mem_ctx)
{
NTSTATUS status;
TALLOC_CTX *loop_ctx, *delta_ctx, *trustdom_ctx;
@@ -1162,7 +1163,7 @@ static bool test_DatabaseSync(struct samsync_state *samsync_state,
}
break;
case NETR_DELTA_USER:
- if (!samsync_handle_user(delta_ctx, samsync_state,
+ if (!samsync_handle_user(tctx, delta_ctx, samsync_state,
r.in.database_id, &r.out.delta_enum_array->delta_enum[d])) {
printf("Failed to handle DELTA_USER\n");
ret = false;
@@ -1611,7 +1612,7 @@ bool torture_rpc_samsync(struct torture_context *torture)
ret = false;
}
- if (!test_DatabaseSync(samsync_state, mem_ctx)) {
+ if (!test_DatabaseSync(torture, samsync_state, mem_ctx)) {
printf("DatabaseSync failed\n");
ret = false;
}