mirror of
https://github.com/samba-team/samba.git
synced 2025-02-04 17:47:26 +03:00
s3/rpc_client: in map_validation_to_info3() make a deep copy
In later commits we want to map a validation to info3 without modifying the validation data. Otherwise no change in behaviour. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
parent
158c89068b
commit
a001f4b509
@ -453,6 +453,7 @@ static NTSTATUS map_validation_to_info3(TALLOC_CTX *mem_ctx,
|
|||||||
struct netr_SamInfo3 **info3_p)
|
struct netr_SamInfo3 **info3_p)
|
||||||
{
|
{
|
||||||
struct netr_SamInfo3 *info3;
|
struct netr_SamInfo3 *info3;
|
||||||
|
struct netr_SamInfo6 *info6 = NULL;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
if (validation == NULL) {
|
if (validation == NULL) {
|
||||||
@ -465,25 +466,54 @@ static NTSTATUS map_validation_to_info3(TALLOC_CTX *mem_ctx,
|
|||||||
return NT_STATUS_INVALID_PARAMETER;
|
return NT_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
info3 = talloc_move(mem_ctx, &validation->sam3);
|
info3 = copy_netr_SamInfo3(mem_ctx, validation->sam3);
|
||||||
|
if (info3 == NULL) {
|
||||||
|
return NT_STATUS_NO_MEMORY;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
if (validation->sam6 == NULL) {
|
if (validation->sam6 == NULL) {
|
||||||
return NT_STATUS_INVALID_PARAMETER;
|
return NT_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
info6 = validation->sam6;
|
||||||
|
|
||||||
info3 = talloc_zero(mem_ctx, struct netr_SamInfo3);
|
info3 = talloc_zero(mem_ctx, struct netr_SamInfo3);
|
||||||
if (info3 == NULL) {
|
if (info3 == NULL) {
|
||||||
return NT_STATUS_NO_MEMORY;
|
return NT_STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
status = copy_netr_SamBaseInfo(info3, &validation->sam6->base, &info3->base);
|
|
||||||
|
status = copy_netr_SamBaseInfo(info3,
|
||||||
|
&info6->base,
|
||||||
|
&info3->base);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
TALLOC_FREE(info3);
|
TALLOC_FREE(info3);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
info3->sidcount = validation->sam6->sidcount;
|
if (validation->sam6->sidcount > 0) {
|
||||||
info3->sids = talloc_move(info3, &validation->sam6->sids);
|
int i;
|
||||||
|
|
||||||
|
info3->sidcount = info6->sidcount;
|
||||||
|
|
||||||
|
info3->sids = talloc_array(info3,
|
||||||
|
struct netr_SidAttr,
|
||||||
|
info3->sidcount);
|
||||||
|
if (info3->sids == NULL) {
|
||||||
|
TALLOC_FREE(info3);
|
||||||
|
return NT_STATUS_NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < info3->sidcount; i++) {
|
||||||
|
info3->sids[i].sid = dom_sid_dup(
|
||||||
|
info3->sids, info6->sids[i].sid);
|
||||||
|
if (info3->sids[i].sid == NULL) {
|
||||||
|
TALLOC_FREE(info3);
|
||||||
|
return NT_STATUS_NO_MEMORY;
|
||||||
|
}
|
||||||
|
info3->sids[i].attributes =
|
||||||
|
info6->sids[i].attributes;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return NT_STATUS_BAD_VALIDATION_CLASS;
|
return NT_STATUS_BAD_VALIDATION_CLASS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user