This patchset is for resolving bugs related with file sharing.
"Cannot share Text by BT" and "Unable to recieve file via bluetooth"
Change-Id: If8d2d9f66f2ff8c8e4f3d58a61166e0313ae7806
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
appsvc appcore-efl storage
capi-content-media-content
libtzplatform-config eventsystem
- cynara-creds-dbus cynara-client cynara-session)
+ cynara-creds-dbus cynara-client cynara-session
+ storage)
pkg_check_modules(CALENDAR_SERVICE2 calendar-service2)
pkg_check_modules(CONTACTS_SERVICE2 contacts-service2)
#define BT_SHARE_FAIL -1
#define BT_SHARE_ERROR_NONE 0
-#define BT_TMP_DIR "/opt/usr/media/Downloads/.bluetooth/"
+//#define BT_TMP_DIR "/opt/home/owner/content/Downloads/.bluetooth/"
+#define BT_TMP_DIR "/opt/home/owner/content/Downloads/"
#define BT_TMP_FILE BT_TMP_DIR"bluetooth_content_share"
#define TXT_FILE_NAME BT_TMP_DIR"bluetooth_content_share.txt"
#define HTML_FILE_NAME BT_TMP_DIR"bluetooth_content_share.html"
#define HTML_FILE_FORMAT BT_TMP_DIR"bluetooth_content_share%s.html"
#define HTML_FORMAT "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\"/></head><body><a href=\"%s\">%s</a></body></html>"
-#define BT_CONTACT_SHARE_TMP_DIR "/opt/usr/media/Downloads/.bluetooth/"
+//#define BT_CONTACT_SHARE_TMP_DIR "/opt/home/owner/content/Downloads/.bluetooth/"
+#define BT_CONTACT_SHARE_TMP_DIR "/opt/home/owner/content/Downloads/"
typedef enum {
BT_HTTP_FILE,
#define BT_DEFAULT_MEM_PHONE 0
#define BT_DEFAULT_MEM_MMC 1
-#define BT_DOWNLOAD_PHONE_FOLDER "/opt/usr/media/Downloads"
-#define BT_DOWNLOAD_MMC_FOLDER "/opt/storage/sdcard/Downloads"
-#define BT_DOWNLOAD_MEDIA_FOLDER "/opt/home/owner/content/Downloads"
-//#define BT_DOWNLOAD_MEDIA_FOLDER tzplatform_getenv(TZ_USER_CONTENT)
+#define BT_DOWNLOAD_DEFAULT_PHONE_FOLDER "/opt/usr/media/Downloads"
+#define BT_DOWNLOAD_DEFAULT_MMC_FOLDER "/opt/storage/sdcard/Downloads"
+#define BT_DOWNLOAD_DEFAULT_MEDIA_FOLDER "/opt/home/owner/content/Downloads"
+//#define BT_DOWNLOAD_DEFAULT_MEDIA_FOLDER tzplatform_getenv(TZ_USER_CONTENT)
/*
#define BT_FTP_FOLDER tzplatform_mkpath(TZ_SYS_SHARE, "bt-ftp")
#include <Ecore_File.h>
#include <bundle.h>
#include <eventsystem.h>
+#include <sys/types.h>
+#include <sys/xattr.h>
+#include <linux/xattr.h>
#include "vconf-keys.h"
#include "applog.h"
return BT_SHARE_FAIL;
}
- bluetooth_obex_server_set_root(BT_FTP_FOLDER);
+ bluetooth_obex_server_set_root(storage);
return BT_SHARE_ERROR_NONE;
}
if (appcore_set_i18n(BT_COMMON_PKG, BT_COMMON_RES) < 0)
return -1;
+ uid_t network_user = 5001; /* uid of owner */
+ gid_t network_group = 100; /* gid of users */
+
+#if 0
uid_t network_user = 551; /* uid of network_fw */
gid_t network_group = 551; /* gid of network_fw */
-
initgroups("network_fw", network_group);
+#endif
+ initgroups("users", network_group);
ret = setgid(network_group);
DBG("setgid return : %d", ret);
ret = setuid(network_user);
#include <vconf.h>
#include <unistd.h>
#include <sys/stat.h>
+#include <storage.h>
/* For multi-user support */
#include <tzplatform_config.h>
static void __bt_default_memory_changed_cb(keynode_t *node, void *data)
{
+ int ret;
int default_memory = 0;
char *root_path = NULL;
char *download_path = NULL;
if (vconf_keynode_get_type(node) == VCONF_TYPE_INT) {
/* Phone memory is 0, MMC is 1 */
default_memory = vconf_keynode_get_int(node);
- root_path = default_memory ? (char *)BT_DOWNLOAD_MMC_FOLDER : (char *)BT_DOWNLOAD_MEDIA_FOLDER;
- download_path = default_memory ? (char *)BT_DOWNLOAD_MMC_FOLDER : (char *)BT_DOWNLOAD_PHONE_FOLDER;
+
+ if (default_memory == BT_DEFAULT_MEM_MMC) /* MMC */ {
+ ret = storage_get_directory(STORAGE_TYPE_EXTERNAL,
+ STORAGE_DIRECTORY_DOWNLOADS, &download_path);
+
+ if (ret != STORAGE_ERROR_NONE)
+ DBG("Fail to get the download path: %d", ret);
+
+ ret = storage_get_root_directory(STORAGE_TYPE_EXTERNAL, &root_path);
+
+ if (ret != STORAGE_ERROR_NONE)
+ DBG("Fail to get the root path: %d", ret);
+
+ if (download_path == NULL)
+ download_path = g_strdup(BT_DOWNLOAD_DEFAULT_MMC_FOLDER);
+
+ if (root_path == NULL)
+ root_path = g_strdup(BT_DOWNLOAD_DEFAULT_MMC_FOLDER);
+
+ } else {
+ download_path = g_strdup(BT_DOWNLOAD_DEFAULT_MEDIA_FOLDER);
+ root_path = g_strdup(BT_DOWNLOAD_DEFAULT_MEDIA_FOLDER);
+ }
if (access(download_path, W_OK) != 0) {
if (mkdir(download_path, 0755) < 0) {
bluetooth_obex_server_set_root(root_path);
bluetooth_obex_server_set_destination_path(download_path);
+
+ g_free(download_path);
+ g_free(root_path);
}
}
void _bt_get_default_storage(char *storage)
{
- int val;
- int err;
- char *path;
+ int val = BT_DEFAULT_MEM_PHONE;
+ int ret;
+ char *path = NULL;
if (vconf_get_int(VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT,
(void *)&val)) {
val = BT_DEFAULT_MEM_PHONE;
}
- if (val == BT_DEFAULT_MEM_MMC)
- path = BT_DOWNLOAD_MMC_FOLDER;
- else
- path = BT_DOWNLOAD_PHONE_FOLDER;
+ if (val == BT_DEFAULT_MEM_MMC) {
+ ret = storage_get_directory(STORAGE_TYPE_EXTERNAL,
+ STORAGE_DIRECTORY_DOWNLOADS, &path);
- if (access(path, W_OK) == 0) {
- g_strlcpy(storage, path, STORAGE_PATH_LEN_MAX);
- DBG("Storage path = [%s]\n", storage);
- return;
- }
+ if (ret != STORAGE_ERROR_NONE)
+ DBG("Fail to get the download path: %d", ret);
- if (mkdir(BT_DOWNLOAD_MEDIA_FOLDER, 0755) < 0) {
- err = -errno;
- DBG("mkdir: %d", -err);
+ if (path == NULL)
+ path = g_strdup(BT_DOWNLOAD_DEFAULT_MMC_FOLDER);
+ } else {
+ path = g_strdup(BT_DOWNLOAD_DEFAULT_MEDIA_FOLDER);
}
- g_strlcpy(storage, BT_DOWNLOAD_MEDIA_FOLDER, STORAGE_PATH_LEN_MAX);
+ g_strlcpy(storage, path, STORAGE_PATH_LEN_MAX);
+ g_free(path);
DBG("Default storage : %s\n", storage);
+
+ if (access(storage, W_OK) != 0)
+ DBG("Can't access the storage");
}
BuildRequires: pkgconfig(cynara-session)
BuildRequires: pkgconfig(cynara-creds-dbus)
BuildRequires: pkgconfig(eventsystem)
+BuildRequires: pkgconfig(storage)
%description
Bluetooth File Share Agent
'
fi
-chown network_fw:network_fw $TZ_SYS_DB/.bluetooth_transfer.db
-chown network_fw:network_fw $TZ_SYS_DB/.bluetooth_transfer.db-journal
+#chown network_fw:network_fw $TZ_SYS_DB/.bluetooth_transfer.db
+#chown network_fw:network_fw $TZ_SYS_DB/.bluetooth_transfer.db-journal
+chown 5001:100 $TZ_SYS_DB/.bluetooth_transfer.db
+chown 5001:100 $TZ_SYS_DB/.bluetooth_transfer.db-journal
chmod 664 $TZ_SYS_DB/.bluetooth_transfer.db
chmod 664 $TZ_SYS_DB/.bluetooth_transfer.db-journal