Stop every ldb startup doing a write to the database.
authorAndrew Bartlett <abartlet@samba.org>
Thu, 21 Aug 2008 06:42:03 +0000 (16:42 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 21 Aug 2008 06:42:03 +0000 (16:42 +1000)
Something in the search stack adds a distinguisedName record, which
isn't in the message we generate.  So we compare, fail and rewrite the
record - every time ldb starts up...

Andrew Bartlett

source/dsdb/schema/schema_set.c

index f4daf66794154bc2d994ac773038b6d2f59a3adc..0ca26c0fc71404be4f1825ca0b5da9c6a33d69f2 100644 (file)
@@ -114,6 +114,7 @@ static int dsdb_schema_set_attributes(struct ldb_context *ldb, struct dsdb_schem
                return ret;
        }
 
+
        ret = ldb_transaction_start(ldb);
        if (ret != LDB_SUCCESS) {
                return ret;
@@ -136,6 +137,9 @@ static int dsdb_schema_set_attributes(struct ldb_context *ldb, struct dsdb_schem
                }
                
                ret = LDB_SUCCESS;
+               /* Annoyingly added to our search results */
+               ldb_msg_remove_attr(res->msgs[0], "distinguishedName");
+
                mod_msg = ldb_msg_diff(ldb, res->msgs[0], msg);
                if (mod_msg->num_elements > 0) {
                        ret = ldb_modify(ldb, mod_msg);
@@ -168,6 +172,9 @@ static int dsdb_schema_set_attributes(struct ldb_context *ldb, struct dsdb_schem
                        return LDB_ERR_NO_SUCH_OBJECT;
                }
                
+               /* Annoyingly added to our search results */
+               ldb_msg_remove_attr(res_idx->msgs[0], "distinguishedName");
+
                mod_msg = ldb_msg_diff(ldb, res_idx->msgs[0], msg_idx);
                if (mod_msg->num_elements > 0) {
                        ret = ldb_modify(ldb, mod_msg);