mirror of
https://github.com/samba-team/samba.git
synced 2025-09-09 01:44:21 +03:00
s4:ldap_server Ensure we don't segfault when sent a NULL new RDN
The Microsoft testsuite tried to rename cn=administrator,cn=users,... into "",cn=users... which didn't go so well. Andrew Bartlett
This commit is contained in:
committed by
Matthias Dieter Wallnöfer
parent
4c235ca787
commit
737f21bd9d
@@ -750,6 +750,12 @@ static NTSTATUS ldapsrv_ModifyDNRequest(struct ldapsrv_call *call)
|
|||||||
DEBUG(10, ("ModifyDNRequest: olddn: [%s]\n", req->dn));
|
DEBUG(10, ("ModifyDNRequest: olddn: [%s]\n", req->dn));
|
||||||
DEBUG(10, ("ModifyDNRequest: newrdn: [%s]\n", req->newrdn));
|
DEBUG(10, ("ModifyDNRequest: newrdn: [%s]\n", req->newrdn));
|
||||||
|
|
||||||
|
if (ldb_dn_get_comp_num(req->newrdn) != 1) {
|
||||||
|
result = LDAP_INVALID_DN_SYNTAX;
|
||||||
|
map_ldb_error(local_ctx, LDB_ERR_INVALID_DN_SYNTAX, &errstr);
|
||||||
|
goto reply;
|
||||||
|
}
|
||||||
|
|
||||||
/* we can't handle the rename if we should not remove the old dn */
|
/* we can't handle the rename if we should not remove the old dn */
|
||||||
if (!req->deleteolddn) {
|
if (!req->deleteolddn) {
|
||||||
result = LDAP_UNWILLING_TO_PERFORM;
|
result = LDAP_UNWILLING_TO_PERFORM;
|
||||||
@@ -779,10 +785,7 @@ static NTSTATUS ldapsrv_ModifyDNRequest(struct ldapsrv_call *call)
|
|||||||
NT_STATUS_HAVE_NO_MEMORY(parentdn);
|
NT_STATUS_HAVE_NO_MEMORY(parentdn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! ldb_dn_add_child_fmt(parentdn,
|
if ( ! ldb_dn_add_child(parentdn, newrdn)) {
|
||||||
"%s=%s",
|
|
||||||
ldb_dn_get_rdn_name(newrdn),
|
|
||||||
(char *)ldb_dn_get_rdn_val(newrdn)->data)) {
|
|
||||||
result = LDAP_OTHER;
|
result = LDAP_OTHER;
|
||||||
goto reply;
|
goto reply;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user