Name: account-manager
Summary: Account Manager
-Version: 0.1.9
+Version: 0.1.10
Release: 1
Group: Social & Content/Other
License: Apache-2.0
BuildRequires: pkgconfig(libtzplatform-config)
%define upgrade_script_path /usr/share/upgrade/scripts
-%define TZ_OWNER_DB %{TZ_SYS_DB}/5001
Requires(post): /sbin/ldconfig
Requires(post): /usr/bin/sqlite3
#then
# mkdir -p /opt/usr/dbspace
#fi
-mkdir -p %{TZ_OWNER_DB}
-if [ ! -f %{TZ_OWNER_DB}/.account.db ]
+mkdir -p %{TZ_SYS_DB}
+if [ ! -f %{TZ_SYS_DB}/.account.db ]
then
- sqlite3 %{TZ_OWNER_DB}/.account.db 'PRAGMA journal_mode = PERSIST;
+ sqlite3 %{TZ_SYS_DB}/.account.db 'PRAGMA journal_mode = PERSIST;
CREATE TABLE if not exists label (AppId TEXT, Label TEXT, Locale TEXT);
CREATE TABLE if not exists account_type (_id INTEGER PRIMARY KEY AUTOINCREMENT, AppId TEXT,
ServiceProviderId TEXT, IconPath TEXT, SmallIconPath TEXT, MultipleAccountSupport INT);
'
fi
-chown service_fw:service_fw %{TZ_OWNER_DB}
-chown service_fw:service_fw %{TZ_OWNER_DB}/.account.db
-chown service_fw:service_fw %{TZ_OWNER_DB}/.account.db-journal
+chown service_fw:service_fw %{TZ_SYS_DB}/.account.db
+chown service_fw:service_fw %{TZ_SYS_DB}/.account.db-journal
-chmod 644 %{TZ_OWNER_DB}/.account.db
-chmod 644 %{TZ_OWNER_DB}/.account.db-journal
+chmod 644 %{TZ_SYS_DB}/.account.db
+chmod 644 %{TZ_SYS_DB}/.account.db-journal
#smack labeling
#chsmack -a 'System::Shared' %{TZ_SYS_DB}/.account.db-journal
int _account_global_db_open(void)
{
- int rc = 0;
+ int rc = 0;
int ret = -1;
char account_db_path[256] = {0, };
- _INFO( "start _account_global_db_open()");
+ _INFO("start _account_global_db_open()");
ACCOUNT_MEMSET(account_db_path, 0x00, sizeof(account_db_path));
- ACCOUNT_GET_OWNER_DB_PATH(account_db_path, sizeof(account_db_path), 5001);
+ ACCOUNT_GET_GLOBAL_DB_PATH(account_db_path, sizeof(account_db_path));
- if( g_hAccountGlobalDB ) {
- _ERR( "Account database is using in another app. %x", g_hAccountDB );
+ if (g_hAccountGlobalDB) {
+ _ERR("Account database is using in another app. %x", g_hAccountDB);
return _ACCOUNT_ERROR_DATABASE_BUSY;
}
ret = _account_db_handle_close(g_hAccountGlobalDB2);
- if( ret != _ACCOUNT_ERROR_NONE )
- ACCOUNT_DEBUG( "db_util_close(g_hAccountGlobalDB2) fail ret = %d", ret);
+ if (ret != _ACCOUNT_ERROR_NONE)
+ ACCOUNT_DEBUG("db_util_close(g_hAccountGlobalDB2) fail ret = %d", ret);
- ACCOUNT_DEBUG( "before _account_global_db_open()");
+ ACCOUNT_DEBUG("before _account_global_db_open()");
// if(mode == ACCOUNT_DB_OPEN_READWRITE)
// rc = db_util_open(account_db_path, &g_hAccountDB, DB_UTIL_REGISTER_HOOK_METHOD);
// else if(mode == ACCOUNT_DB_OPEN_READONLY)
rc = db_util_open_with_options(account_db_path, &g_hAccountGlobalDB, SQLITE_OPEN_READONLY, NULL);
// else
// return _ACCOUNT_ERROR_DB_NOT_OPENED;
- ACCOUNT_DEBUG( "after _account_global_db_open() sqlite_rc = %d", rc);
+ ACCOUNT_DEBUG("after _account_global_db_open() sqlite_rc = %d", rc);
- if( rc == SQLITE_PERM || _account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM ) {
- ACCOUNT_ERROR( "Account permission denied");
+ if (rc == SQLITE_PERM || _account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Account permission denied");
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
- if( rc == SQLITE_BUSY ) {
- ACCOUNT_ERROR( "busy handler fail.");
+ if (rc == SQLITE_BUSY) {
+ ACCOUNT_ERROR("busy handler fail.");
return _ACCOUNT_ERROR_DATABASE_BUSY;
}
- if( rc != SQLITE_OK ) {
- ACCOUNT_ERROR( "The database isn't connected." );
+ if (rc != SQLITE_OK) {
+ ACCOUNT_ERROR("The database isn't connected.");
return _ACCOUNT_ERROR_DB_NOT_OPENED;
}
- _INFO( "end _account_global_db_open()");
+ _INFO("end _account_global_db_open()");
return _ACCOUNT_ERROR_NONE;
}
int _account_global_db_close(void)
{
- ACCOUNT_DEBUG( "start account_global_db_close()");
+ ACCOUNT_DEBUG("start account_global_db_close()");
int ret = -1;
/*
ret = _account_db_handle_close(g_hAccountGlobalDB2);
ACCOUNT_DEBUG( "db_util_close(g_hAccountGlobalDB2) fail ret = %d", ret);
*/
ret = _account_db_handle_close(g_hAccountGlobalDB);
- if( ret != _ACCOUNT_ERROR_NONE )
- {
- ACCOUNT_ERROR( "db_util_close(g_hAccountGlobalDB) fail ret = %d", ret);
+ if (ret != _ACCOUNT_ERROR_NONE) {
+ ACCOUNT_ERROR("db_util_close(g_hAccountGlobalDB) fail ret = %d", ret);
g_hAccountGlobalDB2 = g_hAccountGlobalDB;
}
g_hAccountGlobalDB = NULL;
int _account_db_open(int mode, int pid, uid_t uid)
{
- int rc = 0;
+ int rc = 0;
int ret = -1;
char account_db_dir[256] = {0, };
char account_db_path[256] = {0, };
- _INFO( "start _account_db_open() pid [%d]. uid [%d]", pid, uid);
+ _INFO("start _account_db_open() pid [%d]. uid [%d]", pid, uid);
ACCOUNT_MEMSET(account_db_dir, 0x00, sizeof(account_db_dir));
ACCOUNT_MEMSET(account_db_path, 0x00, sizeof(account_db_path));
ACCOUNT_GET_USER_DB_PATH(account_db_path, sizeof(account_db_path), uid);
- if( g_hAccountDB ) {
- _ERR( "Account database is using in another app. %x", g_hAccountDB );
+ if (g_hAccountDB) {
+ _ERR("Account database is using in another app. %x", g_hAccountDB);
return _ACCOUNT_ERROR_DATABASE_BUSY;
}
ret = _account_db_handle_close(g_hAccountDB2);
- if( ret != _ACCOUNT_ERROR_NONE )
- ACCOUNT_DEBUG( "db_util_close(g_hAccountDB2) fail ret = %d", ret);
+ if (ret != _ACCOUNT_ERROR_NONE)
+ ACCOUNT_DEBUG("db_util_close(g_hAccountDB2) fail ret = %d", ret);
ACCOUNT_GET_USER_DB_DIR(account_db_dir, sizeof(account_db_dir), uid);
if (mkdir(account_db_dir, 0777) != 0)
- ACCOUNT_DEBUG("mkdir \"%s\" fail", account_db_dir);
+ ACCOUNT_DEBUG("\"%s\" is already exist directory", account_db_dir);
-
- ACCOUNT_DEBUG( "before db_util_open()");
+ ACCOUNT_DEBUG("before db_util_open()");
// if(mode == ACCOUNT_DB_OPEN_READWRITE)
rc = db_util_open(account_db_path, &g_hAccountDB, DB_UTIL_REGISTER_HOOK_METHOD);
// else if(mode == ACCOUNT_DB_OPEN_READONLY)
// rc = db_util_open_with_options(account_db_path, &g_hAccountDB, SQLITE_OPEN_READONLY, NULL);
// else
// return _ACCOUNT_ERROR_DB_NOT_OPENED;
- ACCOUNT_DEBUG( "after db_util_open() sqlite_rc = %d", rc);
+ ACCOUNT_DEBUG("after db_util_open() sqlite_rc = %d", rc);
- if( rc == SQLITE_PERM || _account_db_err_code(g_hAccountDB) == SQLITE_PERM ) {
- ACCOUNT_ERROR( "Account permission denied");
+ if (rc == SQLITE_PERM || _account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Account permission denied");
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
- if( rc == SQLITE_BUSY ) {
- ACCOUNT_ERROR( "busy handler fail.");
+ if (rc == SQLITE_BUSY) {
+ ACCOUNT_ERROR("busy handler fail.");
return _ACCOUNT_ERROR_DATABASE_BUSY;
}
- if( rc != SQLITE_OK ) {
- ACCOUNT_ERROR( "The database isn't connected." );
+ if (rc != SQLITE_OK) {
+ ACCOUNT_ERROR("The database isn't connected.");
return _ACCOUNT_ERROR_DB_NOT_OPENED;
}
}
}
- _INFO( "end _account_db_open()");
+ _INFO("end _account_db_open()");
return _ACCOUNT_ERROR_NONE;
}
int _account_db_close(void)
{
- ACCOUNT_DEBUG( "start db_util_close()");
+ ACCOUNT_DEBUG("start db_util_close()");
int ret = -1;
/*
ret = _account_db_handle_close(g_hAccountDB2);
ret = _account_db_handle_close(g_hAccountDB);
if( ret != _ACCOUNT_ERROR_NONE )
{
- ACCOUNT_ERROR( "db_util_close(g_hAccountDB) fail ret = %d", ret);
+ ACCOUNT_ERROR("db_util_close(g_hAccountDB) fail ret = %d", ret);
g_hAccountDB2 = g_hAccountDB;
}
g_hAccountDB = NULL;