Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
hfedcba committed May 7, 2018
2 parents 42b17ba + 96390af commit f918250
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/IpcClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,8 @@ Ipc::PVariable IpcClient::getCommandStatus(Ipc::PArray& parameters)

auto result = std::make_shared<Ipc::Variable>(Ipc::VariableType::tArray);
result->arrayValue->reserve(2);
result->arrayValue->push_back(std::make_shared<Ipc::Variable>(_commandStatus));

std::lock_guard<std::mutex> outputGuard(_commandOutputMutex);
result->arrayValue->push_back(std::make_shared<Ipc::Variable>(_commandStatus));
result->arrayValue->push_back(std::make_shared<Ipc::Variable>(_commandOutput));

return result;
Expand Down Expand Up @@ -633,28 +632,28 @@ Ipc::PVariable IpcClient::writeCloudMaticConfig(Ipc::PArray& parameters)

std::string filename = "/etc/openvpn/cloudmatic.conf";
BaseLib::Io::writeFile(filename, parameters->at(0)->stringValue);
if(chown(filename.c_str(), 0, 0) == -1) std::cerr << "Could not set owner on " << cloudMaticCertPath << std::endl;
if(chmod(filename.c_str(), S_IRUSR | S_IWUSR | S_IRGRP) == -1) std::cerr << "Could not set permissions on " << cloudMaticCertPath << std::endl;
if(chown(filename.c_str(), 0, 0) == -1) std::cerr << "Could not set owner on " << filename << std::endl;
if(chmod(filename.c_str(), S_IRUSR | S_IWUSR | S_IRGRP) == -1) std::cerr << "Could not set permissions on " << filename << std::endl;

filename = "/etc/openvpn/mhcfg";
BaseLib::Io::writeFile(filename, parameters->at(1)->stringValue);
if(chown(filename.c_str(), 0, 0) == -1) std::cerr << "Could not set owner on " << cloudMaticCertPath << std::endl;
if(chmod(filename.c_str(), S_IRUSR | S_IWUSR | S_IRGRP) == -1) std::cerr << "Could not set permissions on " << cloudMaticCertPath << std::endl;
if(chown(filename.c_str(), 0, 0) == -1) std::cerr << "Could not set owner on " << filename << std::endl;
if(chmod(filename.c_str(), S_IRUSR | S_IWUSR | S_IRGRP) == -1) std::cerr << "Could not set permissions on " << filename << std::endl;

filename = "/etc/openvpn/cloudmatic/mhca.crt";
BaseLib::Io::writeFile(filename, parameters->at(2)->stringValue);
if(chown(filename.c_str(), 0, 0) == -1) std::cerr << "Could not set owner on " << cloudMaticCertPath << std::endl;
if(chmod(filename.c_str(), S_IRUSR | S_IWUSR | S_IRGRP) == -1) std::cerr << "Could not set permissions on " << cloudMaticCertPath << std::endl;
if(chown(filename.c_str(), 0, 0) == -1) std::cerr << "Could not set owner on " << filename << std::endl;
if(chmod(filename.c_str(), S_IRUSR | S_IWUSR | S_IRGRP) == -1) std::cerr << "Could not set permissions on " << filename << std::endl;

filename = "/etc/openvpn/cloudmatic/client.crt";
BaseLib::Io::writeFile(filename, parameters->at(3)->stringValue);
if(chown(filename.c_str(), 0, 0) == -1) std::cerr << "Could not set owner on " << cloudMaticCertPath << std::endl;
if(chmod(filename.c_str(), S_IRUSR | S_IWUSR | S_IRGRP) == -1) std::cerr << "Could not set permissions on " << cloudMaticCertPath << std::endl;
if(chown(filename.c_str(), 0, 0) == -1) std::cerr << "Could not set owner on " << filename << std::endl;
if(chmod(filename.c_str(), S_IRUSR | S_IWUSR | S_IRGRP) == -1) std::cerr << "Could not set permissions on " << filename << std::endl;

filename = "/etc/openvpn/cloudmatic/client.key";
BaseLib::Io::writeFile(filename, parameters->at(4)->stringValue);
if(chown(filename.c_str(), 0, 0) == -1) std::cerr << "Could not set owner on " << cloudMaticCertPath << std::endl;
if(chmod(filename.c_str(), S_IRUSR | S_IWUSR) == -1) std::cerr << "Could not set permissions on " << cloudMaticCertPath << std::endl;
if(chown(filename.c_str(), 0, 0) == -1) std::cerr << "Could not set owner on " << filename << std::endl;
if(chmod(filename.c_str(), S_IRUSR | S_IWUSR) == -1) std::cerr << "Could not set permissions on " << filename << std::endl;

return std::make_shared<Ipc::Variable>();
}
Expand Down

0 comments on commit f918250

Please sign in to comment.