ldb:ldb_rename on ldap backends - handle the case when the RDN value is empty
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Fri, 19 Nov 2010 22:01:39 +0000 (23:01 +0100)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Fri, 19 Nov 2010 22:03:49 +0000 (23:03 +0100)
Otherwise we get "<RDN name>=(null),..."

source4/lib/ldb-samba/ldb_ildap.c
source4/lib/ldb/ldb_ldap/ldb_ldap.c

index e2176d6..3c28690 100644 (file)
@@ -633,7 +633,7 @@ static int ildb_rename(struct ildb_context *ac)
        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));
+                                       rdn_val->length > 0 ? ldb_dn_escape_value(msg, *rdn_val) : "");
        } else {
                msg->r.ModifyDNRequest.newrdn = talloc_strdup(msg, "");
        }
index ee677cc..b328ebf 100644 (file)
@@ -410,7 +410,7 @@ static int lldb_rename(struct lldb_context *lldb_ac)
 
        if ((rdn_name != NULL) && (rdn_val != NULL)) {
                newrdn = talloc_asprintf(lldb_ac, "%s=%s", rdn_name,
-                                        ldb_dn_escape_value(lldb, *rdn_val));
+                                        rdn_val->length > 0 ? ldb_dn_escape_value(lldb, *rdn_val) : "");
        } else {
                newrdn = talloc_strdup(lldb_ac, "");
        }