From 47591ea5ec03916393d22484e3b551da033260ea Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 21 Oct 2010 12:47:57 +1100 Subject: s4-dsdb: moved a bunch of fuctions from schema/schema_info_attr.c to samdb/ldb_modules/schema_util.c these functions operate on ldb_modules, so they should be in the ldb_modules directory. They also should return ldb errors codes, not WERROR codes, as otherwise the error can be hidden from the ldap caller This re-arrangement fixes a dependency loop in the schema/samdb code. Pair-Programmed-With: Andrew Bartlett Pair-Programmed-With: Kamen Mazdrashki --- source4/torture/drs/unit/schemainfo_tests.c | 29 +++++++++++++++-------------- source4/torture/drs/wscript_build | 2 +- 2 files changed, 16 insertions(+), 15 deletions(-) (limited to 'source4/torture/drs') diff --git a/source4/torture/drs/unit/schemainfo_tests.c b/source4/torture/drs/unit/schemainfo_tests.c index e419ab0c49..f8fc5ae645 100644 --- a/source4/torture/drs/unit/schemainfo_tests.c +++ b/source4/torture/drs/unit/schemainfo_tests.c @@ -380,7 +380,7 @@ static bool test_dsdb_schema_info_cmp(struct torture_context *tctx, static bool test_dsdb_module_schema_info_blob_rw(struct torture_context *tctx, struct drsut_schemainfo_data *priv) { - WERROR werr; + int ldb_err; DATA_BLOB blob_write; DATA_BLOB blob_read; @@ -393,14 +393,14 @@ static bool test_dsdb_module_schema_info_blob_rw(struct torture_context *tctx, blob_write = strhex_to_data_blob(priv, SCHEMA_INFO_DEFAULT_STR); torture_assert(tctx, blob_write.data, "Not enough memory!"); - werr = dsdb_module_schema_info_blob_write(priv->ldb_module, - DSDB_FLAG_TOP_MODULE, - &blob_write); - torture_assert_werr_ok(tctx, werr, "dsdb_module_schema_info_blob_write() failed"); + ldb_err = dsdb_module_schema_info_blob_write(priv->ldb_module, + DSDB_FLAG_TOP_MODULE, + &blob_write); + torture_assert_int_equal(tctx, ldb_err, LDB_SUCCESS, "dsdb_module_schema_info_blob_write() failed"); - werr = dsdb_module_schema_info_blob_read(priv->ldb_module, DSDB_FLAG_TOP_MODULE, + ldb_err = dsdb_module_schema_info_blob_read(priv->ldb_module, DSDB_FLAG_TOP_MODULE, priv, &blob_read); - torture_assert_werr_ok(tctx, werr, "dsdb_module_schema_info_blob_read() failed"); + torture_assert_int_equal(tctx, ldb_err, LDB_SUCCESS, "dsdb_module_schema_info_blob_read() failed"); /* check if we get what we wrote */ torture_assert_data_blob_equal(tctx, blob_read, blob_write, @@ -415,6 +415,7 @@ static bool test_dsdb_module_schema_info_blob_rw(struct torture_context *tctx, static bool test_dsdb_module_schema_info_update(struct torture_context *tctx, struct drsut_schemainfo_data *priv) { + int ldb_err; WERROR werr; DATA_BLOB blob; struct dsdb_schema_info *schema_info; @@ -424,15 +425,15 @@ static bool test_dsdb_module_schema_info_update(struct torture_context *tctx, _drsut_ldb_schema_info_reset(tctx, priv->ldb, SCHEMA_INFO_INIT_STR, false), "_drsut_ldb_schema_info_reset() failed"); - werr = dsdb_module_schema_info_update(priv->ldb_module, - priv->schema, - DSDB_FLAG_TOP_MODULE | DSDB_FLAG_AS_SYSTEM); - torture_assert_werr_ok(tctx, werr, "dsdb_module_schema_info_update() failed"); + ldb_err = dsdb_module_schema_info_update(priv->ldb_module, + priv->schema, + DSDB_FLAG_TOP_MODULE | DSDB_FLAG_AS_SYSTEM); + torture_assert_int_equal(tctx, ldb_err, LDB_SUCCESS, "dsdb_module_schema_info_update() failed"); /* get updated schemaInfo */ - werr = dsdb_module_schema_info_blob_read(priv->ldb_module, DSDB_FLAG_TOP_MODULE, - priv, &blob); - torture_assert_werr_ok(tctx, werr, "dsdb_module_schema_info_blob_read() failed"); + ldb_err = dsdb_module_schema_info_blob_read(priv->ldb_module, DSDB_FLAG_TOP_MODULE, + priv, &blob); + torture_assert_int_equal(tctx, ldb_err, LDB_SUCCESS, "dsdb_module_schema_info_blob_read() failed"); werr = dsdb_schema_info_from_blob(&blob, priv, &schema_info); torture_assert_werr_ok(tctx, werr, "dsdb_schema_info_from_blob() failed"); diff --git a/source4/torture/drs/wscript_build b/source4/torture/drs/wscript_build index a63edf474c..ac0e7b8fa8 100644 --- a/source4/torture/drs/wscript_build +++ b/source4/torture/drs/wscript_build @@ -5,7 +5,7 @@ bld.SAMBA_MODULE('TORTURE_DRS', autoproto='proto.h', subsystem='smbtorture', init_function='torture_drs_init', - deps='NDR_TABLE RPC_NDR_UNIXINFO dcerpc_samr RPC_NDR_WINREG RPC_NDR_INITSHUTDOWN RPC_NDR_OXIDRESOLVER RPC_NDR_EVENTLOG RPC_NDR_ECHO RPC_NDR_SVCCTL RPC_NDR_NETLOGON dcerpc_atsvc RPC_NDR_DRSUAPI RPC_NDR_LSA RPC_NDR_EPMAPPER RPC_NDR_DFS RPC_NDR_FRSAPI RPC_NDR_SPOOLSS RPC_NDR_SRVSVC RPC_NDR_WKSSVC RPC_NDR_ROT RPC_NDR_DSSETUP RPC_NDR_REMACT RPC_NDR_OXIDRESOLVER RPC_NDR_NTSVCS WB_HELPER LIBSAMBA-NET LIBCLI_AUTH POPT_CREDENTIALS TORTURE_LDAP TORTURE_UTIL TORTURE_RAP dcerpc_server service process_model ntvfs SERVICE_SMB RPC_NDR_BROWSER LIBCLI_DRSUAPI', + deps='NDR_TABLE RPC_NDR_UNIXINFO dcerpc_samr RPC_NDR_WINREG RPC_NDR_INITSHUTDOWN RPC_NDR_OXIDRESOLVER RPC_NDR_EVENTLOG RPC_NDR_ECHO RPC_NDR_SVCCTL RPC_NDR_NETLOGON dcerpc_atsvc RPC_NDR_DRSUAPI RPC_NDR_LSA RPC_NDR_EPMAPPER RPC_NDR_DFS RPC_NDR_FRSAPI RPC_NDR_SPOOLSS RPC_NDR_SRVSVC RPC_NDR_WKSSVC RPC_NDR_ROT RPC_NDR_DSSETUP RPC_NDR_REMACT RPC_NDR_OXIDRESOLVER RPC_NDR_NTSVCS WB_HELPER LIBSAMBA-NET LIBCLI_AUTH POPT_CREDENTIALS TORTURE_LDAP TORTURE_UTIL TORTURE_RAP dcerpc_server service process_model ntvfs SERVICE_SMB RPC_NDR_BROWSER LIBCLI_DRSUAPI DSDB_MODULE_HELPERS', internal_module=True ) -- cgit