summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/common/ldb_msg.c
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-09-16 18:08:56 +0200
committerAndrew Bartlett <abartlet@samba.org>2010-09-24 09:25:41 +1000
commit0f163eb61113424e55887a9d0f2a7a89b109c4d0 (patch)
treead0e91835b2f171e9bcc895dddee2a4407af6d26 /source4/lib/ldb/common/ldb_msg.c
parente59cdaf40eba6afbad987bc9de8442a72433a0c9 (diff)
downloadsamba-0f163eb61113424e55887a9d0f2a7a89b109c4d0.tar.gz
samba-0f163eb61113424e55887a9d0f2a7a89b109c4d0.tar.bz2
samba-0f163eb61113424e55887a9d0f2a7a89b109c4d0.zip
ldb:ldb_msg_add_linearized_dn - handle NULL DNs
Don't let the routine crash Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/lib/ldb/common/ldb_msg.c')
-rw-r--r--source4/lib/ldb/common/ldb_msg.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c
index 5ca3dbb91c..dfd86c6d3a 100644
--- a/source4/lib/ldb/common/ldb_msg.c
+++ b/source4/lib/ldb/common/ldb_msg.c
@@ -307,8 +307,14 @@ int ldb_msg_add_steal_string(struct ldb_message *msg,
int ldb_msg_add_linearized_dn(struct ldb_message *msg, const char *attr_name,
struct ldb_dn *dn)
{
- return ldb_msg_add_steal_string(msg, attr_name,
- ldb_dn_alloc_linearized(msg, dn));
+ char *str = ldb_dn_alloc_linearized(msg, dn);
+
+ if (str == NULL) {
+ /* we don't want to have unknown DNs added */
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ return ldb_msg_add_steal_string(msg, attr_name, str);
}
/*