From 4b144c19405b2fa0909b36c0ae0f28f9853943ab Mon Sep 17 00:00:00 2001 From: "changlin.shi" Date: Thu, 25 Jan 2024 15:54:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20stream=20signed=20?= =?UTF-8?q?=E9=89=B4=E6=9D=83=E5=9C=BA=E6=99=AF=E7=BC=BA=E5=A4=B1acl=20acc?= =?UTF-8?q?ount=20id=20=E6=B3=A8=E5=85=A5bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changlin.shi --- weed/s3api/s3api_object_multipart_handlers.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/weed/s3api/s3api_object_multipart_handlers.go b/weed/s3api/s3api_object_multipart_handlers.go index 5d049280f..07b6497ae 100644 --- a/weed/s3api/s3api_object_multipart_handlers.go +++ b/weed/s3api/s3api_object_multipart_handlers.go @@ -4,6 +4,7 @@ import ( "crypto/sha1" "encoding/xml" "fmt" + "github.com/seaweedfs/seaweedfs/weed/s3api/s3account" "io" "net/http" "net/url" @@ -282,18 +283,22 @@ func (s3a *S3ApiServer) PutObjectPartHandler(w http.ResponseWriter, r *http.Requ if s3a.iam.isEnabled() { rAuthType := getRequestAuthType(r) var s3ErrCode s3err.ErrorCode + var identity *Identity switch rAuthType { case authTypeStreamingSigned: - dataReader, _, s3ErrCode = s3a.iam.newSignV4ChunkedReader(r) + dataReader, identity, s3ErrCode = s3a.iam.newSignV4ChunkedReader(r) case authTypeSignedV2, authTypePresignedV2: - _, s3ErrCode = s3a.iam.isReqAuthenticatedV2(r) + identity, s3ErrCode = s3a.iam.isReqAuthenticatedV2(r) case authTypePresigned, authTypeSigned: - _, s3ErrCode = s3a.iam.reqSignatureV4Verify(r) + identity, s3ErrCode = s3a.iam.reqSignatureV4Verify(r) } if s3ErrCode != s3err.ErrNone { s3err.WriteErrorResponse(w, r, s3ErrCode) return } + if identity.AccountId != s3account.AccountAnonymous.Id { + r.Header.Set(s3_constants.AmzAccountId, identity.AccountId) + } } defer dataReader.Close()