ldb/tdb: let the caller pass ldb_schema_attribute to msg_delete_element()
authorStefan Metzmacher <metze@samba.org>
Tue, 10 Sep 2013 09:02:43 +0000 (11:02 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 25 Sep 2013 08:34:32 +0000 (10:34 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/ldb_tdb/ldb_tdb.c

index 1994f45e670e902f54e7b79397b8c5d7c3e63506..e427cab2b58da8dd35337e29baec85b96caf6169 100644 (file)
@@ -602,6 +602,7 @@ static int msg_delete_attribute(struct ldb_module *module,
 */
 static int msg_delete_element(struct ldb_module *module,
                              struct ldb_message *msg,
+                             const struct ldb_schema_attribute *a,
                              const char *name,
                              const struct ldb_val *val)
 {
@@ -609,7 +610,6 @@ static int msg_delete_element(struct ldb_module *module,
        unsigned int i;
        int found, ret;
        struct ldb_message_element *el;
-       const struct ldb_schema_attribute *a;
 
        found = find_element(msg, name);
        if (found == -1) {
@@ -619,8 +619,6 @@ static int msg_delete_element(struct ldb_module *module,
        i = (unsigned int) found;
        el = &(msg->elements[i]);
 
-       a = ldb_schema_attribute_by_name(ldb, el->name);
-
        for (i=0;i<el->num_values;i++) {
                bool matched;
                if (a->syntax->operator_fn) {
@@ -932,6 +930,7 @@ int ltdb_modify_internal(struct ldb_module *module,
                                for (j=0; j < msg->elements[i].num_values; j++) {
                                        ret = msg_delete_element(module,
                                                                 msg2,
+                                                                a,
                                                                 msg->elements[i].name,
                                                                 &msg->elements[i].values[j]);
                                        if (ret == LDB_ERR_NO_SUCH_ATTRIBUTE &&