s4:remove the "validate_update" LDB module - the task is now handled by the far more...
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Sat, 5 Jun 2010 17:09:51 +0000 (19:09 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Mon, 7 Jun 2010 12:47:23 +0000 (14:47 +0200)
source4/dsdb/samdb/ldb_modules/samba_dsdb.c
source4/dsdb/samdb/ldb_modules/validate_update.c [deleted file]
source4/dsdb/samdb/ldb_modules/wscript_build
source4/dsdb/schema/schema_syntax.c

index ebd2f13ab619b14d6ac3957683c0416e91c4e5ec..3c9fd75651e66f36ab67256f8aae046babfd8f65 100644 (file)
@@ -182,7 +182,6 @@ static int samba_dsdb_init(struct ldb_module *module)
                                             "password_hash",
                                             "operational",
                                             "objectclass_attrs",
-                                            "validate_update",
                                             "kludge_acl",
                                             "schema_load",
                                             "instancetype",
diff --git a/source4/dsdb/samdb/ldb_modules/validate_update.c b/source4/dsdb/samdb/ldb_modules/validate_update.c
deleted file mode 100644 (file)
index 3615ff7..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
-   ldb database library
-
-   Copyright (C) Stefan Metzmacher <metze@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_module.h"
-#include "dsdb/samdb/samdb.h"
-
-static int validate_update_message(struct ldb_context *ldb,
-                                  struct dsdb_schema *schema,
-                                  const struct ldb_message *msg)
-{
-       int i;
-
-       for (i=0; i < msg->num_elements; i++) {
-               WERROR werr;
-
-               werr = dsdb_attribute_validate_ldb(ldb, schema,
-                                                  &msg->elements[i]);
-               if (!W_ERROR_IS_OK(werr)) {
-                       int j;
-
-                       ldb_debug(ldb, LDB_DEBUG_ERROR,
-                                 "TODO: object[%s] add/modify attribute[%d|%s] num_values[%d] - %s\n",
-                                 ldb_dn_get_linearized(msg->dn),
-                                 i, msg->elements[i].name,
-                                 msg->elements[i].num_values,
-                                 win_errstr(werr));
-
-                       for (j=0; j < msg->elements[i].num_values; j++) {
-                               ldb_debug(ldb, LDB_DEBUG_ERROR,
-                                         "TODO: value[%lu] len[%lu]\n", (long unsigned int)j,
-                                         (long unsigned int)msg->elements[i].values[j].length);
-                               dump_data(0,
-                                         msg->elements[i].values[j].data,
-                                         msg->elements[i].values[j].length);
-                       }
-
-                       return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX;
-               }
-       }
-
-       return LDB_SUCCESS;
-}
-
-static int validate_update_add(struct ldb_module *module, struct ldb_request *req)
-{
-       struct ldb_context *ldb;
-       struct dsdb_schema *schema;
-       int ret;
-
-       ldb = ldb_module_get_ctx(module);
-       schema = dsdb_get_schema(ldb, NULL);
-
-       if (!schema) {
-               return ldb_next_request(module, req);
-       }
-
-       /* do not manipulate our control entries */
-       if (ldb_dn_is_special(req->op.add.message->dn)) {
-               return ldb_next_request(module, req);
-       }
-
-       ret = validate_update_message(ldb, schema,
-                                     req->op.add.message);
-       if (ret != LDB_SUCCESS) {
-               return ret;
-       }
-
-       return ldb_next_request(module, req);
-}
-
-static int validate_update_modify(struct ldb_module *module, struct ldb_request *req)
-{
-       struct ldb_context *ldb;
-       struct dsdb_schema *schema;
-       int ret;
-
-       ldb = ldb_module_get_ctx(module);
-       schema = dsdb_get_schema(ldb, NULL);
-
-       if (!schema) {
-               return ldb_next_request(module, req);
-       }
-
-       /* do not manipulate our control entries */
-       if (ldb_dn_is_special(req->op.mod.message->dn)) {
-               return ldb_next_request(module, req);
-       }
-
-       ret = validate_update_message(ldb, schema,
-                                     req->op.mod.message);
-       if (ret != LDB_SUCCESS) {
-               return ret;
-       }
-
-       return ldb_next_request(module, req);
-}
-
-_PUBLIC_ const struct ldb_module_ops ldb_validate_update_module_ops = {
-       .name           = "validate_update",
-       .add            = validate_update_add,
-       .modify         = validate_update_modify,
-};
-
index dfcc2665eb138422fd6f5fd2d7621bb1c4bf50b7..b6f287d91d03d5f693d9777b3a5a50da93dbf786 100644 (file)
@@ -306,10 +306,3 @@ bld.SAMBA_MODULE('ldb_lazy_commit',
        )
 
 
-bld.SAMBA_MODULE('ldb_validate_update',
-       source='validate_update.c',
-       subsystem='LIBLDB',
-       init_function='LDB_MODULE(validate_update)',
-       deps='talloc LIBEVENTS LIBSECURITY SAMDB'
-       )
-
index e3ccab090439c63e82386295f16b4ac825d42160..51c1b29f355b5ab49c9ce2ba64fe3131c0936a2a 100644 (file)
@@ -2554,16 +2554,3 @@ WERROR dsdb_attribute_ldb_to_drsuapi(struct ldb_context *ldb,
        return sa->syntax->ldb_to_drsuapi(ldb, schema, sa, in, mem_ctx, out);
 }
 
-WERROR dsdb_attribute_validate_ldb(struct ldb_context *ldb,
-                                  const struct dsdb_schema *schema,
-                                  const struct ldb_message_element *in)
-{
-       const struct dsdb_attribute *sa;
-
-       sa = dsdb_attribute_by_lDAPDisplayName(schema, in->name);
-       if (!sa) {
-               return WERR_DS_ATTRIBUTE_TYPE_UNDEFINED;
-       }
-
-       return sa->syntax->validate_ldb(ldb, schema, sa, in);
-}