summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCrístian Deives <cristiandeives@gmail.com>2009-11-23 15:47:51 -0200
committerAndrew Tridgell <tridge@samba.org>2009-11-30 20:22:13 +1100
commitbed9efa6cda17ecca91bdf71227ec656b94dcf94 (patch)
tree01dded56aa27f3814e97aebc7d172be02c3cb770
parent7ca2ceb333de6c4daad10890b3e3022e1930235c (diff)
downloadsamba-bed9efa6cda17ecca91bdf71227ec656b94dcf94.tar.gz
samba-bed9efa6cda17ecca91bdf71227ec656b94dcf94.tar.bz2
samba-bed9efa6cda17ecca91bdf71227ec656b94dcf94.zip
s4-ldb: changed ldb_msg_add_dn() to ldb_msg_add_linearized_dn()
this makes the usage clearer Signed-off-by: Andrew Tridgell <tridge@samba.org>
-rw-r--r--source4/dsdb/samdb/ldb_modules/extended_dn_out.c6
-rw-r--r--source4/lib/ldb/common/ldb_msg.c7
-rw-r--r--source4/lib/ldb/include/ldb.h4
-rw-r--r--source4/lib/ldb/ldb_map/ldb_map_inbound.c9
4 files changed, 15 insertions, 11 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn_out.c b/source4/dsdb/samdb/ldb_modules/extended_dn_out.c
index c52953c206..1463e192e9 100644
--- a/source4/dsdb/samdb/ldb_modules/extended_dn_out.c
+++ b/source4/dsdb/samdb/ldb_modules/extended_dn_out.c
@@ -377,9 +377,9 @@ static int extended_callback(struct ldb_request *req, struct ldb_reply *ares,
ret = ldb_msg_add_steal_string(ares->message, "distinguishedName",
ldb_dn_get_extended_linearized(ares->message, ares->message->dn, ac->extended_type));
} else {
- ret = ldb_msg_add_dn(ares->message,
- "distinguishedName",
- ares->message->dn);
+ ret = ldb_msg_add_linearized_dn(ares->message,
+ "distinguishedName",
+ ares->message->dn);
}
if (ret != LDB_SUCCESS) {
ldb_oom(ldb);
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c
index f1dd6f3544..fbf49fbb23 100644
--- a/source4/lib/ldb/common/ldb_msg.c
+++ b/source4/lib/ldb/common/ldb_msg.c
@@ -263,10 +263,11 @@ int ldb_msg_add_steal_string(struct ldb_message *msg,
WARNING: this uses the linearized string from the dn, and does not
copy the string.
*/
-int ldb_msg_add_dn(struct ldb_message *msg, const char *attr_name,
- struct ldb_dn *dn)
+int ldb_msg_add_linearized_dn(struct ldb_message *msg, const char *attr_name,
+ struct ldb_dn *dn)
{
- return ldb_msg_add_string(msg, attr_name, ldb_dn_get_linearized(dn));
+ return ldb_msg_add_steal_string(msg, attr_name,
+ ldb_dn_alloc_linearized(msg, dn));
}
/*
diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h
index f2b4a48b45..88ac29d943 100644
--- a/source4/lib/ldb/include/ldb.h
+++ b/source4/lib/ldb/include/ldb.h
@@ -1776,8 +1776,8 @@ int ldb_msg_add_steal_string(struct ldb_message *msg,
const char *attr_name, char *str);
int ldb_msg_add_string(struct ldb_message *msg,
const char *attr_name, const char *str);
-int ldb_msg_add_dn(struct ldb_message *msg, const char *attr_name,
- struct ldb_dn *dn);
+int ldb_msg_add_linearized_dn(struct ldb_message *msg, const char *attr_name,
+ struct ldb_dn *dn);
int ldb_msg_add_fmt(struct ldb_message *msg,
const char *attr_name, const char *fmt, ...) PRINTF_ATTRIBUTE(3,4);
diff --git a/source4/lib/ldb/ldb_map/ldb_map_inbound.c b/source4/lib/ldb/ldb_map/ldb_map_inbound.c
index 11ec9d2ced..5a948cff69 100644
--- a/source4/lib/ldb/ldb_map/ldb_map_inbound.c
+++ b/source4/lib/ldb/ldb_map/ldb_map_inbound.c
@@ -425,7 +425,9 @@ int map_add(struct ldb_module *module, struct ldb_request *req)
/* Store remote DN in 'IS_MAPPED' */
/* TODO: use GUIDs here instead */
- if (ldb_msg_add_dn(ac->local_msg, IS_MAPPED, remote_msg->dn) != 0) {
+ ret = ldb_msg_add_linearized_dn(ac->local_msg, IS_MAPPED,
+ remote_msg->dn);
+ if (ret != LDB_SUCCESS) {
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -555,8 +557,9 @@ static int map_modify_do_local(struct map_context *ac)
LDB_FLAG_MOD_ADD, NULL) != 0) {
return LDB_ERR_OPERATIONS_ERROR;
}
- if (ldb_msg_add_dn(ac->local_msg, IS_MAPPED,
- ac->remote_req->op.mod.message->dn) != 0) {
+ ret = ldb_msg_add_linearized_dn(ac->local_msg, IS_MAPPED,
+ ac->remote_req->op.mod.message->dn);
+ if (ret != 0) {
return LDB_ERR_OPERATIONS_ERROR;
}