* See the License for the specific language governing permissions and
* limitations under the License
*
- * @file client-common.cpp
+ * @file client-control.cpp
* @author Bartlomiej Grzelewski (b.grzelewski@samsung.com)
* @version 1.0
- * @brief This file is implementation of client-common functions.
+ * @brief This file is implementation of client-control functions.
*/
#include <dpl/log/log.h>
ControlImpl& operator=(const ControlImpl &) = delete;
ControlImpl& operator=(ControlImpl &&) = delete;
- virtual int unlockUserKey(uid_t user, const Password &password) {
+ virtual int unlockUserKey(const ClientInfo &clientInfo, const Password &password) {
return try_catch([&] {
- if((int)user < 0) {
+ if((int)clientInfo.getUID() < 0) {
return CKM_API_ERROR_INPUT_PARAM;
}
MessageBuffer recv;
auto send = MessageBuffer::Serialize(static_cast<int>(ControlCommand::UNLOCK_USER_KEY),
- user,
+ clientInfo.getClientID(),
password);
int retCode = m_controlConnection.processRequest(send.Pop(), recv);
});
}
- virtual int lockUserKey(uid_t user) {
+ virtual int lockUserKey(const ClientInfo &clientInfo) {
return try_catch([&] {
- if((int)user < 0) {
+ if((int)clientInfo.getUID() < 0) {
return CKM_API_ERROR_INPUT_PARAM;
}
MessageBuffer recv;
- auto send = MessageBuffer::Serialize(static_cast<int>(ControlCommand::LOCK_USER_KEY), user);
+ auto send = MessageBuffer::Serialize(static_cast<int>(ControlCommand::LOCK_USER_KEY),
+ clientInfo.getClientID());
int retCode = m_controlConnection.processRequest(send.Pop(), recv);
if (CKM_API_SUCCESS != retCode)
return retCode;
});
}
-
- virtual int removeUserData(uid_t user) {
+ virtual int removeUserData(const ClientInfo &clientInfo) {
return try_catch([&] {
- if((int)user < 0) {
+ if((int)clientInfo.getUID() < 0) {
return CKM_API_ERROR_INPUT_PARAM;
}
MessageBuffer recv;
- auto send = MessageBuffer::Serialize(static_cast<int>(ControlCommand::REMOVE_USER_DATA), user);
+ auto send = MessageBuffer::Serialize(static_cast<int>(ControlCommand::REMOVE_USER_DATA),
+ clientInfo.getClientID());
int retCode = m_controlConnection.processRequest(send.Pop(), recv);
if (CKM_API_SUCCESS != retCode)
return retCode;
});
}
-
- virtual int changeUserPassword(uid_t user, const Password &oldPassword, const Password &newPassword) {
+ virtual int changeUserPassword(const ClientInfo &clientInfo, const Password &oldPassword, const Password &newPassword) {
return try_catch([&] {
- if((int)user < 0) {
+ if((int)clientInfo.getUID() < 0) {
return CKM_API_ERROR_INPUT_PARAM;
}
MessageBuffer recv;
auto send = MessageBuffer::Serialize(
static_cast<int>(ControlCommand::CHANGE_USER_PASSWORD),
- user,
+ clientInfo.getClientID(),
oldPassword,
newPassword);
});
}
- virtual int resetUserPassword(uid_t user, const Password &newPassword) {
+ virtual int resetUserPassword(const ClientInfo &clientInfo, const Password &newPassword) {
return try_catch([&] {
- if((int)user < 0) {
+ if((int)clientInfo.getUID() < 0) {
return CKM_API_ERROR_INPUT_PARAM;
}
MessageBuffer recv;
auto send = MessageBuffer::Serialize(
static_cast<int>(ControlCommand::RESET_USER_PASSWORD),
- user,
+ clientInfo.getClientID(),
newPassword);
int retCode = m_controlConnection.processRequest(send.Pop(), recv);
});
}
- virtual int removeApplicationData(const Label &smackLabel) {
+ virtual int removeApplicationData(const std::string &zone, const Label &smackLabel) {
return try_catch([&] {
if (smackLabel.empty()) {
return CKM_API_ERROR_INPUT_PARAM;
}
MessageBuffer recv;
- auto send = MessageBuffer::Serialize(static_cast<int>(ControlCommand::REMOVE_APP_DATA), smackLabel);
+ auto send = MessageBuffer::Serialize(static_cast<int>(ControlCommand::REMOVE_APP_DATA),
+ zone,
+ smackLabel);
int retCode = m_controlConnection.processRequest(send.Pop(), recv);
if (CKM_API_SUCCESS != retCode)
});
}
- virtual int setPermission(uid_t user,
+ virtual int setPermission(const ClientInfo &clientInfo,
const Alias &alias,
const Label &accessor,
PermissionMask permissionMask)
MessageBuffer recv;
AliasSupport helper(alias);
auto send = MessageBuffer::Serialize(static_cast<int>(ControlCommand::SET_PERMISSION),
- static_cast<int>(user),
+ clientInfo.getClientID(),
helper.getName(),
helper.getLabel(),
accessor,