Merge "Fix invalid memory access" into tizen
authorsung.goo.kim <sung.goo.kim@samsung.com>
Wed, 24 Feb 2016 07:10:49 +0000 (23:10 -0800)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Wed, 24 Feb 2016 07:10:49 +0000 (23:10 -0800)
daemon/CMakeLists.txt
lib/icl-dbus-type.c
lib/icl-dbus-type.h
lib/icl-resource-interfaces.c
lib/icl-resource-interfaces.h
lib/icl-resource-types.c
lib/icl-resource-types.h
packaging/iotcon-old.service [new file with mode: 0644]
packaging/iotcon.service
packaging/iotcon.spec

index 744ec4a..66a4a73 100644 (file)
@@ -26,7 +26,7 @@ INCLUDE_DIRECTORIES(${daemon_pkgs_INCLUDE_DIRS})
 LINK_DIRECTORIES(${daemon_pkgs_LIBRARY_DIRS})
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--hash-style=both -pie")
+SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--hash-style=both -pie")
 ADD_DEFINITIONS("-DIOTCON_DBUS_INTERFACE=\"${DBUS_INTERFACE}\"")
 
 ADD_EXECUTABLE(${DAEMON} ${DAEMON_SRCS})
index 30de394..0bc89a6 100644 (file)
@@ -168,37 +168,6 @@ GVariant* icl_dbus_remote_resource_to_gvariant(struct icl_remote_resource *resou
 }
 
 
