# Define Install Files
##########################################################
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/packaging/service-adaptor.service DESTINATION /usr/lib/systemd/user)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/packaging/org.tizen.serviceadaptor.client.service DESTINATION /usr/share/dbus-1/system-services)
+
CONFIGURE_FILE(service-adaptor.pc.in service-adaptor.pc @ONLY)
INSTALL(FILES ${CMAKE_BINARY_DIR}/service-adaptor.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
typedef struct _service_plugin_s
{
char *uri;
+ GHashTable *property;
} service_plugin_s;
service_adaptor_h service_adaptor = NULL;
service_plugin_h service_plugin = (service_plugin_h) g_malloc0(sizeof(service_plugin_s));
service_plugin->uri = strdup(uri);
+ service_plugin->property = g_hash_table_new(g_str_hash, g_str_equal);
*plugin = service_plugin;
RETV_IF(NULL == key, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == value, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+ g_hash_table_insert(plugin->property, key, value);
+
return SERVICE_ADAPTOR_ERROR_NONE;
}
RETV_IF(NULL == plugin, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == key, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+ g_hash_table_remove(plugin->property, key);
+
return SERVICE_ADAPTOR_ERROR_NONE;
}
RETV_IF(NULL == key, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == value, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- return SERVICE_ADAPTOR_ERROR_NONE;
+ if (0 < g_hash_table_size(plugin->property))
+ {
+ GHashTableIter iter;
+ gpointer iter_key, iter_value;
+
+ g_hash_table_iter_init(&iter, plugin->property);
+ while (g_hash_table_iter_next(&iter, &iter_key, &iter_value))
+ {
+ if (strcmp(key, (char *) iter_key) == 0)
+ {
+ *value = g_strdup(iter_value);
+ return SERVICE_ADAPTOR_ERROR_NONE;
+ }
+ }
+ }
+
+ return SERVICE_ADAPTOR_ERROR_NO_DATA;
}
API int service_plugin_login(service_plugin_h plugin, service_plugin_login_cb callback, void *user_data)
service_storage_cloud_file_h cloud_file = (service_storage_cloud_file_h) g_malloc0(sizeof(service_storage_cloud_file_s));
cloud_file->plugin = plugin;
+ cloud_file->callback = NULL;
+ cloud_file->is_dir = false;
+ cloud_file->size = 0;
+ cloud_file->dir_path = NULL;
+ cloud_file->local_path = NULL;
+ cloud_file->cloud_path = NULL;
+ cloud_file->operation = NULL;
+ cloud_file->files = NULL;
*file = cloud_file;
SAL_FN_CALL;
RETV_IF(NULL == src_file, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == dst_file, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
service_storage_cloud_file_h cloud_file = (service_storage_cloud_file_h) g_malloc0(sizeof(service_storage_cloud_file_s));
cloud_file->plugin = src_file->plugin;
cloud_file->callback = src_file->callback;
cloud_file->is_dir = src_file->is_dir;
- cloud_file->dir_path = strdup(src_file->dir_path);
- cloud_file->local_path = strdup(src_file->local_path);
- cloud_file->cloud_path = strdup(src_file->cloud_path);
cloud_file->size = src_file->size;
- cloud_file->operation = strdup(src_file->operation);
+ cloud_file->dir_path = g_strdup(src_file->dir_path);
+ cloud_file->local_path = g_strdup(src_file->local_path);
+ cloud_file->cloud_path = g_strdup(src_file->cloud_path);
+ cloud_file->operation = g_strdup(src_file->operation);
// TODO: g_list_copy_deep()
- cloud_file->files = g_list_copy(src_file->files);
+ if (NULL != src_file->files)
+ {
+ cloud_file->files = g_list_copy(src_file->files);
+ }
+ else
+ {
+ cloud_file->files = NULL;
+ }
*dst_file = cloud_file;
{
SAL_FN_CALL;
+ RETV_IF(NULL == file, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+
SAL_FREE(file->dir_path);
SAL_FREE(file->local_path);
SAL_FREE(file->cloud_path);
RETV_IF(NULL == file, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == cloud_path, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- *cloud_path = strdup(file->cloud_path);
+ *cloud_path = g_strdup(file->cloud_path);
return SERVICE_ADAPTOR_ERROR_NONE;
}
RETV_IF(NULL == file, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == local_path, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- *local_path = strdup(file->local_path);
+ *local_path = g_strdup(file->local_path);
return SERVICE_ADAPTOR_ERROR_NONE;
}
SAL_FN_CALL;
RETV_IF(NULL == file, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- RETV_IF(0 > size, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
file->size = size;
RETV_IF(NULL == file, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == operation, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- *operation = strdup(file->operation);
+ *operation = g_strdup(file->operation);
return SERVICE_ADAPTOR_ERROR_NONE;
}
RETV_IF(NULL == file, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == callback, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- RETV_IF(false == file->is_dir, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+ RETV_IF(false == file->is_dir, SERVICE_ADAPTOR_ERROR_NO_DATA);
RETV_IF(0 == g_list_length(file->files), SERVICE_ADAPTOR_ERROR_NO_DATA);
RETV_IF(NULL == task, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == uri, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
- *uri = strdup(task->uri);
+ *uri = g_strdup(task->uri);
return SERVICE_ADAPTOR_ERROR_NONE;
}
#define SAL_FN_CALL DBG(">>>>>>>> called")
#define SAL_FN_END DBG("<<<<<<<< ended")
-// #define SAL_FN_CALL INFO(">>>>>>>> called")
-// #define SAL_FN_END INFO("<<<<<<<< ended")
#define SAL_DBG(fmt, arg...) DBG(fmt, ##arg)
#define SAL_WARN(fmt, arg...) WARN(fmt, ##arg)
#define SAL_STRDUP(dst, ptr) do { \
if (ptr) \
dst = strdup(ptr); \
- ptr = NULL; \
+ else \
+ dst = NULL; \
} while(0)
#define SAL_FREE(ptr) do { \
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
- <policy user="system">
+ <policy group="users">
<allow own="org.tizen.serviceadaptor.client"/>
+ <allow send_type="method_call"/>
+ </policy>
+ <policy at_console="true">
+ <allow send_destination="org.tizen.serviceadaptor.client"/>
</policy>
<policy context="default">
<allow send_destination="org.tizen.serviceadaptor.client"/>
Name=org.tizen.serviceadaptor.client
Exec=/bin/false
SystemdService=service-adaptor.service
-User=system
-Group=system
+User=root
[Unit]
Description=Service Adaptor daemon
-Requires=tizen-runtime.target
-After=tizen-runtime.target
[Service]
-User=system
-Group=system
-SmackProcessLabel=service-adaptor
Type=dbus
BusName=org.tizen.serviceadaptor.client
ExecStart=/usr/bin/service-adaptor-server
-Restart=always
-RestartSec=1
+Restart=none
+RestartSec=0
[Install]
-WantedBy=multi-user.target
+WantedBy=default.target
rm -rf %{buildroot}
%make_install
-mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants
-install -m 0644 %SOURCE1 %{buildroot}%{_libdir}/systemd/system/
-ln -sf ../service-adaptor.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/
+mkdir -p %{buildroot}%{_libdir}/systemd/user/default.target.wants
+ln -s %{_libdir}/systemd/user/service-adaptor.service %{buildroot}%{_libdir}/systemd/user/default.target.wants/service-adaptor.service
-mkdir -p %{buildroot}/usr/lib/systemd/user/tizen-middleware.target.wants
-cp %SOURCE1 %{buildroot}/usr/lib/systemd/user/service-adaptor.service
-ln -s ../service-adaptor.service %{buildroot}/usr/lib/systemd/user/tizen-middleware.target.wants/
+mkdir -p %{buildroot}/etc/dbus-1/system.d
+ls -l
+install -m 0644 packaging/org.tizen.serviceadaptor.client.conf %{buildroot}/etc/dbus-1/system.d/org.tizen.serviceadaptor.client.conf
mkdir -p %{buildroot}/usr/share/license
cp LICENSE.APLv2 %{buildroot}/usr/share/license/service-adaptor
%files -n service-adaptor
%manifest service-adaptor.manifest
-#%defattr(-,system,system,-)
%defattr(-,root,root,-)
%{_libdir}/lib*.so.*
-%{_bindir}/service-adaptor-server
-%{_bindir}/sal-test
-/usr/lib/systemd/user/service-adaptor.service
-/usr/lib/systemd/user/tizen-middleware.target.wants/service-adaptor.service
-%{_libdir}/systemd/system/service-adaptor.service
-%{_libdir}/systemd/system/multi-user.target.wants/service-adaptor.service
+%caps(cap_mac_admin,cap_chown,cap_dac_override,cap_lease,cap_setgid,cap_setuid=eip) %attr(755,root,root) %{_bindir}/service-adaptor-server
+%caps(cap_mac_admin,cap_chown,cap_dac_override,cap_lease,cap_setgid,cap_setuid=eip) %attr(755,root,root) %{_bindir}/sal-test
+%attr(644,root,root) %{_libdir}/systemd/user/service-adaptor.service
+%attr(644,root,root) %{_libdir}/systemd/user/default.target.wants/service-adaptor.service
+/usr/share/dbus-1/system-services/org.tizen.serviceadaptor.client.service
+/etc/dbus-1/system.d/org.tizen.serviceadaptor.client.conf
/usr/share/license/%{name}
%files -n service-adaptor-devel
-#%defattr(-,system,system,-)
%defattr(-,root,root,-)
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/service-adaptor.pc
<request>
<smack request="system::use_internet" type="rw"/>
<smack request="system::media" type="rwxt"/>
- <smack request="sys-assert::core" type="rwx"/>
+ <smack request="sys-assert::core" type="rwxat"/>
<smack request="pkgmgr::info" type="rxw"/>
<smack request="pkgmgr::db" type="rxwl"/>
<smack request="pkgmgr::svc" type="rxw"/>
</request>
</define>
<assign>
+ <filesystem path="/usr/share/dbus-1/system-services/org.tizen.serviceadaptor.client.service" label="_"/>
<filesystem path="/usr/lib/systemd/system/service-adaptor.service" label="_"/>
- <filesystem path="/usr/lib/systemd/system/multi-user.target.wants/service-adaptor.service" label="_"/>
+ <filesystem path="/etc/dbus-1/system.d/org.tizen.serviceadaptor.client.conf" label="_"/>
+ <filesystem path="/usr/lib/*" exec_label="none" label="_"/>
</assign>
<request>
<domain name="service-adaptor" />
prefix=/usr
-libdir=${prefix}/lib
+libdir=@LIB_INSTALL_DIR@
includedir=${prefix}/include
Name: service-adaptor library