From ff576d125d10520bb8b3795d586819602f74e5e8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 31 May 2022 17:13:34 +0300 Subject: [PATCH] [#1454] container: Fix reading session token from request origin Signed-off-by: Leonard Lyubich --- pkg/services/container/executor.go | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/pkg/services/container/executor.go b/pkg/services/container/executor.go index a3b6eb7ad9..3fffadb95e 100644 --- a/pkg/services/container/executor.go +++ b/pkg/services/container/executor.go @@ -31,7 +31,12 @@ func NewExecutionService(exec ServiceExecutor) Server { } func (s *executorSvc) Put(ctx context.Context, req *container.PutRequest) (*container.PutResponse, error) { - respBody, err := s.exec.Put(ctx, req.GetMetaHeader().GetOrigin().GetSessionToken(), req.GetBody()) + meta := req.GetMetaHeader() + for origin := meta.GetOrigin(); origin != nil; origin = meta.GetOrigin() { + meta = origin + } + + respBody, err := s.exec.Put(ctx, meta.GetSessionToken(), req.GetBody()) if err != nil { return nil, fmt.Errorf("could not execute Put request: %w", err) } @@ -43,7 +48,12 @@ func (s *executorSvc) Put(ctx context.Context, req *container.PutRequest) (*cont } func (s *executorSvc) Delete(ctx context.Context, req *container.DeleteRequest) (*container.DeleteResponse, error) { - respBody, err := s.exec.Delete(ctx, req.GetMetaHeader().GetOrigin().GetSessionToken(), req.GetBody()) + meta := req.GetMetaHeader() + for origin := meta.GetOrigin(); origin != nil; origin = meta.GetOrigin() { + meta = origin + } + + respBody, err := s.exec.Delete(ctx, meta.GetSessionToken(), req.GetBody()) if err != nil { return nil, fmt.Errorf("could not execute Delete request: %w", err) } @@ -79,7 +89,12 @@ func (s *executorSvc) List(ctx context.Context, req *container.ListRequest) (*co } func (s *executorSvc) SetExtendedACL(ctx context.Context, req *container.SetExtendedACLRequest) (*container.SetExtendedACLResponse, error) { - respBody, err := s.exec.SetExtendedACL(ctx, req.GetMetaHeader().GetOrigin().GetSessionToken(), req.GetBody()) + meta := req.GetMetaHeader() + for origin := meta.GetOrigin(); origin != nil; origin = meta.GetOrigin() { + meta = origin + } + + respBody, err := s.exec.SetExtendedACL(ctx, meta.GetSessionToken(), req.GetBody()) if err != nil { return nil, fmt.Errorf("could not execute SetEACL request: %w", err) }