Commit 11ffc9ca authored by Sacha Brants's avatar Sacha Brants
Browse files

Merge branch 'jorgen.lind/fix_ibm_segfault' into 'master'

fix: IbmStorage uninitialized memory

See merge request !101
parents 70892e2e f96426f1
Pipeline #75387 passed with stages
in 10 minutes and 3 seconds
......@@ -39,10 +39,10 @@ azure-gen-token-test:
INTEGRATION_TESTER: $AZURE_PRINCIPAL_ID
script:
- apt-get update
- apt-get install -y python
- apt-get install -y python-pip
- pip install msal
- svctoken=$(python devops/scripts/azure_jwt_client.py)
- apt-get install -y python3
- apt-get install -y python3-pip
- pip3 install msal
- svctoken=$(python3 devops/scripts/azure_jwt_client.py)
- echo $svctoken > .token
artifacts:
paths:
......
......@@ -110,29 +110,28 @@ namespace seismicdrive
bool IbmStorage::getToken()
{
sas_token = auth_provider->getStorageAuthToken(sdResource, sdReadOnly);
std::lock_guard<std::mutex> guard(mutex);
std::string new_sas_token = sdutils::trimBearer(sas_token);
auto pos = new_sas_token.find(':');
sasToken = authProvider->getStorageAuthToken(sdResource, sdReadOnly);
sasToken = sdutils::trimBearer(sasToken);
auto pos = sasToken.find(':');
if (pos == std::string::npos)
{
return false;
auto accessKeyId = new_sas_token.substr(0, pos);
auto nextId = new_sas_token.substr(pos + 1);
}
auto accessKeyId = sasToken.substr(0, pos);
auto nextId = sasToken.substr(pos + 1);
pos = nextId.find(':');
if (pos == std::string::npos)
{
return false;
}
auto secretKey = nextId.substr(0, pos);
auto sessionToken = nextId.substr(pos + 1);
Aws::String aws_AccessKeyId(accessKeyId.c_str(), accessKeyId.size());
s3_credentials.SetAWSAccessKeyId(Aws::String(aws_AccessKeyId));
Aws::String aws_SecretKey(secretKey.c_str(), secretKey.size());
s3_credentials.SetAWSSecretKey(Aws::String(aws_SecretKey));
Aws::String aws_SessionToken(sessionToken.c_str(), sessionToken.size());
s3_credentials.SetSessionToken(Aws::String(aws_SessionToken));
s3_credentials.SetAWSAccessKeyId({ accessKeyId.data(), accessKeyId.size() });
s3_credentials.SetAWSSecretKey({ secretKey.data(), secretKey.size() });
s3_credentials.SetSessionToken({ sessionToken.data(), sessionToken.size() });
return true;
}
......@@ -164,6 +163,7 @@ namespace seismicdrive
config.endpointOverride = {ibm_cos_url.data(), ibm_cos_url.size()};
log(2) << "MINIO Endpoint " + config.endpointOverride;
// config.endpointOverride = "minio-endpoint-without-https";
std::lock_guard<std::mutex> guard(mutex);
return std::make_shared<Aws::S3::S3Client>(s3_credentials, config, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy::Never, false);
}
......
......@@ -234,8 +234,6 @@ namespace seismicdrive
std::unique_ptr<const HttpContext> context;
int _loggingMode{0};
AuthProvider *auth_provider;
std::string sas_token;
IbmApiInitialize myInit;
Aws::Auth::AWSCredentials s3_credentials;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment