Remove unwanted errorIf calls (#5621)

Remove errorIf call with a errSignatureMismatch error
This commit is contained in:
kannappanr 2018-03-09 00:51:05 -08:00 committed by GitHub
parent 889dd387f1
commit 380e0ddb57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 16 deletions

View File

@ -123,17 +123,9 @@ func checkRequestAuthType(r *http.Request, bucket, policyAction, region string)
switch reqAuthType { switch reqAuthType {
case authTypePresignedV2, authTypeSignedV2: case authTypePresignedV2, authTypeSignedV2:
// Signature V2 validation. // Signature V2 validation.
s3Error := isReqAuthenticatedV2(r) return isReqAuthenticatedV2(r)
if s3Error != ErrNone {
errorIf(errSignatureMismatch, "%s", dumpRequest(r))
}
return s3Error
case authTypeSigned, authTypePresigned: case authTypeSigned, authTypePresigned:
s3Error := isReqAuthenticated(r, region) return isReqAuthenticated(r, region)
if s3Error != ErrNone {
errorIf(errSignatureMismatch, "%s", dumpRequest(r))
}
return s3Error
} }
if reqAuthType == authTypeAnonymous && policyAction != "" { if reqAuthType == authTypeAnonymous && policyAction != "" {

View File

@ -640,21 +640,18 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req
// Initialize stream signature verifier. // Initialize stream signature verifier.
reader, s3Err = newSignV4ChunkedReader(r) reader, s3Err = newSignV4ChunkedReader(r)
if s3Err != ErrNone { if s3Err != ErrNone {
errorIf(errSignatureMismatch, "%s", dumpRequest(r))
writeErrorResponse(w, s3Err, r.URL) writeErrorResponse(w, s3Err, r.URL)
return return
} }
case authTypeSignedV2, authTypePresignedV2: case authTypeSignedV2, authTypePresignedV2:
s3Err = isReqAuthenticatedV2(r) s3Err = isReqAuthenticatedV2(r)
if s3Err != ErrNone { if s3Err != ErrNone {
errorIf(errSignatureMismatch, "%s", dumpRequest(r))
writeErrorResponse(w, s3Err, r.URL) writeErrorResponse(w, s3Err, r.URL)
return return
} }
case authTypePresigned, authTypeSigned: case authTypePresigned, authTypeSigned:
if s3Err = reqSignatureV4Verify(r, globalServerConfig.GetRegion()); s3Err != ErrNone { if s3Err = reqSignatureV4Verify(r, globalServerConfig.GetRegion()); s3Err != ErrNone {
errorIf(errSignatureMismatch, "%s", dumpRequest(r))
writeErrorResponse(w, s3Err, r.URL) writeErrorResponse(w, s3Err, r.URL)
return return
} }
@ -1069,20 +1066,17 @@ func (api objectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http
var s3Error APIErrorCode var s3Error APIErrorCode
reader, s3Error = newSignV4ChunkedReader(r) reader, s3Error = newSignV4ChunkedReader(r)
if s3Error != ErrNone { if s3Error != ErrNone {
errorIf(errSignatureMismatch, "%s", dumpRequest(r))
writeErrorResponse(w, s3Error, r.URL) writeErrorResponse(w, s3Error, r.URL)
return return
} }
case authTypeSignedV2, authTypePresignedV2: case authTypeSignedV2, authTypePresignedV2:
s3Error := isReqAuthenticatedV2(r) s3Error := isReqAuthenticatedV2(r)
if s3Error != ErrNone { if s3Error != ErrNone {
errorIf(errSignatureMismatch, "%s", dumpRequest(r))
writeErrorResponse(w, s3Error, r.URL) writeErrorResponse(w, s3Error, r.URL)
return return
} }
case authTypePresigned, authTypeSigned: case authTypePresigned, authTypeSigned:
if s3Error := reqSignatureV4Verify(r, globalServerConfig.GetRegion()); s3Error != ErrNone { if s3Error := reqSignatureV4Verify(r, globalServerConfig.GetRegion()); s3Error != ErrNone {
errorIf(errSignatureMismatch, "%s", dumpRequest(r))
writeErrorResponse(w, s3Error, r.URL) writeErrorResponse(w, s3Error, r.URL)
return return
} }