summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2012-03-25 22:51:51 +0200
committerAndrew Bartlett <abartlet@samba.org>2012-03-26 00:57:29 +0200
commit0f8ffa9ce1777d0b368eb765a7f69f93e68118bd (patch)
treecc8947939d6b84e55addb6ac8eb4b385c5ace018 /source4/dsdb
parent52340b86a2a3bcb98c8622a9d5a66f23eb1440f8 (diff)
downloadsamba-0f8ffa9ce1777d0b368eb765a7f69f93e68118bd.tar.gz
samba-0f8ffa9ce1777d0b368eb765a7f69f93e68118bd.tar.bz2
samba-0f8ffa9ce1777d0b368eb765a7f69f93e68118bd.zip
s4:objectclass LDB module - fix up the sorting in respect to structural or 88 objectclasses
Please have a look at MS-ADTS 3.1.1.1.4. Reviewed-by: Andrew Bartlett <abartlet@samba.org> Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/objectclass.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/objectclass.c b/source4/dsdb/samdb/ldb_modules/objectclass.c
index f125efc6c4..b66b4d7a5f 100644
--- a/source4/dsdb/samdb/ldb_modules/objectclass.c
+++ b/source4/dsdb/samdb/ldb_modules/objectclass.c
@@ -100,7 +100,9 @@ static int objectclass_sort(struct ldb_module *module,
{
struct ldb_context *ldb;
unsigned int i, lowest;
- struct class_list *unsorted = NULL, *sorted = NULL, *current = NULL, *poss_parent = NULL, *new_parent = NULL, *current_lowest = NULL;
+ struct class_list *unsorted = NULL, *sorted = NULL, *current = NULL,
+ *poss_parent = NULL, *new_parent = NULL,
+ *current_lowest = NULL, *current_lowest_struct = NULL;
ldb = ldb_module_get_ctx(module);
@@ -190,13 +192,25 @@ static int objectclass_sort(struct ldb_module *module,
/* For each object: order by hierarchy */
while (unsorted != NULL) {
lowest = UINT_MAX;
- current_lowest = NULL;
+ current_lowest = current_lowest_struct = NULL;
for (current = unsorted; current != NULL; current = current->next) {
- if(current->objectclass->subClass_order < lowest) {
- current_lowest = current;
+ if (current->objectclass->subClass_order <= lowest) {
+ /*
+ * According to MS-ADTS 3.1.1.1.4 structural
+ * and 88 object classes are always listed after
+ * the other class types in a subclass hierarchy
+ */
+ if (current->objectclass->objectClassCategory > 1) {
+ current_lowest = current;
+ } else {
+ current_lowest_struct = current;
+ }
lowest = current->objectclass->subClass_order;
}
}
+ if (current_lowest == NULL) {
+ current_lowest = current_lowest_struct;
+ }
if (current_lowest != NULL) {
DLIST_REMOVE(unsorted,current_lowest);