summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/samdb/cracknames.c10
-rw-r--r--source4/dsdb/samdb/ldb_modules/entryUUID.c2
-rw-r--r--source4/dsdb/samdb/ldb_modules/extended_dn.c12
-rw-r--r--source4/dsdb/samdb/ldb_modules/local_password.c4
-rw-r--r--source4/dsdb/samdb/ldb_modules/password_hash.c4
-rw-r--r--source4/dsdb/samdb/ldb_modules/proxy.c4
-rw-r--r--source4/dsdb/samdb/ldb_modules/rootdse.c2
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c10
-rw-r--r--source4/dsdb/samdb/samdb.c10
9 files changed, 28 insertions, 30 deletions
diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c
index 16aa616983..64bc812022 100644
--- a/source4/dsdb/samdb/cracknames.c
+++ b/source4/dsdb/samdb/cracknames.c
@@ -73,7 +73,7 @@ static enum drsuapi_DsNameStatus LDB_lookup_spn_alias(krb5_context context, stru
if ( ! ldb_dn_add_base(service_dn, samdb_base_dn(ldb_ctx))) {
return DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR;
}
- service_dn_str = ldb_dn_linearize(tmp_ctx, service_dn);
+ service_dn_str = ldb_dn_alloc_linearized(tmp_ctx, service_dn);
if ( ! service_dn_str) {
return DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR;
}
@@ -637,7 +637,7 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_
"%s", domain_filter);
} else {
ldb_ret = gendb_search(sam_ctx, mem_ctx, partitions_basedn, &domain_res, domain_attrs,
- "(ncName=%s)", ldb_dn_linearize(mem_ctx, samdb_base_dn(sam_ctx)));
+ "(ncName=%s)", ldb_dn_get_linearized(samdb_base_dn(sam_ctx)));
}
switch (ldb_ret) {
@@ -701,7 +701,7 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_
/* here we can use result_res[0] and domain_res[0] */
switch (format_desired) {
case DRSUAPI_DS_NAME_FORMAT_FQDN_1779: {
- info1->result_name = ldb_dn_linearize(mem_ctx, result_res[0]->dn);
+ info1->result_name = ldb_dn_alloc_linearized(mem_ctx, result_res[0]->dn);
W_ERROR_HAVE_NO_MEMORY(info1->result_name);
info1->status = DRSUAPI_DS_NAME_STATUS_OK;
@@ -730,7 +730,7 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_
if (sid->num_auths == 4) {
ldb_ret = gendb_search(sam_ctx, mem_ctx, partitions_basedn, &domain_res, domain_attrs,
- "(ncName=%s)", ldb_dn_linearize(mem_ctx, result_res[0]->dn));
+ "(ncName=%s)", ldb_dn_get_linearized(result_res[0]->dn));
if (ldb_ret != 1) {
info1->status = DRSUAPI_DS_NAME_STATUS_NOT_FOUND;
return WERR_OK;
@@ -753,7 +753,7 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_
return WERR_OK;
}
ldb_ret = gendb_search(sam_ctx, mem_ctx, partitions_basedn, &domain_res2, domain_attrs,
- "(ncName=%s)", ldb_dn_linearize(mem_ctx, domain_res[0]->dn));
+ "(ncName=%s)", ldb_dn_get_linearized(domain_res[0]->dn));
if (ldb_ret != 1) {
info1->status = DRSUAPI_DS_NAME_STATUS_NOT_FOUND;
return WERR_OK;
diff --git a/source4/dsdb/samdb/ldb_modules/entryUUID.c b/source4/dsdb/samdb/ldb_modules/entryUUID.c
index 2bc97f2040..42aa53ca64 100644
--- a/source4/dsdb/samdb/ldb_modules/entryUUID.c
+++ b/source4/dsdb/samdb/ldb_modules/entryUUID.c
@@ -122,7 +122,7 @@ static struct ldb_val objectCategory_always_dn(struct ldb_module *module, TALLOC
for (i=0; list && (i < list->count); i++) {
if (ldb_attr_cmp((const char *)val->data, ldb_msg_find_attr_as_string(list->msgs[i], "lDAPDisplayName", NULL)) == 0) {
- char *dn = ldb_dn_linearize(ctx, list->msgs[i]->dn);
+ char *dn = ldb_dn_alloc_linearized(ctx, list->msgs[i]->dn);
return data_blob_string_const(dn);
}
}
diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn.c b/source4/dsdb/samdb/ldb_modules/extended_dn.c
index 012ac74514..a571857bbb 100644
--- a/source4/dsdb/samdb/ldb_modules/extended_dn.c
+++ b/source4/dsdb/samdb/ldb_modules/extended_dn.c
@@ -107,11 +107,7 @@ static BOOL inject_extended_dn(struct ldb_message *msg,
struct dom_sid *sid;
char *object_guid;
char *object_sid;
- char *new_dn, *dn;
-
- dn = ldb_dn_linearize(msg, msg->dn);
- if (!dn)
- return False;
+ char *new_dn;
/* retrieve object_guid */
guid = samdb_result_guid(msg, "objectGUID");
@@ -140,10 +136,12 @@ static BOOL inject_extended_dn(struct ldb_message *msg,
case 1:
if (object_sid) {
new_dn = talloc_asprintf(msg, "<GUID=%s>;<SID=%s>;%s",
- object_guid, object_sid, dn);
+ object_guid, object_sid,
+ ldb_dn_get_linearized(msg->dn));
} else {
new_dn = talloc_asprintf(msg, "<GUID=%s>;%s",
- object_guid, dn);
+ object_guid,
+ ldb_dn_get_linearized(msg->dn));
}
break;
default:
diff --git a/source4/dsdb/samdb/ldb_modules/local_password.c b/source4/dsdb/samdb/ldb_modules/local_password.c
index 57323d859f..9e1cdd32b3 100644
--- a/source4/dsdb/samdb/ldb_modules/local_password.c
+++ b/source4/dsdb/samdb/ldb_modules/local_password.c
@@ -160,7 +160,7 @@ static int local_password_add(struct ldb_module *module, struct ldb_request *req
if (!ldb_msg_check_string_attribute(req->op.add.message, "objectClass", "person")) {
ldb_asprintf_errstring(module->ldb,
"Cannot relocate a password on entry: %s, does not have objectClass 'person'",
- ldb_dn_linearize(req, req->op.add.message->dn));
+ ldb_dn_get_linearized(req->op.add.message->dn));
return LDB_ERR_OBJECT_CLASS_VIOLATION;
}
@@ -428,7 +428,7 @@ static int local_password_mod_local(struct ldb_handle *h) {
if (!ac->search_res) {
ldb_asprintf_errstring(ac->module->ldb,
"entry just modified (%s) not found!",
- ldb_dn_linearize(ac, ac->remote_req->op.mod.message->dn));
+ ldb_dn_get_linearized(ac->remote_req->op.mod.message->dn));
return LDB_ERR_OPERATIONS_ERROR;
}
if (!ldb_msg_check_string_attribute(ac->search_res->message, "objectClass", "person")) {
diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c
index b25beb7a8f..38a44bdae2 100644
--- a/source4/dsdb/samdb/ldb_modules/password_hash.c
+++ b/source4/dsdb/samdb/ldb_modules/password_hash.c
@@ -160,7 +160,7 @@ static int add_krb5_keys_from_password(struct ldb_module *module, struct ldb_mes
ldb_asprintf_errstring(module->ldb,
"password_hash_handle: "
"generation of new kerberos keys failed: %s is a computer without a samAccountName",
- ldb_dn_linearize(msg, msg->dn));
+ ldb_dn_get_linearized(msg->dn));
return LDB_ERR_OPERATIONS_ERROR;
}
if (name[strlen(name)-1] == '$') {
@@ -191,7 +191,7 @@ static int add_krb5_keys_from_password(struct ldb_module *module, struct ldb_mes
ldb_asprintf_errstring(module->ldb,
"password_hash_handle: "
"generation of new kerberos keys failed: %s has no samAccountName",
- ldb_dn_linearize(msg, msg->dn));
+ ldb_dn_get_linearized(msg->dn));
return LDB_ERR_OPERATIONS_ERROR;
}
krb5_ret = krb5_make_principal(smb_krb5_context->krb5_context,
diff --git a/source4/dsdb/samdb/ldb_modules/proxy.c b/source4/dsdb/samdb/ldb_modules/proxy.c
index 41fe8b68c9..0dd5ee1e3d 100644
--- a/source4/dsdb/samdb/ldb_modules/proxy.c
+++ b/source4/dsdb/samdb/ldb_modules/proxy.c
@@ -285,7 +285,7 @@ static int proxy_search_bytree(struct ldb_module *module, struct ldb_request *re
ldb_dn_add_base(base, proxy->olddn);
ldb_debug(module->ldb, LDB_DEBUG_FATAL, "proxying: '%s' with dn '%s' \n",
- ldb_filter_from_tree(proxy, newreq->op.search.tree), ldb_dn_linearize(proxy, newreq->op.search.base));
+ ldb_filter_from_tree(proxy, newreq->op.search.tree), ldb_dn_get_linearized(newreq->op.search.base));
for (i = 0; req->op.search.attrs && req->op.search.attrs[i]; i++) {
ldb_debug(module->ldb, LDB_DEBUG_FATAL, "attr: '%s'\n", req->op.search.attrs[i]);
}
@@ -313,7 +313,7 @@ static int proxy_search_bytree(struct ldb_module *module, struct ldb_request *re
failed:
ldb_debug(module->ldb, LDB_DEBUG_TRACE, "proxy failed for %s\n",
- ldb_dn_linearize(proxy, req->op.search.base));
+ ldb_dn_get_linearized(req->op.search.base));
passthru:
return ldb_next_request(module, req);
diff --git a/source4/dsdb/samdb/ldb_modules/rootdse.c b/source4/dsdb/samdb/ldb_modules/rootdse.c
index e073c8f89b..86e97f9cfb 100644
--- a/source4/dsdb/samdb/ldb_modules/rootdse.c
+++ b/source4/dsdb/samdb/ldb_modules/rootdse.c
@@ -86,7 +86,7 @@ static int rootdse_add_dynamic(struct ldb_module *module, struct ldb_message *ms
for (i = 0; i < priv->num_partitions; i++) {
struct ldb_dn *dn = priv->partitions[i];
if (ldb_msg_add_steal_string(msg, "namingContexts",
- ldb_dn_linearize(msg, dn)) != 0) {
+ ldb_dn_alloc_linearized(msg, dn)) != 0) {
goto failed;
}
}
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index 667b0d5ca8..c62c7dcf71 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -139,7 +139,7 @@ static int samldb_find_next_rid(struct ldb_module *module, TALLOC_CTX *mem_ctx,
if (str == NULL) {
ldb_asprintf_errstring(module->ldb,
"attribute nextRid not found in %s\n",
- ldb_dn_linearize(res, dn));
+ ldb_dn_get_linearized(dn));
talloc_free(res);
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -239,7 +239,7 @@ static int samldb_get_new_sid(struct ldb_module *module,
if (dom_dn == NULL) {
ldb_asprintf_errstring(module->ldb,
"Invalid dn (%s) not child of a domain object!\n",
- ldb_dn_linearize(mem_ctx, obj_dn));
+ ldb_dn_get_linearized(obj_dn));
return LDB_ERR_CONSTRAINT_VIOLATION;
}
@@ -249,7 +249,7 @@ static int samldb_get_new_sid(struct ldb_module *module,
if (ret != LDB_SUCCESS) {
ldb_asprintf_errstring(module->ldb,
"samldb_get_new_sid: error retrieving domain sid from %s: %s!\n",
- ldb_dn_linearize(mem_ctx, dom_dn),
+ ldb_dn_get_linearized(dom_dn),
ldb_errstring(module->ldb));
talloc_free(res);
return ret;
@@ -258,7 +258,7 @@ static int samldb_get_new_sid(struct ldb_module *module,
if (res->count != 1) {
ldb_asprintf_errstring(module->ldb,
"samldb_get_new_sid: error retrieving domain sid from %s: not found!\n",
- ldb_dn_linearize(mem_ctx, dom_dn));
+ ldb_dn_get_linearized(dom_dn));
talloc_free(res);
return LDB_ERR_CONSTRAINT_VIOLATION;
}
@@ -273,7 +273,7 @@ static int samldb_get_new_sid(struct ldb_module *module,
/* allocate a new Rid for the domain */
ret = samldb_allocate_next_rid(module, mem_ctx, dom_dn, dom_sid, sid);
if (ret != 0) {
- ldb_debug(module->ldb, LDB_DEBUG_FATAL, "Failed to increment nextRid of %s: %s\n", ldb_dn_linearize(mem_ctx, dom_dn), ldb_errstring(module->ldb));
+ ldb_debug(module->ldb, LDB_DEBUG_FATAL, "Failed to increment nextRid of %s: %s\n", ldb_dn_get_linearized(dom_dn), ldb_errstring(module->ldb));
talloc_free(res);
return ret;
}
diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c
index 4439335ca5..da04be1dbb 100644
--- a/source4/dsdb/samdb/samdb.c
+++ b/source4/dsdb/samdb/samdb.c
@@ -1194,8 +1194,8 @@ _PUBLIC_ NTSTATUS samdb_set_password(struct ldb_context *ctx, TALLOC_CTX *mem_ct
count = gendb_search_dn(ctx, mem_ctx, domain_dn, &res, domain_attrs);
if (count != 1) {
DEBUG(2, ("samdb_set_password: Domain DN %s is invalid, for user %s\n",
- ldb_dn_linearize(mem_ctx, domain_dn),
- ldb_dn_linearize(mem_ctx, user_dn)));
+ ldb_dn_get_linearized(domain_dn),
+ ldb_dn_get_linearized(user_dn)));
return NT_STATUS_NO_SUCH_DOMAIN;
}
} else {
@@ -1211,7 +1211,7 @@ _PUBLIC_ NTSTATUS samdb_set_password(struct ldb_context *ctx, TALLOC_CTX *mem_ct
if (count != 1) {
DEBUG(2, ("samdb_set_password: Could not find domain to match SID: %s, for user %s\n",
dom_sid_string(mem_ctx, domain_sid),
- ldb_dn_linearize(mem_ctx, user_dn)));
+ ldb_dn_get_linearized(user_dn)));
return NT_STATUS_NO_SUCH_DOMAIN;
}
}
@@ -1435,7 +1435,7 @@ _PUBLIC_ NTSTATUS samdb_set_password_sid(struct ldb_context *ctx, TALLOC_CTX *me
ret = ldb_transaction_commit(ctx);
if (ret != 0) {
DEBUG(0,("Failed to commit transaction to change password on %s: %s\n",
- ldb_dn_linearize(mem_ctx, msg->dn),
+ ldb_dn_get_linearized(msg->dn),
ldb_errstring(ctx)));
return NT_STATUS_TRANSACTION_ABORTED;
}
@@ -1565,7 +1565,7 @@ NTSTATUS samdb_create_foreign_security_principal(struct ldb_context *sam_ctx, TA
if (ret != 0) {
DEBUG(0,("Failed to create foreignSecurityPrincipal "
"record %s: %s\n",
- ldb_dn_linearize(mem_ctx, msg->dn),
+ ldb_dn_get_linearized(msg->dn),
ldb_errstring(sam_ctx)));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}