diff options
Diffstat (limited to 'source4/dsdb')
-rw-r--r-- | source4/dsdb/common/sidmap.c | 22 | ||||
-rw-r--r-- | source4/dsdb/repl/drepl_service.c | 10 | ||||
-rw-r--r-- | source4/dsdb/repl/replicated_objects.c | 4 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/extended_dn.c | 7 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/instancetype.c | 2 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/kludge_acl.c | 5 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/ranged_results.c | 6 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 161 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/samldb.c | 6 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/schema_fsmo.c | 2 | ||||
-rw-r--r-- | source4/dsdb/samdb/samdb.c | 6 | ||||
-rw-r--r-- | source4/dsdb/schema/schema_syntax.c | 4 |
12 files changed, 80 insertions, 155 deletions
diff --git a/source4/dsdb/common/sidmap.c b/source4/dsdb/common/sidmap.c index 5c170463bb..088dc6bd96 100644 --- a/source4/dsdb/common/sidmap.c +++ b/source4/dsdb/common/sidmap.c @@ -123,10 +123,10 @@ static NTSTATUS sidmap_primary_domain_sid(struct sidmap_context *sidmap, /* map a sid to a unix uid */ -_PUBLIC_ NTSTATUS sidmap_sid_to_unixuid(struct sidmap_context *sidmap, - struct dom_sid *sid, uid_t *uid) +_PUBLIC_ NTSTATUS sidmap_sid_to_unixuid(struct sidmap_context *sidmap, + const struct dom_sid *sid, uid_t *uid) { - const char *attrs[] = { "sAMAccountName", "uidNumber", + const char *attrs[] = { "sAMAccountName", "uidNumber", "sAMAccountType", "unixName", NULL }; int ret; const char *s; @@ -137,15 +137,17 @@ _PUBLIC_ NTSTATUS sidmap_sid_to_unixuid(struct sidmap_context *sidmap, tmp_ctx = talloc_new(sidmap); - ret = gendb_search(sidmap->samctx, tmp_ctx, NULL, &res, attrs, - "objectSid=%s", ldap_encode_ndr_dom_sid(tmp_ctx, sid)); + ret = gendb_search(sidmap->samctx, tmp_ctx, NULL, &res, attrs, + "objectSid=%s", + ldap_encode_ndr_dom_sid(tmp_ctx, sid)); + if (ret != 1) { goto allocated_sid; } /* make sure its a user, not a group */ if (!is_user_account(res[0])) { - DEBUG(0,("sid_to_unixuid: sid %s is not an account!\n", + DEBUG(0,("sid_to_unixuid: sid %s is not an account!\n", dom_sid_string(tmp_ctx, sid))); talloc_free(tmp_ctx); return NT_STATUS_INVALID_SID; @@ -261,9 +263,9 @@ _PUBLIC_ bool sidmap_sid_is_group(struct sidmap_context *sidmap, struct dom_sid map a sid to a unix gid */ _PUBLIC_ NTSTATUS sidmap_sid_to_unixgid(struct sidmap_context *sidmap, - struct dom_sid *sid, gid_t *gid) + const struct dom_sid *sid, gid_t *gid) { - const char *attrs[] = { "sAMAccountName", "gidNumber", + const char *attrs[] = { "sAMAccountName", "gidNumber", "unixName", "sAMAccountType", NULL }; int ret; const char *s; @@ -355,7 +357,7 @@ allocated_sid: */ _PUBLIC_ NTSTATUS sidmap_uid_to_sid(struct sidmap_context *sidmap, TALLOC_CTX *mem_ctx, - uid_t uid, struct dom_sid **sid) + const uid_t uid, struct dom_sid **sid) { const char *attrs[] = { "sAMAccountName", "objectSid", "sAMAccountType", NULL }; int ret, i; @@ -453,7 +455,7 @@ allocate_sid: */ _PUBLIC_ NTSTATUS sidmap_gid_to_sid(struct sidmap_context *sidmap, TALLOC_CTX *mem_ctx, - gid_t gid, struct dom_sid **sid) + const gid_t gid, struct dom_sid **sid) { const char *attrs[] = { "sAMAccountName", "objectSid", "sAMAccountType", NULL }; int ret, i; diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index e212407e24..3375059e99 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -181,17 +181,9 @@ static void dreplsrv_task_init(struct task_server *task) } /* - initialise the dsdb replicator service - */ -static NTSTATUS dreplsrv_init(struct event_context *event_ctx, struct loadparm_context *lp_ctx, const struct model_ops *model_ops) -{ - return task_server_startup(event_ctx, lp_ctx, model_ops, dreplsrv_task_init); -} - -/* register ourselves as a available server */ NTSTATUS server_service_drepl_init(void) { - return register_server_service("drepl", dreplsrv_init); + return register_server_service("drepl", dreplsrv_task_init); } diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c index 8aff1340a5..552d83f411 100644 --- a/source4/dsdb/repl/replicated_objects.c +++ b/source4/dsdb/repl/replicated_objects.c @@ -400,8 +400,8 @@ WERROR dsdb_extended_replicated_objects_commit(struct ldb_context *ldb, ret = ldb_extended(ldb, DSDB_EXTENDED_REPLICATED_OBJECTS_OID, out, &ext_res); if (ret != LDB_SUCCESS) { - DEBUG(0,("Failed to apply records: %d: %s\n", - ret, ldb_strerror(ret))); + DEBUG(0,("Failed to apply records: %s: %s\n", + ldb_errstring(ldb), ldb_strerror(ret))); talloc_free(out); return WERR_FOOBAR; } diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn.c b/source4/dsdb/samdb/ldb_modules/extended_dn.c index b62e806398..802f86570b 100644 --- a/source4/dsdb/samdb/ldb_modules/extended_dn.c +++ b/source4/dsdb/samdb/ldb_modules/extended_dn.c @@ -256,6 +256,7 @@ static int extended_search(struct ldb_module *module, struct ldb_request *req) ac = talloc(req, struct extended_context); if (ac == NULL) { + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } @@ -273,6 +274,7 @@ static int extended_search(struct ldb_module *module, struct ldb_request *req) down_req = talloc_zero(req, struct ldb_request); if (down_req == NULL) { + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } @@ -291,8 +293,10 @@ static int extended_search(struct ldb_module *module, struct ldb_request *req) } if (ac->remove_guid || ac->remove_sid) { new_attrs = copy_attrs(down_req, req->op.search.attrs); - if (new_attrs == NULL) + if (new_attrs == NULL) { + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; + } if (ac->remove_guid) { if (!add_attrs(down_req, &new_attrs, "objectGUID")) @@ -339,6 +343,7 @@ static int extended_init(struct ldb_module *module) req = talloc(module, struct ldb_request); if (req == NULL) { + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } diff --git a/source4/dsdb/samdb/ldb_modules/instancetype.c b/source4/dsdb/samdb/ldb_modules/instancetype.c index 064c28ec65..65df294e90 100644 --- a/source4/dsdb/samdb/ldb_modules/instancetype.c +++ b/source4/dsdb/samdb/ldb_modules/instancetype.c @@ -72,6 +72,7 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req) down_req = talloc(req, struct ldb_request); if (down_req == NULL) { + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } @@ -81,6 +82,7 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req) down_req->op.add.message = msg = ldb_msg_copy_shallow(down_req, req->op.add.message); if (msg == NULL) { talloc_free(down_req); + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } diff --git a/source4/dsdb/samdb/ldb_modules/kludge_acl.c b/source4/dsdb/samdb/ldb_modules/kludge_acl.c index 97130495a3..ea33548b91 100644 --- a/source4/dsdb/samdb/ldb_modules/kludge_acl.c +++ b/source4/dsdb/samdb/ldb_modules/kludge_acl.c @@ -316,6 +316,7 @@ static int kludge_acl_search(struct ldb_module *module, struct ldb_request *req) ac = talloc(req, struct kludge_acl_context); if (ac == NULL) { + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } @@ -329,6 +330,7 @@ static int kludge_acl_search(struct ldb_module *module, struct ldb_request *req) down_req = talloc_zero(req, struct ldb_request); if (down_req == NULL) { + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } @@ -417,6 +419,7 @@ static int kludge_acl_init(struct ldb_module *module) data = talloc(module, struct kludge_private_data); if (data == NULL) { + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } @@ -424,6 +427,7 @@ static int kludge_acl_init(struct ldb_module *module) module->private_data = data; if (!mem_ctx) { + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } @@ -453,6 +457,7 @@ static int kludge_acl_init(struct ldb_module *module) data->password_attrs = talloc_array(data, const char *, password_attributes->num_values + 1); if (!data->password_attrs) { talloc_free(mem_ctx); + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } for (i=0; i < password_attributes->num_values; i++) { diff --git a/source4/dsdb/samdb/ldb_modules/ranged_results.c b/source4/dsdb/samdb/ldb_modules/ranged_results.c index 345b8b8440..c527afc6db 100644 --- a/source4/dsdb/samdb/ldb_modules/ranged_results.c +++ b/source4/dsdb/samdb/ldb_modules/ranged_results.c @@ -153,8 +153,10 @@ static int rr_search(struct ldb_module *module, struct ldb_request *req) if (strncasecmp(p, ";range=", strlen(";range=")) != 0) { continue; } - if (sscanf(p, ";range=%u-*", &start) == 1) { - } else if (sscanf(p, ";range=%u-%u", &start, &end) != 2) { + if (sscanf(p, ";range=%u-%u", &start, &end) == 2) { + } else if (sscanf(p, ";range=%u-*", &start) == 1) { + end = (unsigned int)-1; + } else { ldb_asprintf_errstring(module->ldb, "range request error: range requst malformed"); return LDB_ERR_UNWILLING_TO_PERFORM; } diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 5a3cc4bef4..441dbc9598 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -240,12 +240,9 @@ static int replmd_prepare_originating(struct ldb_module *module, struct ldb_requ struct ldb_dn *dn, const char *fn_name, int (*fn)(struct ldb_module *, struct ldb_request *, - const struct dsdb_schema *, - const struct dsdb_control_current_partition *)) + const struct dsdb_schema *)) { const struct dsdb_schema *schema; - const struct ldb_control *partition_ctrl; - const struct dsdb_control_current_partition *partition; /* do not manipulate our control entries */ if (ldb_dn_is_special(dn)) { @@ -260,46 +257,16 @@ static int replmd_prepare_originating(struct ldb_module *module, struct ldb_requ return LDB_ERR_CONSTRAINT_VIOLATION; } - partition_ctrl = ldb_request_get_control(req, DSDB_CONTROL_CURRENT_PARTITION_OID); - if (!partition_ctrl) { - ldb_debug_set(module->ldb, LDB_DEBUG_FATAL, - "%s: no current partition control found", - fn_name); - return LDB_ERR_CONSTRAINT_VIOLATION; - } - - partition = talloc_get_type(partition_ctrl->data, - struct dsdb_control_current_partition); - if (!partition) { - ldb_debug_set(module->ldb, LDB_DEBUG_FATAL, - "%s: current partition control contains invalid data", - fn_name); - return LDB_ERR_CONSTRAINT_VIOLATION; - } - - if (partition->version != DSDB_CONTROL_CURRENT_PARTITION_VERSION) { - ldb_debug_set(module->ldb, LDB_DEBUG_FATAL, - "%s: current partition control contains invalid version [%u != %u]\n", - fn_name, partition->version, DSDB_CONTROL_CURRENT_PARTITION_VERSION); - return LDB_ERR_CONSTRAINT_VIOLATION; - } - - return fn(module, req, schema, partition); + return fn(module, req, schema); } static int replmd_add_originating(struct ldb_module *module, struct ldb_request *req, - const struct dsdb_schema *schema, - const struct dsdb_control_current_partition *partition) + const struct dsdb_schema *schema) { enum ndr_err_code ndr_err; struct ldb_request *down_req; struct ldb_message *msg; - uint32_t instance_type; - struct ldb_dn *new_dn; - const char *rdn_name; - const char *rdn_name_upper; - const struct ldb_val *rdn_value = NULL; const struct dsdb_attribute *rdn_attr = NULL; struct GUID guid; struct ldb_val guid_value; @@ -321,12 +288,6 @@ static int replmd_add_originating(struct ldb_module *module, return LDB_ERR_UNWILLING_TO_PERFORM; } - if (ldb_msg_find_element(req->op.add.message, "instanceType")) { - ldb_debug_set(module->ldb, LDB_DEBUG_ERROR, - "replmd_add_originating: it's not allowed to add an object with instanceType\n"); - return LDB_ERR_UNWILLING_TO_PERFORM; - } - /* Get a sequence number from the backend */ ret = ldb_sequence_number(module->ldb, LDB_SEQ_NEXT, &seq_num); if (ret != LDB_SUCCESS) { @@ -368,32 +329,9 @@ static int replmd_add_originating(struct ldb_module *module, return LDB_ERR_OPERATIONS_ERROR; } - /* - * get details of the rdn name - */ - rdn_name = ldb_dn_get_rdn_name(msg->dn); - if (!rdn_name) { - talloc_free(down_req); - ldb_oom(module->ldb); - return LDB_ERR_OPERATIONS_ERROR; - } - rdn_attr = dsdb_attribute_by_lDAPDisplayName(schema, rdn_name); - if (!rdn_attr) { - talloc_free(down_req); - return LDB_ERR_OPERATIONS_ERROR; - } - rdn_value = ldb_dn_get_rdn_val(msg->dn); - if (!rdn_value) { - talloc_free(down_req); - ldb_oom(module->ldb); - return LDB_ERR_OPERATIONS_ERROR; - } - /* * remove autogenerated attributes */ - ldb_msg_remove_attr(msg, rdn_name); - ldb_msg_remove_attr(msg, "name"); ldb_msg_remove_attr(msg, "whenCreated"); ldb_msg_remove_attr(msg, "whenChanged"); ldb_msg_remove_attr(msg, "uSNCreated"); @@ -401,69 +339,14 @@ static int replmd_add_originating(struct ldb_module *module, ldb_msg_remove_attr(msg, "replPropertyMetaData"); /* - * TODO: construct a new DN out of: - * - the parent DN - * - the upper case of rdn_attr->LDAPDisplayName - * - rdn_value - */ - new_dn = ldb_dn_copy(msg, msg->dn); - if (!new_dn) { - talloc_free(down_req); - ldb_oom(module->ldb); - return LDB_ERR_OPERATIONS_ERROR; - } - rdn_name_upper = strupper_talloc(msg, rdn_attr->lDAPDisplayName); - if (!rdn_name_upper) { - talloc_free(down_req); - ldb_oom(module->ldb); - return LDB_ERR_OPERATIONS_ERROR; - } - ret = ldb_dn_set_component(new_dn, 0, rdn_name_upper, *rdn_value); - if (ret != LDB_SUCCESS) { - talloc_free(down_req); - ldb_oom(module->ldb); - return LDB_ERR_OPERATIONS_ERROR; - } - msg->dn = new_dn; - - /* - * TODO: calculate correct instance type - */ - instance_type = INSTANCE_TYPE_WRITE; - if (ldb_dn_compare(partition->dn, msg->dn) == 0) { - instance_type |= INSTANCE_TYPE_IS_NC_HEAD; - if (ldb_dn_compare(msg->dn, samdb_base_dn(module->ldb)) != 0) { - instance_type |= INSTANCE_TYPE_NC_ABOVE; - } - } - - /* * readd replicated attributes */ - ret = ldb_msg_add_value(msg, rdn_attr->lDAPDisplayName, rdn_value, NULL); - if (ret != LDB_SUCCESS) { - talloc_free(down_req); - ldb_oom(module->ldb); - return LDB_ERR_OPERATIONS_ERROR; - } - ret = ldb_msg_add_value(msg, "name", rdn_value, NULL); - if (ret != LDB_SUCCESS) { - talloc_free(down_req); - ldb_oom(module->ldb); - return LDB_ERR_OPERATIONS_ERROR; - } ret = ldb_msg_add_string(msg, "whenCreated", time_str); if (ret != LDB_SUCCESS) { talloc_free(down_req); ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } - ret = ldb_msg_add_fmt(msg, "instanceType", "%u", instance_type); - if (ret != LDB_SUCCESS) { - talloc_free(down_req); - ldb_oom(module->ldb); - return LDB_ERR_OPERATIONS_ERROR; - } /* build the replication meta_data */ ZERO_STRUCT(nmd); @@ -508,6 +391,10 @@ static int replmd_add_originating(struct ldb_module *module, m->originating_usn = seq_num; m->local_usn = seq_num; ni++; + + if (ldb_attr_cmp(e->name, ldb_dn_get_rdn_name(msg->dn))) { + rdn_attr = sa; + } } /* fix meta data count */ @@ -598,8 +485,7 @@ static int replmd_add(struct ldb_module *module, struct ldb_request *req) static int replmd_modify_originating(struct ldb_module *module, struct ldb_request *req, - const struct dsdb_schema *schema, - const struct dsdb_control_current_partition *partition) + const struct dsdb_schema *schema) { struct ldb_request *down_req; struct ldb_message *msg; @@ -623,6 +509,18 @@ static int replmd_modify_originating(struct ldb_module *module, return LDB_ERR_OPERATIONS_ERROR; } + /* TODO: + * - get the whole old object + * - if the old object doesn't exist report an error + * - give an error when a readonly attribute should + * be modified + * - merge the changed into the old object + * if the caller set values to the same value + * ignore the attribute, return success when no + * attribute was changed + * - calculate the new replPropertyMetaData attribute + */ + if (add_time_element(msg, "whenChanged", t) != 0) { talloc_free(down_req); return LDB_ERR_OPERATIONS_ERROR; @@ -637,6 +535,11 @@ static int replmd_modify_originating(struct ldb_module *module, } } + /* TODO: + * - sort the attributes by attid with replmd_ldb_message_sort() + * - replace the old object with the newly constructed one + */ + ldb_set_timeout_from_prev_req(module->ldb, req, down_req); /* go on with the call chain */ @@ -806,10 +709,16 @@ static int replmd_replicated_apply_add(struct replmd_replicated_request *ar) return ldb_next_request(ar->module, ar->sub.change_req); #else ret = ldb_next_request(ar->module, ar->sub.change_req); - if (ret != LDB_SUCCESS) return replmd_replicated_request_error(ar, ret); + if (ret != LDB_SUCCESS) { + ldb_asprintf_errstring(ar->module->ldb, "Failed to add replicated object %s: %s", ldb_dn_get_linearized(ar->sub.change_req->op.add.message->dn), + ldb_errstring(ar->module->ldb)); + return replmd_replicated_request_error(ar, ret); + } - ar->sub.change_ret = ldb_wait(ar->sub.search_req->handle, LDB_WAIT_ALL); + ar->sub.change_ret = ldb_wait(ar->sub.change_req->handle, LDB_WAIT_ALL); if (ar->sub.change_ret != LDB_SUCCESS) { + ldb_asprintf_errstring(ar->module->ldb, "Failed while waiting on add replicated object %s: %s", ldb_dn_get_linearized(ar->sub.change_req->op.add.message->dn), + ldb_errstring(ar->module->ldb)); return replmd_replicated_request_error(ar, ar->sub.change_ret); } @@ -1053,7 +962,7 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar) ret = ldb_next_request(ar->module, ar->sub.change_req); if (ret != LDB_SUCCESS) return replmd_replicated_request_error(ar, ret); - ar->sub.change_ret = ldb_wait(ar->sub.search_req->handle, LDB_WAIT_ALL); + ar->sub.change_ret = ldb_wait(ar->sub.change_req->handle, LDB_WAIT_ALL); if (ar->sub.change_ret != LDB_SUCCESS) { return replmd_replicated_request_error(ar, ar->sub.change_ret); } @@ -1137,7 +1046,7 @@ static int replmd_replicated_apply_search(struct replmd_replicated_request *ar) if (ret != LDB_SUCCESS) return replmd_replicated_request_error(ar, ret); ar->sub.search_ret = ldb_wait(ar->sub.search_req->handle, LDB_WAIT_ALL); - if (ar->sub.search_ret != LDB_SUCCESS) { + if (ar->sub.search_ret != LDB_SUCCESS && ar->sub.search_ret != LDB_ERR_NO_SUCH_OBJECT) { return replmd_replicated_request_error(ar, ar->sub.search_ret); } if (ar->sub.search_msg) { diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index 8a80260a69..baf419c750 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -72,7 +72,7 @@ static int samldb_set_next_rid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, if (new_id == 0) { /* out of IDs ! */ - ldb_debug(ldb, LDB_DEBUG_FATAL, "Are we out of valid IDs ?\n"); + ldb_set_errstring(ldb, "Are we out of valid IDs ?\n"); return LDB_ERR_OPERATIONS_ERROR; } @@ -81,6 +81,7 @@ static int samldb_set_next_rid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, ZERO_STRUCT(msg); msg.dn = ldb_dn_copy(mem_ctx, dn); if (!msg.dn) { + ldb_oom(ldb); return LDB_ERR_OPERATIONS_ERROR; } msg.num_elements = 2; @@ -91,6 +92,7 @@ static int samldb_set_next_rid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, els[0].flags = LDB_FLAG_MOD_DELETE; els[0].name = talloc_strdup(mem_ctx, "nextRid"); if (!els[0].name) { + ldb_oom(ldb); return LDB_ERR_OPERATIONS_ERROR; } @@ -101,12 +103,14 @@ static int samldb_set_next_rid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, vals[0].data = (uint8_t *)talloc_asprintf(mem_ctx, "%u", old_id); if (!vals[0].data) { + ldb_oom(ldb); return LDB_ERR_OPERATIONS_ERROR; } vals[0].length = strlen((char *)vals[0].data); vals[1].data = (uint8_t *)talloc_asprintf(mem_ctx, "%u", new_id); if (!vals[1].data) { + ldb_oom(ldb); return LDB_ERR_OPERATIONS_ERROR; } vals[1].length = strlen((char *)vals[1].data); diff --git a/source4/dsdb/samdb/ldb_modules/schema_fsmo.c b/source4/dsdb/samdb/ldb_modules/schema_fsmo.c index 559c91bd2d..f9dd131fd4 100644 --- a/source4/dsdb/samdb/ldb_modules/schema_fsmo.c +++ b/source4/dsdb/samdb/ldb_modules/schema_fsmo.c @@ -59,6 +59,7 @@ static int schema_fsmo_init(struct ldb_module *module) schema_dn = samdb_schema_dn(module->ldb); if (!schema_dn) { + ldb_reset_err_string(module->ldb); ldb_debug(module->ldb, LDB_DEBUG_WARNING, "schema_fsmo_init: no schema dn present: (skip schema loading)\n"); return ldb_next_init(module); @@ -91,6 +92,7 @@ static int schema_fsmo_init(struct ldb_module *module) NULL, schema_attrs, &schema_res); if (ret == LDB_ERR_NO_SUCH_OBJECT) { + ldb_reset_err_string(module->ldb); ldb_debug(module->ldb, LDB_DEBUG_WARNING, "schema_fsmo_init: no schema head present: (skip schema loading)\n"); talloc_free(mem_ctx); diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c index c11eea1757..a01e442587 100644 --- a/source4/dsdb/samdb/samdb.c +++ b/source4/dsdb/samdb/samdb.c @@ -103,8 +103,8 @@ int samdb_copy_template(struct ldb_context *ldb, if (!templates_ldb) { templates_ldb_path = samdb_relative_path(ldb, - msg, - "templates.ldb"); + msg, + "templates.ldb"); if (!templates_ldb_path) { *errstring = talloc_asprintf(msg, "samdb_copy_template: ERROR: Failed to contruct path for template db"); return LDB_ERR_OPERATIONS_ERROR; @@ -115,6 +115,8 @@ int samdb_copy_template(struct ldb_context *ldb, NULL, 0, NULL); talloc_free(templates_ldb_path); if (!templates_ldb) { + *errstring = talloc_asprintf(msg, "samdb_copy_template: ERROR: Failed to connect to templates db at: %s", + templates_ldb_path); return LDB_ERR_OPERATIONS_ERROR; } diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c index 9bc51c676e..2c133b6424 100644 --- a/source4/dsdb/schema/schema_syntax.c +++ b/source4/dsdb/schema/schema_syntax.c @@ -939,7 +939,7 @@ static WERROR dsdb_syntax_DN_BINARY_drsuapi_to_ldb(const struct dsdb_schema *sch } ndr_err = ndr_pull_struct_blob_all(in->value_ctr.values[i].blob, - out->values, NULL, &id3b, + out->values, lp_iconv_convenience(global_loadparm), &id3b, (ndr_pull_flags_fn_t)ndr_pull_drsuapi_DsReplicaObjectIdentifier3Binary); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { NTSTATUS status = ndr_map_error2ntstatus(ndr_err); @@ -997,7 +997,7 @@ static WERROR dsdb_syntax_DN_BINARY_ldb_to_drsuapi(const struct dsdb_schema *sch id3b.dn = (const char *)in->values[i].data; id3b.binary = data_blob(NULL, 0); - ndr_err = ndr_push_struct_blob(&blobs[i], blobs, NULL, &id3b, + ndr_err = ndr_push_struct_blob(&blobs[i], blobs, lp_iconv_convenience(global_loadparm), &id3b, (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3Binary); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { NTSTATUS status = ndr_map_error2ntstatus(ndr_err); |