mkdir -p %{buildroot}/%{_unitdir}/multi-user.target.wants
mkdir -p %{buildroot}/%{_unitdir}/sockets.target.wants
ln -s ../security-manager.service %{buildroot}/%{_unitdir}/multi-user.target.wants/security-manager.service
-ln -s ../security-manager-installer.socket %{buildroot}/%{_unitdir}/sockets.target.wants/security-manager-installer.socket
+ln -s ../security-manager.socket %{buildroot}/%{_unitdir}/sockets.target.wants/security-manager.socket
%clean
rm -rf %{buildroot}
%attr(-,root,root) %{_unitdir}/multi-user.target.wants/security-manager.service
%attr(-,root,root) %{_unitdir}/security-manager.service
%attr(-,root,root) %{_unitdir}/security-manager.target
-%attr(-,root,root) %{_unitdir}/sockets.target.wants/security-manager-installer.socket
-%attr(-,root,root) %{_unitdir}/security-manager-installer.socket
+%attr(-,root,root) %{_unitdir}/sockets.target.wants/security-manager.socket
+%attr(-,root,root) %{_unitdir}/security-manager.socket
%attr(-,root,root) %{TZ_SYS_SMACK}/app-rules-template.smack
%config(noreplace) %attr(0600,root,root) %{TZ_SYS_DB}/.security-manager.db
%config(noreplace) %attr(0600,root,root) %{TZ_SYS_DB}/.security-manager.db-journal
Serialization::Serialize(send, p_req->appPaths);
//send buffer to server
- int retval = sendToServer(SERVICE_SOCKET_INSTALLER, send.Pop(), recv);
+ int retval = sendToServer(SERVICE_SOCKET, send.Pop(), recv);
if (retval != SECURITY_MANAGER_API_SUCCESS) {
LogError("Error in sendToServer. Error code: " << retval);
return SECURITY_MANAGER_ERROR_UNKNOWN;
Serialization::Serialize(send, p_req->appId);
//send buffer to server
- int retval = sendToServer(SERVICE_SOCKET_INSTALLER, send.Pop(), recv);
+ int retval = sendToServer(SERVICE_SOCKET, send.Pop(), recv);
if (retval != SECURITY_MANAGER_API_SUCCESS) {
LogError("Error in sendToServer. Error code: " << retval);
return SECURITY_MANAGER_ERROR_UNKNOWN;
Serialization::Serialize(send, std::string(app_id));
//send buffer to server
- int retval = sendToServer(SERVICE_SOCKET_INSTALLER, send.Pop(), recv);
+ int retval = sendToServer(SERVICE_SOCKET, send.Pop(), recv);
if (retval != SECURITY_MANAGER_API_SUCCESS) {
LogDebug("Error in sendToServer. Error code: " << retval);
return SECURITY_MANAGER_ERROR_UNKNOWN;
namespace SecurityManager {
-extern char const * const SERVICE_SOCKET_INSTALLER;
+extern char const * const SERVICE_SOCKET;
enum class SecurityModuleCall
{
namespace SecurityManager {
#define SOCKET_PATH_PREFIX "/run/"
-#define SOCKET_PATH_PREFIX_SECURITY_MANAGER SOCKET_PATH_PREFIX "security-manager/"
-char const * const SERVICE_SOCKET_INSTALLER =
- SOCKET_PATH_PREFIX_SECURITY_MANAGER "security-manager-installer.socket";
+char const * const SERVICE_SOCKET =
+ SOCKET_PATH_PREFIX "security-manager.socket";
} // namespace SecurityManager
${SERVER_PATH}/main/generic-socket-manager.cpp
${SERVER_PATH}/main/socket-manager.cpp
${SERVER_PATH}/main/server-main.cpp
+ ${SERVER_PATH}/service/service.cpp
${SERVER_PATH}/service/smack-rules.cpp
${SERVER_PATH}/service/smack-labels.cpp
- ${SERVER_PATH}/service/installer.cpp
${SERVER_PATH}/service/cynara.cpp
${SERVER_PATH}/db/privilege_db.cpp
${DPL_PATH}/core/src/errno_string.cpp
#include <socket-manager.h>
-#include <installer.h>
+#include <service.h>
IMPLEMENT_SAFE_SINGLETON(SecurityManager::Log::LogSystem);
LogInfo("Start!");
SecurityManager::SocketManager manager;
- REGISTER_SOCKET_SERVICE(manager, SecurityManager::InstallerService);
+ REGISTER_SOCKET_SERVICE(manager, SecurityManager::Service);
manager.MainLoop();
}
* limitations under the License
*/
/*
- * @file installer.h
+ * @file service.h
* @author Michal Witanowski <m.witanowski@samsung.com>
* @author Rafal Krypa <r.krypa@samsung.com>
- * @brief Implementation of installer service
+ * @brief Implementation of security-manager service
*/
-#ifndef _SECURITY_MANAGER_INSTALLER_
-#define _SECURITY_MANAGER_INSTALLER_
+#ifndef _SECURITY_MANAGER_SERVICE_
+#define _SECURITY_MANAGER_SERVICE_
#include <service-thread.h>
#include <generic-socket-manager.h>
namespace SecurityManager {
-class InstallerException
+class ServiceException
{
public:
DECLARE_EXCEPTION_TYPE(SecurityManager::Exception, Base)
DECLARE_EXCEPTION_TYPE(Base, InvalidAction)
};
-class InstallerService :
+class Service :
public SecurityManager::GenericSocketService,
- public SecurityManager::ServiceThread<InstallerService>
+ public SecurityManager::ServiceThread<Service>
{
public:
- InstallerService();
+ Service();
ServiceDescriptionVector GetServiceDescription();
DECLARE_THREAD_EVENT(AcceptEvent, accept)
} // namespace SecurityManager
-#endif // _SECURITY_MANAGER_INSTALLER_
+#endif // _SECURITY_MANAGER_SERVICE_
* limitations under the License
*/
/*
- * @file installer.cpp
+ * @file service.cpp
* @author Michal Witanowski <m.witanowski@samsung.com>
* @author Jacek Bukarewicz <j.bukarewicz@samsung.com>
* @author Rafal Krypa <r.krypa@samsung.com>
- * @brief Implementation of installer service.
+ * @brief Implementation of security-manager service.
*/
#include <dpl/log/log.h>
#include <limits.h>
#include <cstring>
-#include "installer.h"
+#include "service.h"
#include "protocols.h"
#include "security-manager.h"
#include "smack-common.h"
namespace SecurityManager {
-const InterfaceID INSTALLER_IFACE = 0;
+const InterfaceID IFACE = 1;
-InstallerService::InstallerService()
+Service::Service()
{
}
-GenericSocketService::ServiceDescriptionVector InstallerService::GetServiceDescription()
+GenericSocketService::ServiceDescriptionVector Service::GetServiceDescription()
{
return ServiceDescriptionVector {
- {SERVICE_SOCKET_INSTALLER, "security-manager::installer", INSTALLER_IFACE},
+ {SERVICE_SOCKET, "security-manager", IFACE},
};
}
-void InstallerService::accept(const AcceptEvent &event)
+void Service::accept(const AcceptEvent &event)
{
LogDebug("Accept event. ConnectionID.sock: " << event.connectionID.sock <<
" ConnectionID.counter: " << event.connectionID.counter <<
info.interfaceID = event.interfaceID;
}
-void InstallerService::write(const WriteEvent &event)
+void Service::write(const WriteEvent &event)
{
LogDebug("WriteEvent. ConnectionID: " << event.connectionID.sock <<
" Size: " << event.size <<
m_serviceManager->Close(event.connectionID);
}
-void InstallerService::process(const ReadEvent &event)
+void Service::process(const ReadEvent &event)
{
LogDebug("Read event for counter: " << event.connectionID.counter);
auto &info = m_connectionInfoMap[event.connectionID.counter];
while (processOne(event.connectionID, info.buffer, info.interfaceID));
}
-void InstallerService::close(const CloseEvent &event)
+void Service::close(const CloseEvent &event)
{
LogDebug("CloseEvent. ConnectionID: " << event.connectionID.sock);
m_connectionInfoMap.erase(event.connectionID.counter);
return false;
}
-bool InstallerService::processOne(const ConnectionID &conn, MessageBuffer &buffer,
+bool Service::processOne(const ConnectionID &conn, MessageBuffer &buffer,
InterfaceID interfaceID)
{
LogDebug("Iteration begin. Interface = " << interfaceID);
return false;
}
- if (INSTALLER_IFACE == interfaceID) {
+ if (IFACE == interfaceID) {
Try {
// deserialize API call type
int call_type_int;
break;
default:
LogError("Invalid call: " << call_type_int);
- Throw(InstallerException::InvalidAction);
+ Throw(ServiceException::InvalidAction);
}
// if we reach this point, the protocol is OK
retval = true;
} Catch (MessageBuffer::Exception::Base) {
LogError("Broken protocol.");
- } Catch (InstallerException::Base) {
+ } Catch (ServiceException::Base) {
LogError("Broken protocol.");
} catch (std::exception &e) {
LogError("STD exception " << e.what());
return true;
}
-bool InstallerService::processAppInstall(MessageBuffer &buffer, MessageBuffer &send, uid_t uid)
+bool Service::processAppInstall(MessageBuffer &buffer, MessageBuffer &send, uid_t uid)
{
bool pkgIdIsNew = false;
std::vector<std::string> addedPermissions;
return false;
}
-bool InstallerService::processAppUninstall(MessageBuffer &buffer, MessageBuffer &send, uid_t uid)
+bool Service::processAppUninstall(MessageBuffer &buffer, MessageBuffer &send, uid_t uid)
{
// deserialize request data
std::string appId;
return false;
}
-bool InstallerService::processGetPkgId(MessageBuffer &buffer, MessageBuffer &send)
+bool Service::processGetPkgId(MessageBuffer &buffer, MessageBuffer &send)
{
// deserialize request data
std::string appId;
INSTALL(FILES
security-manager.service
security-manager.target
- security-manager-installer.socket
+ security-manager.socket
DESTINATION
${SYSTEMD_INSTALL_DIR}
)
Type=notify
ExecStart=@BIN_INSTALL_DIR@/security-manager
-Sockets=security-manager-installer.socket
+Sockets=security-manager.socket
[Install]
WantedBy=multi-user.target
[Socket]
-ListenStream=/run/security-manager/security-manager-installer.socket
+ListenStream=/run/security-manager.socket
SocketMode=0777
SmackLabelIPIn=*
SmackLabelIPOut=@