summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorBrendan Powers <brendan0powers@gmail.com>2009-12-14 20:36:44 -0500
committerAndrew Bartlett <abartlet@samba.org>2009-12-18 14:27:43 +1100
commitd99084ffdb2c898c18bd4b264d8dd297dd0f1f25 (patch)
tree0b8a35e1543928234595a5052907e856074bbfab /source4/dsdb/samdb
parent2ad086e7f6ab39767cd691b059ab5d78b03d55c0 (diff)
downloadsamba-d99084ffdb2c898c18bd4b264d8dd297dd0f1f25.tar.gz
samba-d99084ffdb2c898c18bd4b264d8dd297dd0f1f25.tar.bz2
samba-d99084ffdb2c898c18bd4b264d8dd297dd0f1f25.zip
s4-dsdb: Move get_last_structural class from descriptor.c to util.c
It can now also be used by objectclass.c get_last_structural_class now ignores AUX classes, because they are not structural Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/descriptor.c17
-rw-r--r--source4/dsdb/samdb/ldb_modules/util.c28
-rw-r--r--source4/dsdb/samdb/ldb_modules/util.h1
3 files changed, 30 insertions, 16 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/descriptor.c b/source4/dsdb/samdb/ldb_modules/descriptor.c
index 7622f968e5..d5a5e36e0e 100644
--- a/source4/dsdb/samdb/ldb_modules/descriptor.c
+++ b/source4/dsdb/samdb/ldb_modules/descriptor.c
@@ -41,6 +41,7 @@
#include "libcli/security/security.h"
#include "auth/auth.h"
#include "param/param.h"
+#include "util.h"
struct descriptor_data {
int _dummy;
@@ -56,22 +57,6 @@ struct descriptor_context {
int (*step_fn)(struct descriptor_context *);
};
-static const struct dsdb_class * get_last_structural_class(const struct dsdb_schema *schema, struct ldb_message_element *element)
-{
- const struct dsdb_class *last_class = NULL;
- int i;
- for (i = 0; i < element->num_values; i++){
- if (!last_class) {
- last_class = dsdb_class_by_lDAPDisplayName_ldb_val(schema, &element->values[i]);
- } else {
- const struct dsdb_class *tmp_class = dsdb_class_by_lDAPDisplayName_ldb_val(schema, &element->values[i]);
- if (tmp_class->subClass_order > last_class->subClass_order)
- last_class = tmp_class;
- }
- }
- return last_class;
-}
-
struct dom_sid *get_default_ag(TALLOC_CTX *mem_ctx,
struct ldb_dn *dn,
struct security_token *token,
diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c
index d8d55ae42a..8d9930a81f 100644
--- a/source4/dsdb/samdb/ldb_modules/util.c
+++ b/source4/dsdb/samdb/ldb_modules/util.c
@@ -25,6 +25,7 @@
#include "librpc/ndr/libndr.h"
#include "dsdb/samdb/ldb_modules/util.h"
#include "dsdb/samdb/samdb.h"
+#include "util.h"
/*
add a set of controls to a ldb_request structure based on a set of
@@ -337,3 +338,30 @@ int dsdb_module_rename(struct ldb_module *module,
talloc_free(tmp_ctx);
return ret;
}
+
+const struct dsdb_class * get_last_structural_class(const struct dsdb_schema *schema,const struct ldb_message_element *element)
+{
+ const struct dsdb_class *last_class = NULL;
+ int i;
+
+ for (i = 0; i < element->num_values; i++){
+ const struct dsdb_class *tmp_class = dsdb_class_by_lDAPDisplayName_ldb_val(schema, &element->values[i]);
+
+ if(tmp_class == NULL) {
+ continue;
+ }
+
+ if(tmp_class->objectClassCategory == 3) {
+ continue;
+ }
+
+ if (!last_class) {
+ last_class = tmp_class;
+ } else {
+ if (tmp_class->subClass_order > last_class->subClass_order)
+ last_class = tmp_class;
+ }
+ }
+
+ return last_class;
+}
diff --git a/source4/dsdb/samdb/ldb_modules/util.h b/source4/dsdb/samdb/ldb_modules/util.h
index 56db27d498..41ec873dde 100644
--- a/source4/dsdb/samdb/ldb_modules/util.h
+++ b/source4/dsdb/samdb/ldb_modules/util.h
@@ -19,6 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+struct dsdb_schema; /* predeclare schema struct */
#include "dsdb/samdb/ldb_modules/util_proto.h"
#define DSDB_SEARCH_SEARCH_ALL_PARTITIONS 0x0001