*/
int dsdb_find_dn_by_guid(struct ldb_context *ldb,
TALLOC_CTX *mem_ctx,
- const struct GUID *guid, struct ldb_dn **dn)
+ const struct GUID *guid,
+ uint32_t dsdb_flags,
+ struct ldb_dn **dn)
{
int ret;
struct ldb_result *res;
ret = dsdb_search(ldb, mem_ctx, &res, NULL, LDB_SCOPE_SUBTREE, attrs,
DSDB_SEARCH_SEARCH_ALL_PARTITIONS |
DSDB_SEARCH_SHOW_EXTENDED_DN |
- DSDB_SEARCH_ONE_ONLY,
+ DSDB_SEARCH_ONE_ONLY | dsdb_flags,
"objectGUID=%s", guid_str);
talloc_free(guid_str);
if (ret != LDB_SUCCESS) {
ret = LDB_ERR_INVALID_DN_SYNTAX;
goto done;
}
- ret = dsdb_find_dn_by_guid(s->samdb, tmp_ctx, &conn->dsa_guid, &server_dn);
+ ret = dsdb_find_dn_by_guid(s->samdb, tmp_ctx, &conn->dsa_guid, 0, &server_dn);
if (ret != LDB_SUCCESS) {
DEBUG(0, ("failed to find fromServer DN '%s'\n",
GUID_string(tmp_ctx, &conn->dsa_guid)));
int ret;
tmp_ctx = talloc_new(s);
- ret = dsdb_find_dn_by_guid(s->samdb, tmp_ctx, &conn->obj_guid, &dn);
+ ret = dsdb_find_dn_by_guid(s->samdb, tmp_ctx, &conn->obj_guid, 0, &dn);
if (ret != LDB_SUCCESS) {
DEBUG(0, ("failed to find nTDSConnection's DN: %s\n",
ldb_strerror(ret)));
neigh->source_dsa_obj_guid = reps_from->source_dsa_obj_guid;
ret = dsdb_find_dn_by_guid(samdb, mem_ctx, &reps_from->source_dsa_obj_guid,
+ DSDB_SEARCH_SHOW_RECYCLED,
&source_dsa_dn);
if (ret != LDB_SUCCESS) {
neigh->source_dsa_obj_dn = ldb_dn_get_linearized(source_dsa_dn);
neigh->naming_context_dn = ldb_dn_get_linearized(nc_dn);
- if (dsdb_find_guid_by_dn(samdb, nc_dn, &neigh->naming_context_obj_guid)
+ if (dsdb_find_guid_by_dn(samdb, nc_dn,
+ &neigh->naming_context_obj_guid)
!= LDB_SUCCESS) {
return WERR_DS_DRA_INTERNAL_ERROR;
}
if (!GUID_all_zero(&reps_from->transport_guid)) {
ret = dsdb_find_dn_by_guid(samdb, mem_ctx, &reps_from->transport_guid,
+ DSDB_SEARCH_SHOW_RECYCLED,
&transport_obj_dn);
if (ret != LDB_SUCCESS) {
return WERR_DS_DRA_INTERNAL_ERROR;
neigh->last_attempt = reps_to->last_attempt;
neigh->source_dsa_obj_guid = reps_to->source_dsa_obj_guid;
- ret = dsdb_find_dn_by_guid(samdb, mem_ctx, &reps_to->source_dsa_obj_guid, &source_dsa_dn);
+ ret = dsdb_find_dn_by_guid(samdb, mem_ctx,
+ &reps_to->source_dsa_obj_guid,
+ DSDB_SEARCH_SHOW_RECYCLED,
+ &source_dsa_dn);
if (ret != LDB_SUCCESS) {
DEBUG(0,(__location__ ": Failed to find DN for neighbor GUID %s\n",
GUID_string(mem_ctx, &reps_to->source_dsa_obj_guid)));
tmp_ctx = talloc_new(mem_ctx);
/* we need to find their hostname */
- ret = dsdb_find_dn_by_guid(s->samdb, tmp_ctx, &rft->source_dsa_obj_guid, &ntds_dn);
+ ret = dsdb_find_dn_by_guid(s->samdb, tmp_ctx, &rft->source_dsa_obj_guid, 0, &ntds_dn);
if (ret != LDB_SUCCESS) {
talloc_free(tmp_ctx);
/* its OK for their NTDSDSA DN not to be in our database */
sa->lDAPDisplayName, ldb_dn_get_linearized(msg->dn)));
return ntstatus_to_werror(status);
}
- ret = dsdb_find_dn_by_guid(sam_ctx, mem_ctx, &guid, &tdn);
+ ret = dsdb_find_dn_by_guid(sam_ctx, mem_ctx, &guid, 0, &tdn);
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
DEBUG(2, (" Search of guid %s returned 0 objects, skipping it !\n",
GUID_string(mem_ctx, &guid)));
W_ERROR_HAVE_NO_MEMORY(msg->dn);
/* TODO: make sure ntds_dn is a valid nTDSDSA object */
- ret = dsdb_find_dn_by_guid(ldb, msg, &req10->destination_dsa_guid, &ntds_dn);
+ ret = dsdb_find_dn_by_guid(ldb, msg, &req10->destination_dsa_guid, 0, &ntds_dn);
if (ret != LDB_SUCCESS) {
DEBUG(0, (__location__ ": Unable to find NTDS object for guid %s - %s\n",
GUID_string(mem_ctx, &req10->destination_dsa_guid), ldb_errstring(ldb)));