MsgInitCallStatusManager();
try {
- /* ipc data folder set acl for priv_read and priv_write */
- if (!MsgAclInit()) {
- MSG_ERR("FAIL TO INITIALIZE ACL [%d]", err);
- }
-
/* storage handler initialize */
err = MsgStoInitDB(false);
if (err != MSG_SUCCESS) {
/* To store latest setting values */
/* when it sets to vconf, it will be compared with below values */
-MSG_GENERAL_OPT_S g_generalOpt;
-MSG_SMS_SENDOPT_S g_smsSendOpt;
-MSG_SMSC_LIST_S g_smscList;
-MSG_MMS_SENDOPT_S g_mmsSendOpt;
-MSG_MMS_RECVOPT_S g_mmsRecvOpt;
-MSG_MMS_STYLEOPT_S g_mmsStyleOpt;
-MSG_PUSHMSG_OPT_S g_pushMsgOpt;
+MSG_GENERAL_OPT_S g_generalOpt = {0,};
+MSG_SMS_SENDOPT_S g_smsSendOpt = {0,};
+MSG_SMSC_LIST_S g_smscList = {0,};
+MSG_MMS_SENDOPT_S g_mmsSendOpt = {0,};
+MSG_MMS_RECVOPT_S g_mmsRecvOpt = {0,};
+MSG_MMS_STYLEOPT_S g_mmsStyleOpt = {0,};
+MSG_PUSHMSG_OPT_S g_pushMsgOpt = {0,};
/*==================================================================================================
FUNCTION IMPLEMENTATION
void MsgGetMimeType(char *filePath, char *mimeType, int size);
int MsgTcsScanFile(const char *filepath, int *bLevel);
-bool MsgAclInit();
#endif /* MSG_UTIL_FILE_H */
[Service]
Type=simple
+User=messaging
+Group=messaging
ExecStart=/usr/bin/msg-server
Restart=always
MemoryLimit=10M
[Socket]
+SocketUser=messaging
+SocketGroup=messaging
ListenStream=/tmp/.msgfw_socket
Service=msg-server.service
Requires(postun): /sbin/ldconfig
Requires(post): systemd
Requires(postun): systemd
+Requires: acl
+Requires: security-config
BuildRequires: cmake
-BuildRequires: libacl-devel
BuildRequires: pkgconfig(alarm-service)
BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(boost)
chmod 640 %{TZ_SYS_DB}/.msg_service.db
chmod 660 %{TZ_SYS_DB}/.msg_service.db-journal
-mkdir -p -m 775 %{TZ_SYS_DATA}/msg-service
-mkdir -p -m 770 %{TZ_SYS_DATA}/msg-service/msgdata
-mkdir -p -m 770 %{TZ_SYS_DATA}/msg-service/smildata
+mkdir -p -m 770 %{TZ_SYS_DATA}/msg-service
+mkdir -p -m 750 %{TZ_SYS_DATA}/msg-service/msgdata
+mkdir -p -m 750 %{TZ_SYS_DATA}/msg-service/smildata
mkdir -p -m 770 %{TZ_SYS_DATA}/msg-service/ipcdata
-mkdir -p -m 770 %{TZ_SYS_DATA}/msg-service/msgdata/thumbnails
+mkdir -p -m 750 %{TZ_SYS_DATA}/msg-service/msgdata/thumbnails
+chown messaging:priv_message_read %{TZ_SYS_DB}/.msg_service.db
+chown messaging:priv_message_read %{TZ_SYS_DB}/.msg_service.db-journal
+chown messaging:priv_message_read %{TZ_SYS_DATA}/msg-service
+chown messaging:priv_message_read %{TZ_SYS_DATA}/msg-service/msgdata
+chown messaging:priv_message_read %{TZ_SYS_DATA}/msg-service/smildata
+chown messaging:priv_message_read %{TZ_SYS_DATA}/msg-service/ipcdata
+chown messaging:priv_message_read %{TZ_SYS_DATA}/msg-service/msgdata/thumbnails
-chgrp priv_message_read %{TZ_SYS_DB}/.msg_service.db
-chgrp priv_message_read %{TZ_SYS_DATA}/msg-service/msgdata
-chgrp priv_message_read %{TZ_SYS_DATA}/msg-service/smildata
-chgrp priv_message_write %{TZ_SYS_DATA}/msg-service/ipcdata
-chgrp priv_message_read %{TZ_SYS_DATA}/msg-service/msgdata/thumbnails
-
+chmod g+s %{TZ_SYS_DATA}/msg-service/msgdata
+chmod g+s %{TZ_SYS_DATA}/msg-service/smildata
+chmod g+s %{TZ_SYS_DATA}/msg-service/ipcdata
+chmod g+s %{TZ_SYS_DATA}/msg-service/msgdata/thumbnails
chsmack -a "*" %{TZ_SYS_DB}/.msg_service.db
+chsmack -a "*" %{TZ_SYS_DB}/.msg_service.db-journal
+chsmack -a "System::Shared" %{TZ_SYS_DATA}/msg-service/
chsmack -a "System::Shared" %{TZ_SYS_DATA}/msg-service/msgdata -t
chsmack -a "System::Shared" %{TZ_SYS_DATA}/msg-service/smildata -t
chsmack -a "System::Run" %{TZ_SYS_DATA}/msg-service/ipcdata -t
chsmack -a "System::Shared" %{TZ_SYS_DATA}/msg-service/msgdata/thumbnails -t
+#Multi group to ipcdata directory
+chmod o= %{TZ_SYS_DATA}/msg-service/ipcdata
+setfacl -m group:priv_message_write:rw %{TZ_SYS_DATA}/msg-service/ipcdata
+
%post -n sms-plugin -p /sbin/ldconfig
%post -n mms-plugin -p /sbin/ldconfig
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
ADD_LIBRARY(${UTILS-LIB} SHARED ${UTILS-SRCS})
-TARGET_LINK_LIBRARIES(${UTILS-LIB} ${utils_pkgs_LDFLAGS} rt ${VOBJECT-LIB} acl)
+TARGET_LINK_LIBRARIES(${UTILS-LIB} ${utils_pkgs_LDFLAGS} rt ${VOBJECT-LIB})
INSTALL(TARGETS ${UTILS-LIB} DESTINATION ${LIBDIR} COMPONENT RuntimeLibraries)
int len = strlen(serverSA.sun_path) + sizeof(serverSA.sun_family);
if (::connect(sockfd, (struct sockaddr *)&serverSA, len) == CUSTOM_SOCKET_ERROR) {
+ MSG_DEBUG("errno=[%d]", errno);
if(errno == EACCES)
THROW(MsgException::SECURITY_ERROR, "cannot connect server %s", g_strerror(errno));
else
#include <unistd.h>
#include <fcntl.h>
#include <libgen.h>
-#include <acl/libacl.h>
#include <thumbnail_util.h>
#include <image_util.h>
}
close(fd);
-
return true;
}
return 0;
}
-
-
-bool MsgAclInit()
-{
- /* ACL */
- /* In msg-service.spec file use libacl-devel. Because acl get not process open API */
- /* So have to set TARGET_LINK_LIBRARIES(acl) in makefile */
- /* After GPL-3.0, not supply shell commend (setfacl, getfacl) by license issue, use the API */
- MSG_BEGIN();
-
- const char *priv_read =
- "user::rwx\n"
- "group::rwx\n"
- "group:priv_message_read:rwx\n"
- "mask::rwx\n"
- "other::---";
- acl_t acl = NULL;
- int ret = 0;
-
- acl = acl_from_text(priv_read);
- if (!acl) {
- MSG_ERR("%s: `%s': %s\n", MSG_IPC_DATA_PATH, priv_read, g_strerror(errno));
- return false;
- }
-
- ret = acl_check(acl, NULL);
- if (ret != 0) {
- acl_free(acl);
- if (ret == ACL_DUPLICATE_ERROR) {
- MSG_DEBUG("Already Set ACL");
- return true;
- }
- MSG_ERR("acl_check Fail : [%d],[%s]", ret, acl_error(ret));
- return false;
- }
-
- ret = acl_set_file((const char *)MSG_IPC_DATA_PATH, ACL_TYPE_ACCESS, acl);
- if (ret != 0) {
- MSG_ERR("acl_set_file Fail : [%d][%s]", ret, g_strerror(errno));
- }
- acl_free(acl);
-
- MSG_END();
- return true;
-}