PROJECT(downloadagent2 C)
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+ SET(CMAKE_BUILD_TYPE "Release")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
+
SET(VERSION "0.1.0")
FIND_PROGRAM(UNAME NAMES uname)
ADD_DEFINITIONS("-D_FILE_OFFSET_BITS=64")
ENDIF (SUPPORT_OMA_DRM)
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-SET(CMAKE_C_FLAGS_DEBUG "-O0 -Wall")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror -fvisibility=hidden")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -fPIE")
+SET(CMAKE_C_FLAGS_RELEASE "-O2 -fPIE")
ADD_DEFINITIONS("-D_ENABLE_DLOG")
#This should be removed when release a target
* 3. requesting URL
* 4. Otherwise, define it as "No name"
*/
-da_ret_t __get_candidate_file_name(char *user_file_name, char *url,
+da_ret_t __get_candidate_file_name(const char *user_file_name, char *url,
char *file_name_from_header,
char **out_pure_file_name, char **out_extension)
{
char *extension = DA_NULL;
char *file_name = DA_NULL;
char *tmp_file_path = DA_NULL;
- char *install_dir = DA_NULL;
- char *user_file_name = DA_NULL;
char *file_name_from_header = DA_NULL;
char *url = DA_NULL;
+ const char *install_dir = DA_NULL;
+ const char *user_file_name = DA_NULL;
file_info_t *file_info = DA_NULL;
req_info_t *req_info = DA_NULL;
http_info_t *http_info = DA_NULL;
NULL_CHECK_RET(slot);
if (req_info->install_path)
- install_dir = req_info->install_path;
- else
- {
+ install_dir = (const char *)req_info->install_path;
+ else {
tzplatform_set_user(slot->credential.uid);
install_dir = DA_DEFAULT_INSTALL_PATH_FOR_PHONE;
tzplatform_reset_user();
}
- user_file_name = req_info->file_name;
+ user_file_name = (const char *)req_info->file_name;
/* If there is location url from response header in case of redirection,
* it try to parse the file name from the location url */
if (http_info->location_url) {
return;
}
-char *get_full_path_avoided_duplication(char *in_dir,
+char *get_full_path_avoided_duplication(const char *in_dir,
char *in_candidate_file_name, char *in_extension)
{
- char *dir = in_dir;
+ char *dir = NULL;
char *file_name = in_candidate_file_name;
char *extension = in_extension;
char *final_path = DA_NULL;
if (!in_dir || !in_candidate_file_name)
return DA_NULL;
+ dir = strdup(in_dir);
+ if (!dir)
+ return DA_NULL;
+
//DA_SECURE_LOGI("in_candidate_file_name=[%s],in_extension=[%s]",
//in_candidate_file_name, in_extension);
final_path = (char*)calloc(1, final_path_len);
if (!final_path) {
DA_LOGE("DA_ERR_FAIL_TO_MEMALLOC");
+ free(dir);
return DA_NULL;
}
} while (1);
//DA_SECURE_LOGD("decided path = [%s]", final_path);
+ free(dir);
+
return final_path;
}
da_ret_t check_drm_convert(file_info_t *file_info)
{
da_ret_t ret = DA_RESULT_OK;
+#ifdef _ENABLE_OMA_DRM
da_bool_t ret_b = DA_TRUE;
+#endif
DA_LOGD("");
}
}
-da_ret_t get_available_memory(char *dir_path, da_size_t len)
+da_ret_t get_available_memory(const char *dir_path, da_size_t len)
{
da_ret_t ret = DA_RESULT_OK;
int fs_ret = 0;
- //struct statfs filesys_info = {0, };
- struct statvfs filesys_info;
+ struct statfs filesys_info = {0, };
+ //struct statvfs filesys_info;
DA_LOGV("");
{
da_ret_t ret = DA_RESULT_OK;
da_size_t cont_len = 0;
- char *dir_path = DA_NULL;
- char *user_install_path = DA_NULL;
dp_client_slots_fmt *slot = DA_NULL;
+ const char *dir_path = DA_NULL;
+ const char *user_install_path = DA_NULL;
DA_LOGV("");
NULL_CHECK_RET(http_info);
cont_len = http_info->content_len_from_header;
NULL_CHECK_RET(req_info);
- user_install_path = req_info->install_path;
+ user_install_path = (const char*)req_info->install_path;
slot = req_info->user_client_data;
NULL_CHECK_RET(slot);
if (cont_len > 0) {
- if (user_install_path)
+ if (user_install_path) {
dir_path = user_install_path;
- else
- {
+ } else {
tzplatform_set_user(slot->credential.uid);
dir_path = DA_DEFAULT_INSTALL_PATH_FOR_PHONE;
tzplatform_reset_user();
char *value = NULL;
da_size_t size = 0;
char *temp_file_path = DA_NULL;
- char *dir_path = DA_NULL;
+ const char *dir_path = DA_NULL;
dp_client_slots_fmt *slot = DA_NULL;
DA_LOGV("");
if (remained_content_len > 0) {
if (req_info->install_path)
- dir_path = req_info->install_path;
+ dir_path = (const char *)req_info->install_path;
else
{
tzplatform_set_user(slot->credential.uid);
da_bool_t __get_http_header_for_field(http_msg_response_t *http_msg_response,
const char *in_field, http_header_t **out_header)
{
- http_msg_iter_t http_msg_iter;
+ http_msg_iter_t http_msg_iter = DA_NULL;
http_header_t *header = NULL;
char *field = NULL;
da_bool_t __get_http_req_header_for_field(http_msg_request_t *http_msg_request,
const char *in_field, http_header_t **out_header)
{
- http_msg_iter_t http_msg_iter;
+ http_msg_iter_t http_msg_iter = DA_NULL;
http_header_t *header = NULL;
char *field = NULL;
da_ret_t get_user_agent_string(char **uagent_str)
{
da_ret_t ret = DA_RESULT_OK;
- char *key = DA_NULL;
DA_LOGV("");
DA_LOGE("Invalid Argument");
return DA_ERR_INVALID_ARGUMENT;
}
-#if 0
- key = VCONFKEY_BROWSER_USER_AGENT;
- ret = __get_conf_string(key, uagent_str);
- if(ret == DA_RESULT_OK) {
- if(*uagent_str) {
-// DA_SECURE_LOGD("getting uagent_str = \n%s", *uagent_str);
- return ret;
- }
- }
-#endif
+
DA_LOGI("No UA information from vconf !!");
*uagent_str = strdup(DEFAULT_UA_STR);
DA_LOGV("Set default UA");
da_ret_t start_file_append(file_info_t *file_info);
da_ret_t discard_download(file_info_t *file_info) ;
void clean_paused_file(file_info_t *file_info);
-char *get_full_path_avoided_duplication(char *in_dir,
+char *get_full_path_avoided_duplication(const char *in_dir,
char *in_candidate_file_name, char *in_extension);
void remove_file(const char *file_path);
-da_ret_t get_available_memory(char *dir_path, da_size_t len);
+da_ret_t get_available_memory(const char *dir_path, da_size_t len);
#endif
%define _ux_define tizen2.3
Name: download-provider
Summary: Download the contents in background
-Version: 2.1.78
+Version: 2.1.79
Release: 0
Group: Development/Libraries
License: Apache-2.0
%define support_knox ON
%define _manifest_name %{name}.manifest
-%if 0%{?model_build_feature_wlan_p2p_disable }
+%if 0%{?model_build_feature_wlan_p2p_disable}
%define wifi_direct OFF
%endif
%if "%{?tizen_profile_name}" == "wearable"
%define support_knox ON
%endif
-%define cmake \
- CFLAGS="${CFLAGS:-%optflags} -fPIC -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fvisibility=hidden"; export CFLAGS \
- FFLAGS="${FFLAGS:-%optflags} -fPIC -fvisibility=hidden"; export FFLAGS \
- LDFLAGS+=" -Wl,--as-needed -Wl,--hash-style=both"; export LDFLAGS \
- %__cmake \\\
- -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \\\
- -DBIN_INSTALL_DIR:PATH=%{_bindir} \\\
- -DLIB_INSTALL_DIR:PATH=%{_libdir} \\\
- %ifarch aarch64 x86_64 \
- -DLIB_AGENT_PATH="/usr/lib64/libdownloadagent2.so" \\\
- %else \
- -DLIB_AGENT_PATH="/usr/lib/libdownloadagent2.so" \\\
- %endif \
- -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \\\
- -DPKG_NAME=%{name} \\\
- -DPKG_VERSION=%{version} \\\
- -DPKG_RELEASE=%{release} \\\
- -DIPC_SOCKET:PATH=%{_ipc_socket} \\\
- -DPROVIDER_DIR:PATH=%{_data_install_path} \\\
- -DNOTIFY_DIR:PATH=%{_notifydir} \\\
- -DDATABASE_DIR:PATH=%{_databasedir} \\\
- -DDATABASE_CLIENT_DIR:PATH=%{_database_client_dir} \\\
- -DIMAGE_DIR:PATH=%{_imagedir} \\\
- -DLOCALE_DIR:PATH=%{_localedir} \\\
- -DSUPPORT_WIFI_DIRECT:BOOL=OFF \\\
- %if "%{?download_booster}" == "ON" \
- -DSUPPORT_DOWNLOAD_BOOSTER:BOOL=ON \\\
- %else \
- -DSUPPORT_DOWNLOAD_BOOSTER:BOOL=OFF \\\
- %endif \
- %if "%{?support_notification}" == "ON" \
- -DSUPPORT_NOTIFICATION:BOOL=ON \\\
- %else \
- -DSUPPORT_NOTIFICATION:BOOL=OFF \\\
- %endif \
- -DSUPPORT_LOG_MESSAGE:BOOL=ON \\\
- %if "%{?support_oma_drm}" == "ON" \
- -DSUPPORT_OMA_DRM:BOOL=ON \\\
- %else \
- -DSUPPORT_OMA_DRM:BOOL=OFF \\\
- %endif \
- %if "%{?support_security_privilege}" == "ON" \
- -DSUPPORT_SECURITY_PRIVILEGE:BOOL=ON \\\
- %else \
- -DSUPPORT_SECURITY_PRIVILEGE:BOOL=OFF \\\
- %endif \
- %if "%{?support_companion_mode}" == "ON" \
- -DSUPPORT_COMPANION_MODE:BOOL=ON \\\
- %else \
- -DSUPPORT_COMPANION_MODE:BOOL=OFF \\\
- %endif \
- %if "%{?support_knox}" == "ON" \
- -DSUPPORT_KNOX:BOOL=ON \\\
- %else \
- -DSUPPORT_KNOX:BOOL=OFF \\\
- %endif \
- %if "%{?_ux_define}" == "tizen2.3" \
- -DTIZEN_2_3_UX:BOOL=ON \\\
- %endif \
- -DCMAKE_LOG_DUMP_SCRIPT_DIR=%{_logdump_script_dir} \\\
- -DHTTP_LIB=%{_http_lib} \\\
- %if "%{?_lib}" == "lib64" \
- %{?_cmake_lib_suffix64} \\\
- %endif \
- %{?_cmake_skip_rpath} \\\
- -DBUILD_SHARED_LIBS:BOOL=ON
-
%build
export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
-%cmake . -DTZ_SYS_GLOBALUSER_DATA=%TZ_SYS_GLOBALUSER_DATA
+
+%cmake -DTZ_SYS_GLOBALUSER_DATA=%TZ_SYS_GLOBALUSER_DATA \
+ -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
+ -DBIN_INSTALL_DIR:PATH=%{_bindir} \
+ -DLIB_INSTALL_DIR:PATH=%{_libdir} \
+%ifarch aarch64 x86_64
+ -DLIB_AGENT_PATH="/usr/lib64/libdownloadagent2.so" \
+%else
+ -DLIB_AGENT_PATH="/usr/lib/libdownloadagent2.so" \
+%endif
+ -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \
+ -DPKG_NAME=%{name} \
+ -DPKG_VERSION=%{version} \
+ -DPKG_RELEASE=%{release} \
+ -DIPC_SOCKET:PATH=%{_ipc_socket} \
+ -DPROVIDER_DIR:PATH=%{_data_install_path} \
+ -DNOTIFY_DIR:PATH=%{_notifydir} \
+ -DDATABASE_DIR:PATH=%{_databasedir} \
+ -DDATABASE_CLIENT_DIR:PATH=%{_database_client_dir} \
+ -DIMAGE_DIR:PATH=%{_imagedir} \
+ -DLOCALE_DIR:PATH=%{_localedir} \
+ -DSUPPORT_WIFI_DIRECT:BOOL=OFF \
+%if "%{?download_booster}" == "ON"
+ -DSUPPORT_DOWNLOAD_BOOSTER:BOOL=ON \
+%else \
+ -DSUPPORT_DOWNLOAD_BOOSTER:BOOL=OFF \
+%endif
+%if "%{?support_notification}" == "ON"
+ -DSUPPORT_NOTIFICATION:BOOL=ON \
+%else
+ -DSUPPORT_NOTIFICATION:BOOL=OFF \
+%endif
+ -DSUPPORT_LOG_MESSAGE:BOOL=ON \
+%if "%{?support_oma_drm}" == "ON"
+ -DSUPPORT_OMA_DRM:BOOL=ON \
+%else
+ -DSUPPORT_OMA_DRM:BOOL=OFF \
+%endif
+%if "%{?support_security_privilege}" == "ON"
+ -DSUPPORT_SECURITY_PRIVILEGE:BOOL=ON \
+%else \
+ -DSUPPORT_SECURITY_PRIVILEGE:BOOL=OFF \
+%endif
+%if "%{?support_companion_mode}" == "ON"
+ -DSUPPORT_COMPANION_MODE:BOOL=ON \
+%else
+ -DSUPPORT_COMPANION_MODE:BOOL=OFF \
+%endif
+%if "%{?support_knox}" == "ON"
+ -DSUPPORT_KNOX:BOOL=ON \
+%else
+ -DSUPPORT_KNOX:BOOL=OFF \
+%endif
+%if "%{?_ux_define}" == "tizen2.3"
+ -DTIZEN_2_3_UX:BOOL=ON \
+%endif
+ -DCMAKE_LOG_DUMP_SCRIPT_DIR=%{_logdump_script_dir} \
+ -DHTTP_LIB=%{_http_lib} \
+%if "%{?_lib}" == "lib64"
+ %{?_cmake_lib_suffix64} \
+%endif
+ %{?_cmake_skip_rpath} \
+ -DBUILD_SHARED_LIBS:BOOL=ON \
+ .
make %{?jobs:-j%jobs}
install -m 644 packaging/download-provider.notstrip %{buildroot}/etc/notstrip/download-provider.notstrip
%endif
-#%if 0%{?sec_product_feature_container_enable}
+## container_enable
mkdir -p %{buildroot}/etc/vasum/vsmzone.resource/
mv %{buildroot}/usr/share/download-provider/download-provider.res %{buildroot}/etc/vasum/vsmzone.resource/
-#%endif
mkdir -p %{buildroot}/lib/systemd/system/graphical.target.wants
mkdir -p %{buildroot}/lib/systemd/system/sockets.target.wants
%{_libdir}/libdownload-provider-interface.so.0
%{_bindir}/%{name}
%attr(0544,root,root) %{_logdump_script_dir}/dump-%{name}.sh
-#%if 0%{?sec_product_feature_container_enable}
+## container_enable
%attr(0644,root,root) /etc/vasum/vsmzone.resource/download-provider.res
-#%endif
%{upgrade_script_path}/500.download-provider_upgrade.sh
%if ("%{VD_PRODUCT_TYPE}" == "AUDIO") || ("%{VD_PRODUCT_TYPE}" == "TV") || ("%{VD_PRODUCT_TYPE}" == "LFD") || ("%{VD_PRODUCT_TYPE}" == "HTV") || ("%{VD_PRODUCT_TYPE}" == "AV")
/etc/notstrip/download-provider.notstrip
SET(PACKAGE_DESCRIPTION "Interface supported by download-provider")
IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
- SET(CMAKE_BUILD_TYPE "Debug")
+ SET(CMAKE_BUILD_TYPE "Release")
ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
pthread
)
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -Wall")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror -fvisibility=hidden")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g -fPIE")
+SET(CMAKE_C_FLAGS_RELEASE "-O2 -fPIE")
ADD_DEFINITIONS(-DDOWNLOAD_PROVIDER_LOG_TAG=\"DOWNLOAD_PROVIDER_INTERFACE\")
PROJECT(${PKG_NAME} C)
IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
- SET(CMAKE_BUILD_TYPE "Debug")
+ SET(CMAKE_BUILD_TYPE "Release")
ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
capi-appfw-app-manager
)
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -Wall -fPIE")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror -fvisibility=hidden")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g -fPIE")
+SET(CMAKE_C_FLAGS_RELEASE "-O2 -fPIE")
IF(DEFINED IMAGE_DIR)
ADD_DEFINITIONS(-DIMAGE_DIR=\"${IMAGE_DIR}\")
int len = snprintf(headers_buffer, buffer_length + 1,
"%s:%s", header_field, header_data);
if (len <= 0) {
- if (headers_buffer)
- free(headers_buffer);
- continue;
+ free(headers_buffer);
+ continue;
} else {
headers_buffer[len] = '\0';
}
GMainLoop *event_loop;
TRACE_INFO("download-provider's working is started");
- g_type_init();
-
event_loop = g_main_loop_new(NULL, FALSE);
if (!event_loop) {
TRACE_ERROR("Failed to create g main loop handle");
struct stat fstat_info;
int fd;
int errorcode = DP_ERROR_NONE;
- char *str = NULL;
- str = strrchr(saved_path, '/');
dp_credential cred = slot->credential;
if (lstat(saved_path, &lstat_info) != -1) {
fd = open (saved_path, O_RDONLY);
#include <stdlib.h>
#include <signal.h> // pthread_kill
#include <errno.h> // ESRCH
+#include <sys/time.h>
#include <download-provider-log.h>
#include <download-provider-pthread.h>