[SCM] Samba Shared Repository - branch master updated
Andrew Bartlett
abartlet at samba.org
Mon Nov 16 17:20:19 MST 2009
The branch, master has been updated
via b9e262c... s4/drs(tort): Convert DSSYNC test to a test case fixture
via 442cded... s4/drs(tort): replace DEBUG with torture_asert/comment/fail
via aaff29f... s4/drs(tort): use torture_drsuapi_assert_call() macro for error checking
via 6730491... s4/drs(tort): replace 'printf' with 'torture_...' calls
via 9e4beef... s4/drs(tort): 'DsSyncBindInfo.pipe' renamed - 'pipe' is a system call
via b0de573... s4/drs(tort): 'DsPrivate.pipe' renamed - 'pipe' is a system call
via b13518e... s4:dsdb With these workarounds, we now pass the RPC-DSSYNC test
via 5c3ef6d... s4:provision Split up reference creation, load schema earlier in the stack
via e9f4dbc... s4:schema Add the GUID to each defaultObjectCategory when loading from LDIF
via 0795314... s4:dsdb Rework samdb code to use 'storage format' DNs for defaultObjectCategory
via 0238147... s4:provision Generate a random objectGUID for each schema record
via 39b8f31... s4:dsdb Load objectGUID and extended DN defaultObjectCategory into the schema
via 6710bec... s4:dsdb Use the new flags to dsdb_module_search in schema_load
via 58ded23... s4:dsdb Break up 'parse a DN from DRSUAPI' into a subfunction
via 41ce3dc... s4:dsdb Add 'dsdb_flags' to dsdb_module_search() to enable often-used features
from a2a8dc5... Don't overwrite a dynamic pointer with the address of a stack variable. Jeremy.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit b9e262c51261af275db4d0e7e6e2c7318a41bed0
Author: Kamen Mazdrashki <kamen.mazdrashki at postpath.com>
Date: Mon Nov 16 03:28:01 2009 +0200
s4/drs(tort): Convert DSSYNC test to a test case fixture
Now it should be much more clear why and where a test
in DSSYNC test case has failed.
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
commit 442cded430a94c583d147f54075a8814d3cbdab1
Author: Kamen Mazdrashki <kamen.mazdrashki at postpath.com>
Date: Mon Nov 16 11:36:20 2009 +0200
s4/drs(tort): replace DEBUG with torture_asert/comment/fail
I left dumping of decrypted attributes values 'as is'
(using DEBUG and DEBUGADD) as it uses dump_data() function.
dump_data() uses DEBUGADD internally, so I have no way
to redirect its output to torture_context at this point.
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
commit aaff29f5b472468e0ffbfc9bf33eead16bdb111c
Author: Kamen Mazdrashki <kamen.mazdrashki at postpath.com>
Date: Sat Nov 14 15:51:53 2009 +0200
s4/drs(tort): use torture_drsuapi_assert_call() macro for error checking
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
commit 673049142b9f5e002ddbae7b3aeb051b0a6ecdc2
Author: Kamen Mazdrashki <kamen.mazdrashki at postpath.com>
Date: Thu Nov 12 03:11:58 2009 +0200
s4/drs(tort): replace 'printf' with 'torture_...' calls
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
commit 9e4beef61407cb884cb36577769a08148f1e1eea
Author: Kamen Mazdrashki <kamen.mazdrashki at postpath.com>
Date: Tue Nov 10 18:12:40 2009 +0200
s4/drs(tort): 'DsSyncBindInfo.pipe' renamed - 'pipe' is a system call
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
commit b0de5736290376b1b63375df94e480a60b4020b7
Author: Kamen Mazdrashki <kamen.mazdrashki at postpath.com>
Date: Sat Nov 14 03:56:21 2009 +0200
s4/drs(tort): 'DsPrivate.pipe' renamed - 'pipe' is a system call
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
commit b13518e4e89f887d01cdc0a52f3288d6ee9e87a1
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue Nov 17 10:37:04 2009 +1100
s4:dsdb With these workarounds, we now pass the RPC-DSSYNC test
commit 5c3ef6dbaecb032a33351bea04f044ce9fd2fc8d
Author: Andrew Bartlett <abartlet at samba.org>
Date: Mon Nov 16 18:51:17 2009 +1100
s4:provision Split up reference creation, load schema earlier in the stack
The schema needs to be loaded above the extended_dn_out modules as
otherwise we don't get an extended DN in the search results.
The reference split is to ensure we create references after the
objects they reference exist.
Andrew Bartlett
commit e9f4dbce64b29882ae2f2f51cda50805c4e27190
Author: Andrew Bartlett <abartlet at samba.org>
Date: Mon Nov 16 18:48:46 2009 +1100
s4:schema Add the GUID to each defaultObjectCategory when loading from LDIF
This makes these full extended DNs, so we set the right values into
the database, even before we actually set the schema objects
themselves.
Andrew Bartlett
commit 07953142a4755354a8e76fa217c6cbf1b5dbcf30
Author: Andrew Bartlett <abartlet at samba.org>
Date: Mon Nov 16 18:46:28 2009 +1100
s4:dsdb Rework samdb code to use 'storage format' DNs for defaultObjectCategory
It is important to always ensure that this attribute has an extended
DN if the rest of the database stores things that way.
The knowlege of what format the DN is stored on disk with is passed
around in an LDB opaque.
Andrew Bartlett
commit 0238147a855c65ea0a81b0a945ae8ffd9b260c75
Author: Andrew Bartlett <abartlet at samba.org>
Date: Mon Nov 16 18:45:21 2009 +1100
s4:provision Generate a random objectGUID for each schema record
This is needed to then create extended DNs with GUID attributes in
them, when importing from the LDIF
Andrew Bartlett
commit 39b8f31d669d157ab750e11952c7c1d26ad5e29f
Author: Andrew Bartlett <abartlet at samba.org>
Date: Mon Nov 16 18:40:24 2009 +1100
s4:dsdb Load objectGUID and extended DN defaultObjectCategory into the schema
The load of defaultObjectCategory as an extended DN means we need to
use the common parsing functions I just split out, rather than the
GET_DS_DN macro.
The objectGUIDs are loaded so that we can create the extended DN when
we load from LDIF (and are loaded for the other cases for
consistency).
Also adapt callers to API changes needed for common parsing code
Andrew Bartlett
commit 6710becbd46020512a14a262d39d5085d06458fe
Author: Andrew Bartlett <abartlet at samba.org>
Date: Mon Nov 16 18:37:51 2009 +1100
s4:dsdb Use the new flags to dsdb_module_search in schema_load
This loads the defaultObjectCategory DN as an extended DN, so we can
apply it, with the associated GUID, when setting this on records in
the objectClass module.
Previously we would not store the extended DN components for
objectCategory.
Andrew Bartlett
commit 58ded23b86c657eac157c76ab31fe20c89ae7e02
Author: Andrew Bartlett <abartlet at samba.org>
Date: Mon Nov 16 18:35:08 2009 +1100
s4:dsdb Break up 'parse a DN from DRSUAPI' into a subfunction
This should make it easier to call this function from the DRS schema
load code, rather than duplicate it.
(we may do the same with other functions in future).
Andrew Bartlett
commit 41ce3dc0c3cbfdf06f0ffd3738c34ff8c22f450e
Author: Andrew Bartlett <abartlet at samba.org>
Date: Mon Nov 16 18:32:17 2009 +1100
s4:dsdb Add 'dsdb_flags' to dsdb_module_search() to enable often-used features
These flags, also on dsdb_module_search_dn() allow us to add commonly
set controls to this pre-packaged blocking search, without rebuilding
the whole function in each caller.
Andrew Bartlett
-----------------------------------------------------------------------
Summary of changes:
source4/dsdb/samdb/ldb_modules/extended_dn_out.c | 31 +++
source4/dsdb/samdb/ldb_modules/extended_dn_store.c | 7 +-
source4/dsdb/samdb/ldb_modules/naming_fsmo.c | 4 +-
source4/dsdb/samdb/ldb_modules/objectclass.c | 27 ++-
source4/dsdb/samdb/ldb_modules/partition_init.c | 6 +-
source4/dsdb/samdb/ldb_modules/pdc_fsmo.c | 2 +-
source4/dsdb/samdb/ldb_modules/samldb.c | 5 +
source4/dsdb/samdb/ldb_modules/schema_load.c | 4 +-
source4/dsdb/samdb/ldb_modules/util.c | 71 ++++++-
source4/dsdb/samdb/ldb_modules/util.h | 5 +
source4/dsdb/samdb/samdb.h | 5 +
source4/dsdb/schema/schema.h | 2 +
source4/dsdb/schema/schema_init.c | 60 ++---
source4/dsdb/schema/schema_set.c | 49 ++++
source4/dsdb/schema/schema_syntax.c | 162 +++++++------
source4/libnet/libnet_vampire.c | 2 +-
source4/scripting/python/samba/ms_schema.py | 2 +
source4/scripting/python/samba/provision.py | 14 +-
source4/selftest/knownfail | 1 -
source4/setup/provision_basedn_modify.ldif | 14 +-
source4/setup/provision_basedn_references.ldif | 22 ++
...dif => provision_configuration_references.ldif} | 0
source4/torture/libnet/libnet_BecomeDC.c | 2 +-
source4/torture/rpc/drsuapi.c | 20 +-
source4/torture/rpc/drsuapi.h | 2 +-
source4/torture/rpc/drsuapi_cracknames.c | 4 +-
source4/torture/rpc/dssync.c | 263 ++++++++++++--------
source4/torture/rpc/rpc.c | 2 +-
28 files changed, 527 insertions(+), 261 deletions(-)
create mode 100644 source4/setup/provision_basedn_references.ldif
rename source4/setup/{provision_configuration_basedn_modify.ldif => provision_configuration_references.ldif} (100%)
Changeset truncated at 500 lines:
diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn_out.c b/source4/dsdb/samdb/ldb_modules/extended_dn_out.c
index bf70c3e..a3e4f57 100644
--- a/source4/dsdb/samdb/ldb_modules/extended_dn_out.c
+++ b/source4/dsdb/samdb/ldb_modules/extended_dn_out.c
@@ -665,6 +665,7 @@ static int extended_dn_out_ldb_init(struct ldb_module *module)
int ret;
struct extended_dn_out_private *p = talloc(module, struct extended_dn_out_private);
+ struct dsdb_extended_dn_store_format *dn_format;
ldb_module_set_private(module, p);
@@ -673,6 +674,20 @@ static int extended_dn_out_ldb_init(struct ldb_module *module)
return LDB_ERR_OPERATIONS_ERROR;
}
+ dn_format = talloc(p, struct dsdb_extended_dn_store_format);
+ if (!dn_format) {
+ talloc_free(p);
+ ldb_oom(ldb_module_get_ctx(module));
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ dn_format->store_extended_dn_in_ldb = true;
+ ret = ldb_set_opaque(ldb_module_get_ctx(module), DSDB_EXTENDED_DN_STORE_FORMAT_OPAQUE_NAME, dn_format);
+ if (ret != LDB_SUCCESS) {
+ talloc_free(p);
+ return ret;
+ }
+
p->dereference = false;
p->normalise = false;
@@ -690,6 +705,7 @@ static int extended_dn_out_dereference_init(struct ldb_module *module, const cha
{
int ret, i = 0;
struct extended_dn_out_private *p = talloc_zero(module, struct extended_dn_out_private);
+ struct dsdb_extended_dn_store_format *dn_format;
struct dsdb_openldap_dereference_control *dereference_control;
struct dsdb_attribute *cur;
struct ldb_context *ldb = ldb_module_get_ctx(module);
@@ -702,6 +718,21 @@ static int extended_dn_out_dereference_init(struct ldb_module *module, const cha
return LDB_ERR_OPERATIONS_ERROR;
}
+ dn_format = talloc(p, struct dsdb_extended_dn_store_format);
+ if (!dn_format) {
+ talloc_free(p);
+ ldb_oom(ldb_module_get_ctx(module));
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ dn_format->store_extended_dn_in_ldb = false;
+
+ ret = ldb_set_opaque(ldb_module_get_ctx(module), DSDB_EXTENDED_DN_STORE_FORMAT_OPAQUE_NAME, dn_format);
+ if (ret != LDB_SUCCESS) {
+ talloc_free(p);
+ return ret;
+ }
+
p->dereference = true;
/* At the moment, servers that need dereference also need the
diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn_store.c b/source4/dsdb/samdb/ldb_modules/extended_dn_store.c
index 557acf2..3a531c0 100644
--- a/source4/dsdb/samdb/ldb_modules/extended_dn_store.c
+++ b/source4/dsdb/samdb/ldb_modules/extended_dn_store.c
@@ -42,7 +42,7 @@
#include "librpc/gen_ndr/ndr_misc.h"
#include "dsdb/samdb/samdb.h"
#include "libcli/security/security.h"
-
+#include "dsdb/samdb/ldb_modules/util.h"
#include <time.h>
struct extended_dn_replace_list {
@@ -275,9 +275,8 @@ static int extended_store_replace(struct extended_dn_context *ac,
return ret;
}
- ret = ldb_request_add_control(os->search_req,
- DSDB_CONTROL_DN_STORAGE_FORMAT_OID,
- true, NULL);
+ ret = dsdb_module_search_handle_flags(ac->module, os->search_req,
+ DSDB_SEARCH_SHOW_DELETED|DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT);
if (ret != LDB_SUCCESS) {
talloc_free(os);
return ret;
diff --git a/source4/dsdb/samdb/ldb_modules/naming_fsmo.c b/source4/dsdb/samdb/ldb_modules/naming_fsmo.c
index 15cad25..3a10a60 100644
--- a/source4/dsdb/samdb/ldb_modules/naming_fsmo.c
+++ b/source4/dsdb/samdb/ldb_modules/naming_fsmo.c
@@ -67,8 +67,8 @@ static int naming_fsmo_init(struct ldb_module *module)
ldb_module_set_private(module, naming_fsmo);
ret = dsdb_module_search_dn(module, mem_ctx, &naming_res,
- naming_dn,
- naming_attrs);
+ naming_dn,
+ naming_attrs, 0);
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
ldb_debug(ldb, LDB_DEBUG_WARNING,
"naming_fsmo_init: no partitions dn present: (skip loading of naming contexts details)\n");
diff --git a/source4/dsdb/samdb/ldb_modules/objectclass.c b/source4/dsdb/samdb/ldb_modules/objectclass.c
index ba28d42..a26dcd2 100644
--- a/source4/dsdb/samdb/ldb_modules/objectclass.c
+++ b/source4/dsdb/samdb/ldb_modules/objectclass.c
@@ -621,7 +621,15 @@ static int objectclass_do_add(struct oc_context *ac)
}
if (!ldb_msg_find_element(msg, "objectCategory")) {
- value = talloc_strdup(msg, current->objectclass->defaultObjectCategory);
+ struct dsdb_extended_dn_store_format *dn_format = talloc_get_type(ldb_module_get_private(ac->module), struct dsdb_extended_dn_store_format);
+ if (dn_format && dn_format->store_extended_dn_in_ldb == false) {
+ /* Strip off extended components */
+ struct ldb_dn *dn = ldb_dn_new(msg, ldb, current->objectclass->defaultObjectCategory);
+ value = ldb_dn_alloc_linearized(msg, dn);
+ talloc_free(dn);
+ } else {
+ value = talloc_strdup(msg, current->objectclass->defaultObjectCategory);
+ }
if (value == NULL) {
ldb_oom(ldb);
talloc_free(mem_ctx);
@@ -1189,9 +1197,26 @@ static int objectclass_do_rename(struct oc_context *ac)
return ldb_next_request(ac->module, rename_req);
}
+static int objectclass_init(struct ldb_module *module)
+{
+ struct ldb_context *ldb = ldb_module_get_ctx(module);
+ int ret;
+ /* Init everything else */
+ ret = ldb_next_init(module);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+
+ /* Look for the opaque to indicate we might have to cut down the DN of defaultObjectCategory */
+ ldb_module_set_private(module, ldb_get_opaque(ldb, DSDB_EXTENDED_DN_STORE_FORMAT_OPAQUE_NAME));
+
+ return ldb_next_init(module);
+}
+
_PUBLIC_ const struct ldb_module_ops ldb_objectclass_module_ops = {
.name = "objectclass",
.add = objectclass_add,
.modify = objectclass_modify,
.rename = objectclass_rename,
+ .init_context = objectclass_init
};
diff --git a/source4/dsdb/samdb/ldb_modules/partition_init.c b/source4/dsdb/samdb/ldb_modules/partition_init.c
index db99b75..416648c 100644
--- a/source4/dsdb/samdb/ldb_modules/partition_init.c
+++ b/source4/dsdb/samdb/ldb_modules/partition_init.c
@@ -136,7 +136,7 @@ static int partition_reload_metadata(struct ldb_module *module, struct partition
/* perform search for @PARTITION, looking for module, replicateEntries and ldapBackend */
ret = dsdb_module_search_dn(module, mem_ctx, &res,
ldb_dn_new(mem_ctx, ldb, DSDB_PARTITION_DN),
- attrs);
+ attrs, 0);
if (ret != LDB_SUCCESS) {
return ret;
}
@@ -493,7 +493,7 @@ int partition_reload_if_required(struct ldb_module *module,
/* Get the 'correct' case of the partition DNs from the database */
ret = dsdb_module_search_dn(partition->module, data, &dn_res,
- dn, no_attrs);
+ dn, no_attrs, 0);
if (ret == LDB_SUCCESS) {
talloc_free(partition->ctrl->dn);
partition->ctrl->dn = talloc_steal(partition->ctrl, dn_res->msgs[0]->dn);
@@ -533,7 +533,7 @@ static int new_partition_set_replicated_metadata(struct ldb_context *ldb,
struct ldb_request *add_req;
ret = dsdb_module_search_dn(module, last_req, &replicate_res,
data->replicate[i],
- NULL);
+ NULL, 0);
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
continue;
}
diff --git a/source4/dsdb/samdb/ldb_modules/pdc_fsmo.c b/source4/dsdb/samdb/ldb_modules/pdc_fsmo.c
index 6d814f9..796ecaf 100644
--- a/source4/dsdb/samdb/ldb_modules/pdc_fsmo.c
+++ b/source4/dsdb/samdb/ldb_modules/pdc_fsmo.c
@@ -67,7 +67,7 @@ static int pdc_fsmo_init(struct ldb_module *module)
ret = dsdb_module_search_dn(module, mem_ctx, &pdc_res,
pdc_dn,
- pdc_attrs);
+ pdc_attrs, 0);
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
ldb_debug(ldb, LDB_DEBUG_WARNING,
"pdc_fsmo_init: no domain object present: (skip loading of domain details)\n");
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index 9cfdb37..e8d9cba 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -33,6 +33,7 @@
#include "libcli/ldap/ldap_ndr.h"
#include "ldb_module.h"
#include "dsdb/samdb/samdb.h"
+#include "dsdb/samdb/ldb_modules/util.h"
#include "libcli/security/security.h"
#include "librpc/gen_ndr/ndr_security.h"
#include "../lib/util/util_ldb.h"
@@ -1008,6 +1009,10 @@ static int samldb_find_for_defaultObjectCategory(struct samldb_ctx *ac)
if (ret != LDB_SUCCESS) {
return ret;
}
+ ret = dsdb_module_search_handle_flags(ac->module, req, DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
return ldb_next_request(ac->module, req);
}
diff --git a/source4/dsdb/samdb/ldb_modules/schema_load.c b/source4/dsdb/samdb/ldb_modules/schema_load.c
index b695700..c7cd76a 100644
--- a/source4/dsdb/samdb/ldb_modules/schema_load.c
+++ b/source4/dsdb/samdb/ldb_modules/schema_load.c
@@ -69,7 +69,7 @@ static int dsdb_schema_from_schema_dn(TALLOC_CTX *mem_ctx, struct ldb_module *mo
* setup the prefix mappings and schema info
*/
ret = dsdb_module_search_dn(module, tmp_ctx, &schema_res,
- schema_dn, schema_attrs);
+ schema_dn, schema_attrs, 0);
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
goto failed;
} else if (ret != LDB_SUCCESS) {
@@ -84,6 +84,7 @@ static int dsdb_schema_from_schema_dn(TALLOC_CTX *mem_ctx, struct ldb_module *mo
*/
ret = dsdb_module_search(module, tmp_ctx, &a_res,
schema_dn, LDB_SCOPE_ONELEVEL, NULL,
+ 0,
"(objectClass=attributeSchema)");
if (ret != LDB_SUCCESS) {
ldb_asprintf_errstring(ldb,
@@ -97,6 +98,7 @@ static int dsdb_schema_from_schema_dn(TALLOC_CTX *mem_ctx, struct ldb_module *mo
*/
ret = dsdb_module_search(module, tmp_ctx, &c_res,
schema_dn, LDB_SCOPE_ONELEVEL, NULL,
+ DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT,
"(objectClass=classSchema)");
if (ret != LDB_SUCCESS) {
ldb_asprintf_errstring(ldb,
diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c
index 372cad6..b0f22de 100644
--- a/source4/dsdb/samdb/ldb_modules/util.c
+++ b/source4/dsdb/samdb/ldb_modules/util.c
@@ -19,8 +19,63 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "includes.h"
#include "ldb.h"
#include "ldb_module.h"
+#include "dsdb/samdb/ldb_modules/util.h"
+#include "dsdb/samdb/samdb.h"
+
+int dsdb_module_search_handle_flags(struct ldb_module *module, struct ldb_request *req, int dsdb_flags)
+{
+ int ret;
+ if (dsdb_flags & DSDB_SEARCH_SEARCH_ALL_PARTITIONS) {
+ struct ldb_search_options_control *options;
+ /* Using the phantom root control allows us to search all partitions */
+ options = talloc(req, struct ldb_search_options_control);
+ if (options == NULL) {
+ ldb_module_oom(module);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+ options->search_options = LDB_SEARCH_OPTION_PHANTOM_ROOT;
+
+ ret = ldb_request_add_control(req,
+ LDB_CONTROL_SEARCH_OPTIONS_OID,
+ true, options);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+ }
+
+ if (dsdb_flags & DSDB_SEARCH_SHOW_DELETED) {
+ ret = ldb_request_add_control(req, LDB_CONTROL_SHOW_DELETED_OID, true, NULL);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+ }
+
+ if (dsdb_flags & DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT) {
+ ret = ldb_request_add_control(req, DSDB_CONTROL_DN_STORAGE_FORMAT_OID, true, NULL);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+ }
+
+ if (dsdb_flags & DSDB_SEARCH_SHOW_EXTENDED_DN) {
+ struct ldb_extended_dn_control *extended_ctrl = talloc(req, struct ldb_extended_dn_control);
+ if (!extended_ctrl) {
+ ldb_module_oom(module);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+ extended_ctrl->type = 1;
+
+ ret = ldb_request_add_control(req, LDB_CONTROL_EXTENDED_DN_OID, true, extended_ctrl);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+ }
+
+ return LDB_SUCCESS;
+}
/*
search for attrs on one DN, in the modules below
@@ -29,7 +84,8 @@ int dsdb_module_search_dn(struct ldb_module *module,
TALLOC_CTX *mem_ctx,
struct ldb_result **_res,
struct ldb_dn *basedn,
- const char * const *attrs)
+ const char * const *attrs,
+ int dsdb_flags)
{
int ret;
struct ldb_request *req;
@@ -57,6 +113,12 @@ int dsdb_module_search_dn(struct ldb_module *module,
return ret;
}
+ ret = dsdb_module_search_handle_flags(module, req, dsdb_flags);
+ if (ret != LDB_SUCCESS) {
+ talloc_free(tmp_ctx);
+ return ret;
+ }
+
ret = ldb_next_request(module, req);
if (ret == LDB_SUCCESS) {
ret = ldb_wait(req->handle, LDB_WAIT_ALL);
@@ -88,6 +150,7 @@ int dsdb_module_search(struct ldb_module *module,
struct ldb_result **_res,
struct ldb_dn *basedn, enum ldb_scope scope,
const char * const *attrs,
+ int dsdb_flags,
const char *expression)
{
int ret;
@@ -116,6 +179,12 @@ int dsdb_module_search(struct ldb_module *module,
return ret;
}
+ ret = dsdb_module_search_handle_flags(module, req, dsdb_flags);
+ if (ret != LDB_SUCCESS) {
+ talloc_free(tmp_ctx);
+ return ret;
+ }
+
ret = ldb_next_request(module, req);
if (ret == LDB_SUCCESS) {
ret = ldb_wait(req->handle, LDB_WAIT_ALL);
diff --git a/source4/dsdb/samdb/ldb_modules/util.h b/source4/dsdb/samdb/ldb_modules/util.h
index 0a1ab83..b612c64 100644
--- a/source4/dsdb/samdb/ldb_modules/util.h
+++ b/source4/dsdb/samdb/ldb_modules/util.h
@@ -20,3 +20,8 @@
*/
#include "dsdb/samdb/ldb_modules/util_proto.h"
+
+#define DSDB_SEARCH_SEARCH_ALL_PARTITIONS 0x0001
+#define DSDB_SEARCH_SHOW_DELETED 0x0002
+#define DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT 0x0004
+#define DSDB_SEARCH_SHOW_EXTENDED_DN 0x0010
diff --git a/source4/dsdb/samdb/samdb.h b/source4/dsdb/samdb/samdb.h
index 45ab716..33f4fd3 100644
--- a/source4/dsdb/samdb/samdb.h
+++ b/source4/dsdb/samdb/samdb.h
@@ -135,4 +135,9 @@ struct dsdb_openldap_dereference_result_control {
#define DSDB_PARTITION_DN "@PARTITION"
#define DSDB_PARTITION_ATTR "partition"
+#define DSDB_EXTENDED_DN_STORE_FORMAT_OPAQUE_NAME "dsdb_extended_dn_store_format"
+struct dsdb_extended_dn_store_format {
+ bool store_extended_dn_in_ldb;
+};
+
#endif /* __SAMDB_H__ */
diff --git a/source4/dsdb/schema/schema.h b/source4/dsdb/schema/schema.h
index 033dc6e..fa687d0 100644
--- a/source4/dsdb/schema/schema.h
+++ b/source4/dsdb/schema/schema.h
@@ -64,6 +64,7 @@ struct dsdb_attribute {
uint32_t mAPIID;
struct GUID attributeSecurityGUID;
+ struct GUID objectGUID;
uint32_t searchFlags;
uint32_t systemFlags;
@@ -104,6 +105,7 @@ struct dsdb_class {
const char *governsID_oid;
uint32_t governsID_id;
struct GUID schemaIDGUID;
+ struct GUID objectGUID;
uint32_t objectClassCategory;
const char *rDNAttID;
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c
index 19c7273..069da95 100644
--- a/source4/dsdb/schema/schema_init.c
+++ b/source4/dsdb/schema/schema_init.c
@@ -573,6 +573,8 @@ WERROR dsdb_attribute_from_ldb(struct ldb_context *ldb,
GET_GUID_LDB(msg, "attributeSecurityGUID", attr, attributeSecurityGUID);
+ GET_GUID_LDB(msg, "objectGUID", attr, objectGUID);
+
GET_UINT32_LDB(msg, "searchFlags", attr, searchFlags);
GET_UINT32_LDB(msg, "systemFlags", attr, systemFlags);
GET_BOOL_LDB(msg, "isMemberOfPartialAttributeSet", attr, isMemberOfPartialAttributeSet, false);
@@ -651,6 +653,7 @@ WERROR dsdb_class_from_ldb(struct dsdb_schema *schema,
}
}
GET_GUID_LDB(msg, "schemaIDGUID", obj, schemaIDGUID);
+ GET_GUID_LDB(msg, "objectGUID", obj, objectGUID);
GET_UINT32_LDB(msg, "objectClassCategory", obj, objectClassCategory);
GET_STRING_LDB(msg, "rDNAttID", obj, obj, rDNAttID, false);
@@ -907,39 +910,6 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb
if (_a) (p)->elem[list_counter] = 0; \
} while (0)
-#define GET_DN_DS(s, r, attr, mem_ctx, p, elem, strict) do { \
- struct drsuapi_DsReplicaAttribute *_a; \
- _a = dsdb_find_object_attr_name(s, r, attr, NULL); \
- if (strict && !_a) { \
- d_printf("%s: %s == NULL\n", __location__, attr); \
- return WERR_INVALID_PARAM; \
- } \
- if (strict && _a->value_ctr.num_values != 1) { \
- d_printf("%s: %s num_values == %u\n", __location__, attr, \
- _a->value_ctr.num_values); \
- return WERR_INVALID_PARAM; \
- } \
- if (strict && !_a->value_ctr.values[0].blob) { \
- d_printf("%s: %s data == NULL\n", __location__, attr); \
- return WERR_INVALID_PARAM; \
- } \
- if (_a && _a->value_ctr.num_values >= 1 \
- && _a->value_ctr.values[0].blob) { \
- 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, 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); \
- return ntstatus_to_werror(_nt_status); \
- } \
- (p)->elem = _id3.dn; \
- } else { \
- (p)->elem = NULL; \
- } \
-} while (0)
-
#define GET_BOOL_DS(s, r, attr, p, elem, strict) do { \
struct drsuapi_DsReplicaAttribute *_a; \
_a = dsdb_find_object_attr_name(s, r, attr, NULL); \
@@ -1054,6 +1024,8 @@ WERROR dsdb_attribute_from_drsuapi(struct ldb_context *ldb,
GET_GUID_DS(schema, r, "attributeSecurityGUID", mem_ctx, attr, attributeSecurityGUID);
+ attr->objectGUID = r->identifier->guid;
+
GET_UINT32_DS(schema, r, "searchFlags", attr, searchFlags);
GET_UINT32_DS(schema, r, "systemFlags", attr, systemFlags);
GET_BOOL_DS(schema, r, "isMemberOfPartialAttributeSet", attr, isMemberOfPartialAttributeSet, false);
@@ -1099,12 +1071,15 @@ WERROR dsdb_attribute_from_drsuapi(struct ldb_context *ldb,
return WERR_OK;
}
-WERROR dsdb_class_from_drsuapi(struct dsdb_schema *schema,
+WERROR dsdb_class_from_drsuapi(struct ldb_context *ldb,
+ struct dsdb_schema *schema,
struct drsuapi_DsReplicaObject *r,
TALLOC_CTX *mem_ctx,
struct dsdb_class *obj)
{
WERROR status;
+ struct drsuapi_DsReplicaAttribute *attr;
+ DATA_BLOB blob;
GET_STRING_DS(schema, r, "name", mem_ctx, obj, cn, true);
GET_STRING_DS(schema, r, "lDAPDisplayName", mem_ctx, obj, lDAPDisplayName, true);
@@ -1119,9 +1094,24 @@ WERROR dsdb_class_from_drsuapi(struct dsdb_schema *schema,
}
GET_GUID_DS(schema, r, "schemaIDGUID", mem_ctx, obj, schemaIDGUID);
+ obj->objectGUID = r->identifier->guid;
+
GET_UINT32_DS(schema, r, "objectClassCategory", obj, objectClassCategory);
--
Samba Shared Repository
More information about the samba-cvs
mailing list