1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

r19832: better prototypes for the linearization functions:

- ldb_dn_get_linearized
  returns a const string

- ldb_dn_alloc_linearized
  allocs astring with the linearized dn
(This used to be commit 3929c086d5)
This commit is contained in:
Simo Sorce 2006-11-22 02:05:19 +00:00 committed by Gerald (Jerry) Carter
parent 4889eb9f7a
commit a9e31b33b5
51 changed files with 170 additions and 188 deletions

View File

@ -89,7 +89,7 @@ static NTSTATUS authsam_search_account(TALLOC_CTX *mem_ctx, struct ldb_context *
if (ret == 0) {
DEBUG(3,("sam_search_user: Couldn't find user [%s\\%s] in samdb, under %s\n",
domain_name, account_name, ldb_dn_linearize(mem_ctx, domain_dn)));
domain_name, account_name, ldb_dn_get_linearized(domain_dn)));
return NT_STATUS_NO_SUCH_USER;
}
@ -127,7 +127,7 @@ static NTSTATUS authsam_search_account(TALLOC_CTX *mem_ctx, struct ldb_context *
}
ret_domain = gendb_search(sam_ctx, mem_ctx, partitions_basedn, &msgs_domain_ref, domain_ref_attrs,
"(nCName=%s)", ldb_dn_linearize(msgs_tmp, msgs_tmp[0]->dn));
"(nCName=%s)", ldb_dn_alloc_linearized(msgs_tmp, msgs_tmp[0]->dn));
if (ret_domain == -1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
@ -135,13 +135,13 @@ static NTSTATUS authsam_search_account(TALLOC_CTX *mem_ctx, struct ldb_context *
if (ret_domain == 0) {
DEBUG(3,("check_sam_security: Couldn't find domain [%s] in passdb file.\n",
ldb_dn_linearize(msgs_tmp, msgs_tmp[0]->dn)));
ldb_dn_get_linearized(msgs_tmp[0]->dn)));
return NT_STATUS_NO_SUCH_USER;
}
if (ret_domain > 1) {
DEBUG(0,("Found %d records matching domain [%s]\n",
ret_domain, ldb_dn_linearize(msgs_tmp, msgs_tmp[0]->dn)));
ret_domain, ldb_dn_get_linearized(msgs_tmp[0]->dn)));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}

View File

@ -434,7 +434,7 @@ NTSTATUS cli_credentials_update_all_keytabs(TALLOC_CTX *parent_ctx)
return NT_STATUS_NO_MEMORY;
}
cli_credentials_set_conf(creds);
filter = talloc_asprintf(mem_ctx, "dn=%s", ldb_dn_linearize(mem_ctx, msgs[i]->dn));
filter = talloc_asprintf(mem_ctx, "dn=%s", ldb_dn_get_linearized(msgs[i]->dn));
status = cli_credentials_set_secrets(creds, NULL, filter);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Failed to read secrets for keytab update for %s\n",

View File

@ -127,7 +127,7 @@ NTSTATUS schannel_store_session_key_ldb(TALLOC_CTX *mem_ctx,
if (ret != 0) {
DEBUG(0,("Unable to add %s to session key db - %s\n",
ldb_dn_linearize(msg, msg->dn), ldb_errstring(ldb)));
ldb_dn_get_linearized(msg->dn), ldb_errstring(ldb)));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}

View File

@ -209,7 +209,7 @@ _PUBLIC_ NTSTATUS authsam_make_server_info(TALLOC_CTX *mem_ctx, struct ldb_conte
group_ret = gendb_search(sam_ctx,
tmp_ctx, NULL, &group_msgs, group_attrs,
"(&(member=%s)(sAMAccountType=*))",
ldb_dn_linearize(tmp_ctx, msg->dn));
ldb_dn_get_linearized(msg->dn));
if (group_ret == -1) {
talloc_free(tmp_ctx);
return NT_STATUS_INTERNAL_DB_CORRUPTION;
@ -336,7 +336,7 @@ _PUBLIC_ NTSTATUS sam_get_results_principal(struct ldb_context *sam_ctx,
/* grab domain info from the reference */
ret = gendb_search(sam_ctx, tmp_ctx, partitions_basedn, msgs_domain_ref, domain_ref_attrs,
"(ncName=%s)", ldb_dn_linearize(tmp_ctx, domain_dn));
"(ncName=%s)", ldb_dn_get_linearized(domain_dn));
if (ret != 1) {
talloc_free(tmp_ctx);

View File

@ -87,12 +87,12 @@ static NTSTATUS cldapd_netlogon_fill(struct cldapd_server *cldapd,
LDB_SCOPE_BASE, "objectClass=domain",
dom_attrs, &dom_ldb_result);
if (ret != LDB_SUCCESS) {
DEBUG(2,("Error finding domain '%s'/'%s' in sam: %s\n", domain, ldb_dn_linearize(mem_ctx, dom_dn), ldb_errstring(cldapd->samctx)));
DEBUG(2,("Error finding domain '%s'/'%s' in sam: %s\n", domain, ldb_dn_get_linearized(dom_dn), ldb_errstring(cldapd->samctx)));
return NT_STATUS_NO_SUCH_DOMAIN;
}
talloc_steal(mem_ctx, dom_ldb_result);
if (dom_ldb_result->count != 1) {
DEBUG(2,("Error finding domain '%s'/'%s' in sam\n", domain, ldb_dn_linearize(mem_ctx, dom_dn)));
DEBUG(2,("Error finding domain '%s'/'%s' in sam\n", domain, ldb_dn_get_linearized(dom_dn)));
return NT_STATUS_NO_SUCH_DOMAIN;
}
dom_res = dom_ldb_result->msgs;
@ -108,10 +108,10 @@ static NTSTATUS cldapd_netlogon_fill(struct cldapd_server *cldapd,
/* try and find the domain */
ret = gendb_search(cldapd->samctx, mem_ctx, partitions_basedn, &ref_res, ref_attrs,
"(&(objectClass=crossRef)(ncName=%s))",
ldb_dn_linearize(mem_ctx, dom_res[0]->dn));
ldb_dn_get_linearized(dom_res[0]->dn));
if (ret != 1) {
DEBUG(2,("Unable to find referece to '%s' in sam\n",
ldb_dn_linearize(mem_ctx, dom_res[0]->dn)));
ldb_dn_get_linearized(dom_res[0]->dn)));
return NT_STATUS_NO_SUCH_DOMAIN;
}
}

View File

