mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
dsdb-descriptor: Avoid segfault copying an SD without an owner or group
This is an unusual SD, but it does exist is some very old upgraded databases. Andrew Bartlett Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Fri Feb 22 11:06:17 CET 2013 on sn-devel-104
This commit is contained in:
parent
87db2331fc
commit
e4d85fa73d
@ -181,20 +181,28 @@ static struct security_descriptor *descr_handle_sd_flags(TALLOC_CTX *mem_ctx,
|
||||
final_sd->type = SEC_DESC_SELF_RELATIVE;
|
||||
|
||||
if (sd_flags & (SECINFO_OWNER)) {
|
||||
if (new_sd->owner_sid) {
|
||||
final_sd->owner_sid = talloc_memdup(mem_ctx, new_sd->owner_sid, sizeof(struct dom_sid));
|
||||
}
|
||||
final_sd->type |= new_sd->type & SEC_DESC_OWNER_DEFAULTED;
|
||||
}
|
||||
else if (old_sd) {
|
||||
if (old_sd->owner_sid) {
|
||||
final_sd->owner_sid = talloc_memdup(mem_ctx, old_sd->owner_sid, sizeof(struct dom_sid));
|
||||
}
|
||||
final_sd->type |= old_sd->type & SEC_DESC_OWNER_DEFAULTED;
|
||||
}
|
||||
|
||||
if (sd_flags & (SECINFO_GROUP)) {
|
||||
if (new_sd->group_sid) {
|
||||
final_sd->group_sid = talloc_memdup(mem_ctx, new_sd->group_sid, sizeof(struct dom_sid));
|
||||
}
|
||||
final_sd->type |= new_sd->type & SEC_DESC_GROUP_DEFAULTED;
|
||||
}
|
||||
else if (old_sd) {
|
||||
if (old_sd->group_sid) {
|
||||
final_sd->group_sid = talloc_memdup(mem_ctx, old_sd->group_sid, sizeof(struct dom_sid));
|
||||
}
|
||||
final_sd->type |= old_sd->type & SEC_DESC_GROUP_DEFAULTED;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user