summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2009-10-02 21:26:12 +0200
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2009-10-02 21:27:46 +0200
commitb45f56d4ba103f5ef04084285466f7e52d3de959 (patch)
treeae1ee1d6792d2f3da6033edc313bc77da38da960 /source4/lib
parent767fce6fccf484b547219abd5e6abc941eacaf92 (diff)
downloadsamba-b45f56d4ba103f5ef04084285466f7e52d3de959.tar.gz
samba-b45f56d4ba103f5ef04084285466f7e52d3de959.tar.bz2
samba-b45f56d4ba103f5ef04084285466f7e52d3de959.zip
s4:ldb_ildap - Don't segfault on a empty RDN
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb/ldb_ildap/ldb_ildap.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
index ffde048223..352b7696d6 100644
--- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c
+++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
@@ -591,6 +591,8 @@ static int ildb_rename(struct ildb_context *ac)
{
struct ldb_request *req = ac->req;
struct ldap_message *msg;
+ const char *rdn_name;
+ const struct ldb_val *rdn_val;
msg = new_ldap_message(req);
if (msg == NULL) {
@@ -604,10 +606,16 @@ static int ildb_rename(struct ildb_context *ac)
return LDB_ERR_INVALID_DN_SYNTAX;
}
- msg->r.ModifyDNRequest.newrdn =
- talloc_asprintf(msg, "%s=%s",
- ldb_dn_get_rdn_name(req->op.rename.newdn),
- ldb_dn_escape_value(msg, *ldb_dn_get_rdn_val(req->op.rename.newdn)));
+ rdn_name = ldb_dn_get_rdn_name(req->op.rename.newdn);
+ rdn_val = ldb_dn_get_rdn_val(req->op.rename.newdn);
+
+ if ((rdn_name != NULL) && (rdn_val != NULL)) {
+ msg->r.ModifyDNRequest.newrdn =
+ talloc_asprintf(msg, "%s=%s", rdn_name,
+ ldb_dn_escape_value(msg, *rdn_val));
+ } else {
+ msg->r.ModifyDNRequest.newrdn = talloc_strdup(msg, "");
+ }
if (msg->r.ModifyDNRequest.newrdn == NULL) {
talloc_free(msg);
return LDB_ERR_OPERATIONS_ERROR;