[#1125] objectSvc: Add EC header APE check
All checks were successful
Build / Build Components (1.21) (pull_request) Successful in 6m27s
DCO action / DCO (pull_request) Successful in 6m38s
Build / Build Components (1.22) (pull_request) Successful in 8m54s
Vulncheck / Vulncheck (pull_request) Successful in 8m37s
Tests and linters / gopls check (pull_request) Successful in 10m32s
Tests and linters / Staticcheck (pull_request) Successful in 11m3s
Tests and linters / Lint (pull_request) Successful in 11m27s
Pre-commit hooks / Pre-commit (pull_request) Successful in 14m16s
Tests and linters / Tests (1.21) (pull_request) Successful in 14m26s
Tests and linters / Tests (1.22) (pull_request) Successful in 15m14s
Tests and linters / Tests with -race (pull_request) Successful in 15m45s

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2024-05-08 10:02:54 +03:00
parent 368218f0cc
commit 0144117cc9
6 changed files with 272 additions and 23 deletions

View file

@ -122,7 +122,7 @@ func (c SenderClassifier) isContainerKey(
return false, err
}
in, err := lookupKeyInContainer(nm, owner, idCnr, cnr)
in, err := LookupKeyInContainer(nm, owner, idCnr, cnr)
if err != nil {
return false, err
} else if in {
@ -136,12 +136,12 @@ func (c SenderClassifier) isContainerKey(
return false, err
}
return lookupKeyInContainer(nm, owner, idCnr, cnr)
return LookupKeyInContainer(nm, owner, idCnr, cnr)
}
func lookupKeyInContainer(
func LookupKeyInContainer(
nm *netmap.NetMap,
owner, idCnr []byte,
pkey, idCnr []byte,
cnr container.Container,
) (bool, error) {
cnrVectors, err := nm.ContainerNodes(cnr.PlacementPolicy(), idCnr)
@ -151,7 +151,7 @@ func lookupKeyInContainer(
for i := range cnrVectors {
for j := range cnrVectors[i] {
if bytes.Equal(cnrVectors[i][j].PublicKey(), owner) {
if bytes.Equal(cnrVectors[i][j].PublicKey(), pkey) {
return true, nil
}
}