From f9beb357e88f1c7a55f61c1812c075ea6a0ed373 Mon Sep 17 00:00:00 2001 From: Evgenii Baidakov Date: Fri, 14 Apr 2023 10:48:06 +0400 Subject: [PATCH] client: Check CID is set to eacl table in ContainerSetEACL command Signed-off-by: Evgenii Baidakov --- client/container.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/container.go b/client/container.go index 60676bd2..3a0fb7c9 100644 --- a/client/container.go +++ b/client/container.go @@ -602,7 +602,7 @@ type PrmContainerSetEACL struct { } // SetTable sets eACL table structure to be set for the container. -// Required parameter. +// Required parameter and CID must be set inside the table. func (x *PrmContainerSetEACL) SetTable(table eacl.Table) { x.table = table x.tableSet = true @@ -656,6 +656,11 @@ func (c *Client) ContainerSetEACL(ctx context.Context, prm PrmContainerSetEACL) panic("eACL table not set") } + _, isCIDSet := prm.table.CID() + if !isCIDSet { + return nil, errors.New("missing container in eACL table") + } + // sign the eACL table eaclV2 := prm.table.ToV2()