diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-11-10 16:20:38 +0100 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-11-11 10:03:41 +0100 |
commit | f0367905d9a6db76712f1dcf9734f64fe5c5e1b3 (patch) | |
tree | 8e0cb530a7c760037b9bbe4023761ee39c5d897f /source4/lib/ldb/ldb_ldap | |
parent | feb00fe7cc238a78b3832c116cb4634936597735 (diff) | |
download | samba-f0367905d9a6db76712f1dcf9734f64fe5c5e1b3.tar.gz samba-f0367905d9a6db76712f1dcf9734f64fe5c5e1b3.tar.bz2 samba-f0367905d9a6db76712f1dcf9734f64fe5c5e1b3.zip |
ldb:ldb_ldap.c rename operation - check for the RDN name and value
Make it more similar to "ldb_ildap.c" and also more save
Diffstat (limited to 'source4/lib/ldb/ldb_ldap')
-rw-r--r-- | source4/lib/ldb/ldb_ldap/ldb_ldap.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c index e028fb20a3..ee677cce94 100644 --- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c +++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c @@ -389,6 +389,8 @@ static int lldb_rename(struct lldb_context *lldb_ac) struct lldb_private *lldb = lldb_ac->lldb; struct ldb_module *module = lldb_ac->module; struct ldb_request *req = lldb_ac->req; + const char *rdn_name; + const struct ldb_val *rdn_val; char *old_dn; char *newrdn; char *parentdn; @@ -403,9 +405,15 @@ static int lldb_rename(struct lldb_context *lldb_ac) return LDB_ERR_OPERATIONS_ERROR; } - newrdn = talloc_asprintf(lldb_ac, "%s=%s", - ldb_dn_get_rdn_name(req->op.rename.newdn), - ldb_dn_escape_value(lldb, *(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)) { + newrdn = talloc_asprintf(lldb_ac, "%s=%s", rdn_name, + ldb_dn_escape_value(lldb, *rdn_val)); + } else { + newrdn = talloc_strdup(lldb_ac, ""); + } if (!newrdn) { return LDB_ERR_OPERATIONS_ERROR; } |