summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-09-24 20:15:11 -0700
committerAndrew Tridgell <tridge@samba.org>2009-09-28 10:23:47 +1000
commita130ad27c4d913f9d8a8f4bf3fde6c44ba33587d (patch)
tree44506708319b0e42f28880910f2c81d31da06867 /source4/dsdb/samdb
parentd515b6e3265f61a8eaeaaa7b3afc1e536fb216ef (diff)
downloadsamba-a130ad27c4d913f9d8a8f4bf3fde6c44ba33587d.tar.gz
samba-a130ad27c4d913f9d8a8f4bf3fde6c44ba33587d.tar.bz2
samba-a130ad27c4d913f9d8a8f4bf3fde6c44ba33587d.zip
s4-repl: use GUID to resolve target in linked attributes
When we vampire from w2k8-r2, the DC sends us a linked attribute for our machine account which has a target DN with a GUID of the OU=Domain Controllers objects, but has a DN of CN=Computers. We need to use the GUID to resolve the real DN.
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/repl_meta_data.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index f729d5c88f..c83fb0f01b 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -2076,10 +2076,10 @@ static int replmd_process_linked_attribute(struct ldb_module *module,
struct ldb_message_element *ret_el;
TALLOC_CTX *tmp_ctx = talloc_new(la_entry);
enum ndr_err_code ndr_err;
- char *target_dn;
struct ldb_request *mod_req;
int ret;
const struct dsdb_attribute *attr;
+ struct ldb_dn *target_dn;
/*
linked_attributes[0]:
@@ -2176,16 +2176,15 @@ linked_attributes[0]:
}
ret_el->num_values = 1;
- target_dn = talloc_asprintf(tmp_ctx, "<GUID=%s>;<SID=%s>;%s",
- GUID_string(tmp_ctx, &target.guid),
- dom_sid_string(tmp_ctx, &target.sid),
- target.dn);
- if (target_dn == NULL) {
- ldb_oom(ldb);
+ ret = dsdb_find_dn_by_guid(ldb, tmp_ctx, GUID_string(tmp_ctx, &target.guid), &target_dn);
+ if (ret != LDB_SUCCESS) {
+ DEBUG(0,(__location__ ": Failed to map GUID %s to DN\n", GUID_string(tmp_ctx, &target.guid)));
talloc_free(tmp_ctx);
return LDB_ERR_OPERATIONS_ERROR;
}
- ret_el->values[0] = data_blob_string_const(target_dn);
+
+ ret_el->values[0].data = (uint8_t *)ldb_dn_get_extended_linearized(tmp_ctx, target_dn, 1);
+ ret_el->values[0].length = strlen((char *)ret_el->values[0].data);
ret = ldb_build_mod_req(&mod_req, ldb, tmp_ctx,
msg,