// Store cryptParams
size_t cryptParamsSize = DM_MAX_BUFFER_SIZE - (cryptParams - dmBuf);
+ std::string keyHex = convertToHex(key);
int ret = snprintf(cryptParams,
cryptParamsSize,
"%s %s 0 %s 0",
cryptoTypeName.c_str(),
- convertToHex(key).c_str(),
+ keyHex.c_str(),
realBlkDev.c_str());
if (ret < 0) {
throw runtime::Exception("snprintf() failed");
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2015-2019 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
for (int i = key.size(); i < ECRYPTFS_SIGNATURE_SIZE / 2; i++) {
signature << (unsigned int) 0;
}
+ std::string signatureStr = signature.str();
::memcpy((char *)payload.token.password.signature,
- signature.str().c_str(), ECRYPTFS_SIGNATURE_SIZE);
+ signatureStr.c_str(), ECRYPTFS_SIGNATURE_SIZE);
if (KernelKeyRing::search(KEY_SPEC_USER_KEYRING, ECRYPTFS_AUTH_TOKEN_TYPE,
(char *)payload.token.password.signature, 0) < 0) {
server.createNotification("ExternalEncryptionServer::mount");
- engine.reset(new EXTERNAL_ENGINE(
- EXTERNAL_PATH, EXTERNAL_PATH,
- ProgressBar([](unsigned v) {
- ::vconf_set_str(VCONFKEY_SDE_ENCRYPT_PROGRESS,
- std::to_string(v).c_str());
- })
- ));
+ engine.reset(new EXTERNAL_ENGINE(EXTERNAL_PATH,
+ EXTERNAL_PATH,
+ ProgressBar(VCONFKEY_SDE_ENCRYPT_PROGRESS)));
externalAddEventReceiver();
}
}
}
- engine.reset(new INTERNAL_ENGINE(
- source, INTERNAL_PATH,
- ProgressBar([](unsigned v) {
- ::vconf_set_str(VCONFKEY_ODE_ENCRYPT_PROGRESS,
- std::to_string(v).c_str());
- })
- ));
+ engine.reset(new INTERNAL_ENGINE(source,
+ INTERNAL_PATH,
+ ProgressBar(VCONFKEY_ODE_ENCRYPT_PROGRESS)));
try {
dbus::Connection &systemDBus = dbus::Connection::getSystem();
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2017-2019 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
#include "progress-bar.h"
+#include <cassert>
+#include <vconf.h>
+#include "logger.h"
namespace ode {
ProgressBar::ProgressBar(UpdateFunc const &updater)
- : updater(updater), updateValue(0)
+ : updater(updater)
{
updater(0);
}
+ProgressBar::ProgressBar(const char *vconfKey)
+{
+ assert(vconfKey != NULL);
+
+ updater = [vconfKey](unsigned v) {
+ std::string vStr = std::to_string(v);
+ int ret = ::vconf_set_str(vconfKey, vStr.c_str());
+ if (ret != 0)
+ ERROR(SINK, "vconf_set_str() failed with " << ret);
+ };
+ updater(0);
+}
+
ProgressBar::~ProgressBar()
{
}
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2017-2019 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
ProgressBar() = delete;
explicit ProgressBar(UpdateFunc const &updater);
+ explicit ProgressBar(const char *vconfKey);
~ProgressBar();
void update(unsigned value);
private:
UpdateFunc updater;
- unsigned updateValue;
+ unsigned updateValue = 0;
};
-
template <typename T>
void ProgressBar::update(T count, T totalCount)
{
{
server.expose(this, PRIVILEGE_PLATFORM, (int)(SecureEraseServer::clean)(std::string));
- engine.reset(new ERASE_ENGINE(ProgressBar([](unsigned v) {
- ::vconf_set_str(VCONFKEY_ODE_ERASE_PROGRESS, std::to_string(v).c_str());
- }))
- );
+ engine.reset(new ERASE_ENGINE(ProgressBar(VCONFKEY_ODE_ERASE_PROGRESS)));
}
SecureEraseServer::~SecureEraseServer()
return false;
}
+ std::string uid = std::to_string(cred.uid);
if (::cynara_check(p_cynara, cred.security.c_str(), "",
- std::to_string(cred.uid).c_str(),
+ uid.c_str(),
privilege.c_str()) != CYNARA_API_ACCESS_ALLOWED) {
::cynara_finish(p_cynara);
ERROR(SINK, "Access denied: " + cred.security + " : " + privilege);