summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2012-04-04 22:24:16 +0200
committerAndrew Bartlett <abartlet@samba.org>2012-04-11 06:31:51 +0200
commit0c44d46f24ef69598eaef281bcb82f943655d0bc (patch)
tree6219094ce16ab0e5332ddcf50a3bec11a731e891 /source4/dsdb/samdb/ldb_modules
parent83062125e60dd097a1a151fb35467fe55a356780 (diff)
downloadsamba-0c44d46f24ef69598eaef281bcb82f943655d0bc.tar.gz
samba-0c44d46f24ef69598eaef281bcb82f943655d0bc.tar.bz2
samba-0c44d46f24ef69598eaef281bcb82f943655d0bc.zip
s4:dsdb/samdb/ldb_modules/schema.c - move "get_last_structural_class()" into "util.c"
And remove this helper module - it does not have much sense keeping it. Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Wed Apr 11 06:31:51 CEST 2012 on sn-devel-104
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules')
-rw-r--r--source4/dsdb/samdb/ldb_modules/acl.c3
-rw-r--r--source4/dsdb/samdb/ldb_modules/descriptor.c7
-rw-r--r--source4/dsdb/samdb/ldb_modules/objectclass.c11
-rw-r--r--source4/dsdb/samdb/ldb_modules/schema.c62
-rw-r--r--source4/dsdb/samdb/ldb_modules/util.c30
-rw-r--r--source4/dsdb/samdb/ldb_modules/wscript_build16
6 files changed, 46 insertions, 83 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/acl.c b/source4/dsdb/samdb/ldb_modules/acl.c
index bce878501a..843d17e5d1 100644
--- a/source4/dsdb/samdb/ldb_modules/acl.c
+++ b/source4/dsdb/samdb/ldb_modules/acl.c
@@ -39,7 +39,6 @@
#include "librpc/gen_ndr/ndr_security.h"
#include "param/param.h"
#include "dsdb/samdb/ldb_modules/util.h"
-#include "dsdb/samdb/ldb_modules/schema.h"
#include "lib/util/tsort.h"
#include "system/kerberos.h"
#include "auth/kerberos/kerberos.h"
@@ -919,7 +918,7 @@ static const struct GUID *get_oc_guid_from_message(const struct dsdb_schema *sch
return NULL;
}
- object_class = get_last_structural_class(schema, oc_el);
+ object_class = dsdb_get_last_structural_class(schema, oc_el);
if (object_class == NULL) {
return NULL;
}
diff --git a/source4/dsdb/samdb/ldb_modules/descriptor.c b/source4/dsdb/samdb/ldb_modules/descriptor.c
index 0a4b1da39f..18245a0b79 100644
--- a/source4/dsdb/samdb/ldb_modules/descriptor.c
+++ b/source4/dsdb/samdb/ldb_modules/descriptor.c
@@ -39,7 +39,6 @@
#include "librpc/ndr/libndr.h"
#include "librpc/gen_ndr/ndr_security.h"
#include "libcli/security/security.h"
-#include "dsdb/samdb/ldb_modules/schema.h"
#include "auth/auth.h"
#include "param/param.h"
#include "dsdb/samdb/ldb_modules/util.h"
@@ -542,7 +541,8 @@ static int descriptor_add(struct ldb_module *module, struct ldb_request *req)
return ldb_operr(ldb);
}
- objectclass = get_last_structural_class(schema, objectclass_element);
+ objectclass = dsdb_get_last_structural_class(schema,
+ objectclass_element);
if (objectclass == NULL) {
return ldb_operr(ldb);
}
@@ -660,7 +660,8 @@ static int descriptor_modify(struct ldb_module *module, struct ldb_request *req)
return ldb_operr(ldb);
}
- objectclass = get_last_structural_class(schema, objectclass_element);
+ objectclass = dsdb_get_last_structural_class(schema,
+ objectclass_element);
if (objectclass == NULL) {
return ldb_operr(ldb);
}
diff --git a/source4/dsdb/samdb/ldb_modules/objectclass.c b/source4/dsdb/samdb/ldb_modules/objectclass.c
index 033330c86c..d431367b5a 100644
--- a/source4/dsdb/samdb/ldb_modules/objectclass.c
+++ b/source4/dsdb/samdb/ldb_modules/objectclass.c
@@ -44,7 +44,6 @@
#include "auth/auth.h"
#include "param/param.h"
#include "../libds/common/flags.h"
-#include "dsdb/samdb/ldb_modules/schema.h"
#include "dsdb/samdb/ldb_modules/util.h"
struct oc_context {
@@ -469,8 +468,8 @@ static int objectclass_do_add(struct oc_context *ac)
* Get the new top-most structural object class and check for
* unrelated structural classes
*/
- objectclass = get_last_structural_class(ac->schema,
- objectclass_element);
+ objectclass = dsdb_get_last_structural_class(ac->schema,
+ objectclass_element);
if (objectclass == NULL) {
ldb_asprintf_errstring(ldb,
"Failed to find a structural class for %s",
@@ -954,7 +953,8 @@ static int objectclass_do_mod(struct oc_context *ac)
* Get the new top-most structural object class and check for
* unrelated structural classes
*/
- objectclass = get_last_structural_class(ac->schema, oc_el_entry);
+ objectclass = dsdb_get_last_structural_class(ac->schema,
+ oc_el_entry);
if (objectclass == NULL) {
ldb_set_errstring(ldb,
"objectclass: cannot delete all structural objectclasses!");
@@ -1130,7 +1130,8 @@ static int objectclass_do_rename2(struct oc_context *ac)
/* existing entry without a valid object class? */
return ldb_operr(ldb);
}
- objectclass = get_last_structural_class(ac->schema, oc_el_entry);
+ objectclass = dsdb_get_last_structural_class(ac->schema,
+ oc_el_entry);
if (objectclass == NULL) {
/* existing entry without a valid object class? */
return ldb_operr(ldb);
diff --git a/source4/dsdb/samdb/ldb_modules/schema.c b/source4/dsdb/samdb/ldb_modules/schema.c
deleted file mode 100644
index 233816f99a..0000000000
--- a/source4/dsdb/samdb/ldb_modules/schema.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Samba utility functions
-
- Copyright (C) Andrew Tridgell 2009
- Copyright (C) Andrew Bartlett <abartlet@samba.org> 2009
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-#include "ldb.h"
-#include "ldb_module.h"
-#include "librpc/ndr/libndr.h"
-#include "dsdb/samdb/ldb_modules/util.h"
-#include "dsdb/samdb/samdb.h"
-#include "dsdb/common/util.h"
-#include "libcli/security/security.h"
-#include "dsdb/samdb/ldb_modules/schema.h"
-
-/*
- * This function determines the (last) structural or 88 object class of a passed
- * "objectClass" attribute - per MS-ADTS 3.1.1.1.4 this is the last value.
- * Without schema this does not work and hence NULL is returned.
- */
-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;
-
- if (schema == NULL) {
- return NULL;
- }
-
- if (element->num_values == 0) {
- return NULL;
- }
-
- last_class = dsdb_class_by_lDAPDisplayName_ldb_val(schema,
- &element->values[element->num_values-1]);
- if (last_class == NULL) {
- return NULL;
- }
- if (last_class->objectClassCategory > 1) {
- return NULL;
- }
-
- return last_class;
-}
-
-
diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c
index 4e0001d17b..0f1a61236f 100644
--- a/source4/dsdb/samdb/ldb_modules/util.c
+++ b/source4/dsdb/samdb/ldb_modules/util.c
@@ -1362,3 +1362,33 @@ struct ldb_message_element *dsdb_get_single_valued_attr(const struct ldb_message
return el;
}
+
+/*
+ * This function determines the (last) structural or 88 object class of a passed
+ * "objectClass" attribute - per MS-ADTS 3.1.1.1.4 this is the last value.
+ * Without schema this does not work and hence NULL is returned.
+ */
+const struct dsdb_class *dsdb_get_last_structural_class(const struct dsdb_schema *schema,
+ const struct ldb_message_element *element)
+{
+ const struct dsdb_class *last_class;
+
+ if (schema == NULL) {
+ return NULL;
+ }
+
+ if (element->num_values == 0) {
+ return NULL;
+ }
+
+ last_class = dsdb_class_by_lDAPDisplayName_ldb_val(schema,
+ &element->values[element->num_values-1]);
+ if (last_class == NULL) {
+ return NULL;
+ }
+ if (last_class->objectClassCategory > 1) {
+ return NULL;
+ }
+
+ return last_class;
+}
diff --git a/source4/dsdb/samdb/ldb_modules/wscript_build b/source4/dsdb/samdb/ldb_modules/wscript_build
index 348ed3cd3e..120e50270d 100644
--- a/source4/dsdb/samdb/ldb_modules/wscript_build
+++ b/source4/dsdb/samdb/ldb_modules/wscript_build
@@ -2,7 +2,7 @@
bld.SAMBA_LIBRARY('dsdb-module',
source=[],
- deps='DSDB_MODULE_HELPERS DSDB_MODULE_HELPER_SCHEMA DSDB_MODULE_HELPER_RIDALLOC',
+ deps='DSDB_MODULE_HELPERS DSDB_MODULE_HELPER_RIDALLOC',
private_library=True,
grouping_library=True)
@@ -18,12 +18,6 @@ bld.SAMBA_SUBSYSTEM('DSDB_MODULE_HELPER_RIDALLOC',
deps='MESSAGING',
)
-bld.SAMBA_SUBSYSTEM('DSDB_MODULE_HELPER_SCHEMA',
- source='schema.c',
- autoproto='schema.h',
- deps='SAMDB_SCHEMA'
- )
-
bld.SAMBA_MODULE('ldb_samba_dsdb',
source='samba_dsdb.c',
subsystem='ldb',
@@ -230,7 +224,7 @@ bld.SAMBA_MODULE('ldb_objectclass',
init_function='ldb_objectclass_module_init',
module_init_name='ldb_init_module',
internal_module=False,
- deps='talloc samdb DSDB_MODULE_HELPERS samba-util DSDB_MODULE_HELPER_SCHEMA'
+ deps='talloc samdb DSDB_MODULE_HELPERS samba-util'
)
@@ -320,7 +314,7 @@ bld.SAMBA_MODULE('ldb_descriptor',
init_function='ldb_descriptor_module_init',
module_init_name='ldb_init_module',
internal_module=False,
- deps='talloc security NDR_SECURITY samdb DSDB_MODULE_HELPERS DSDB_MODULE_HELPER_SCHEMA'
+ deps='talloc security NDR_SECURITY samdb DSDB_MODULE_HELPERS'
)
@@ -340,7 +334,7 @@ bld.SAMBA_MODULE('ldb_acl',
init_function='ldb_acl_module_init',
module_init_name='ldb_init_module',
internal_module=False,
- deps='talloc security samdb DSDB_MODULE_HELPERS DSDB_MODULE_HELPER_SCHEMA'
+ deps='talloc security samdb DSDB_MODULE_HELPERS'
)
@@ -377,5 +371,5 @@ bld.SAMBA_MODULE('ldb_dirsync',
init_function='ldb_dirsync_module_init',
module_init_name='ldb_init_module',
internal_module=False,
- deps='talloc security samdb DSDB_MODULE_HELPERS DSDB_MODULE_HELPER_SCHEMA'
+ deps='talloc security samdb DSDB_MODULE_HELPERS'
)