-GVariant* icl_dbus_device_info_to_gvariant(iotcon_device_info_h device_info)
-{
-       GVariant *value;
-
-       value = g_variant_new("(s)", device_info->device_name);
-
-       return value;
-}
-
-
-GVariant* icl_dbus_platform_info_to_gvariant(iotcon_platform_info_h platform_info)
-{
-       GVariant *value;
-
-       value = g_variant_new("(sssssssssss)",
-                       platform_info->platform_id,
-                       platform_info->manuf_name,
-                       platform_info->manuf_url,
-                       platform_info->model_number,
-                       platform_info->date_of_manuf,
-                       platform_info->platform_ver,
-                       platform_info->os_ver,
-                       platform_info->hardware_ver,
-                       platform_info->firmware_ver,
-                       platform_info->support_url,
-                       platform_info->system_time);
-
-       return value;
-}
-
-
 GVariant* icl_dbus_query_to_gvariant(iotcon_query_h query)
 {
        FN_CALL;
index 188367a..7aefcc9 100644 (file)
@@ -26,8 +26,6 @@ const char** icl_dbus_resource_types_to_array(iotcon_resource_types_h types);
 GVariant* icl_dbus_representation_to_gvariant(struct icl_representation_s *repr);
 GVariant* icl_dbus_response_to_gvariant(struct icl_resource_response *response);
 GVariant* icl_dbus_remote_resource_to_gvariant(struct icl_remote_resource *resource);
-GVariant* icl_dbus_device_info_to_gvariant(struct icl_device_info *device_info);
-GVariant* icl_dbus_platform_info_to_gvariant(struct icl_platform_info *platform_info);
 GVariant* icl_dbus_query_to_gvariant(iotcon_query_h query);
 GVariant* icl_dbus_options_to_gvariant(iotcon_options_h options);
 GVariant* icl_dbus_observers_to_gvariant(iotcon_observers_h observers);
index a46721d..3353cff 100644 (file)
@@ -199,16 +199,3 @@ API int iotcon_resource_interfaces_clone(iotcon_resource_interfaces_h src,
        return IOTCON_ERROR_NONE;
 }
 
-
-/* counting from 0 */
-const char* icl_resource_interfaces_get_nth_data(iotcon_resource_interfaces_h ifaces,
-               int index)
-{
-       return g_list_nth_data(ifaces->iface_list, index);
-}
-
-
-unsigned int icl_resource_interfaces_get_length(iotcon_resource_interfaces_h ifaces)
-{
-       return g_list_length(ifaces->iface_list);
-}
index 251ddba..6c54f83 100644 (file)
@@ -26,8 +26,5 @@ struct icl_resource_ifaces {
 
 iotcon_resource_interfaces_h icl_resource_interfaces_ref(
                iotcon_resource_interfaces_h res_ifaces);
-const char* icl_resource_interfaces_get_nth_data(iotcon_resource_interfaces_h res_ifaces,
-               int index);
-unsigned int icl_resource_interfaces_get_length(iotcon_resource_interfaces_h res_ifaces);
 
 #endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_RESOURCE_INTERFACES_H__ */
index 0078cde..a8e3205 100644 (file)
@@ -203,15 +203,3 @@ API int iotcon_resource_types_clone(iotcon_resource_types_h src,
        return IOTCON_ERROR_NONE;
 }
 
-
-/* counting from 0 */
-const char* icl_resource_types_get_nth_data(iotcon_resource_types_h types, int index)
-{
-       return g_list_nth_data(types->type_list, index);
-}
-
-
-unsigned int icl_resource_types_get_length(iotcon_resource_types_h types)
-{
-       return g_list_length(types->type_list);
-}
index c493a24..586e51d 100644 (file)
@@ -34,7 +34,5 @@ struct icl_resource_types {
 };
 
 iotcon_resource_types_h icl_resource_types_ref(iotcon_resource_types_h res_types);
-const char* icl_resource_types_get_nth_data(iotcon_resource_types_h res_types, int index);
-unsigned int icl_resource_types_get_length(iotcon_resource_types_h res_types);
 
 #endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_RESOURCE_TYPES_H__ */
diff --git a/packaging/iotcon-old.service b/packaging/iotcon-old.service
new file mode 100644 (file)
index 0000000..d76f30c
--- /dev/null
@@ -0,0 +1,13 @@
+[Unit]
+Description=Tizen IoT Connectivity
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/iotcon-daemon
+Restart=always
+User=system
+Group=system
+SmackProcessLabel=iotcon
+
+[Install]
+WantedBy=multi-user.target
index 92b1622..5fbbb6e 100644 (file)
@@ -5,6 +5,7 @@ Description=Tizen IoT Connectivity
 Type=simple
 ExecStart=/usr/bin/iotcon-daemon
 Restart=always
+User=iotcon
 
 [Install]
 WantedBy=multi-user.target
index 2102c7d..21512a8 100644 (file)
@@ -6,6 +6,7 @@ Group:      Network & Connectivity/Service
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
 Source1:    %{name}.service
+Source2:    %{name}-old.service
 Source1001: %{name}.manifest
 Source1002: %{name}-old.manifest
 Source1003: %{name}-test-old.manifest
@@ -26,6 +27,9 @@ BuildRequires:  pkgconfig(cynara-creds-gdbus)
 %if "%{tizen}" == "2.3"
 BuildRequires:  python-xml
 %endif
+%if 0%{?tizen_version_major} >= 3
+Requires(post): /usr/bin/getent, /usr/bin/useradd, /usr/bin/groupadd
+%endif
 Requires(post): /sbin/ldconfig, /usr/bin/systemctl
 Requires(postun): /sbin/ldconfig, /usr/bin/systemctl
 
@@ -58,9 +62,11 @@ Tizen IoT Connectivity Test Programs
 %setup -q
 chmod g-w %_sourcedir/*
 %if 0%{?tizen_version_major} < 3
+cp %{SOURCE2} ./%{name}.service
 cp %{SOURCE1002} ./%{name}.manifest
 cp %{SOURCE1003} ./%{name}-test.manifest
 %else
+cp %{SOURCE1} ./%{name}.service
 cp %{SOURCE1001} ./%{name}.manifest
 cp %{SOURCE1001} ./%{name}-test.manifest
 %endif
@@ -73,6 +79,7 @@ TZ_VER_3=0
 TZ_VER_3=1
 %endif
 
+export LDFLAGS+="-Wl,--as-needed"
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
 %cmake . -DMAJORVER=${MAJORVER} -DFULLVER=%{version} -DBIN_INSTALL_DIR:PATH=%{_bindir} \
                -DTZ_VER_3=${TZ_VER_3} -DDBUS_INTERFACE=%{_dbus_interface}
@@ -83,7 +90,7 @@ rm -rf %{buildroot}
 %make_install
 
 mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
-cp -af %{SOURCE1} %{buildroot}%{_unitdir}/
+cp -af %{name}.service %{buildroot}%{_unitdir}/
 ln -s ../%{name}.service %{buildroot}%{_unitdir}/multi-user.target.wants/%{name}.service
 
 %if 0%{?tizen_version_major} < 3
@@ -98,6 +105,11 @@ cp -af %{SOURCE1004} %{buildroot}%{_sysconfdir}/dbus-1/system.d/%{name}.conf
 
 
 %post
+%if 0%{?tizen_version_major} >= 3
+getent group iotcon > /dev/null || groupadd -r iotcon
+getent passwd iotcon > /dev/null || useradd -r -g iotcon -d '/var/lib/empty' -s /sbin/nologin -c "iotcon daemon" iotcon
+%endif
+
 systemctl daemon-reload
 if [ $1 == 1 ]; then
     systemctl restart %{name}.service