if (-1 == filefd) {
LogError("Error in SignalService.GetDescriptor()");
delete signalService;
+ signalService = nullptr;
} else {
auto &desc2 = CreateDefaultReadSocketDescription(filefd, false);
desc2.service = signalService;
namespace CKM {
+AccessControl::AccessControl() : m_ccMode(false)
+{
+}
+
void AccessControl::updateCCMode()
{
/* newMode should be extracted from global property like buxton in product */
class AccessControl {
public:
+ AccessControl();
/**
* return true if client uid is from the system services uid space
*/
{
errno = 0;
- if ((mkdir(RW_DATA_DIR, 0700)) && (errno != EEXIST)) {
+ if ((mkdir(RW_DATA_DIR, S_IRWXU)) && (errno != EEXIST)) {
int err = errno;
LogError("Error in mkdir " << RW_DATA_DIR << ". Reason: " << GetErrnoString(
err));
void WrappedKeyAndInfoContainer::setKeyInfoClient(const std::string resized_client)
{
- strncpy(
- wrappedKeyAndInfo->keyInfo.client,
- resized_client.c_str(),
- MAX_CLIENT_ID_SIZE-1);
+ if (resized_client.size() >= sizeof(wrappedKeyAndInfo->keyInfo.client)) {
+ ThrowErr(Exc::InternalError, "Client name too long");
+ }
+
+ strcpy(wrappedKeyAndInfo->keyInfo.client, resized_client.c_str());
}
void WrappedKeyAndInfoContainer::setKeyInfoSalt(const unsigned char *salt,
const Password TEST_PASS = "custom user password";
const size_t IV_LEN = 16;
const size_t CHAIN_LEN = 3;
+const mode_t MODE_0644 = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
enum {
NO_PASS = 0,
FdPtr sourceFdPtr(&sourceFd);
- int targetFd = TEMP_FAILURE_RETRY(creat(targetPath.c_str(), 0644));
+ int targetFd = TEMP_FAILURE_RETRY(creat(targetPath.c_str(), MODE_0644));
err = errno;
BOOST_REQUIRE_MESSAGE(targetFd > 0,
"Creating " << targetPath << " failed: " << GetErrnoString(err));