Corrected ECS headers

This commit is contained in:
Richard Caunt 2017-11-08 15:21:49 +00:00 committed by GitHub
parent 60d2ac3c7a
commit c238701d09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2119,7 +2119,7 @@ string S3fsCurl::CalcSignatureV2(const string& method, const string& strMD5, con
string Signature; string Signature;
string StringToSign; string StringToSign;
if(0 < S3fsCurl::IAM_role.size()){ if(0 < S3fsCurl::IAM_role.size() || S3fsCurl::is_ecs){
if(!S3fsCurl::CheckIAMCredentialUpdate()){ if(!S3fsCurl::CheckIAMCredentialUpdate()){
S3FS_PRN_ERR("Something error occurred in checking IAM credential."); S3FS_PRN_ERR("Something error occurred in checking IAM credential.");
return Signature; // returns empty string, then it occurs error. return Signature; // returns empty string, then it occurs error.
@ -2161,7 +2161,7 @@ string S3fsCurl::CalcSignature(const string& method, const string& canonical_uri
string Signature, StringCQ, StringToSign; string Signature, StringCQ, StringToSign;
string uriencode; string uriencode;
if(0 < S3fsCurl::IAM_role.size()){ if(0 < S3fsCurl::IAM_role.size() || S3fsCurl::is_ecs){
if(!S3fsCurl::CheckIAMCredentialUpdate()){ if(!S3fsCurl::CheckIAMCredentialUpdate()){
S3FS_PRN_ERR("Something error occurred in checking IAM credential."); S3FS_PRN_ERR("Something error occurred in checking IAM credential.");
return Signature; // returns empty string, then it occurs error. return Signature; // returns empty string, then it occurs error.
@ -2297,12 +2297,6 @@ void S3fsCurl::insertV4Headers(const string &op, const string &path, const strin
string auth = "AWS4-HMAC-SHA256 Credential=" + AWSAccessKeyId + "/" + strdate + "/" + endpoint + string auth = "AWS4-HMAC-SHA256 Credential=" + AWSAccessKeyId + "/" + strdate + "/" + endpoint +
"/s3/aws4_request, SignedHeaders=" + get_sorted_header_keys(requestHeaders) + ", Signature=" + Signature; "/s3/aws4_request, SignedHeaders=" + get_sorted_header_keys(requestHeaders) + ", Signature=" + Signature;
requestHeaders = curl_slist_sort_insert(requestHeaders, "Authorization", auth.c_str()); requestHeaders = curl_slist_sort_insert(requestHeaders, "Authorization", auth.c_str());
if (S3fsCurl::is_ecs) {
S3FS_PRN_INFO3("Adding x-amz-security-token header");
requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-security-token", S3fsCurl::AWSAccessToken.c_str());
}
} }
} }