Skip to content

Commit

Permalink
client: Check CID is set to eacl table in ContainerSetEACL command
Browse files Browse the repository at this point in the history
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
  • Loading branch information
smallhive committed Apr 14, 2023
1 parent bd429c9 commit f9beb35
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion client/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit f9beb35

Please sign in to comment.