capi-content-media-content
libtzplatform-config eventsystem
cynara-creds-dbus cynara-client cynara-session
- storage db-util)
+ storage db-util libsystemd-login)
#pkg_check_modules(CALENDAR_SERVICE2 calendar-service2)
#pkg_check_modules(CONTACTS_SERVICE2 contacts-service2 zlib)
void _bt_remove_vcf_file(char *file_path);
char *_bt_get_time_of_the_day(void);
char *_bt_share_get_storage_path(int storage_type);
+int _bt_share_get_active_uid(uid_t *uid);
#ifdef __cplusplus
}
#include <sys/xattr.h>
#include <linux/xattr.h>
#include <storage.h>
+#include <systemd/sd-login.h>
#include "vconf-keys.h"
#include "applog.h"
return path;
}
+int _bt_share_get_active_uid(uid_t *uid)
+{
+ DBG("+");
+
+ int ret = 0;
+ uid_t *active_user_list = NULL;
+ char *slice = NULL;
+ *uid = getuid();
+
+ ret = sd_pid_get_slice(getpid(), &slice);
+ if (0 <= ret && slice) {
+ if (!g_strcmp0(slice, "system.slice")) {
+ ret = sd_get_active_uids(&active_user_list);
+ /* the number of active users is 1 in tizen3.0 */
+ if (1 == ret && active_user_list) {
+ *uid = active_user_list[0];
+ DBG("uid = %d", *uid);
+ } else {
+ ERR("sd_get_active_uids() Fail(%d)", ret);
+ free(active_user_list);
+ free(slice);
+ return BT_SHARE_ERROR_NONE;
+ }
+ free(active_user_list);
+ }
+ free(slice);
+ } else {
+ ERR("sd_pid_get_slice() Fail(%d)", ret);
+ }
+
+ DBG("getuid() = %d, uid = %d", getuid(), *uid);
+
+ return BT_SHARE_ERROR_NONE;
+}
+
#include <bluetooth-share-api.h>
#include <notification.h>
#include <media_content.h>
+#include <media_content_internal.h>
#include <sys/stat.h>
#include <aul.h>
#include <storage.h>
static gboolean __bt_scan_media_file(char *file_path)
{
int ret = 0;
+ uid_t uid = 0;
- ret = media_content_connect();
+ /* Set active UID for system session's bt-share process */
+ ret = _bt_share_get_active_uid(&uid);
+ retvm_if(ret != BT_SHARE_ERROR_NONE, FALSE,
+ "Fail to get the active uid: %d", ret);
+
+ ret = media_content_connect_with_uid(uid);
retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, FALSE,
"Fail to connect the media content: %d", ret);
Description=Bluetooth service
[Service]
-User=owner
-Group=users
+User=network_fw
+Group=network_fw
SupplementaryGroups=priv_mediastorage priv_externalstorage
Type=simple
-SmackProcessLabel=User
ExecStart=/usr/bin/bluetooth-share
KillMode=process
BuildRequires: pkgconfig(cynara-creds-dbus)
BuildRequires: pkgconfig(eventsystem)
BuildRequires: pkgconfig(storage)
+BuildRequires: pkgconfig(libsystemd)
%description
Bluetooth File Share Agent
); '
fi
-/usr/bin/chown 5001:100 $TZ_SYS_DB/.bluetooth_transfer.db
-/usr/bin/chown 5001:100 $TZ_SYS_DB/.bluetooth_transfer.db-journal
-/usr/bin/chmod 664 $TZ_SYS_DB/.bluetooth_transfer.db
-/usr/bin/chmod 664 $TZ_SYS_DB/.bluetooth_transfer.db-journal
+/usr/bin/chown network_fw:network_fw $TZ_SYS_DB/.bluetooth_transfer.db
+/usr/bin/chown network_fw:network_fw $TZ_SYS_DB/.bluetooth_transfer.db-journal
+/usr/bin/chmod 644 $TZ_SYS_DB/.bluetooth_transfer.db
+/usr/bin/chmod 644 $TZ_SYS_DB/.bluetooth_transfer.db-journal
-/usr/bin/chsmack -a 'User::Home' $TZ_SYS_DB/.bluetooth_transfer.db
-/usr/bin/chsmack -a 'User::Home' $TZ_SYS_DB/.bluetooth_transfer.db-journal
+/usr/bin/chsmack -a _ $TZ_SYS_DB/.bluetooth_transfer.db
+/usr/bin/chsmack -a _ $TZ_SYS_DB/.bluetooth_transfer.db-journal