summaryrefslogtreecommitdiff
path: root/source4/dsdb/schema/schema_set.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-09-12 21:31:56 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-09-12 21:31:56 +0200
commit218a1c8a671ef84614b7b36bbb67ef4b3589c4dc (patch)
tree425c8e8fa733d8f39cb6531fea882521fee9011b /source4/dsdb/schema/schema_set.c
parentfc23663f4b830709b65e03185a78ed917970b2b5 (diff)
parente4412a0470b18ea9e605f2afb00c23609102d59c (diff)
downloadsamba-218a1c8a671ef84614b7b36bbb67ef4b3589c4dc.tar.gz
samba-218a1c8a671ef84614b7b36bbb67ef4b3589c4dc.tar.bz2
samba-218a1c8a671ef84614b7b36bbb67ef4b3589c4dc.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into manpage
(This used to be commit eff27744d3dcb4f6bcdf9bd03583bb38634c398d)
Diffstat (limited to 'source4/dsdb/schema/schema_set.c')
-rw-r--r--source4/dsdb/schema/schema_set.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/source4/dsdb/schema/schema_set.c b/source4/dsdb/schema/schema_set.c
index 3f5ddd8446..2303b88a05 100644
--- a/source4/dsdb/schema/schema_set.c
+++ b/source4/dsdb/schema/schema_set.c
@@ -79,13 +79,13 @@ static int dsdb_schema_set_attributes(struct ldb_context *ldb, struct dsdb_schem
ret = ldb_msg_add_string(msg, attr->lDAPDisplayName, "CASE_INSENSITIVE");
}
if (ret != LDB_SUCCESS) {
- return ret;
+ break;
}
if (attr->searchFlags & SEARCH_FLAG_ATTINDEX) {
ret = ldb_msg_add_string(msg_idx, "@IDXATTR", attr->lDAPDisplayName);
if (ret != LDB_SUCCESS) {
- return ret;
+ break;
}
}
@@ -105,11 +105,11 @@ static int dsdb_schema_set_attributes(struct ldb_context *ldb, struct dsdb_schem
}
if (ret != LDB_SUCCESS) {
- return ret;
+ break;
}
}
- if (!write_attributes) {
+ if (!write_attributes || ret != LDB_SUCCESS) {
talloc_free(mem_ctx);
return ret;
}
@@ -120,19 +120,13 @@ static int dsdb_schema_set_attributes(struct ldb_context *ldb, struct dsdb_schem
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
ret = ldb_add(ldb, msg);
} else if (ret != LDB_SUCCESS) {
- talloc_free(mem_ctx);
- return ret;
+ } else if (res->count != 1) {
+ ret = ldb_add(ldb, msg);
} else {
-
- if (res->count != 1) {
- talloc_free(mem_ctx);
- return LDB_ERR_NO_SUCH_OBJECT;
- }
-
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);
@@ -141,10 +135,11 @@ static int dsdb_schema_set_attributes(struct ldb_context *ldb, struct dsdb_schem
if (ret == LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS) {
/* We might be on a read-only DB */
+ ret = LDB_SUCCESS;
+ }
+ if (ret != LDB_SUCCESS) {
talloc_free(mem_ctx);
return ret;
- } else if (ret != LDB_SUCCESS) {
- return ret;
}
/* Now write out the indexs, as found in the schema (if they have changed) */
@@ -153,14 +148,10 @@ static int dsdb_schema_set_attributes(struct ldb_context *ldb, struct dsdb_schem
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
ret = ldb_add(ldb, msg_idx);
} else if (ret != LDB_SUCCESS) {
- talloc_free(mem_ctx);
- return ret;
+ } else if (res->count != 1) {
+ ret = ldb_add(ldb, msg_idx);
} else {
- if (res_idx->count != 1) {
- talloc_free(mem_ctx);
- return LDB_ERR_NO_SUCH_OBJECT;
- }
-
+ ret = LDB_SUCCESS;
/* Annoyingly added to our search results */
ldb_msg_remove_attr(res_idx->msgs[0], "distinguishedName");
@@ -171,7 +162,6 @@ static int dsdb_schema_set_attributes(struct ldb_context *ldb, struct dsdb_schem
}
if (ret == LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS) {
/* We might be on a read-only DB */
- talloc_free(mem_ctx);
ret = LDB_SUCCESS;
}
talloc_free(mem_ctx);