@ -107,7 +107,7 @@ static void cldapd_rootdse_fill(struct cldapd_server *cldapd,
ent = talloc(mem_ctx, struct ldap_SearchResEntry);
if (ent == NULL) goto nomem;
ent->dn = ldb_dn_linearize(ent, res->msgs[0]->dn);
ent->dn = ldb_dn_alloc_linearized(ent, res->msgs[0]->dn);
if (ent->dn == NULL) goto nomem;
ent->num_attributes = 0;
ent->attributes = NULL;

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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:

View File

@ -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")) {

View File

@ -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,

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -719,7 +719,7 @@ static krb5_error_code LDB_fetch_server(krb5_context context, HDB *db,
ldb_ret = gendb_search((struct ldb_context *)db->hdb_db,
mem_ctx, partitions_basedn, &realm_ref_msg, realm_ref_attrs,
"ncName=%s", ldb_dn_linearize(mem_ctx, domain_dn));
"ncName=%s", ldb_dn_get_linearized(domain_dn));
if (ldb_ret != 1) {
return HDB_ERR_NOENTRY;

View File

@ -372,7 +372,7 @@ static BOOL kpasswd_process_request(struct kdc_server *kdc,
ret = samdb_replace(samdb, mem_ctx, msg);
if (ret != 0) {
DEBUG(2,("Failed to modify record to set password on %s: %s\n",
ldb_dn_linearize(mem_ctx, msg->dn),
ldb_dn_get_linearized(msg->dn),
ldb_errstring(samdb)));
status = NT_STATUS_ACCESS_DENIED;
}
@ -381,7 +381,7 @@ static BOOL kpasswd_process_request(struct kdc_server *kdc,
ret = ldb_transaction_commit(samdb);
if (ret != 0) {
DEBUG(1,("Failed to commit transaction to set password on %s: %s\n",
ldb_dn_linearize(mem_ctx, msg->dn),
ldb_dn_get_linearized(msg->dn),
ldb_errstring(samdb)));
status = NT_STATUS_TRANSACTION_ABORTED;
}

View File

@ -249,7 +249,7 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call)
NT_STATUS_HAVE_NO_MEMORY(ent_r);
ent = &ent_r->msg->r.SearchResultEntry;
ent->dn = ldb_dn_linearize(ent_r, res->msgs[i]->dn);
ent->dn = ldb_dn_alloc_linearized(ent_r, res->msgs[i]->dn);
ent->num_attributes = 0;
ent->attributes = NULL;
if (res->msgs[i]->num_elements == 0) {

View File

@ -58,7 +58,7 @@ int gendb_search_v(struct ldb_context *ldb,
talloc_steal(mem_ctx, res->msgs);
DEBUG(6,("gendb_search_v: %s %s -> %d\n",
basedn?ldb_dn_linearize(mem_ctx,basedn):"NULL",
basedn?ldb_dn_get_linearized(basedn):"NULL",
expr?expr:"NULL", res->count));
ret = res->count;

View File

@ -239,7 +239,7 @@ static int ldb_canonicalise_dn(struct ldb_context *ldb, void *mem_ctx,
return -1;
}
out->data = (uint8_t *)ldb_dn_linearize(mem_ctx, dn);
out->data = (uint8_t *)ldb_dn_alloc_linearized(mem_ctx, dn);
if (out->data == NULL) {
goto done;
}

View File

@ -561,7 +561,7 @@ const char *ldb_dn_get_linearized(struct ldb_dn *dn)
return dn->linearized;
}
char *ldb_dn_linearize(void *mem_ctx, struct ldb_dn *dn)
char *ldb_dn_alloc_linearized(void *mem_ctx, struct ldb_dn *dn)
{
return talloc_strdup(mem_ctx, ldb_dn_get_linearized(dn));
}
@ -664,7 +664,7 @@ const char *ldb_dn_get_casefold(struct ldb_dn *dn)
return dn->casefold;
}
char *ldb_dn_casefold(void *mem_ctx, struct ldb_dn *dn)
char *ldb_dn_alloc_casefold(void *mem_ctx, struct ldb_dn *dn)
{
return talloc_strdup(mem_ctx, ldb_dn_get_casefold(dn));
}

View File

@ -286,7 +286,7 @@ int ldb_ldif_write(struct ldb_context *ldb,
msg = ldif->msg;
ret = fprintf_fn(private_data, "dn: %s\n", ldb_dn_linearize(msg->dn, msg->dn));
ret = fprintf_fn(private_data, "dn: %s\n", ldb_dn_get_linearized(msg->dn));
CHECK_RET;
if (ldif->changetype != LDB_CHANGETYPE_NONE) {

View File

@ -626,7 +626,7 @@ int ldb_msg_sanity_check(struct ldb_context *ldb,
/* TODO: return also an error string */
ldb_asprintf_errstring(ldb, "Element %s has empty attribute in ldb message (%s)!",
msg->elements[i].name,
ldb_dn_linearize(mem_ctx, msg->dn));
ldb_dn_get_linearized(msg->dn));
talloc_free(mem_ctx);
return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX;
}

View File

@ -1274,10 +1274,10 @@ struct ldb_dn *ldb_dn_new_fmt(void *mem_ctx, struct ldb_context *ldb, const char
bool ldb_dn_validate(struct ldb_dn *dn);
char *ldb_dn_escape_value(void *mem_ctx, struct ldb_val value);
char *ldb_dn_linearize(void *mem_ctx, struct ldb_dn *dn);
char *ldb_dn_casefold(void *mem_ctx, struct ldb_dn *dn);
const char *ldb_dn_get_linearized(struct ldb_dn *dn);
const char *ldb_dn_get_casefold(struct ldb_dn *dn);
char *ldb_dn_alloc_linearized(void *mem_ctx, struct ldb_dn *dn);
char *ldb_dn_alloc_casefold(void *mem_ctx, struct ldb_dn *dn);
int ldb_dn_compare_base(struct ldb_dn *base, struct ldb_dn *dn);
int ldb_dn_compare(struct ldb_dn *edn0, struct ldb_dn *edn1);

View File

@ -452,7 +452,7 @@ static int ildb_search(struct ldb_module *module, struct ldb_request *req)
if (req->op.search.base == NULL) {
msg->r.SearchRequest.basedn = talloc_strdup(msg, "");
} else {
msg->r.SearchRequest.basedn = ldb_dn_linearize(msg, req->op.search.base);
msg->r.SearchRequest.basedn = ldb_dn_alloc_linearized(msg, req->op.search.base);
}
if (msg->r.SearchRequest.basedn == NULL) {
ldb_set_errstring(module->ldb, "Unable to determine baseDN");
@ -504,7 +504,7 @@ static int ildb_add(struct ldb_module *module, struct ldb_request *req)
msg->type = LDAP_TAG_AddRequest;
msg->r.AddRequest.dn = ldb_dn_linearize(msg, req->op.add.message->dn);
msg->r.AddRequest.dn = ldb_dn_alloc_linearized(msg, req->op.add.message->dn);
if (msg->r.AddRequest.dn == NULL) {
talloc_free(msg);
return LDB_ERR_INVALID_DN_SYNTAX;
@ -554,7 +554,7 @@ static int ildb_modify(struct ldb_module *module, struct ldb_request *req)
msg->type = LDAP_TAG_ModifyRequest;
msg->r.ModifyRequest.dn = ldb_dn_linearize(msg, req->op.mod.message->dn);
msg->r.ModifyRequest.dn = ldb_dn_alloc_linearized(msg, req->op.mod.message->dn);
if (msg->r.ModifyRequest.dn == NULL) {
talloc_free(msg);
return LDB_ERR_INVALID_DN_SYNTAX;
@ -602,7 +602,7 @@ static int ildb_delete(struct ldb_module *module, struct ldb_request *req)
msg->type = LDAP_TAG_DelRequest;
msg->r.DelRequest.dn = ldb_dn_linearize(msg, req->op.del.dn);
msg->r.DelRequest.dn = ldb_dn_alloc_linearized(msg, req->op.del.dn);
if (msg->r.DelRequest.dn == NULL) {
talloc_free(msg);
return LDB_ERR_INVALID_DN_SYNTAX;
@ -632,7 +632,7 @@ static int ildb_rename(struct ldb_module *module, struct ldb_request *req)
}
msg->type = LDAP_TAG_ModifyDNRequest;
msg->r.ModifyDNRequest.dn = ldb_dn_linearize(msg, req->op.rename.olddn);
msg->r.ModifyDNRequest.dn = ldb_dn_alloc_linearized(msg, req->op.rename.olddn);
if (msg->r.ModifyDNRequest.dn == NULL) {
talloc_free(msg);
return LDB_ERR_INVALID_DN_SYNTAX;
@ -648,8 +648,7 @@ static int ildb_rename(struct ldb_module *module, struct ldb_request *req)
}
msg->r.ModifyDNRequest.newsuperior =
ldb_dn_linearize(msg,
ldb_dn_get_parent(msg, req->op.rename.newdn));
ldb_dn_alloc_linearized(msg, ldb_dn_get_parent(msg, req->op.rename.newdn));
if (msg->r.ModifyDNRequest.newsuperior == NULL) {
talloc_free(msg);
return LDB_ERR_INVALID_DN_SYNTAX;

View File

@ -262,7 +262,7 @@ static int lldb_search(struct ldb_module *module, struct ldb_request *req)
lldb_ac = talloc_get_type(req->handle->private_data, struct lldb_context);
search_base = ldb_dn_linearize(lldb_ac, req->op.search.base);
search_base = ldb_dn_alloc_linearized(lldb_ac, req->op.search.base);
if (req->op.search.base == NULL) {
search_base = talloc_strdup(lldb_ac, "");
}
@ -335,7 +335,7 @@ static int lldb_add(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_OPERATIONS_ERROR;
}
dn = ldb_dn_linearize(lldb_ac, req->op.add.message->dn);
dn = ldb_dn_alloc_linearized(lldb_ac, req->op.add.message->dn);
if (dn == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
@ -380,7 +380,7 @@ static int lldb_modify(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_OPERATIONS_ERROR;
}
dn = ldb_dn_linearize(lldb_ac, req->op.mod.message->dn);
dn = ldb_dn_alloc_linearized(lldb_ac, req->op.mod.message->dn);
if (dn == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
@ -419,7 +419,7 @@ static int lldb_delete(struct ldb_module *module, struct ldb_request *req)
lldb_ac = talloc_get_type(req->handle->private_data, struct lldb_context);
dnstr = ldb_dn_linearize(lldb_ac, req->op.del.dn);
dnstr = ldb_dn_alloc_linearized(lldb_ac, req->op.del.dn);
ret = ldap_delete_ext(lldb->ldap, dnstr,
NULL,
@ -457,7 +457,7 @@ static int lldb_rename(struct ldb_module *module, struct ldb_request *req)
lldb_ac = talloc_get_type(req->handle->private_data, struct lldb_context);
old_dn = ldb_dn_linearize(lldb_ac, req->op.rename.olddn);
old_dn = ldb_dn_alloc_linearized(lldb_ac, req->op.rename.olddn);
if (old_dn == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
@ -469,7 +469,7 @@ static int lldb_rename(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_OPERATIONS_ERROR;
}
parentdn = ldb_dn_linearize(lldb_ac, ldb_dn_get_parent(lldb_ac, req->op.rename.newdn));
parentdn = ldb_dn_alloc_linearized(lldb_ac, ldb_dn_get_parent(lldb_ac, req->op.rename.newdn));
if (!parentdn) {
return LDB_ERR_OPERATIONS_ERROR;
}

View File

@ -369,8 +369,8 @@ static char *parsetree_to_sql(struct ldb_module *module,
} else if (strcasecmp(t->u.equality.attr, "dn") == 0) {
/* DN query is a special ldb case */
char *cdn = ldb_dn_casefold(mem_ctx,
ldb_dn_new(mem_ctx, module->ldb,
const char *cdn = ldb_dn_get_casefold(
ldb_dn_new(mem_ctx, module->ldb,
(const char *)value.data));
return lsqlite3_tprintf(mem_ctx,
@ -828,7 +828,7 @@ static long long lsqlite3_get_eid(struct ldb_module *module, struct ldb_dn *dn)
return -1;
}
cdn = ldb_dn_linearize(local_ctx, ldb_dn_casefold(module->ldb, local_ctx, dn));
cdn = ldb_dn_alloc_casefold(local_ctx, dn);
if (!cdn) goto done;
eid = lsqlite3_get_eid_ndn(lsqlite3->sqlite, local_ctx, cdn);
@ -865,7 +865,7 @@ int lsql_search(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_OPERATIONS_ERROR;
if (req->op.search.base) {
norm_basedn = ldb_dn_linearize(lsql_ac, ldb_dn_casefold(module->ldb, lsql_ac, req->op.search.base));
norm_basedn = ldb_dn_alloc_casefold(lsql_ac, req->op.search.base);
if (norm_basedn == NULL) {
ret = LDB_ERR_INVALID_DN_SYNTAX;
goto failed;
@ -1064,8 +1064,8 @@ static int lsql_add(struct ldb_module *module, struct ldb_request *req)
}
/* create linearized and normalized dns */
dn = ldb_dn_linearize(lsql_ac, msg->dn);
ndn = ldb_dn_linearize(lsql_ac, ldb_dn_casefold(module->ldb, lsql_ac, msg->dn));
dn = ldb_dn_alloc_linearized(lsql_ac, msg->dn);
ndn = ldb_dn_alloc_casefold(lsql_ac, msg->dn);
if (dn == NULL || ndn == NULL) {
ret = LDB_ERR_OTHER;
goto done;
@ -1426,9 +1426,9 @@ static int lsql_rename(struct ldb_module *module, struct ldb_request *req)
req->handle->status = LDB_SUCCESS;
/* create linearized and normalized dns */
old_cdn = ldb_dn_linearize(lsql_ac, ldb_dn_casefold(module->ldb, lsql_ac, req->op.rename.olddn));
new_cdn = ldb_dn_linearize(lsql_ac, ldb_dn_casefold(module->ldb, lsql_ac, req->op.rename.newdn));
new_dn = ldb_dn_linearize(lsql_ac, req->op.rename.newdn);
old_cdn = ldb_dn_alloc_casefold(lsql_ac, req->op.rename.olddn);
new_cdn = ldb_dn_alloc_casefold(lsql_ac, req->op.rename.newdn);
new_dn = ldb_dn_alloc_linearized(lsql_ac, req->op.rename.newdn);
if (old_cdn == NULL || new_cdn == NULL || new_dn == NULL) {
goto done;
}

View File

@ -740,7 +740,7 @@ int ltdb_search_indexed(struct ldb_handle *handle)
ldb_oom(ac->module->ldb);
return -1;
}
dn_list->dn[0] = ldb_dn_linearize(dn_list, ac->base);
dn_list->dn[0] = ldb_dn_alloc_linearized(dn_list, ac->base);
if (dn_list->dn[0] == NULL) {
ldb_oom(ac->module->ldb);
return -1;
@ -933,19 +933,16 @@ static int ltdb_index_add0(struct ldb_module *module, const char *dn,
*/
int ltdb_index_add(struct ldb_module *module, const struct ldb_message *msg)
{
struct ltdb_private *ltdb = module->private_data;
char *dn;
const char *dn;
int ret;
dn = ldb_dn_linearize(ltdb, msg->dn);
dn = ldb_dn_get_linearized(msg->dn);
if (dn == NULL) {
return -1;
}
ret = ltdb_index_add0(module, dn, msg->elements, msg->num_elements);
talloc_free(dn);
return ret;
}
@ -994,7 +991,7 @@ int ltdb_index_del_value(struct ldb_module *module, const char *dn,
if (i == -1) {
ldb_debug(ldb, LDB_DEBUG_ERROR,
"ERROR: dn %s not found in %s\n", dn,
ldb_dn_linearize(dn_key, dn_key));
ldb_dn_get_linearized(dn_key));
/* it ain't there. hmmm */
talloc_free(dn_key);
return 0;
@ -1027,7 +1024,7 @@ int ltdb_index_del(struct ldb_module *module, const struct ldb_message *msg)
{
struct ltdb_private *ltdb = module->private_data;
int ret;
char *dn;
const char *dn;
unsigned int i, j;
/* find the list of indexed fields */
@ -1040,7 +1037,7 @@ int ltdb_index_del(struct ldb_module *module, const struct ldb_message *msg)
return 0;
}
dn = ldb_dn_linearize(ltdb, msg->dn);
dn = ldb_dn_get_linearized(msg->dn);
if (dn == NULL) {
return -1;
}
@ -1054,13 +1051,11 @@ int ltdb_index_del(struct ldb_module *module, const struct ldb_message *msg)
for (j = 0; j < msg->elements[i].num_values; j++) {
ret = ltdb_index_del_value(module, dn, &msg->elements[i], j);
if (ret == -1) {
talloc_free(dn);
return -1;
}
}
}
talloc_free(dn);
return 0;
}
@ -1084,7 +1079,7 @@ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *
{
struct ldb_module *module = state;
struct ldb_message *msg;
char *dn = NULL;
const char *dn = NULL;
int ret;
TDB_DATA key2;
@ -1110,7 +1105,7 @@ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *
if (key2.dptr == NULL) {
/* probably a corrupt record ... darn */
ldb_debug(module->ldb, LDB_DEBUG_ERROR, "Invalid DN in re_index: %s\n",
ldb_dn_linearize(msg, msg->dn));
ldb_dn_get_linearized(msg->dn));
talloc_free(msg);
return 0;
}
@ -1123,7 +1118,7 @@ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *
if (msg->dn == NULL) {
dn = (char *)key.dptr + 3;
} else {
dn = ldb_dn_linearize(msg->dn, msg->dn);
dn = ldb_dn_get_linearized(msg->dn);
}
ret = ltdb_index_add0(module, dn, msg->elements, msg->num_elements);

View File

@ -85,11 +85,11 @@ int ltdb_pack_data(struct ldb_module *module,
struct ldb_context *ldb = module->ldb;
unsigned int i, j, real_elements=0;
size_t size;
char *dn;
const char *dn;
uint8_t *p;
size_t len;
dn = ldb_dn_linearize(ldb, message->dn);
dn = ldb_dn_get_linearized(message->dn);
if (dn == NULL) {
errno = ENOMEM;
return -1;
@ -116,7 +116,6 @@ int ltdb_pack_data(struct ldb_module *module,
/* allocate it */
data->dptr = talloc_array(ldb, uint8_t, size);
if (!data->dptr) {
talloc_free(dn);
errno = ENOMEM;
return -1;
}
@ -151,7 +150,6 @@ int ltdb_pack_data(struct ldb_module *module,
}
}
talloc_free(dn);
return 0;
}

View File

@ -101,7 +101,7 @@ static int msg_add_distinguished_name(struct ldb_message *msg)
el.name = "distinguishedName";
el.num_values = 1;
el.values = &val;
val.data = (uint8_t *)ldb_dn_linearize(msg, msg->dn);
val.data = (uint8_t *)ldb_dn_alloc_linearized(msg, msg->dn);
val.length = strlen((char *)val.data);
ret = msg_add_element(msg, &el, 1);

View File

@ -123,7 +123,7 @@ struct TDB_DATA ltdb_key(struct ldb_module *module, struct ldb_dn *dn)
struct ldb_context *ldb = module->ldb;
TDB_DATA key;
char *key_str = NULL;
char *dn_folded = NULL;
const char *dn_folded = NULL;
/*
most DNs are case insensitive. The exception is index DNs for
@ -267,14 +267,7 @@ static int ltdb_add_internal(struct ldb_module *module, const struct ldb_message
ret = ltdb_store(module, msg, TDB_INSERT);
if (ret == LDB_ERR_ENTRY_ALREADY_EXISTS) {
char *dn;
dn = ldb_dn_linearize(module, msg->dn);
if (!dn) {
return ret;
}
ldb_asprintf_errstring(module->ldb, "Entry %s already exists", dn);
talloc_free(dn);
ldb_asprintf_errstring(module->ldb, "Entry %s already exists", ldb_dn_get_linearized(msg->dn));
return ret;
}
@ -504,10 +497,10 @@ static int msg_delete_attribute(struct ldb_module *module,
struct ldb_context *ldb,
struct ldb_message *msg, const char *name)
{
char *dn;
const char *dn;
unsigned int i, j;
dn = ldb_dn_linearize(ldb, msg->dn);
dn = ldb_dn_get_linearized(msg->dn);
if (dn == NULL) {
return -1;
}
@ -532,7 +525,6 @@ static int msg_delete_attribute(struct ldb_module *module,
}
}
talloc_free(dn);
return 0;
}
@ -627,7 +619,7 @@ int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *ms
struct ldb_message_element *el = &msg->elements[i];
struct ldb_message_element *el2;
struct ldb_val *vals;
char *dn;
const char *dn;
switch (msg->elements[i].flags & LDB_FLAG_MOD_MASK) {
@ -690,7 +682,7 @@ int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *ms
case LDB_FLAG_MOD_DELETE:
dn = ldb_dn_linearize(msg2, msg->dn);
dn = ldb_dn_get_linearized(msg->dn);
if (dn == NULL) {
ret = LDB_ERR_OTHER;
goto failed;

View File

@ -679,7 +679,7 @@ static struct ldb_val ldb_dn_convert_local(struct ldb_module *module, void *mem_
talloc_free(dn);
newval.length = 0;
newval.data = (uint8_t *)ldb_dn_linearize(mem_ctx, newdn);
newval.data = (uint8_t *)ldb_dn_alloc_linearized(mem_ctx, newdn);
if (newval.data) {
newval.length = strlen((char *)newval.data);
}
@ -705,7 +705,7 @@ static struct ldb_val ldb_dn_convert_remote(struct ldb_module *module, void *mem
talloc_free(dn);
newval.length = 0;
newval.data = (uint8_t *)ldb_dn_linearize(mem_ctx, newdn);
newval.data = (uint8_t *)ldb_dn_alloc_linearized(mem_ctx, newdn);
if (newval.data) {
newval.length = strlen((char *)newval.data);
}
@ -992,9 +992,9 @@ struct ldb_request *map_build_fixup_req(struct map_context *ac, struct ldb_dn *o
}
/* Update local 'IS_MAPPED' to the new remote DN */
msg->dn = discard_const_p(struct ldb_dn, olddn);
dn = ldb_dn_linearize(msg, newdn);
if (dn == NULL) {
msg->dn = ldb_dn_copy(msg, olddn);
dn = ldb_dn_alloc_linearized(msg, newdn);
if ( ! dn || ! ldb_dn_validate(msg->dn)) {
goto failed;
}
if (ldb_msg_add_empty(msg, IS_MAPPED, LDB_FLAG_MOD_REPLACE, NULL) != 0) {

View File

@ -297,7 +297,7 @@ int map_add(struct ldb_module *module, struct ldb_request *req)
/* Store remote DN in 'IS_MAPPED' */
/* TODO: use GUIDs here instead */
dn = ldb_dn_linearize(local, remote->dn);
dn = ldb_dn_alloc_linearized(local, remote->dn);
if (ldb_msg_add_string(local, IS_MAPPED, dn) != 0) {
goto failed;
}
@ -344,10 +344,10 @@ int map_modify_do_local(struct ldb_handle *handle)
/* Add local 'IS_MAPPED' */
/* TODO: use GUIDs here instead */
dn = ldb_dn_linearize(msg, ac->remote_req->op.mod.message->dn);
if (ldb_msg_add_empty(msg, IS_MAPPED, LDB_FLAG_MOD_ADD, NULL) != 0) {
return LDB_ERR_OPERATIONS_ERROR;
}
dn = ldb_dn_alloc_linearized(msg, ac->remote_req->op.mod.message->dn);
if (ldb_msg_add_string(msg, IS_MAPPED, dn) != 0) {
return LDB_ERR_OPERATIONS_ERROR;
}

View File

@ -1028,7 +1028,7 @@ int map_up_callback(struct ldb_context *ldb, const struct ldb_request *req, stru
ldb_debug(ldb, LDB_DEBUG_TRACE, "ldb_map: "
"Skipping record '%s': "
"doesn't match original search\n",
ldb_dn_linearize(ldb, ares->message->dn));
ldb_dn_get_linearized(ares->message->dn));
return LDB_SUCCESS;
}

View File

@ -119,7 +119,7 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req)
if (i == attribute->num_values) {
ldb_debug_set(module->ldb, LDB_DEBUG_FATAL,
"RDN mismatch on %s: %s (%s)",
ldb_dn_linearize(msg, msg->dn), rdn_name, rdn_val.data);
ldb_dn_get_linearized(msg->dn), rdn_name, rdn_val.data);
talloc_free(down_req);
return LDB_ERR_OPERATIONS_ERROR;
}

View File

@ -71,7 +71,7 @@ static int process_file(struct ldb_context *ldb, FILE *f, int *count)
ret = ldb_add(ldb, ldif->msg);
if (ret != LDB_SUCCESS) {
fprintf(stderr, "ERR: \"%s\" on DN %s\n",
ldb_errstring(ldb), ldb_dn_linearize(ldb, ldif->msg->dn));
ldb_errstring(ldb), ldb_dn_get_linearized(ldif->msg->dn));
failures++;
} else {
(*count)++;

View File

@ -108,7 +108,7 @@ int main(int argc, const char **argv)
}
if (ret != 0) {
printf("delete of '%s' failed - %s\n",
ldb_dn_linearize(ldb, dn),
ldb_dn_get_linearized(dn),
ldb_errstring(ldb));
}
}

View File

@ -78,7 +78,7 @@ static int modify_record(struct ldb_context *ldb,
if (ldb_modify(ldb, mod) != 0) {
fprintf(stderr, "failed to modify %s - %s\n",
ldb_dn_linearize(ldb, msg1->dn), ldb_errstring(ldb));
ldb_dn_get_linearized(msg1->dn), ldb_errstring(ldb));
return -1;
}
@ -123,7 +123,7 @@ static int merge_edits(struct ldb_context *ldb,
}
if (ldb_add(ldb, msgs2[i]) != 0) {
fprintf(stderr, "failed to add %s - %s\n",
ldb_dn_linearize(ldb, msgs2[i]->dn),
ldb_dn_get_linearized(msgs2[i]->dn),
ldb_errstring(ldb));
return -1;
}
@ -144,7 +144,7 @@ static int merge_edits(struct ldb_context *ldb,
}
if (ldb_delete(ldb, msgs1[i]->dn) != 0) {
fprintf(stderr, "failed to delete %s - %s\n",
ldb_dn_linearize(ldb, msgs1[i]->dn),
ldb_dn_get_linearized(msgs1[i]->dn),
ldb_errstring(ldb));
return -1;
}

View File

@ -73,7 +73,7 @@ static int process_file(struct ldb_context *ldb, FILE *f, int *count)
}
if (ret != LDB_SUCCESS) {
fprintf(stderr, "ERR: \"%s\" on DN %s\n",
ldb_errstring(ldb), ldb_dn_linearize(ldb, ldif->msg->dn));
ldb_errstring(ldb), ldb_dn_get_linearized(ldif->msg->dn));
failures++;
} else {
(*count)++;

View File

@ -322,7 +322,7 @@ static void start_test_index(struct ldb_context **ldb)
ldb_msg_add_string(msg, "@IDXATTR", strdup("uid"));
if (ldb_add(*ldb, msg) != 0) {
printf("Add of %s failed - %s\n", ldb_dn_linearize(*ldb, msg->dn), ldb_errstring(*ldb));
printf("Add of %s failed - %s\n", ldb_dn_get_linearized(msg->dn), ldb_errstring(*ldb));
exit(1);
}
@ -337,7 +337,7 @@ static void start_test_index(struct ldb_context **ldb)
ldb_msg_add_string(msg, "objectClass", strdup("OpenLDAPperson"));
if (ldb_add(*ldb, msg) != 0) {
printf("Add of %s failed - %s\n", ldb_dn_linearize(*ldb, msg->dn), ldb_errstring(*ldb));
printf("Add of %s failed - %s\n", ldb_dn_get_linearized(msg->dn), ldb_errstring(*ldb));
exit(1);
}

View File

@ -176,7 +176,7 @@ static WERROR ldb_get_subkey_by_id(TALLOC_CTX *mem_ctx, const struct registry_ke
ret = ldb_search(c, kd->dn, LDB_SCOPE_ONELEVEL, "(key=*)", NULL, &res);
if (ret != LDB_SUCCESS) {
DEBUG(0, ("Error getting subkeys for '%s': %s\n", ldb_dn_linearize(mem_ctx, kd->dn), ldb_errstring(c)));
DEBUG(0, ("Error getting subkeys for '%s': %s\n", ldb_dn_get_linearized(kd->dn), ldb_errstring(c)));
return WERR_FOOBAR;
}
@ -213,7 +213,7 @@ static WERROR ldb_get_value_by_id(TALLOC_CTX *mem_ctx, const struct registry_key
ret = ldb_search(c, kd->dn, LDB_SCOPE_ONELEVEL, "(value=*)", NULL, &res);
if (ret != LDB_SUCCESS) {
DEBUG(0, ("Error getting values for '%s': %s\n", ldb_dn_linearize(mem_ctx, kd->dn), ldb_errstring(c)));
DEBUG(0, ("Error getting values for '%s': %s\n", ldb_dn_get_linearized(kd->dn), ldb_errstring(c)));
return WERR_FOOBAR;
}
kd->value_count = res->count;
@ -243,7 +243,7 @@ static WERROR ldb_open_key(TALLOC_CTX *mem_ctx, const struct registry_key *h, co
ret = ldb_search(c, ldap_path, LDB_SCOPE_BASE, "(key=*)", NULL, &res);
if (ret != LDB_SUCCESS) {
DEBUG(0, ("Error opening key '%s': %s\n", ldb_dn_linearize(ldap_path, ldap_path), ldb_errstring(c)));
DEBUG(0, ("Error opening key '%s': %s\n", ldb_dn_get_linearized(ldap_path), ldb_errstring(c)));
return WERR_FOOBAR;
} else if (res->count == 0) {
talloc_free(res);

View File

@ -324,7 +324,7 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J
r->out.error_string
= talloc_asprintf(r,
"Failed to replace entries on %s",
ldb_dn_linearize(tmp_ctx, msg->dn));
ldb_dn_get_linearized(msg->dn));
talloc_free(tmp_ctx);
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -1148,7 +1148,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
ret = samdb_add(ldb, tmp_mem, msg);
if (ret != 0) {
r->out.error_string = talloc_asprintf(mem_ctx, "Failed to create secret record %s",
ldb_dn_linearize(ldb, msg->dn));
ldb_dn_get_linearized(msg->dn));
talloc_free(tmp_mem);
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -1163,7 +1163,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
return NT_STATUS_NO_MEMORY;
}
cli_credentials_set_conf(creds);
filter = talloc_asprintf(mem_ctx, "dn=%s", ldb_dn_linearize(mem_ctx, msg->dn));
filter = talloc_asprintf(mem_ctx, "dn=%s", ldb_dn_get_linearized(msg->dn));
status = cli_credentials_set_secrets(creds, NULL, filter);
if (!NT_STATUS_IS_OK(status)) {
r->out.error_string = talloc_asprintf(mem_ctx, "Failed to read secrets for keytab update for %s",

View File

@ -79,7 +79,7 @@ static NTSTATUS samsync_ldb_add_foreignSecurityPrincipal(TALLOC_CTX *mem_ctx,
*error_string = talloc_asprintf(mem_ctx,
"Failed to find DN for "
"ForeignSecurityPrincipal container under %s",
ldb_dn_linearize(mem_ctx, state->base_dn[SAM_DATABASE_DOMAIN]));
ldb_dn_get_linearized(state->base_dn[SAM_DATABASE_DOMAIN]));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -104,7 +104,7 @@ static NTSTATUS samsync_ldb_add_foreignSecurityPrincipal(TALLOC_CTX *mem_ctx,
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to create foreignSecurityPrincipal "
"record %s: %s",
ldb_dn_linearize(mem_ctx, msg->dn),
ldb_dn_get_linearized(msg->dn),
ldb_errstring(state->sam_ldb));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -298,7 +298,7 @@ static NTSTATUS samsync_ldb_handle_user(TALLOC_CTX *mem_ctx,
return NT_STATUS_INTERNAL_DB_CORRUPTION;
} else if (ret == 0) {
*error_string = talloc_asprintf(mem_ctx, "User exists in samsync but not in remote LDAP domain! (base: %s, SID: %s)",
ldb_dn_linearize(mem_ctx, state->base_dn[database]),
ldb_dn_get_linearized(state->base_dn[database]),
dom_sid_string(mem_ctx, user_sid));
return NT_STATUS_NO_SUCH_USER;
} else if (ret > 1) {
@ -436,8 +436,8 @@ static NTSTATUS samsync_ldb_handle_user(TALLOC_CTX *mem_ctx,
ret = samdb_add(state->sam_ldb, mem_ctx, msg);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to create user record. Tried both %s and %s: %s",
ldb_dn_linearize(mem_ctx, first_try_dn),
ldb_dn_linearize(mem_ctx, msg->dn),
ldb_dn_get_linearized(first_try_dn),
ldb_dn_get_linearized(msg->dn),
ldb_errstring(state->sam_ldb));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -446,7 +446,7 @@ static NTSTATUS samsync_ldb_handle_user(TALLOC_CTX *mem_ctx,
ret = samdb_replace(state->sam_ldb, mem_ctx, msg);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to modify user record %s: %s",
ldb_dn_linearize(mem_ctx, msg->dn),
ldb_dn_get_linearized(msg->dn),
ldb_errstring(state->sam_ldb));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -488,7 +488,7 @@ static NTSTATUS samsync_ldb_delete_user(TALLOC_CTX *mem_ctx,
ret = samdb_delete(state->sam_ldb, mem_ctx, msgs[0]->dn);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to delete user record %s: %s",
ldb_dn_linearize(mem_ctx, msgs[0]->dn),
ldb_dn_get_linearized(msgs[0]->dn),
ldb_errstring(state->sam_ldb));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -577,7 +577,7 @@ static NTSTATUS samsync_ldb_handle_group(TALLOC_CTX *mem_ctx,
ret = samdb_add(state->sam_ldb, mem_ctx, msg);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to create group record %s: %s",
ldb_dn_linearize(mem_ctx, msg->dn),
ldb_dn_get_linearized(msg->dn),
ldb_errstring(state->sam_ldb));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -585,7 +585,7 @@ static NTSTATUS samsync_ldb_handle_group(TALLOC_CTX *mem_ctx,
ret = samdb_replace(state->sam_ldb, mem_ctx, msg);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to modify group record %s: %s",
ldb_dn_linearize(mem_ctx, msg->dn),
ldb_dn_get_linearized(msg->dn),
ldb_errstring(state->sam_ldb));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -627,7 +627,7 @@ static NTSTATUS samsync_ldb_delete_group(TALLOC_CTX *mem_ctx,
ret = samdb_delete(state->sam_ldb, mem_ctx, msgs[0]->dn);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to delete group record %s: %s",
ldb_dn_linearize(mem_ctx, msgs[0]->dn),
ldb_dn_get_linearized(msgs[0]->dn),
ldb_errstring(state->sam_ldb));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -691,7 +691,7 @@ static NTSTATUS samsync_ldb_handle_group_member(TALLOC_CTX *mem_ctx,
} else if (ret > 1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
} else {
samdb_msg_add_string(state->sam_ldb, mem_ctx, msg, "member", ldb_dn_linearize(mem_ctx, msgs[0]->dn));
samdb_msg_add_string(state->sam_ldb, mem_ctx, msg, "member", ldb_dn_alloc_linearized(mem_ctx, msgs[0]->dn));
}
talloc_free(msgs);
@ -700,7 +700,7 @@ static NTSTATUS samsync_ldb_handle_group_member(TALLOC_CTX *mem_ctx,
ret = samdb_replace(state->sam_ldb, mem_ctx, msg);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to modify group record %s: %s",
ldb_dn_linearize(mem_ctx, msg->dn),
ldb_dn_get_linearized(msg->dn),
ldb_errstring(state->sam_ldb));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -791,7 +791,7 @@ static NTSTATUS samsync_ldb_handle_alias(TALLOC_CTX *mem_ctx,
ret = samdb_add(state->sam_ldb, mem_ctx, msg);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to create alias record %s: %s",
ldb_dn_linearize(mem_ctx, msg->dn),
ldb_dn_get_linearized(msg->dn),
ldb_errstring(state->sam_ldb));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -799,7 +799,7 @@ static NTSTATUS samsync_ldb_handle_alias(TALLOC_CTX *mem_ctx,
ret = samdb_replace(state->sam_ldb, mem_ctx, msg);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to modify alias record %s: %s",
ldb_dn_linearize(mem_ctx, msg->dn),
ldb_dn_get_linearized(msg->dn),
ldb_errstring(state->sam_ldb));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -836,7 +836,7 @@ static NTSTATUS samsync_ldb_delete_alias(TALLOC_CTX *mem_ctx,
ret = samdb_delete(state->sam_ldb, mem_ctx, msgs[0]->dn);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to delete alias record %s: %s",
ldb_dn_linearize(mem_ctx, msgs[0]->dn),
ldb_dn_get_linearized(msgs[0]->dn),
ldb_errstring(state->sam_ldb));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -910,7 +910,7 @@ static NTSTATUS samsync_ldb_handle_alias_member(TALLOC_CTX *mem_ctx,
} else {
alias_member_dn = msgs[0]->dn;
}
samdb_msg_add_string(state->sam_ldb, mem_ctx, msg, "member", ldb_dn_linearize(mem_ctx, alias_member_dn));
samdb_msg_add_string(state->sam_ldb, mem_ctx, msg, "member", ldb_dn_alloc_linearized(mem_ctx, alias_member_dn));
talloc_free(msgs);
}
@ -918,7 +918,7 @@ static NTSTATUS samsync_ldb_handle_alias_member(TALLOC_CTX *mem_ctx,
ret = samdb_replace(state->sam_ldb, mem_ctx, msg);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to modify group record %s: %s",
ldb_dn_linearize(mem_ctx, msg->dn),
ldb_dn_get_linearized(msg->dn),
ldb_errstring(state->sam_ldb));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -982,7 +982,7 @@ static NTSTATUS samsync_ldb_handle_account(TALLOC_CTX *mem_ctx,
ret = samdb_replace(state->sam_ldb, mem_ctx, msg);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to modify privilege record %s",
ldb_dn_linearize(mem_ctx, msg->dn));
ldb_dn_get_linearized(msg->dn));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -1031,7 +1031,7 @@ static NTSTATUS samsync_ldb_delete_account(TALLOC_CTX *mem_ctx,
ret = samdb_replace(state->sam_ldb, mem_ctx, msg);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to modify privilege record %s",
ldb_dn_linearize(mem_ctx, msg->dn));
ldb_dn_get_linearized(msg->dn));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}

View File

@ -146,7 +146,7 @@ static void nbtd_netlogon_getdc2(struct dgram_mailslot_handler *dgmslot,
&dom_res, dom_attrs);
if (ret != 1) {
DEBUG(2,("Unable to find domain from reference '%s' in sam\n",
ldb_dn_linearize(samctx, ref_res[0]->dn)));
ldb_dn_get_linearized(ref_res[0]->dn)));
return;
}

View File

@ -751,7 +751,7 @@ NTSTATUS winsdb_record(struct winsdb_handle *h, struct ldb_message *msg, TALLOC_
return NT_STATUS_OK;
failed:
if (NT_STATUS_EQUAL(NT_STATUS_INTERNAL_DB_CORRUPTION, status)) {
DEBUG(1,("winsdb_record: corrupted record: %s\n", ldb_dn_linearize(rec, msg->dn)));
DEBUG(1,("winsdb_record: corrupted record: %s\n", ldb_dn_get_linearized(msg->dn)));
}
talloc_free(rec);
return status;

View File

@ -311,7 +311,7 @@ static WERROR drsuapi_DsWriteAccountSpn(struct dcesrv_call_state *dce_call, TALL
ret = samdb_modify(b_state->sam_ctx, mem_ctx, msg);
if (ret != 0) {
DEBUG(0,("Failed to modify SPNs on %s: %s\n",
ldb_dn_linearize(mem_ctx, msg->dn),
ldb_dn_get_linearized(msg->dn),
ldb_errstring(b_state->sam_ctx)));
r->out.res.res1.status = WERR_ACCESS_DENIED;
} else {

View File

@ -338,7 +338,7 @@ static NTSTATUS lsa_get_policy_state(struct dcesrv_call_state *dce_call, TALLOC_
talloc_free(dom_res);
ref_filter = talloc_asprintf(state, "(&(objectclass=crossRef)(ncName=%s))",
ldb_dn_linearize(mem_ctx, state->domain_dn));
ldb_dn_get_linearized(state->domain_dn));
if (!ref_filter) {
return NT_STATUS_NO_MEMORY;
}
@ -829,7 +829,7 @@ static NTSTATUS lsa_CreateTrustedDomain(struct dcesrv_call_state *dce_call, TALL
if (ret < 0 || ret > 1) {
DEBUG(0,("Found %d records matching DN %s\n", ret,
ldb_dn_linearize(mem_ctx, policy_state->system_dn)));
ldb_dn_get_linearized(policy_state->system_dn)));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -858,7 +858,7 @@ static NTSTATUS lsa_CreateTrustedDomain(struct dcesrv_call_state *dce_call, TALL
ret = ldb_add(trusted_domain_state->policy->sam_ldb, msg);
if (ret != LDB_SUCCESS) {
DEBUG(0,("Failed to create trusted_domain record %s: %s\n",
ldb_dn_linearize(mem_ctx, msg->dn), ldb_errstring(trusted_domain_state->policy->sam_ldb)));
ldb_dn_get_linearized(msg->dn), ldb_errstring(trusted_domain_state->policy->sam_ldb)));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -922,7 +922,7 @@ static NTSTATUS lsa_OpenTrustedDomain(struct dcesrv_call_state *dce_call, TALLOC
if (ret != 1) {
DEBUG(0,("Found %d records matching DN %s\n", ret,
ldb_dn_linearize(mem_ctx, policy_state->system_dn)));
ldb_dn_get_linearized(policy_state->system_dn)));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -988,7 +988,7 @@ static NTSTATUS lsa_OpenTrustedDomainByName(struct dcesrv_call_state *dce_call,
if (ret != 1) {
DEBUG(0,("Found %d records matching DN %s\n", ret,
ldb_dn_linearize(mem_ctx, policy_state->system_dn)));
ldb_dn_get_linearized(policy_state->system_dn)));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -2004,7 +2004,7 @@ static NTSTATUS lsa_AddRemoveAccountRights(struct dcesrv_call_state *dce_call,
}
DEBUG(3, ("Could not %s attributes from %s: %s",
ldb_flag == LDB_FLAG_MOD_DELETE ? "delete" : "add",
ldb_dn_linearize(mem_ctx, msg->dn), ldb_errstring(state->sam_ldb)));
ldb_dn_get_linearized(msg->dn), ldb_errstring(state->sam_ldb)));
return NT_STATUS_UNEXPECTED_IO_ERROR;
}
@ -2269,7 +2269,7 @@ static NTSTATUS lsa_CreateSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX
ret = samdb_add(secret_state->sam_ldb, mem_ctx, msg);
if (ret != 0) {
DEBUG(0,("Failed to create secret record %s: %s\n",
ldb_dn_linearize(mem_ctx, msg->dn),
ldb_dn_get_linearized(msg->dn),
ldb_errstring(secret_state->sam_ldb)));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -2344,7 +2344,7 @@ static NTSTATUS lsa_OpenSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX *m
if (ret != 1) {
DEBUG(0,("Found %d records matching DN %s\n", ret,
ldb_dn_linearize(mem_ctx, policy_state->system_dn)));
ldb_dn_get_linearized(policy_state->system_dn)));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -2369,7 +2369,7 @@ static NTSTATUS lsa_OpenSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX *m
if (ret != 1) {
DEBUG(0,("Found %d records matching DN %s\n", ret,
ldb_dn_linearize(mem_ctx, policy_state->system_dn)));
ldb_dn_get_linearized(policy_state->system_dn)));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
}
@ -2521,7 +2521,7 @@ static NTSTATUS lsa_SetSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX *me
if (ret != 1) {
DEBUG(0,("Found %d records matching dn=%s\n", ret,
ldb_dn_linearize(mem_ctx, secret_state->secret_dn)));
ldb_dn_get_linearized(secret_state->secret_dn)));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}

View File

@ -905,7 +905,7 @@ static NTSTATUS netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_call, TALL
ret = gendb_search(sam_ctx, mem_ctx, partitions_basedn,
&ref_res, ref_attrs,
"(&(objectClass=crossRef)(ncName=%s))",
ldb_dn_linearize(mem_ctx, res1[0]->dn));
ldb_dn_get_linearized(res1[0]->dn));
if (ret != 1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -1151,7 +1151,7 @@ static WERROR netr_DsrEnumerateDomainTrusts(struct dcesrv_call_state *dce_call,
ret = gendb_search(sam_ctx, mem_ctx, partitions_basedn, &ref_res, ref_attrs,
"(&(objectClass=crossRef)(ncName=%s))",
ldb_dn_linearize(mem_ctx, dom_res[0]->dn));
ldb_dn_get_linearized(dom_res[0]->dn));
if (ret == -1) {
return WERR_GENERAL_FAILURE;
}

View File

@ -340,7 +340,7 @@ static NTSTATUS samr_EnumDomains(struct dcesrv_call_state *dce_call, TALLOC_CTX
ret = gendb_search(c_state->sam_ctx, mem_ctx, partitions_basedn,
&ref_msgs, ref_attrs,
"(&(objectClass=crossRef)(ncName=%s))",
ldb_dn_linearize(mem_ctx, dom_msgs[i]->dn));
ldb_dn_get_linearized(dom_msgs[i]->dn));
if (ret == 1) {
array->entries[i].name.string = samdb_result_string(ref_msgs[0], "nETBIOSName", NULL);
} else {
@ -399,7 +399,7 @@ static NTSTATUS samr_OpenDomain(struct dcesrv_call_state *dce_call, TALLOC_CTX *
ret = gendb_search(c_state->sam_ctx,
mem_ctx, partitions_basedn, &ref_msgs, ref_attrs,
"(&(&(nETBIOSName=*)(objectclass=crossRef))(ncName=%s))",
ldb_dn_linearize(mem_ctx, dom_msgs[0]->dn));
ldb_dn_get_linearized(dom_msgs[0]->dn));
if (ret == 0) {
domain_name = ldb_msg_find_attr_as_string(dom_msgs[0], "cn", NULL);
if (domain_name == NULL) {
@ -880,7 +880,7 @@ static NTSTATUS samr_SetDomainInfo(struct dcesrv_call_state *dce_call, TALLOC_CT
ret = samdb_replace(sam_ctx, mem_ctx, msg);
if (ret != 0) {
DEBUG(1,("Failed to modify record %s: %s\n",
ldb_dn_linearize(mem_ctx, d_state->domain_dn),
ldb_dn_get_linearized(d_state->domain_dn),
ldb_errstring(sam_ctx)));
/* we really need samdb.c to return NTSTATUS */
@ -946,7 +946,7 @@ static NTSTATUS samr_CreateDomainGroup(struct dcesrv_call_state *dce_call, TALLO
ret = samdb_add(d_state->sam_ctx, mem_ctx, msg);
if (ret != 0) {
DEBUG(0,("Failed to create group record %s\n",
ldb_dn_linearize(mem_ctx, msg->dn)));
ldb_dn_get_linearized(msg->dn)));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -1244,7 +1244,7 @@ static NTSTATUS samr_CreateUser2(struct dcesrv_call_state *dce_call, TALLOC_CTX
if (ret != 1) {
ldb_transaction_cancel(d_state->sam_ctx);
DEBUG(0,("Apparently we failed to create an account record, as %s now doesn't exist\n",
ldb_dn_linearize(mem_ctx, msg->dn)));
ldb_dn_get_linearized(msg->dn)));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
sid = samdb_result_dom_sid(mem_ctx, msgs[0], "objectSid");
@ -1283,7 +1283,7 @@ static NTSTATUS samr_CreateUser2(struct dcesrv_call_state *dce_call, TALLOC_CTX
ret = samdb_replace(a_state->sam_ctx, mem_ctx, msg);
if (ret != 0) {
DEBUG(0,("Failed to modify account record %s to set userAccountControl: %s\n",
ldb_dn_linearize(mem_ctx, msg->dn),
ldb_dn_get_linearized(msg->dn),
ldb_errstring(d_state->sam_ctx)));
ldb_transaction_cancel(d_state->sam_ctx);
@ -1294,7 +1294,7 @@ static NTSTATUS samr_CreateUser2(struct dcesrv_call_state *dce_call, TALLOC_CTX
ret = ldb_transaction_commit(d_state->sam_ctx);
if (ret != 0) {
DEBUG(0,("Failed to commit transaction to add and modify account record %s: %s\n",
ldb_dn_linearize(mem_ctx, msg->dn),
ldb_dn_get_linearized(msg->dn),
ldb_errstring(d_state->sam_ctx)));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -1484,7 +1484,7 @@ static NTSTATUS samr_CreateDomAlias(struct dcesrv_call_state *dce_call, TALLOC_C
return NT_STATUS_ALIAS_EXISTS;
default:
DEBUG(0,("Failed to create alias record %s: %s\n",
ldb_dn_linearize(mem_ctx, msg->dn),
ldb_dn_get_linearized(msg->dn),
ldb_errstring(d_state->sam_ctx)));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -2102,7 +2102,7 @@ static NTSTATUS samr_AddGroupMember(struct dcesrv_call_state *dce_call, TALLOC_C
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
memberdn = ldb_dn_linearize(mem_ctx, res->msgs[0]->dn);
memberdn = ldb_dn_alloc_linearized(mem_ctx, res->msgs[0]->dn);
if (memberdn == NULL)
return NT_STATUS_NO_MEMORY;
@ -2205,7 +2205,7 @@ static NTSTATUS samr_DeleteGroupMember(struct dcesrv_call_state *dce_call, TALLO
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
memberdn = ldb_dn_linearize(mem_ctx, res->msgs[0]->dn);
memberdn = ldb_dn_alloc_linearized(mem_ctx, res->msgs[0]->dn);
if (memberdn == NULL)
return NT_STATUS_NO_MEMORY;
@ -2587,7 +2587,7 @@ static NTSTATUS samr_AddAliasMember(struct dcesrv_call_state *dce_call, TALLOC_C
mod->dn = talloc_reference(mem_ctx, a_state->account_dn);
if (samdb_msg_add_addval(d_state->sam_ctx, mem_ctx, mod, "member",
ldb_dn_linearize(mem_ctx, memberdn)) != 0)
ldb_dn_alloc_linearized(mem_ctx, memberdn)) != 0)
return NT_STATUS_UNSUCCESSFUL;
if (samdb_modify(a_state->sam_ctx, mem_ctx, mod) != 0)
@ -3406,7 +3406,7 @@ static NTSTATUS samr_SetUserInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX
ret = samdb_replace(a_state->sam_ctx, mem_ctx, msg);
if (ret != 0) {
DEBUG(1,("Failed to modify record %s: %s\n",
ldb_dn_linearize(mem_ctx, a_state->account_dn),
ldb_dn_get_linearized(a_state->account_dn),
ldb_errstring(a_state->sam_ctx)));
/* we really need samdb.c to return NTSTATUS */
@ -3439,7 +3439,7 @@ static NTSTATUS samr_GetGroupsForUser(struct dcesrv_call_state *dce_call, TALLOC
count = samdb_search_domain(a_state->sam_ctx, mem_ctx, d_state->domain_dn, &res,
attrs, d_state->domain_sid,
"(&(member=%s)(grouptype=%d)(objectclass=group))",
ldb_dn_linearize(mem_ctx, a_state->account_dn),
ldb_dn_get_linearized(a_state->account_dn),
GTYPE_SECURITY_GLOBAL_GROUP);
if (count < 0)
return NT_STATUS_INTERNAL_DB_CORRUPTION;

View File

@ -158,7 +158,7 @@ NTSTATUS samr_ChangePasswordUser(struct dcesrv_call_state *dce_call, TALLOC_CTX
ret = samdb_replace(sam_ctx, mem_ctx, msg);
if (ret != 0) {
DEBUG(2,("Failed to modify record to change password on %s: %s\n",
ldb_dn_linearize(mem_ctx, a_state->account_dn),
ldb_dn_get_linearized(a_state->account_dn),
ldb_errstring(sam_ctx)));
ldb_transaction_cancel(sam_ctx);
return NT_STATUS_INTERNAL_DB_CORRUPTION;
@ -168,7 +168,7 @@ NTSTATUS samr_ChangePasswordUser(struct dcesrv_call_state *dce_call, TALLOC_CTX
ret = ldb_transaction_commit(sam_ctx);
if (ret != 0) {
DEBUG(1,("Failed to commit transaction to change password on %s: %s\n",
ldb_dn_linearize(mem_ctx, a_state->account_dn),
ldb_dn_get_linearized(a_state->account_dn),
ldb_errstring(sam_ctx)));
return NT_STATUS_TRANSACTION_ABORTED;
}
@ -290,7 +290,7 @@ NTSTATUS samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call, TALLOC_
ret = samdb_replace(sam_ctx, mem_ctx, mod);
if (ret != 0) {
DEBUG(2,("Failed to modify record to change password on %s: %s\n",
ldb_dn_linearize(mem_ctx, user_dn),
ldb_dn_get_linearized(user_dn),
ldb_errstring(sam_ctx)));
ldb_transaction_cancel(sam_ctx);
return NT_STATUS_INTERNAL_DB_CORRUPTION;
@ -300,7 +300,7 @@ NTSTATUS samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call, TALLOC_
ret = ldb_transaction_commit(sam_ctx);
if (ret != 0) {
DEBUG(1,("Failed to commit transaction to change password on %s: %s\n",
ldb_dn_linearize(mem_ctx, user_dn),
ldb_dn_get_linearized(user_dn),
ldb_errstring(sam_ctx)));
return NT_STATUS_TRANSACTION_ABORTED;
}
@ -443,7 +443,7 @@ NTSTATUS samr_ChangePasswordUser3(struct dcesrv_call_state *dce_call,
ret = samdb_replace(sam_ctx, mem_ctx, mod);
if (ret != 0) {
DEBUG(2,("samdb_replace failed to change password for %s: %s\n",
ldb_dn_linearize(mem_ctx, user_dn),
ldb_dn_get_linearized(user_dn),
ldb_errstring(sam_ctx)));
status = NT_STATUS_UNSUCCESSFUL;
goto failed;
@ -453,7 +453,7 @@ NTSTATUS samr_ChangePasswordUser3(struct dcesrv_call_state *dce_call,
ret = ldb_transaction_commit(sam_ctx);
if (ret != 0) {
DEBUG(1,("Failed to commit transaction to change password on %s: %s\n",
ldb_dn_linearize(mem_ctx, user_dn),
ldb_dn_get_linearized(user_dn),
ldb_errstring(sam_ctx)));
status = NT_STATUS_TRANSACTION_ABORTED;
goto failed;

View File

@ -166,7 +166,7 @@ static struct MprVar mprLdbMessage(struct ldb_context *ldb, struct ldb_message *
const char *multivalued[] = { "objectClass", "memberOf", "privilege",
"member", NULL };
var = mprObject(ldb_dn_linearize(msg, msg->dn));
var = mprObject(ldb_dn_alloc_linearized(msg, msg->dn));
for (i=0;i<msg->num_elements;i++) {
struct ldb_message_element *el = &msg->elements[i];
@ -213,7 +213,7 @@ static struct MprVar mprLdbMessage(struct ldb_context *ldb, struct ldb_message *
/* add the dn if it is not already specified */
if (mprGetProperty(&var, "dn", 0) == 0) {
mprSetVar(&var, "dn", mprString(ldb_dn_linearize(msg, msg->dn)));
mprSetVar(&var, "dn", mprString(ldb_dn_alloc_linearized(msg, msg->dn)));
}
return var;