pkgmgr_ret = pkgmgrinfo_appinfo_get_appid(handle, &appid);
- if( pkgmgr_ret != PMINFO_R_OK ){
+ if (pkgmgr_ret != PMINFO_R_OK)
ACCOUNT_DEBUG("pkgmgrinfo_appinfo_get_appid(%d)", pkgmgr_ret);
- }
item = _account_dup_text(appid);
*appid_list = g_slist_append(*appid_list, item);
ACCOUNT_ERROR("fd read error(%d)\n", fd);
close(fd);
return -1;
- } else
+ } else {
buf[ret] = 0;
+ }
close(fd);
return strdup(buf);
}
-
/*
static int _account_execute_query_from_global_db(const char *query)
{
int rc = -1;
char* pszErrorMsg = NULL;
- if(!query){
+ if (!query) {
ACCOUNT_ERROR("NULL query\n");
return _ACCOUNT_ERROR_QUERY_SYNTAX_ERROR;
}
- if(!g_hAccountGlobalDB){
+ if (!g_hAccountGlobalDB) {
ACCOUNT_ERROR("Global DB is not opened\n");
return _ACCOUNT_ERROR_DB_NOT_OPENED;
}
return rc;
}
*/
+
/*
static int _account_begin_transaction_from_global_db(void)
{
ret = _account_execute_query_from_global_db("BEGIN IMMEDIATE TRANSACTION");
- if (ret == SQLITE_BUSY){
+ if (ret == SQLITE_BUSY) {
ACCOUNT_ERROR(" sqlite3 busy = %d", ret);
return _ACCOUNT_ERROR_DATABASE_BUSY;
- } else if(ret != SQLITE_OK) {
+ } else if (ret != SQLITE_OK) {
ACCOUNT_ERROR("_account_svc_begin_transaction_in_global_db fail :: %d", ret);
return _ACCOUNT_ERROR_DB_FAILED;
}
ACCOUNT_DEBUG("_account_end_transaction ROLLBACK");
}
- if(ret == SQLITE_PERM) {
+ if (ret == SQLITE_PERM) {
ACCOUNT_ERROR("Account permission denied :: %d", ret);
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
- if (ret == SQLITE_BUSY){
+ if (ret == SQLITE_BUSY) {
ACCOUNT_DEBUG(" sqlite3 busy = %d", ret);
return _ACCOUNT_ERROR_DATABASE_BUSY;
}
ACCOUNT_DEBUG("db_util_close(g_hAccountGlobalDB2) fail ret = %d", ret);
ACCOUNT_DEBUG("before _account_global_db_open()");
-// if(mode == ACCOUNT_DB_OPEN_READWRITE)
+// 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)
+// 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;
int ret = -1;
/*
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);
*/
ret = _account_db_handle_close(g_hAccountGlobalDB);
if (ret != _ACCOUNT_ERROR_NONE) {
static bool _account_check_add_more_account(const char* app_id)
{
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
+ int rc = 0;
ACCOUNT_RETURN_VAL((app_id != 0), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, _ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
rc = _account_get_record_count(g_hAccountDB, query);
/* multiple account support case (User DB & global DB) */
- if(rc > 0 || _account_get_record_count(g_hAccountGlobalDB, query) > 0) {
+ if (rc > 0 || _account_get_record_count(g_hAccountGlobalDB, query) > 0) {
ACCOUNT_SLOGD("app id (%s) supports multiple account. rc(%d)\n", app_id, rc);
return TRUE;
}
ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE package_name = '%s'", ACCOUNT_TABLE, app_id);
rc = _account_get_record_count(g_hAccountDB, query);
- if(rc <= 0) {
+ if (rc <= 0) {
ACCOUNT_SLOGD("app id (%s) supports single account. and there is no account of the app id\n", app_id);
return TRUE;
}
ACCOUNT_DEBUG("\"%s\" is already exist directory", account_db_dir);
ACCOUNT_DEBUG("before db_util_open()");
-// if(mode == ACCOUNT_DB_OPEN_READWRITE)
+// 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)
+// 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;
int ret = -1;
/*
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);
*/
ret = _account_db_handle_close(g_hAccountDB);
- if( ret != _ACCOUNT_ERROR_NONE )
- {
+ if (ret != _ACCOUNT_ERROR_NONE) {
ACCOUNT_ERROR("db_util_close(g_hAccountDB) fail ret = %d", ret);
g_hAccountDB2 = g_hAccountDB;
}
int rc = 0;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
int error_code = _ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
+ account_stmt hstmt = NULL;
/* check whether app id exist in account type db */
rc = _account_query_step(hstmt);
if (rc != SQLITE_DONE) {
_INFO("");
- ACCOUNT_ERROR( "account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM )
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM)
error_code = _ACCOUNT_ERROR_PERMISSION_DENIED;
else
error_code = _ACCOUNT_ERROR_DB_FAILED;
static int _account_insert_capability(account_s *account, int account_id)
{
_INFO("_account_insert_capability start");
- int rc, count = 1;
+ int rc, count = 1;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- account_stmt hstmt = NULL;
+ account_stmt hstmt = NULL;
ACCOUNT_RETURN_VAL((account != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
- if (g_slist_length( account->capablity_list)==0) {
- ACCOUNT_DEBUG( "_account_insert_capability, no capability\n");
+ if (g_slist_length(account->capablity_list) == 0) {
+ ACCOUNT_DEBUG("_account_insert_capability, no capability\n");
return _ACCOUNT_ERROR_NONE;
}
_INFO("_account_insert_capability _account_get_record_count [%s]", query);
rc = _account_get_record_count(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- _ERR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ _ERR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
- if (rc <= 0) {
+
+ if (rc <= 0)
return _ACCOUNT_ERROR_RECORD_NOT_FOUND;
- }
/* insert query*/
_INFO("_account_insert_capability _account_query_step[%d]", rc);
if (rc != SQLITE_DONE) {
- _ERR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
+ _ERR("_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
break;
}
static int _account_update_capability(account_s *account, int account_id)
{
- int rc, count = 1;
+ int rc, count = 1;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- account_stmt hstmt = NULL;
+ account_stmt hstmt = NULL;
ACCOUNT_RETURN_VAL((account != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
- if (g_slist_length( account->capablity_list)==0) {
- ACCOUNT_ERROR( "_account_update_capability, no capability\n");
+ if (g_slist_length(account->capablity_list) == 0) {
+ ACCOUNT_ERROR("_account_update_capability, no capability\n");
return _ACCOUNT_ERROR_NONE;
}
rc = _account_get_record_count(g_hAccountDB, query);
if (rc <= 0) {
- ACCOUNT_SLOGI( "_account_update_capability : related account item is not existed rc=%d , %s", rc, _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_SLOGI("_account_update_capability : related account item is not existed rc=%d , %s", rc, _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_RECORD_NOT_FOUND;
}
rc = _account_query_step(hstmt);
if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_DB_FAILED;
}
rc = _account_query_finalize(hstmt);
rc = _account_query_step(hstmt);
if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
break;
}
return _ACCOUNT_ERROR_NONE;
}
-static int _account_update_capability_by_user_name(account_s *account, const char *user_name, const char *package_name )
+static int _account_update_capability_by_user_name(account_s *account, const char *user_name, const char *package_name)
{
- int rc, count = 1;
+ int rc, count = 1;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- account_stmt hstmt = NULL;
+ account_stmt hstmt = NULL;
ACCOUNT_RETURN_VAL((account != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
- if (g_slist_length( account->capablity_list)==0) {
- ACCOUNT_ERROR( "_account_update_capability_by_user_name, no capability\n");
+ if (g_slist_length(account->capablity_list) == 0) {
+ ACCOUNT_ERROR("_account_update_capability_by_user_name, no capability\n");
return _ACCOUNT_ERROR_NONE;
}
rc = _account_get_record_count(g_hAccountDB, query);
if (rc <= 0) {
- ACCOUNT_SLOGI( "_account_update_capability_by_user_name : related account item is not existed rc=%d , %s ", rc, _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_SLOGI("_account_update_capability_by_user_name : related account item is not existed rc=%d , %s ", rc, _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_RECORD_NOT_FOUND;
}
_account_query_bind_text(hstmt, count++, (char*)account->user_name);
rc = _account_query_step(hstmt);
if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_DB_FAILED;
}
rc = _account_query_step(hstmt);
if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
break;
}
static int _account_compare_old_record_by_user_name(account_s *new_account, const char* user_name, const char* package_name)
{
int error_code = _ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
+ account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
int rc = 0;
account_s *old_account = NULL;
ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, _ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
old_account = (account_s*)calloc(1, sizeof(account_s));
- if(!old_account) {
+ if (!old_account) {
ACCOUNT_FATAL("Memory alloc fail\n");
return _ACCOUNT_ERROR_OUT_OF_MEMORY;
}
new_account->id = old_account->id;
//user name
- if(!new_account->user_name) {
- if(old_account->user_name)
+ if (!new_account->user_name) {
+ if (old_account->user_name)
new_account->user_name = _account_dup_text(old_account->user_name);
}
// display name
- if(!new_account->display_name) {
- if(old_account->display_name)
+ if (!new_account->display_name) {
+ if (old_account->display_name)
new_account->display_name = _account_dup_text(old_account->display_name);
}
// email address
- if(!new_account->email_address) {
- if(old_account->email_address)
+ if (!new_account->email_address) {
+ if (old_account->email_address)
new_account->email_address = _account_dup_text(old_account->email_address);
}
// domain name
- if(!new_account->domain_name) {
- if(old_account->domain_name)
+ if (!new_account->domain_name) {
+ if (old_account->domain_name)
new_account->domain_name = _account_dup_text(old_account->domain_name);
}
// icon path
- if(!new_account->icon_path) {
- if(old_account->icon_path)
+ if (!new_account->icon_path) {
+ if (old_account->icon_path)
new_account->icon_path = _account_dup_text(old_account->icon_path);
}
// source
- if(!new_account->source) {
- if(old_account->source)
+ if (!new_account->source) {
+ if (old_account->source)
new_account->source = _account_dup_text(old_account->source);
}
new_account->package_name = _account_dup_text(old_account->package_name);
// access token
- if(!new_account->access_token) {
- if(old_account->access_token)
+ if (!new_account->access_token) {
+ if (old_account->access_token)
new_account->access_token = _account_dup_text(old_account->access_token);
}
// auth type
- if(new_account->auth_type == _ACCOUNT_AUTH_TYPE_INVALID) {
+ if (new_account->auth_type == _ACCOUNT_AUTH_TYPE_INVALID)
new_account->auth_type = old_account->auth_type;
- }
//secret
- if(new_account->secret== _ACCOUNT_SECRECY_INVALID) {
+ if (new_account->secret == _ACCOUNT_SECRECY_INVALID)
new_account->secret = old_account->secret;
- }
// sync support
- if(new_account->sync_support == _ACCOUNT_SYNC_INVALID) {
+ if (new_account->sync_support == _ACCOUNT_SYNC_INVALID)
new_account->sync_support = old_account->sync_support;
- }
// TODO user text
int i;
- for(i=0;i<USER_TXT_CNT;i++) {
- if(!new_account->user_data_txt[i]) {
- if(old_account->user_data_txt[i])
+ for (i = 0; i < USER_TXT_CNT; i++) {
+ if (!new_account->user_data_txt[i]) {
+ if (old_account->user_data_txt[i])
new_account->user_data_txt[i] = _account_dup_text(old_account->user_data_txt[i]);
}
}
// TODO user int
- for(i=0;i<USER_INT_CNT;i++) {
- if(new_account->user_data_int[i] == 0) {
+ for (i = 0; i < USER_INT_CNT; i++) {
+ if (new_account->user_data_int[i] == 0)
new_account->user_data_int[i] = old_account->user_data_int[i];
- }
}
- // capability
-
- // user custom table
-
CATCH:
- if (old_account) {
+ if (old_account)
_account_free_account_with_items(old_account);
- }
if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
return _ACCOUNT_ERROR_NONE;
}
-
-
static int _account_update_account_by_user_name(int pid, uid_t uid, account_s *account, const char *user_name, const char *package_name)
{
int rc = 0, binding_count = 0, count = 0;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
int error_code = _ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
+ account_stmt hstmt = NULL;
ACCOUNT_RETURN_VAL((user_name != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("user_name is NULL.\n"));
- ACCOUNT_RETURN_VAL((package_name!= NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("package_name is NULL.\n"));
+ ACCOUNT_RETURN_VAL((package_name != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("package_name is NULL.\n"));
char* current_appid = NULL;
char* verified_appid = NULL;
_ACCOUNT_FREE(current_appid);
_ACCOUNT_FREE(verified_appid);
- if(error_code != _ACCOUNT_ERROR_NONE){
+ if (error_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_ERROR("No permission to update\n");
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
error_code = encrypt_access_token(account);
- if (error_code != _ACCOUNT_ERROR_NONE)
- {
+ if (error_code != _ACCOUNT_ERROR_NONE) {
_ERR("_encrypt_access_token error");
return error_code;
}
_account_compare_old_record_by_user_name(account, user_name, package_name);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
count = _account_get_record_count(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
"int_custom0=?, int_custom1=?, int_custom2=?, int_custom3=?, int_custom4=? WHERE user_name=? and package_name=? ", ACCOUNT_TABLE);
hstmt = _account_prepare_query(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
_account_end_transaction(g_hAccountDB, FALSE);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
ACCOUNT_RETURN_VAL((hstmt != NULL), {}, _ACCOUNT_ERROR_DB_FAILED, ("_account_svc_query_prepare() failed(%s).\n", _account_db_err_msg(g_hAccountDB)));
_account_query_bind_text(hstmt, binding_count++, user_name);
_account_query_bind_text(hstmt, binding_count++, package_name);
+
rc = _account_query_step(hstmt);
- if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
- }
+ if (rc != SQLITE_DONE)
+ ACCOUNT_ERROR("account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
+
rc = _account_query_finalize(hstmt);
ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
hstmt = NULL;
{
_INFO("");
int error_code = _ACCOUNT_ERROR_NONE;
- int ret_transaction = 0;
+ int ret_transaction = 0;
ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, _ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
ACCOUNT_RETURN_VAL((account != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
/* transaction control required*/
ret_transaction = _account_begin_transaction(g_hAccountDB);
- if(_account_db_err_code(g_hAccountDB) == SQLITE_PERM){
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
ACCOUNT_ERROR("account insert:_account_begin_transaction fail %d\n", ret_transaction);
pthread_mutex_unlock(&account_mutex);
return _ACCOUNT_ERROR_DATABASE_BUSY;
- }else if (ret_transaction != _ACCOUNT_ERROR_NONE) {
+ } else if (ret_transaction != _ACCOUNT_ERROR_NONE) {
ACCOUNT_ERROR("account insert:_account_begin_transaction fail %d\n", ret_transaction);
pthread_mutex_unlock(&account_mutex);
return ret_transaction;
char* appid = NULL;
appid = _account_get_current_appid(pid, uid);
- if(!appid)
- {
+ if (!appid) {
_INFO("");
// API caller cannot be recognized
ret_transaction = _account_end_transaction(g_hAccountDB, FALSE);
char* verified_appid = NULL;
error_code = _account_get_represented_appid_from_db(g_hAccountDB, g_hAccountGlobalDB, appid, uid, &verified_appid);//FIX
_ACCOUNT_FREE(appid);
- if(error_code != _ACCOUNT_ERROR_NONE)
- {
+ if (error_code != _ACCOUNT_ERROR_NONE) {
_ERR("error_code = %d", error_code);
ret_transaction = _account_end_transaction(g_hAccountDB, FALSE);
ACCOUNT_ERROR("App id is not registered in account type DB, transaction ret (%x)!!!!\n", ret_transaction);
return error_code;
}
- if(verified_appid)
- {
+ if (verified_appid) {
_INFO("");
error_code = _account_check_duplicated(g_hAccountDB, data, verified_appid, uid);
if (error_code != _ACCOUNT_ERROR_NONE) {
pthread_mutex_unlock(&account_mutex);
return error_code;
}
- if(!_account_check_add_more_account(verified_appid)) {
+ if (!_account_check_add_more_account(verified_appid)) {
ret_transaction = _account_end_transaction(g_hAccountDB, FALSE);
ACCOUNT_ERROR("No more account cannot be added, transaction ret (%x)!!!!\n", ret_transaction);
pthread_mutex_unlock(&account_mutex);
_ACCOUNT_FREE(verified_appid);
}
- if(!_account_check_add_more_account(data->package_name))
- {
+ if (!_account_check_add_more_account(data->package_name)) {
_INFO("");
ret_transaction = _account_end_transaction(g_hAccountDB, FALSE);
ACCOUNT_ERROR("No more account cannot be added, transaction ret (%x)!!!!\n", ret_transaction);
}
error_code = encrypt_access_token(data);
- if (error_code != _ACCOUNT_ERROR_NONE)
- {
+ if (error_code != _ACCOUNT_ERROR_NONE) {
ret_transaction = _account_end_transaction(g_hAccountDB, FALSE);
ACCOUNT_ERROR("encrypt_access_token fail, rollback insert query(%x)!!!!\n", ret_transaction);
*account_id = -1;
error_code = _account_execute_insert_query(data);
- if (error_code != _ACCOUNT_ERROR_NONE)
- {
+ if (error_code != _ACCOUNT_ERROR_NONE) {
_INFO("");
ret_transaction = _account_end_transaction(g_hAccountDB, FALSE);
ACCOUNT_ERROR("INSERT account fail, rollback insert query(%x)!!!!\n", ret_transaction);
_INFO("");
error_code = _account_insert_capability(data, *account_id);
- if (error_code != _ACCOUNT_ERROR_NONE)
- {
+ if (error_code != _ACCOUNT_ERROR_NONE) {
_INFO("");
ret_transaction = _account_end_transaction(g_hAccountDB, FALSE);
ACCOUNT_ERROR("INSERT capability fail, rollback insert capability query(%x)!!!!\n", ret_transaction);
_INFO("");
error_code = _account_insert_custom(data, *account_id);
- if (error_code != _ACCOUNT_ERROR_NONE)
- {
+ if (error_code != _ACCOUNT_ERROR_NONE) {
ret_transaction = _account_end_transaction(g_hAccountDB, FALSE);
ACCOUNT_ERROR("INSERT custom fail, rollback insert capability query(%x)!!!!\n", ret_transaction);
*account_id = -1;
_account_end_transaction(g_hAccountDB, TRUE);
ACCOUNT_SLOGD("(%s)-(%d) account _end_transaction.\n", __FUNCTION__, __LINE__);
- char buf[64]={0,};
+ char buf[64] = {0,};
ACCOUNT_SNPRINTF(buf, sizeof(buf), "%s:%d", _ACCOUNT_NOTI_NAME_INSERT, *account_id);
_account_insert_delete_update_notification_send(buf);
_INFO("account _notification_send end.");
return _ACCOUNT_ERROR_NONE;
-
}
GSList* _account_get_capability_list_by_account_id(int account_id, int *error_code)
*error_code = _ACCOUNT_ERROR_NONE;
account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
+ int rc = 0;
GSList* capability_list = NULL;
- ACCOUNT_RETURN_VAL((account_id > 0), {*error_code = _ACCOUNT_ERROR_INVALID_PARAMETER;}, NULL, ("ACCOUNT INDEX IS LESS THAN 0"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {*error_code = _ACCOUNT_ERROR_DB_NOT_OPENED;}, NULL, ("The database isn't connected."));
+ ACCOUNT_RETURN_VAL((account_id > 0), { *error_code = _ACCOUNT_ERROR_INVALID_PARAMETER; }, NULL, ("ACCOUNT INDEX IS LESS THAN 0"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), { *error_code = _ACCOUNT_ERROR_DB_NOT_OPENED; }, NULL, ("The database isn't connected."));
ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE account_id = %d", CAPABILITY_TABLE, account_id);
hstmt = _account_prepare_query(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
*error_code = _ACCOUNT_ERROR_PERMISSION_DENIED;
return NULL;
}
}
rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {*error_code = rc;}, NULL, ("finalize error"));
+ ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), { *error_code = rc; }, NULL, ("finalize error"));
hstmt = NULL;
*error_code = _ACCOUNT_ERROR_NONE;
CATCH:
- if (hstmt != NULL)
- {
+ if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {*error_code = rc;}, NULL, ("finalize error"));
+ ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), { *error_code = rc; }, NULL, ("finalize error"));
hstmt = NULL;
}
pthread_mutex_unlock(&account_mutex);
+
return capability_list;
}
static int _account_compare_old_record(account_s *new_account, int account_id)
{
int error_code = _ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
+ account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
int rc = 0;
account_s *old_account = NULL;
new_account->id = old_account->id;
//user name
- if(!new_account->user_name) {
- if(old_account->user_name)
+ if (!new_account->user_name) {
+ if (old_account->user_name)
new_account->user_name = _account_dup_text(old_account->user_name);
}
// display name
- if(!new_account->display_name) {
- if(old_account->display_name)
+ if (!new_account->display_name) {
+ if (old_account->display_name)
new_account->display_name = _account_dup_text(old_account->display_name);
}
// email address
- if(!new_account->email_address) {
- if(old_account->email_address)
+ if (!new_account->email_address) {
+ if (old_account->email_address)
new_account->email_address = _account_dup_text(old_account->email_address);
}
// domain name
- if(!new_account->domain_name) {
- if(old_account->domain_name)
+ if (!new_account->domain_name) {
+ if (old_account->domain_name)
new_account->domain_name = _account_dup_text(old_account->domain_name);
}
// icon path
- if(!new_account->icon_path) {
- if(old_account->icon_path)
+ if (!new_account->icon_path) {
+ if (old_account->icon_path)
new_account->icon_path = _account_dup_text(old_account->icon_path);
}
// source
- if(!new_account->source) {
- if(old_account->source)
+ if (!new_account->source) {
+ if (old_account->source)
new_account->source = _account_dup_text(old_account->source);
}
new_account->package_name = _account_dup_text(old_account->package_name);
// access token
- if(!new_account->access_token) {
- if(old_account->access_token)
+ if (!new_account->access_token) {
+ if (old_account->access_token)
new_account->access_token = _account_dup_text(old_account->access_token);
}
// user text
int i;
- for(i=0;i<USER_TXT_CNT;i++) {
- if(!new_account->user_data_txt[i]) {
- if(old_account->user_data_txt[i])
+ for (i = 0; i < USER_TXT_CNT; i++) {
+ if (!new_account->user_data_txt[i]) {
+ if (old_account->user_data_txt[i])
new_account->user_data_txt[i] = _account_dup_text(old_account->user_data_txt[i]);
}
}
// auth type
- if(new_account->auth_type == _ACCOUNT_AUTH_TYPE_INVALID) {
+ if (new_account->auth_type == _ACCOUNT_AUTH_TYPE_INVALID)
new_account->auth_type = old_account->auth_type;
- }
- //secret
- if(new_account->secret== _ACCOUNT_SECRECY_INVALID) {
+ // secret
+ if (new_account->secret == _ACCOUNT_SECRECY_INVALID)
new_account->secret = old_account->secret;
- }
// sync support
- if(new_account->sync_support == _ACCOUNT_SYNC_INVALID) {
+ if (new_account->sync_support == _ACCOUNT_SYNC_INVALID)
new_account->sync_support = old_account->sync_support;
- }
// user int
- for(i=0;i<USER_INT_CNT;i++) {
- if(new_account->user_data_int[i] == 0) {
+ for (i = 0; i < USER_INT_CNT; i++) {
+ if (new_account->user_data_int[i] == 0)
new_account->user_data_int[i] = old_account->user_data_int[i];
- }
}
- // capability
-
- // user custom table
-
CATCH:
- if (old_account)
- _account_free_account_with_items(old_account);
+ if (old_account)
+ _account_free_account_with_items(old_account);
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
+ if (hstmt != NULL) {
+ rc = _account_query_finalize(hstmt);
+ ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
+ hstmt = NULL;
+ }
return _ACCOUNT_ERROR_NONE;
}
static int _account_get_package_name_from_account_id(int account_id, char **package_name)
{
int error_code = _ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
+ account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
int rc = 0;
account_s *old_account = NULL;
// get package name.
*package_name = _account_dup_text(old_account->package_name);
+CATCH:
+ if (old_account)
+ _account_free_account_with_items(old_account);
- CATCH:
- if (old_account) {
- _account_free_account_with_items(old_account);
- }
-
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
+ if (hstmt != NULL) {
+ rc = _account_query_finalize(hstmt);
+ ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
+ hstmt = NULL;
+ }
return error_code;
static int _account_update_account(int pid, uid_t uid, account_s *account, int account_id)
{
- int rc = 0, binding_count =0;
+ int rc = 0, binding_count = 0;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int error_code = _ACCOUNT_ERROR_NONE, count=0, ret_transaction = 0;
- account_stmt hstmt = NULL;
+ int error_code = _ACCOUNT_ERROR_NONE, count = 0, ret_transaction = 0;
+ account_stmt hstmt = NULL;
if (!account->package_name) {
ACCOUNT_ERROR("Package name is mandetory field, it can not be NULL!!!!\n");
current_appid = _account_get_current_appid(pid, uid);
error_code = _account_get_package_name_from_account_id(account_id, &package_name);
- if(error_code != _ACCOUNT_ERROR_NONE || package_name == NULL){
+ if (error_code != _ACCOUNT_ERROR_NONE || package_name == NULL) {
ACCOUNT_ERROR("No package name with account_id\n");
_ACCOUNT_FREE(current_appid);
_ACCOUNT_FREE(package_name);
}
error_code = _account_check_appid_group_with_package_name(current_appid, package_name, uid);
- ACCOUNT_DEBUG( "UPDATE:account_id[%d],current_appid[%s]package_name[%s]", account_id, current_appid, package_name); // TODO: remove the log later.
+ ACCOUNT_DEBUG("UPDATE:account_id[%d],current_appid[%s]package_name[%s]", account_id, current_appid, package_name); // TODO: remove the log later.
_ACCOUNT_FREE(current_appid);
_ACCOUNT_FREE(package_name);
- if(error_code != _ACCOUNT_ERROR_NONE){
+ if (error_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_ERROR("No permission to update\n");
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
error_code = encrypt_access_token(account);
- if (error_code != _ACCOUNT_ERROR_NONE)
- {
+ if (error_code != _ACCOUNT_ERROR_NONE) {
_ERR("_encrypt_access_token error");
return error_code;
}
return error_code;
}
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
- } else if( _account_db_err_code(g_hAccountDB) == SQLITE_BUSY ){
- ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg(g_hAccountDB));
+ } else if (_account_db_err_code(g_hAccountDB) == SQLITE_BUSY) {
+ ACCOUNT_ERROR("database busy(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_DATABASE_BUSY;
}
/* transaction control required*/
ret_transaction = _account_begin_transaction(g_hAccountDB);
- if( ret_transaction == _ACCOUNT_ERROR_DATABASE_BUSY ){
- ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg(g_hAccountDB));
+ if (ret_transaction == _ACCOUNT_ERROR_DATABASE_BUSY) {
+ ACCOUNT_ERROR("database busy(%s)", _account_db_err_msg(g_hAccountDB));
pthread_mutex_unlock(&account_mutex);
return _ACCOUNT_ERROR_DATABASE_BUSY;
}
hstmt = _account_prepare_query(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
ret_transaction = _account_end_transaction(g_hAccountDB, FALSE);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
_account_query_bind_int(hstmt, binding_count++, account_id);
rc = _account_query_step(hstmt);
- if (rc != SQLITE_DONE) {
- ACCOUNT_SLOGE( "account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
- }
+ if (rc != SQLITE_DONE)
+ ACCOUNT_SLOGE("account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
rc = _account_query_finalize(hstmt);
ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
/*update capability*/
error_code = _account_update_capability(account, account_id);
- if(error_code != _ACCOUNT_ERROR_NONE && error_code!= _ACCOUNT_ERROR_RECORD_NOT_FOUND){
+ if (error_code != _ACCOUNT_ERROR_NONE && error_code != _ACCOUNT_ERROR_RECORD_NOT_FOUND) {
ret_transaction = _account_end_transaction(g_hAccountDB, FALSE);
ACCOUNT_ERROR("update capability Failed, trying to roll back(%x) !!!\n", ret_transaction);
return error_code;
/* update custom */
error_code = _account_update_custom(account, account_id);
- if(error_code != _ACCOUNT_ERROR_NONE && error_code!= _ACCOUNT_ERROR_RECORD_NOT_FOUND){
+ if (error_code != _ACCOUNT_ERROR_NONE && error_code != _ACCOUNT_ERROR_RECORD_NOT_FOUND) {
ret_transaction = _account_end_transaction(g_hAccountDB, FALSE);
ACCOUNT_ERROR("update capability Failed, trying to roll back(%x) !!!\n", ret_transaction);
return error_code;
ret_transaction = _account_end_transaction(g_hAccountDB, TRUE);
_INFO("update end");
+
return error_code;
}
static int _account_update_account_ex(account_s *account, int account_id)
{
- int rc = 0, binding_count =0;
+ int rc = 0, binding_count = 0;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int error_code = _ACCOUNT_ERROR_NONE, count=0, ret_transaction = 0;
- account_stmt hstmt = NULL;
+ int error_code = _ACCOUNT_ERROR_NONE, count = 0, ret_transaction = 0;
+ account_stmt hstmt = NULL;
if (!account->package_name) {
ACCOUNT_ERROR("Package name is mandetory field, it can not be NULL!!!!\n");
}
error_code = encrypt_access_token(account);
- if (error_code != _ACCOUNT_ERROR_NONE)
- {
+ if (error_code != _ACCOUNT_ERROR_NONE) {
_ERR("_encrypt_access_token error");
return error_code;
}
return error_code;
}
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
/* transaction control required*/
ret_transaction = _account_begin_transaction(g_hAccountDB);
- if( ret_transaction == _ACCOUNT_ERROR_DATABASE_BUSY ){
- ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg(g_hAccountDB));
+ if (ret_transaction == _ACCOUNT_ERROR_DATABASE_BUSY) {
+ ACCOUNT_ERROR("database busy(%s)", _account_db_err_msg(g_hAccountDB));
pthread_mutex_unlock(&account_mutex);
return _ACCOUNT_ERROR_DATABASE_BUSY;
}
hstmt = _account_prepare_query(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
ret_transaction = _account_end_transaction(g_hAccountDB, FALSE);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
_INFO("account_update_to_db_by_id_ex_p : after bind() : ret = %d", rc);
rc = _account_query_step(hstmt);
- if (rc != SQLITE_DONE) {
- ACCOUNT_SLOGE( "account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
- }
+ if (rc != SQLITE_DONE)
+ ACCOUNT_SLOGE("account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
_INFO("account_update_to_db_by_id_ex_p : after query_step() : ret = %d", rc);
rc = _account_query_finalize(hstmt);
_INFO("account_update_to_db_by_id_ex_p : before update_capability()");
/*update capability*/
error_code = _account_update_capability(account, account_id);
- if(error_code != _ACCOUNT_ERROR_NONE && error_code!= _ACCOUNT_ERROR_RECORD_NOT_FOUND){
+ if (error_code != _ACCOUNT_ERROR_NONE && error_code != _ACCOUNT_ERROR_RECORD_NOT_FOUND) {
ret_transaction = _account_end_transaction(g_hAccountDB, FALSE);
ACCOUNT_ERROR("update capability Failed, trying to roll back(%x) !!!\n", ret_transaction);
return error_code;
_INFO("account_update_to_db_by_id_ex_p : before update_custom()");
/* update custom */
error_code = _account_update_custom(account, account_id);
- if(error_code != _ACCOUNT_ERROR_NONE && error_code!= _ACCOUNT_ERROR_RECORD_NOT_FOUND){
+ if (error_code != _ACCOUNT_ERROR_NONE && error_code != _ACCOUNT_ERROR_RECORD_NOT_FOUND) {
ret_transaction = _account_end_transaction(g_hAccountDB, FALSE);
ACCOUNT_ERROR("update capability Failed, trying to roll back(%x) !!!\n", ret_transaction);
return error_code;
error_code = _account_update_account(pid, uid, data, account_id);
- if(error_code != _ACCOUNT_ERROR_NONE) {
+ if (error_code != _ACCOUNT_ERROR_NONE) {
pthread_mutex_unlock(&account_mutex);
return error_code;
}
pthread_mutex_unlock(&account_mutex);
- char buf[64]={0,};
+ char buf[64] = {0,};
ACCOUNT_SNPRINTF(buf, sizeof(buf), "%s:%d", _ACCOUNT_NOTI_NAME_UPDATE, account_id);
_account_insert_delete_update_notification_send(buf);
error_code = _account_update_account_ex(data, account_id);
_INFO("after update_account_ex() : account_id[%d], user_name=%s", account_id, data->user_name);
- if(error_code != _ACCOUNT_ERROR_NONE) {
+ if (error_code != _ACCOUNT_ERROR_NONE) {
pthread_mutex_unlock(&account_mutex);
return error_code;
}
pthread_mutex_unlock(&account_mutex);
- char buf[64]={0,};
+ char buf[64] = {0,};
ACCOUNT_SNPRINTF(buf, sizeof(buf), "%s:%d", _ACCOUNT_NOTI_NAME_UPDATE, account_id);
_account_insert_delete_update_notification_send(buf);
return _ACCOUNT_ERROR_NONE;
}
-
int _account_update_to_db_by_user_name(int pid, uid_t uid, account_s* account, const char *user_name, const char *package_name)
{
ACCOUNT_RETURN_VAL((user_name != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("USER NAME IS NULL"));
pthread_mutex_unlock(&account_mutex);
- char buf[64]={0,};
+ char buf[64] = {0,};
ACCOUNT_SNPRINTF(buf, sizeof(buf), "%s:%d", _ACCOUNT_NOTI_NAME_UPDATE, data->id);
_account_insert_delete_update_notification_send(buf);
GSList* _account_db_query_all(int pid, uid_t uid)
{
- //int error_code = _ACCOUNT_ERROR_NONE;
+ //int error_code = _ACCOUNT_ERROR_NONE;
account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
+ int rc = 0;
GSList *account_list = NULL;
ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, NULL, ("The database isn't connected."));
ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s ", ACCOUNT_TABLE);
hstmt = _account_prepare_query(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return NULL;
}
account_s *account_record = NULL;
- if (rc != SQLITE_ROW)
- {
+ if (rc != SQLITE_ROW) {
_ERR("The record isn't found");
goto CATCH;
}
- while(rc == SQLITE_ROW) {
+ while (rc == SQLITE_ROW) {
account_record = (account_s*) malloc(sizeof(account_s));
if (account_record == NULL) {
CATCH:
if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {_account_gslist_account_free(account_list);}, NULL, ("finalize error"));
+ ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {_account_gslist_account_free(account_list); }, NULL, ("finalize error"));
hstmt = NULL;
}
+
if (account_list)
- {
_remove_sensitive_info_from_non_owning_account_slist(account_list, pid, uid);
- }
+
return account_list;
}
int _account_update_sync_status_by_id(uid_t uid, int account_db_id, const int sync_status)
{
int error_code = _ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
+ account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
int rc = 0;
- int count =1;
+ int count = 1;
ACCOUNT_RETURN_VAL((account_db_id > 0), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INDEX IS LESS THAN 0"));
ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, _ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
- if ( (sync_status < 0) || (sync_status >= _ACCOUNT_SYNC_MAX)) {
+ if ((sync_status < 0) || (sync_status >= _ACCOUNT_SYNC_MAX)) {
ACCOUNT_SLOGE("(%s)-(%d) sync_status is less than 0 or more than enum max.\n", __FUNCTION__, __LINE__);
return _ACCOUNT_ERROR_INVALID_PARAMETER;
}
rc = _account_get_record_count(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
if (rc <= 0) {
- ACCOUNT_SLOGE( "account_update_sync_status_by_id : related account item is not existed rc=%d , %s", rc, _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_SLOGE("account_update_sync_status_by_id : related account item is not existed rc=%d , %s", rc, _account_db_err_msg(g_hAccountDB));
pthread_mutex_unlock(&account_mutex);
return _ACCOUNT_ERROR_RECORD_NOT_FOUND;
}
rc = _account_query_step(hstmt);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
pthread_mutex_unlock(&account_mutex);
return rc;
}
- char buf[64]={0,};
+
+ char buf[64] = {0,};
ACCOUNT_SNPRINTF(buf, sizeof(buf), "%s:%d", _ACCOUNT_NOTI_NAME_SYNC_UPDATE, account_db_id);
_account_insert_delete_update_notification_send(buf);
}
pthread_mutex_unlock(&account_mutex);
+
return error_code;
}
_INFO("_account_query_account_by_account_id() start, account_db_id=[%d]", account_db_id);
int error_code = _ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
+ account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
int rc = 0;
rc = _account_db_err_code(g_hAccountDB);
_INFO("after _account_prepare_query, rc=[%d]", rc);
- if( rc == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (rc == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
}
if (account_record)
- {
_remove_sensitive_info_from_non_owning_account(account_record, pid, uid);
- }
+
pthread_mutex_unlock(&account_mutex);
ACCOUNT_DEBUG("_account_query_account_by_account_id end [%d]", error_code);
+
return error_code;
}
GList* _account_query_account_by_user_name(int pid, uid_t uid, const char *user_name, int *error_code)
{
*error_code = _ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
+ account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
int rc = 0;
account_s *account_head = NULL;
- if (user_name == NULL)
- {
+ if (user_name == NULL) {
_ERR("USER NAME IS NULL");
*error_code = _ACCOUNT_ERROR_INVALID_PARAMETER;
goto CATCH;
hstmt = _account_prepare_query(g_hAccountDB, query);
- if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM)
- {
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
*error_code = _ACCOUNT_ERROR_PERMISSION_DENIED;
goto CATCH;
}
rc = _account_query_step(hstmt);
- if (rc != SQLITE_ROW)
- {
+ if (rc != SQLITE_ROW) {
_ERR("The record isn't found");
*error_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND;
goto CATCH;
ACCOUNT_FATAL("malloc Failed");
if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
-
- if (rc != _ACCOUNT_ERROR_NONE)
- {
+ if (rc != _ACCOUNT_ERROR_NONE) {
_ERR("finalize error");
*error_code = rc;
goto CATCH;
rc = _account_query_finalize(hstmt);
- if (rc != _ACCOUNT_ERROR_NONE)
- {
+ if (rc != _ACCOUNT_ERROR_NONE) {
_ERR("finalize error");
*error_code = rc;
goto CATCH;
GList *iter;
-
tmp = g_list_length(account_head->account_list);
for (iter = account_head->account_list; iter != NULL; iter = g_list_next(iter)) {
-// account_h account;
-// account = (account_h)iter->data;
+ //account_h account;
+ //account = (account_h)iter->data;
account_s *testaccount = (account_s*)iter->data;
_account_query_capability_by_account_id(g_hAccountDB, _account_add_capability_to_account_cb, testaccount->id, (void*)testaccount);
_account_query_custom_by_account_id(g_hAccountDB, _account_add_custom_to_account_cb, testaccount->id, (void*)testaccount);
-
}
*error_code = _ACCOUNT_ERROR_NONE;
CATCH:
if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
- if (rc != _ACCOUNT_ERROR_NONE)
- {
+ if (rc != _ACCOUNT_ERROR_NONE) {
_ERR("finalize error");
*error_code = rc;
}
}
pthread_mutex_unlock(&account_mutex);
- if (account_head)
- {
+
+ if (account_head) {
_remove_sensitive_info_from_non_owning_account_list(account_head->account_list, pid, uid);
GList* result = account_head->account_list;
_ACCOUNT_FREE(account_head);
return result;
}
+
return NULL;
}
*error_code = _ACCOUNT_ERROR_NONE;
account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
+ int rc = 0;
- ACCOUNT_RETURN_VAL((capability_type != NULL), {*error_code = _ACCOUNT_ERROR_INVALID_PARAMETER;}, NULL, ("capability_type IS NULL"));
+ ACCOUNT_RETURN_VAL((capability_type != NULL), { *error_code = _ACCOUNT_ERROR_INVALID_PARAMETER; }, NULL, ("capability_type IS NULL"));
if ((capability_value < 0) || (capability_value >= _ACCOUNT_CAPABILITY_STATE_MAX)) {
ACCOUNT_SLOGE("(%s)-(%d) capability_value is not equal to 0 or 1.\n", __FUNCTION__, __LINE__);
return NULL;
}
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {*error_code = _ACCOUNT_ERROR_DB_NOT_OPENED;}, NULL, ("The database isn't connected."));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), { *error_code = _ACCOUNT_ERROR_DB_NOT_OPENED; }, NULL, ("The database isn't connected."));
ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
hstmt = _account_prepare_query(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
*error_code = _ACCOUNT_ERROR_PERMISSION_DENIED;
return NULL;
}
ACCOUNT_FATAL("malloc Failed");
if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {*error_code = rc;}, NULL, ("finalize error"));
+ ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), { *error_code = rc; }, NULL, ("finalize error"));
hstmt = NULL;
}
*error_code = _ACCOUNT_ERROR_OUT_OF_MEMORY;
tmp = g_list_length(account_head->account_list);
for (iter = account_head->account_list; iter != NULL; iter = g_list_next(iter)) {
-// account_h account = NULL;
-// account = (account_h)iter->data;
+ //account_h account = NULL;
+ //account = (account_h)iter->data;
account_s* testaccount = (account_s*)iter->data;
_account_query_capability_by_account_id(g_hAccountDB, _account_add_capability_to_account_cb, testaccount->id, (void*)testaccount);
}
-
*error_code = _ACCOUNT_ERROR_NONE;
CATCH:
if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
- if ( rc != _ACCOUNT_ERROR_NONE ) {
+ if (rc != _ACCOUNT_ERROR_NONE) {
*error_code = rc;
_ERR("finalize error");
}
hstmt = NULL;
}
- if( *error_code != _ACCOUNT_ERROR_NONE && account_head ) {
+ if (*error_code != _ACCOUNT_ERROR_NONE && account_head) {
_account_glist_account_free(account_head->account_list);
_ACCOUNT_FREE(account_head);
account_head = NULL;
pthread_mutex_unlock(&account_mutex);
- if (account_head)
- {
+ if (account_head) {
_remove_sensitive_info_from_non_owning_account_list(account_head->account_list, pid, uid);
GList* result = account_head->account_list;
_ACCOUNT_FREE(account_head);
return result;
}
+
return NULL;
}
*error_code = _ACCOUNT_ERROR_NONE;
account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
+ int rc = 0;
- ACCOUNT_RETURN_VAL((capability_type != NULL), {*error_code = _ACCOUNT_ERROR_INVALID_PARAMETER;}, NULL, ("capability_type IS NULL"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {*error_code = _ACCOUNT_ERROR_DB_NOT_OPENED;},
+ ACCOUNT_RETURN_VAL((capability_type != NULL), { *error_code = _ACCOUNT_ERROR_INVALID_PARAMETER; }, NULL, ("capability_type IS NULL"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), { *error_code = _ACCOUNT_ERROR_DB_NOT_OPENED; },
NULL, ("The database isn't connected."));
ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
hstmt = _account_prepare_query(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
*error_code = _ACCOUNT_ERROR_PERMISSION_DENIED;
return NULL;
}
ACCOUNT_FATAL("malloc Failed");
if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {*error_code = rc;}, NULL, ("finalize error"));
+ ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), { *error_code = rc; }, NULL, ("finalize error"));
hstmt = NULL;
}
*error_code = _ACCOUNT_ERROR_OUT_OF_MEMORY;
*error_code = _ACCOUNT_ERROR_NONE;
CATCH:
- if (hstmt != NULL)
- {
+ if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
if (rc != _ACCOUNT_ERROR_NONE) {
*error_code = rc;
hstmt = NULL;
}
- if( (*error_code != _ACCOUNT_ERROR_NONE) && account_head ) {
+ if ((*error_code != _ACCOUNT_ERROR_NONE) && account_head) {
_account_glist_account_free(account_head->account_list);
_ACCOUNT_FREE(account_head);
account_head = NULL;
pthread_mutex_unlock(&account_mutex);
- if (account_head)
- {
+ if (account_head) {
_remove_sensitive_info_from_non_owning_account_list(account_head->account_list, pid, uid);
GList* result = account_head->account_list;
_ACCOUNT_FREE(account_head);
return result;
}
+
return NULL;
}
GList * account_list = NULL;
*error_code = _ACCOUNT_ERROR_NONE;
- ACCOUNT_RETURN_VAL((package_name != NULL), {*error_code = _ACCOUNT_ERROR_INVALID_PARAMETER;}, NULL, ("PACKAGE NAME IS NULL"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {*error_code = _ACCOUNT_ERROR_DB_NOT_OPENED;}, NULL, ("The database isn't connected."));
+ ACCOUNT_RETURN_VAL((package_name != NULL), { *error_code = _ACCOUNT_ERROR_INVALID_PARAMETER; }, NULL, ("PACKAGE NAME IS NULL"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), { *error_code = _ACCOUNT_ERROR_DB_NOT_OPENED; }, NULL, ("The database isn't connected."));
account_list = _account_query_account_by_package_name(g_hAccountDB, package_name, error_code, pid, uid);
_INFO("account_server_query_account_by_package_name end");
+
return account_list;
}
error_code = _account_delete_account_by_package_name(g_hAccountDB, package_name, permission, pid, uid);
_INFO("account_server_delete_account_by_package_name end");
+
return error_code;
}
int _account_delete(int pid, uid_t uid, int account_id)
{
int error_code = _ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
+ account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
int rc = 0;
int ret_transaction = 0;
count = _account_get_record_count(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
error_code = _account_get_package_name_from_account_id(account_id, &package_name);
- if(error_code != _ACCOUNT_ERROR_NONE){
+ if (error_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_ERROR("No package name with account_id\n");
_ACCOUNT_FREE(current_appid);
_ACCOUNT_FREE(package_name);
return _ACCOUNT_ERROR_RECORD_NOT_FOUND;
}
- ACCOUNT_DEBUG( "DELETE:account_id[%d],current_appid[%s]package_name[%s]", account_id, current_appid, package_name);
+ ACCOUNT_DEBUG("DELETE:account_id[%d],current_appid[%s]package_name[%s]", account_id, current_appid, package_name);
error_code = _account_check_appid_group_with_package_name(current_appid, package_name, uid);
_ACCOUNT_FREE(current_appid);
_ACCOUNT_FREE(package_name);
- if(error_code != _ACCOUNT_ERROR_NONE){
+ if (error_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_ERROR("No permission to delete\n");
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
/* transaction control required*/
ret_transaction = _account_begin_transaction(g_hAccountDB);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
- if( ret_transaction == _ACCOUNT_ERROR_DATABASE_BUSY ){
- ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg(g_hAccountDB));
+ if (ret_transaction == _ACCOUNT_ERROR_DATABASE_BUSY) {
+ ACCOUNT_ERROR("database busy(%s)", _account_db_err_msg(g_hAccountDB));
pthread_mutex_unlock(&account_mutex);
return _ACCOUNT_ERROR_DATABASE_BUSY;
}
hstmt = _account_prepare_query(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
CATCH:
if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
- if(rc != _ACCOUNT_ERROR_NONE ){
+ if (rc != _ACCOUNT_ERROR_NONE) {
ACCOUNT_ERROR("rc (%d)", rc);
is_success = FALSE;
}
ACCOUNT_ERROR("account_delete:_account_end_transaction fail %d, is_success=%d\n", ret_transaction, is_success);
} else {
if (is_success == true) {
- char buf[64]={0,};
+ char buf[64] = {0,};
ACCOUNT_SNPRINTF(buf, sizeof(buf), "%s:%d", _ACCOUNT_NOTI_NAME_DELETE, account_id);
_account_insert_delete_update_notification_send(buf);
}
pthread_mutex_unlock(&account_mutex);
return error_code;
-
}
static int _account_query_account_by_username_and_package(const char* username, const char* package_name, account_s *account)
//FIXME
//return -1;
int error_code = _ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
+ account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
int rc = 0;
int binding_count = 1;
ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE user_name = ? and package_name = ?", ACCOUNT_TABLE);
hstmt = _account_prepare_query(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
}
pthread_mutex_unlock(&account_mutex);
+
return error_code;
}
ACCOUNT_MEMSET(data, 0, sizeof(account_s));
/*Setting account as visible by default*/
-// data->secret = _ACCOUNT_SECRECY_VISIBLE;
+ //data->secret = _ACCOUNT_SECRECY_VISIBLE;
/*Setting account as not supporting sync by default*/
-// data->sync_support = _ACCOUNT_SYNC_NOT_SUPPORT;
+ //data->sync_support = _ACCOUNT_SYNC_NOT_SUPPORT;
*account = data;
int _account_get_account_id(account_s* account, int *account_id)
{
- if (!account) {
+ if (!account)
return _ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!account_id) {
+
+ if (!account_id)
return _ACCOUNT_ERROR_INVALID_PARAMETER;
- }
*account_id = account->id;
{
_INFO("[%s][%s]", user_name, package_name);
- int error_code = _ACCOUNT_ERROR_NONE;
+ int error_code = _ACCOUNT_ERROR_NONE;
account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
- int ret_transaction = 0;
+ int rc = 0;
+ int ret_transaction = 0;
bool is_success = FALSE;
account_s *account = NULL;
- int binding_count = 1;
+ int binding_count = 1;
int account_id = -1;
ACCOUNT_RETURN_VAL((user_name != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("user_name is null!"));
package_name_temp = _account_dup_text(package_name);
- ACCOUNT_DEBUG( "DELETE:user_name[%s],current_appid[%s], package_name[%s]", user_name, current_appid, package_name_temp);
+ ACCOUNT_DEBUG("DELETE:user_name[%s],current_appid[%s], package_name[%s]", user_name, current_appid, package_name_temp);
error_code = _account_check_appid_group_with_package_name(current_appid, package_name_temp, uid);
_ACCOUNT_FREE(current_appid);
_ACCOUNT_FREE(package_name_temp);
- if(error_code != _ACCOUNT_ERROR_NONE){
+ if (error_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_ERROR("No permission to delete\n");
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
_INFO("");
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM )
- {
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
_account_destroy(account);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
/* transaction control required*/
ret_transaction = _account_begin_transaction(g_hAccountDB);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM )
- {
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
pthread_mutex_unlock(&account_mutex);
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
_INFO("");
- if( ret_transaction == _ACCOUNT_ERROR_DATABASE_BUSY )
- {
- ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg(g_hAccountDB));
+ if (ret_transaction == _ACCOUNT_ERROR_DATABASE_BUSY) {
+ ACCOUNT_ERROR("database busy(%s)", _account_db_err_msg(g_hAccountDB));
pthread_mutex_unlock(&account_mutex);
return _ACCOUNT_ERROR_DATABASE_BUSY;
- }
- else if (ret_transaction != _ACCOUNT_ERROR_NONE) {
+ } else if (ret_transaction != _ACCOUNT_ERROR_NONE) {
ACCOUNT_ERROR("account_delete:_account_begin_transaction fail %d\n", ret_transaction);
pthread_mutex_unlock(&account_mutex);
return ret_transaction;
hstmt = _account_prepare_query(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
_account_end_transaction(g_hAccountDB, FALSE);
pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
ACCOUNT_ERROR("account_svc_delete:_account_svc_end_transaction fail %d, is_success=%d\n", ret_transaction, is_success);
} else {
if (is_success == true) {
- char buf[64]={0,};
+ char buf[64] = {0,};
ACCOUNT_SNPRINTF(buf, sizeof(buf), "%s:%d", _ACCOUNT_NOTI_NAME_DELETE, account_id);
_account_insert_delete_update_notification_send(buf);
}
return _ACCOUNT_ERROR_INVALID_PARAMETER;
}
- if(!g_hAccountDB){
+ if (!g_hAccountDB) {
ACCOUNT_ERROR("DB is not opened\n");
return _ACCOUNT_ERROR_DB_NOT_OPENED;
}
ACCOUNT_MEMSET(query, 0x00, sizeof(query));
if (include_hidden)
- {
ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from %s", ACCOUNT_TABLE);
- }
else
- {
ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from %s where secret = %d", ACCOUNT_TABLE, _ACCOUNT_SECRECY_VISIBLE);
- }
*count = _account_get_record_count(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
ret = _account_type_query_app_id_exist_from_all_db(g_hAccountDB, g_hAccountGlobalDB, app_id);
_INFO("account_server_query_app_id_exist end error_code=[%d]", ret);
+
return ret;
}
ret = _account_type_insert_to_db(g_hAccountDB, account_type, account_type_id);
_INFO("account_server_insert_account_type_to_user_db end error_code=[%d]", ret);
+
return ret;
}
ret = _account_type_delete_by_app_id(g_hAccountDB, app_id);
_INFO("account_server_delete_account_type_by_app_id_from_user_db end error_code=[%d]", ret);
+
return ret;
}
int rc = 0, binding_count = 1;
GSList* feature_list = NULL;
- ACCOUNT_RETURN_VAL((app_id != NULL), {*error_code = _ACCOUNT_ERROR_INVALID_PARAMETER;}, NULL, ("APP ID IS NULL"));
- ACCOUNT_RETURN_VAL((error_code != NULL), {_ERR("error_code pointer is NULL");}, NULL, (""));
- ACCOUNT_RETURN_VAL((g_hAccountGlobalDB != NULL), {*error_code = _ACCOUNT_ERROR_INVALID_PARAMETER; _ERR("The database isn't connected.");}, NULL, ("The database isn't connected."));
+ ACCOUNT_RETURN_VAL((app_id != NULL), { *error_code = _ACCOUNT_ERROR_INVALID_PARAMETER; }, NULL, ("APP ID IS NULL"));
+ ACCOUNT_RETURN_VAL((error_code != NULL), {_ERR("error_code pointer is NULL"); }, NULL, (""));
+ ACCOUNT_RETURN_VAL((g_hAccountGlobalDB != NULL), { *error_code = _ACCOUNT_ERROR_INVALID_PARAMETER; _ERR("The database isn't connected."); }, NULL, ("The database isn't connected."));
ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
hstmt = _account_prepare_query(g_hAccountGlobalDB, query);
- if( _account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
*error_code = _ACCOUNT_ERROR_PERMISSION_DENIED;
return NULL;
}
rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR_P(rc == SQLITE_ROW, {*error_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND; _ERR("The record isn't found from global db. rc=[%d]", rc);}, _ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+ ACCOUNT_CATCH_ERROR_P(rc == SQLITE_ROW, { *error_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND; _ERR("The record isn't found from global db. rc=[%d]", rc); }, _ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
provider_feature_s* feature_record = NULL;
}
}
- if (*error_code != _ACCOUNT_ERROR_NONE) {
+ if (*error_code != _ACCOUNT_ERROR_NONE)
_account_type_gslist_feature_free(feature_list);
- }
_INFO("Returning account feature_list from global db");
+
return feature_list;
}
int rc = 0, binding_count = 1;
GSList* feature_list = NULL;
- ACCOUNT_RETURN_VAL((app_id != NULL), {*error_code = _ACCOUNT_ERROR_INVALID_PARAMETER;}, NULL, ("APP ID IS NULL"));
- ACCOUNT_RETURN_VAL((error_code != NULL), {_ERR("error_code pointer is NULL");}, NULL, (""));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {*error_code = _ACCOUNT_ERROR_DB_NOT_OPENED;}, NULL, ("The database isn't connected."));
+ ACCOUNT_RETURN_VAL((app_id != NULL), { *error_code = _ACCOUNT_ERROR_INVALID_PARAMETER; }, NULL, ("APP ID IS NULL"));
+ ACCOUNT_RETURN_VAL((error_code != NULL), {_ERR("error_code pointer is NULL"); }, NULL, (""));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), { *error_code = _ACCOUNT_ERROR_DB_NOT_OPENED; }, NULL, ("The database isn't connected."));
ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
hstmt = _account_prepare_query(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
*error_code = _ACCOUNT_ERROR_PERMISSION_DENIED;
return NULL;
}
rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR_P(rc == SQLITE_ROW, {*error_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND; _ERR("The record isn't found from user db. rc=[%d]", rc);}, _ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+ ACCOUNT_CATCH_ERROR_P(rc == SQLITE_ROW, { *error_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND; _ERR("The record isn't found from user db. rc=[%d]", rc); }, _ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
provider_feature_s* feature_record = NULL;
*error_code = _ACCOUNT_ERROR_NONE;
rc = _account_query_finalize(hstmt);
- ACCOUNT_CATCH_ERROR_P((rc == _ACCOUNT_ERROR_NONE), {*error_code = rc;}, rc, ("account finalize error"));
+ ACCOUNT_CATCH_ERROR_P((rc == _ACCOUNT_ERROR_NONE), { *error_code = rc; }, rc, ("account finalize error"));
hstmt = NULL;
CATCH:
}
_INFO("*error_code=[%d]", *error_code);
- if (*error_code == _ACCOUNT_ERROR_RECORD_NOT_FOUND) {
+ if (*error_code == _ACCOUNT_ERROR_RECORD_NOT_FOUND)
feature_list = _account_type_query_provider_feature_by_app_id_from_global_db(app_id, error_code);
- }
if (*error_code != _ACCOUNT_ERROR_NONE)
_account_type_gslist_feature_free(feature_list);
_INFO("Returning account feature_list");
+
return feature_list;
}
-int _account_type_query_provider_feature_cb_by_app_id_from_global_db(account_type_provider_feature_cb callback, const char* app_id, void *user_data )
+int _account_type_query_provider_feature_cb_by_app_id_from_global_db(account_type_provider_feature_cb callback, const char* app_id, void *user_data)
{
- int error_code = _ACCOUNT_ERROR_NONE;
+ int error_code = _ACCOUNT_ERROR_NONE;
account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0, binding_count = 1;
+ int rc = 0, binding_count = 1;
_INFO("_account_type_query_provider_feature_cb_by_app_id_in_global_db start app_id=%s", app_id);
ACCOUNT_RETURN_VAL((app_id != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE app_id = ?", PROVIDER_FEATURE_TABLE);
hstmt = _account_prepare_query(g_hAccountGlobalDB, query);
- if( _account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountGlobalDB));
+ if (_account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountGlobalDB));
ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, _ACCOUNT_ERROR_PERMISSION_DENIED, ("global db permission denied.\n"));
}
_account_query_bind_text(hstmt, binding_count++, app_id);
rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {_ERR("The record isn't found. rc=[%d]", rc);}, _ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {_ERR("The record isn't found. rc=[%d]", rc); }, _ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
provider_feature_s* feature_record = NULL;
}
_INFO("_account_type_query_provider_feature_cb_by_app_id_in_global_db end. error_code=[%d]", error_code);
+
return error_code;
}
-int _account_type_query_provider_feature_cb_by_app_id(account_type_provider_feature_cb callback, const char* app_id, void *user_data )
+int _account_type_query_provider_feature_cb_by_app_id(account_type_provider_feature_cb callback, const char* app_id, void *user_data)
{
- int error_code = _ACCOUNT_ERROR_NONE;
+ int error_code = _ACCOUNT_ERROR_NONE;
account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0, binding_count = 1;
+ int rc = 0, binding_count = 1;
_INFO("_account_type_query_provider_feature_cb_by_app_id start app_id=%s", app_id);
ACCOUNT_RETURN_VAL((app_id != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE app_id = ?", PROVIDER_FEATURE_TABLE);
hstmt = _account_prepare_query(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
hstmt = NULL;
}
/*
- if (error_code == _ACCOUNT_ERROR_RECORD_NOT_FOUND) {
+ if (error_code == _ACCOUNT_ERROR_RECORD_NOT_FOUND)
error_code = _account_type_query_provider_feature_cb_by_app_id_from_global_db(callback, app_id, user_data);
- }
*/
_INFO("_account_type_query_provider_feature_cb_by_app_id end");
+
return error_code;
}
-int account_type_query_provider_feature_cb_by_app_id(account_type_provider_feature_cb callback, const char* app_id, void *user_data )
+int account_type_query_provider_feature_cb_by_app_id(account_type_provider_feature_cb callback, const char* app_id, void *user_data)
{
- int error_code = _ACCOUNT_ERROR_NONE;
+ int error_code = _ACCOUNT_ERROR_NONE;
ACCOUNT_RETURN_VAL((app_id != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
ACCOUNT_RETURN_VAL((callback != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
error_code = _account_type_query_provider_feature_cb_by_app_id(callback, app_id, user_data);
- if (error_code == _ACCOUNT_ERROR_RECORD_NOT_FOUND) {
+ if (error_code == _ACCOUNT_ERROR_RECORD_NOT_FOUND)
error_code = _account_type_query_provider_feature_cb_by_app_id_from_global_db(callback, app_id, user_data);
- }
return error_code;
}
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
int record_count = 0;
- if (app_id == NULL || capability == NULL)
- {
+ if (app_id == NULL || capability == NULL) {
*error_code = _ACCOUNT_ERROR_INVALID_PARAMETER;
return false;
}
record_count = _account_get_record_count(g_hAccountGlobalDB, query);
- if( _account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountGlobalDB));
+ if (_account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountGlobalDB));
*error_code = _ACCOUNT_ERROR_PERMISSION_DENIED;
}
- if (record_count <= 0)
- {
+ if (record_count <= 0) {
*error_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND;
return false;
}
_INFO("_account_type_query_supported_feature_in_global_db end");
+
return true;
}
*error_code = _ACCOUNT_ERROR_NONE;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int record_count = 0;
+ int record_count = 0;
- if (app_id == NULL || capability == NULL)
- {
+ if (app_id == NULL || capability == NULL) {
*error_code = _ACCOUNT_ERROR_INVALID_PARAMETER;
return false;
}
record_count = _account_get_record_count(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
*error_code = _ACCOUNT_ERROR_PERMISSION_DENIED;
return false;
}
- if (record_count <= 0)
- {
+ if (record_count <= 0) {
bool is_exist = false;
is_exist = _account_type_query_supported_feature_from_global_db(app_id, capability, error_code);
if (!is_exist)
}
_INFO("_account_type_query_supported_feature end");
+
return true;
}
static int _account_type_update_provider_feature(sqlite3 *account_db_handle, account_type_s *account_type, const char* app_id)
{
- int rc, count = 1;
+ int rc, count = 1;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
account_stmt hstmt = NULL;
ACCOUNT_RETURN_VAL((account_type != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
- if (g_slist_length( account_type->provider_feature_list)==0) {
- ACCOUNT_ERROR( "no feature\n");
+ if (g_slist_length(account_type->provider_feature_list) == 0) {
+ ACCOUNT_ERROR("no feature\n");
return _ACCOUNT_ERROR_NONE;
}
- ACCOUNT_DEBUG( "app id", app_id);
+ ACCOUNT_DEBUG("app id", app_id);
ACCOUNT_MEMSET(query, 0x00, sizeof(query));
ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE app_id=? ", PROVIDER_FEATURE_TABLE);
hstmt = _account_prepare_query(account_db_handle, query);
- if( _account_db_err_code(account_db_handle) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(account_db_handle));
+ if (_account_db_err_code(account_db_handle) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(account_db_handle));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
rc = _account_query_step(hstmt);
if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(account_db_handle));
+ ACCOUNT_ERROR("_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(account_db_handle));
return _ACCOUNT_ERROR_DB_FAILED;
}
rc = _account_query_finalize(hstmt);
rc = _account_query_step(hstmt);
if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(account_db_handle));
+ ACCOUNT_ERROR("_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(account_db_handle));
break;
}
rc = _account_query_finalize(hstmt);
static int _account_type_update_label(sqlite3 *account_db_handle, account_type_s *account_type, const char* app_id)
{
- int rc, count = 1;
+ int rc, count = 1;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- account_stmt hstmt = NULL;
+ account_stmt hstmt = NULL;
ACCOUNT_RETURN_VAL((account_type != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
- if (g_slist_length( account_type->label_list)==0) {
+ if (g_slist_length(account_type->label_list) == 0)
return _ACCOUNT_ERROR_NONE;
- }
ACCOUNT_MEMSET(query, 0x00, sizeof(query));
ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE AppId=? ", LABEL_TABLE);
hstmt = _account_prepare_query(account_db_handle, query);
- if( _account_db_err_code(account_db_handle) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(account_db_handle));
+ if (_account_db_err_code(account_db_handle) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(account_db_handle));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
rc = _account_query_step(hstmt);
if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(account_db_handle));
+ ACCOUNT_ERROR("_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(account_db_handle));
return _ACCOUNT_ERROR_DB_FAILED;
}
rc = _account_query_finalize(hstmt);
rc = _account_query_step(hstmt);
if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(account_db_handle));
+ ACCOUNT_ERROR("_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(account_db_handle));
break;
}
rc = _account_query_finalize(hstmt);
static int _account_type_update_account(sqlite3 *account_db_handle, account_type_s *account_type, const char* app_id)
{
- int rc = 0, binding_count =1;
+ int rc = 0, binding_count = 1;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
int error_code = _ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
+ account_stmt hstmt = NULL;
if (!account_type->app_id) {
ACCOUNT_ERROR("app id is mandetory field, it can not be NULL!!!!\n");
hstmt = _account_prepare_query(account_db_handle, query);
- if( _account_db_err_code(account_db_handle) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(account_db_handle));
+ if (_account_db_err_code(account_db_handle) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(account_db_handle));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
- } else if (_account_db_err_code(account_db_handle) == SQLITE_BUSY){
- ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg(account_db_handle));
+ } else if (_account_db_err_code(account_db_handle) == SQLITE_BUSY) {
+ ACCOUNT_ERROR("database busy(%s)", _account_db_err_msg(account_db_handle));
return _ACCOUNT_ERROR_DATABASE_BUSY;
}
_account_query_bind_text(hstmt, binding_count++, app_id);
rc = _account_query_step(hstmt);
- if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg(account_db_handle));
- }
+ if (rc != SQLITE_DONE)
+ ACCOUNT_ERROR("account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg(account_db_handle));
rc = _account_query_finalize(hstmt);
ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
return error_code;
}
-GSList* _account_type_get_label_list_by_app_id_from_global_db(const char* app_id, int *error_code )
+GSList* _account_type_get_label_list_by_app_id_from_global_db(const char* app_id, int *error_code)
{
*error_code = _ACCOUNT_ERROR_NONE;
account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0, binding_count = 1;
+ int rc = 0, binding_count = 1;
GSList* label_list = NULL;
- ACCOUNT_RETURN_VAL((app_id != NULL), {*error_code = _ACCOUNT_ERROR_INVALID_PARAMETER;}, NULL, ("APP ID IS NULL"));
+ ACCOUNT_RETURN_VAL((app_id != NULL), { *error_code = _ACCOUNT_ERROR_INVALID_PARAMETER; }, NULL, ("APP ID IS NULL"));
ACCOUNT_RETURN_VAL((g_hAccountGlobalDB != NULL), {}, _ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE AppId = ?", LABEL_TABLE);
hstmt = _account_prepare_query(g_hAccountGlobalDB, query);
- if( _account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountGlobalDB));
+ if (_account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountGlobalDB));
*error_code = _ACCOUNT_ERROR_PERMISSION_DENIED;
goto CATCH;
_account_query_bind_text(hstmt, binding_count++, app_id);
rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR_P((rc == SQLITE_ROW), {_ERR("The record isn't found. rc=[%d] done", rc);}, _ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+ ACCOUNT_CATCH_ERROR_P((rc == SQLITE_ROW), {_ERR("The record isn't found. rc=[%d] done", rc); }, _ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
label_s* label_record = NULL;
_account_type_convert_column_to_label(hstmt, label_record);
_INFO("Adding account label_list");
- label_list = g_slist_append (label_list, label_record);
+ label_list = g_slist_append(label_list, label_record);
rc = _account_query_step(hstmt);
}
CATCH:
if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
- if (rc != _ACCOUNT_ERROR_NONE) {
+ if (rc != _ACCOUNT_ERROR_NONE)
_ERR("global db finalize error[%d]", rc);
- }
hstmt = NULL;
}
_INFO("Returning account global label_list");
+
return label_list;
}
-GSList* _account_type_get_label_list_by_app_id(const char* app_id, int *error_code )
+GSList* _account_type_get_label_list_by_app_id(const char* app_id, int *error_code)
{
*error_code = _ACCOUNT_ERROR_NONE;
account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0, binding_count = 1;
+ int rc = 0, binding_count = 1;
GSList* label_list = NULL;
- ACCOUNT_RETURN_VAL((app_id != NULL), {*error_code = _ACCOUNT_ERROR_INVALID_PARAMETER;}, NULL, ("APP ID IS NULL"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {*error_code = _ACCOUNT_ERROR_DB_NOT_OPENED;}, NULL, ("The database isn't connected."));
+ ACCOUNT_RETURN_VAL((app_id != NULL), { *error_code = _ACCOUNT_ERROR_INVALID_PARAMETER; }, NULL, ("APP ID IS NULL"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), { *error_code = _ACCOUNT_ERROR_DB_NOT_OPENED; }, NULL, ("The database isn't connected."));
ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE AppId = ?", LABEL_TABLE);
hstmt = _account_prepare_query(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
*error_code = _ACCOUNT_ERROR_PERMISSION_DENIED;
return NULL;
}
_account_type_convert_column_to_label(hstmt, label_record);
_INFO("Adding account label_list");
- label_list = g_slist_append (label_list, label_record);
+ label_list = g_slist_append(label_list, label_record);
rc = _account_query_step(hstmt);
}
rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {*error_code = rc;}, NULL, ("finalize error"));
+ ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), { *error_code = rc; }, NULL, ("finalize error"));
hstmt = NULL;
*error_code = _ACCOUNT_ERROR_NONE;
CATCH:
if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {*error_code = rc;}, NULL, ("finalize error"));
+ ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), { *error_code = rc; }, NULL, ("finalize error"));
hstmt = NULL;
}
- if (*error_code == _ACCOUNT_ERROR_RECORD_NOT_FOUND) {
+ if (*error_code == _ACCOUNT_ERROR_RECORD_NOT_FOUND)
label_list = _account_type_get_label_list_by_app_id_from_global_db(app_id, error_code);
- }
_INFO("Returning account label_list");
+
return label_list;
}
-int _account_type_query_label_by_app_id_from_global_db(account_type_label_cb callback, const char* app_id, void *user_data )
+int _account_type_query_label_by_app_id_from_global_db(account_type_label_cb callback, const char* app_id, void *user_data)
{
- int error_code = _ACCOUNT_ERROR_NONE;
+ int error_code = _ACCOUNT_ERROR_NONE;
account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0, binding_count = 1;
+ int rc = 0, binding_count = 1;
_INFO("account_type_query_label_by_app_id_from_global_db start");
ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE AppId = ?", LABEL_TABLE);
hstmt = _account_prepare_query(g_hAccountGlobalDB, query);
- if( _account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountGlobalDB));
+ if (_account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountGlobalDB));
error_code = _ACCOUNT_ERROR_PERMISSION_DENIED;
goto CATCH;
}
CATCH:
if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
- if (rc != _ACCOUNT_ERROR_NONE) {
+ if (rc != _ACCOUNT_ERROR_NONE)
_ERR("global db finalize error[%d]", rc);
- }
hstmt = NULL;
}
_INFO("account_type_query_label_by_app_id_from_global_db end [%d]", error_code);
+
return error_code;
}
-int _account_type_query_label_by_app_id(account_type_label_cb callback, const char* app_id, void *user_data )
+int _account_type_query_label_by_app_id(account_type_label_cb callback, const char* app_id, void *user_data)
{
- int error_code = _ACCOUNT_ERROR_NONE;
+ int error_code = _ACCOUNT_ERROR_NONE;
account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0, binding_count = 1;
+ int rc = 0, binding_count = 1;
ACCOUNT_RETURN_VAL((app_id != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
ACCOUNT_RETURN_VAL((callback != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE AppId = ?", LABEL_TABLE);
hstmt = _account_prepare_query(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
_account_type_free_label_with_items(label_record);
-// ACCOUNT_CATCH_ERROR(cb_ret == TRUE, {}, _ACCOUNT_ERROR_NONE, ("Callback func returs FALSE, its iteration is stopped!!!!\n"));
- if(cb_ret != TRUE) {
+ //ACCOUNT_CATCH_ERROR(cb_ret == TRUE, {}, _ACCOUNT_ERROR_NONE, ("Callback func returs FALSE, its iteration is stopped!!!!\n"));
+ if (cb_ret != TRUE) {
_INFO("Callback func returs FALSE, its iteration is stopped!!!!\n");
break;
}
return error_code;
}
-int account_type_query_label_by_app_id(account_type_label_cb callback, const char* app_id, void *user_data )
+int account_type_query_label_by_app_id(account_type_label_cb callback, const char* app_id, void *user_data)
{
- int error_code = _ACCOUNT_ERROR_NONE;
+ int error_code = _ACCOUNT_ERROR_NONE;
ACCOUNT_RETURN_VAL((app_id != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
ACCOUNT_RETURN_VAL((callback != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
error_code = _account_type_query_label_by_app_id(callback, app_id, user_data);
- if (error_code == _ACCOUNT_ERROR_RECORD_NOT_FOUND) {
+ if (error_code == _ACCOUNT_ERROR_RECORD_NOT_FOUND)
error_code = _account_type_query_label_by_app_id_from_global_db(callback, app_id, user_data);
- }
return error_code;
}
{
_INFO("_account_type_query_by_app_id_from_global_db start");
- int error_code = _ACCOUNT_ERROR_NONE;
+ int error_code = _ACCOUNT_ERROR_NONE;
account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0, binding_count = 1;
+ int rc = 0, binding_count = 1;
ACCOUNT_RETURN_VAL((app_id != 0), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, _ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE AppId = ?", ACCOUNT_TYPE_TABLE);
hstmt = _account_prepare_query(g_hAccountGlobalDB, query);
- if( _account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountGlobalDB));
+ if (_account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountGlobalDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
}
rc = _account_query_finalize(hstmt);
- ACCOUNT_CATCH_ERROR((rc == _ACCOUNT_ERROR_NONE), {_ERR("global db finalize error rc=[%d]", rc);}, rc, ("finalize error"));
+ ACCOUNT_CATCH_ERROR((rc == _ACCOUNT_ERROR_NONE), {_ERR("global db finalize error rc=[%d]", rc); }, rc, ("finalize error"));
_account_type_query_label_by_app_id_from_global_db(_account_get_label_text_cb, app_id, (void*)(*account_type_record));
- _account_type_query_provider_feature_cb_by_app_id_from_global_db(_account_get_provider_feature_cb, app_id,(void*)(*account_type_record));
+ _account_type_query_provider_feature_cb_by_app_id_from_global_db(_account_get_provider_feature_cb, app_id, (void*)(*account_type_record));
hstmt = NULL;
error_code = _ACCOUNT_ERROR_NONE;
}
_INFO("_account_type_query_by_app_id_from_global_db end [%d]", error_code);
+
return error_code;
}
{
_INFO("_account_type_query_by_app_id start");
- int error_code = _ACCOUNT_ERROR_NONE;
+ int error_code = _ACCOUNT_ERROR_NONE;
account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0, binding_count = 1;
+ int rc = 0, binding_count = 1;
ACCOUNT_RETURN_VAL((app_id != 0), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
ACCOUNT_RETURN_VAL((account_type_record != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("account type record(account_type_s**) is NULL"));
ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE AppId = ?", ACCOUNT_TYPE_TABLE);
hstmt = _account_prepare_query(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
rc = _account_query_finalize(hstmt);
ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
_account_type_query_label_by_app_id(_account_get_label_text_cb, app_id, (void*)(*account_type_record));
- _account_type_query_provider_feature_cb_by_app_id(_account_get_provider_feature_cb, app_id,(void*)(*account_type_record));
+ _account_type_query_provider_feature_cb_by_app_id(_account_get_provider_feature_cb, app_id, (void*)(*account_type_record));
hstmt = NULL;
error_code = _ACCOUNT_ERROR_NONE;
hstmt = NULL;
}
- if (error_code == _ACCOUNT_ERROR_RECORD_NOT_FOUND) {
+ if (error_code == _ACCOUNT_ERROR_RECORD_NOT_FOUND)
error_code = _account_type_query_by_app_id_from_global_db(app_id, account_type_record);
- }
_INFO("_account_type_query_by_app_id end [%d]", error_code);
+
return error_code;
}
int error_code = _ACCOUNT_ERROR_NONE;
account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
+ int rc = 0;
GSList *account_type_list = NULL;
_INFO("_account_type_query_by_provider_feature_from_global_db start key=%s", key);
- if(key == NULL)
- {
+ if (key == NULL) {
ACCOUNT_ERROR("capability_type IS NULL.");
error_code = _ACCOUNT_ERROR_INVALID_PARAMETER;
goto CATCH;
}
- if(g_hAccountGlobalDB == NULL)
- {
+ if (g_hAccountGlobalDB == NULL) {
ACCOUNT_ERROR("The database isn't connected.");
error_code = _ACCOUNT_ERROR_DB_NOT_OPENED;
goto CATCH;
hstmt = _account_prepare_query(g_hAccountGlobalDB, query);
- if( _account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM )
- {
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountGlobalDB));
+ if (_account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountGlobalDB));
error_code = _ACCOUNT_ERROR_PERMISSION_DENIED;
goto CATCH;
}
account_type_s *account_type_record = NULL;
- if(rc != SQLITE_ROW)
- {
+ if (rc != SQLITE_ROW) {
ACCOUNT_ERROR("The record isn't found. rc=[%d]", rc);
error_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND;
goto CATCH;
}
- while(rc == SQLITE_ROW) {
+ while (rc == SQLITE_ROW) {
account_type_record = (account_type_s*) malloc(sizeof(account_type_s));
if (account_type_record == NULL) {
}
rc = _account_query_finalize(hstmt);
- if (rc != _ACCOUNT_ERROR_NONE )
- {
+ if (rc != _ACCOUNT_ERROR_NONE) {
_account_type_gslist_account_type_free(account_type_list);
ACCOUNT_ERROR("finalize error(%s)", rc);
error_code = rc;
for (iter = account_type_list; iter != NULL; iter = g_slist_next(iter)) {
account_type_s *account_type = NULL;
account_type = (account_type_s*)iter->data;
- _account_type_query_label_by_app_id_from_global_db(_account_get_label_text_cb,account_type->app_id,(void*)account_type);
- _account_type_query_provider_feature_cb_by_app_id_from_global_db(_account_get_provider_feature_cb, account_type->app_id,(void*)account_type);
+ _account_type_query_label_by_app_id_from_global_db(_account_get_label_text_cb, account_type->app_id, (void*)account_type);
+ _account_type_query_provider_feature_cb_by_app_id_from_global_db(_account_get_provider_feature_cb, account_type->app_id, (void*)account_type);
_INFO("add label & provider_feature");
}
CATCH:
if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
- if (rc != _ACCOUNT_ERROR_NONE)
- {
+ if (rc != _ACCOUNT_ERROR_NONE) {
ACCOUNT_ERROR("finalize error(%s)", rc);
return rc;
}
}
_INFO("_account_type_query_by_provider_feature_from_global_db end. error_code=[%d]", error_code);
+
return error_code;
}
GSList *account_type_list = NULL;
_INFO("account_type_query_by_provider_feature start key=%s", key);
- if(key == NULL)
- {
+ if (key == NULL) {
ACCOUNT_ERROR("capability_type IS NULL.");
*error_code = _ACCOUNT_ERROR_INVALID_PARAMETER;
goto CATCH;
}
- if(g_hAccountDB == NULL)
- {
+ if (g_hAccountDB == NULL) {
ACCOUNT_ERROR("The database isn't connected.");
*error_code = _ACCOUNT_ERROR_DB_NOT_OPENED;
goto CATCH;
hstmt = _account_prepare_query(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM )
- {
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
*error_code = _ACCOUNT_ERROR_PERMISSION_DENIED;
goto CATCH;
}
account_type_s *account_type_record = NULL;
- if(rc != SQLITE_ROW)
- {
+ if (rc != SQLITE_ROW) {
ACCOUNT_ERROR("The record isn't found. rc=[%d]", rc);
*error_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND;
goto CATCH;
}
- while(rc == SQLITE_ROW) {
+ while (rc == SQLITE_ROW) {
account_type_record = (account_type_s*) malloc(sizeof(account_type_s));
if (account_type_record == NULL) {
}
rc = _account_query_finalize(hstmt);
- if (rc != _ACCOUNT_ERROR_NONE )
- {
+ if (rc != _ACCOUNT_ERROR_NONE) {
_account_type_gslist_account_type_free(account_type_list);
ACCOUNT_ERROR("finalize error(%s)", rc);
*error_code = rc;
for (iter = account_type_list; iter != NULL; iter = g_slist_next(iter)) {
account_type_s *account_type = NULL;
account_type = (account_type_s*)iter->data;
- _account_type_query_label_by_app_id(_account_get_label_text_cb,account_type->app_id,(void*)account_type);
- _account_type_query_provider_feature_cb_by_app_id(_account_get_provider_feature_cb, account_type->app_id,(void*)account_type);
+ _account_type_query_label_by_app_id(_account_get_label_text_cb, account_type->app_id, (void*)account_type);
+ _account_type_query_provider_feature_cb_by_app_id(_account_get_provider_feature_cb, account_type->app_id, (void*)account_type);
}
*error_code = _ACCOUNT_ERROR_NONE;
CATCH:
if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
- if (rc != _ACCOUNT_ERROR_NONE)
- {
+ if (rc != _ACCOUNT_ERROR_NONE) {
*error_code = rc;
return NULL;
}
if (*error_code == _ACCOUNT_ERROR_NONE || *error_code == _ACCOUNT_ERROR_RECORD_NOT_FOUND) {
rc = _account_type_query_by_provider_feature_from_global_db(key, &account_type_list);
if (rc != _ACCOUNT_ERROR_NONE && rc != _ACCOUNT_ERROR_RECORD_NOT_FOUND) {
- ACCOUNT_ERROR( "_account_type_query_by_provider_feature_from_global_db fail=[%d]", rc);
+ ACCOUNT_ERROR("_account_type_query_by_provider_feature_from_global_db fail=[%d]", rc);
_account_type_gslist_account_type_free(account_type_list);
return NULL;
}
}
_INFO("account_type_query_by_provider_feature end");
+
return account_type_list;
}
rc = _account_query_step(hstmt);
- if( _account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountGlobalDB));
+ if (_account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountGlobalDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
account_type_s *account_type_record = NULL;
- if (rc != SQLITE_ROW)
- {
+ if (rc != SQLITE_ROW) {
_INFO("[_ACCOUNT_ERROR_RECORD_NOT_FOUND]The record isn't found.");
error_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND;
goto CATCH;
}
- while(rc == SQLITE_ROW) {
+ while (rc == SQLITE_ROW) {
account_type_record = (account_type_s*) malloc(sizeof(account_type_s));
if (account_type_record == NULL) {
for (iter = account_type_list; iter != NULL; iter = g_slist_next(iter)) {
account_type_s *account_type = NULL;
account_type = (account_type_s*)iter->data;
- _account_type_query_label_by_app_id_from_global_db(_account_get_label_text_cb,account_type->app_id,(void*)account_type);
- _account_type_query_provider_feature_cb_by_app_id_from_global_db(_account_get_provider_feature_cb, account_type->app_id,(void*)account_type);
+ _account_type_query_label_by_app_id_from_global_db(_account_get_label_text_cb, account_type->app_id, (void*)account_type);
+ _account_type_query_provider_feature_cb_by_app_id_from_global_db(_account_get_provider_feature_cb, account_type->app_id, (void*)account_type);
}
for (iter = account_type_list; iter != NULL; iter = g_slist_next(iter)) {
g_slist_free(account_type_list);
error_code = _ACCOUNT_ERROR_NONE;
+
CATCH:
- if (hstmt != NULL)
- {
+ if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {_account_type_gslist_account_type_free(account_type_list);}, rc, ("finalize error"));
+ ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {_account_type_gslist_account_type_free(account_type_list); }, rc, ("finalize error"));
hstmt = NULL;
}
_INFO("_account_type_query_all_in_global_db end");
+
return error_code;
}
rc = _account_query_step(hstmt);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return NULL;
}
account_type_s *account_type_record = NULL;
- if (rc != SQLITE_ROW)
- {
+ if (rc != SQLITE_ROW) {
_INFO("[_ACCOUNT_ERROR_RECORD_NOT_FOUND]The record isn't found.");
error_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND;
goto CATCH;
}
- while(rc == SQLITE_ROW) {
+ while (rc == SQLITE_ROW) {
account_type_record = (account_type_s*) malloc(sizeof(account_type_s));
if (account_type_record == NULL) {
for (iter = account_type_list; iter != NULL; iter = g_slist_next(iter)) {
account_type_s *account_type = NULL;
account_type = (account_type_s*)iter->data;
- _account_type_query_label_by_app_id(_account_get_label_text_cb,account_type->app_id,(void*)account_type);
- _account_type_query_provider_feature_cb_by_app_id(_account_get_provider_feature_cb, account_type->app_id,(void*)account_type);
+ _account_type_query_label_by_app_id(_account_get_label_text_cb, account_type->app_id, (void*)account_type);
+ _account_type_query_provider_feature_cb_by_app_id(_account_get_provider_feature_cb, account_type->app_id, (void*)account_type);
}
error_code = _ACCOUNT_ERROR_NONE;
+
CATCH:
- if (hstmt != NULL)
- {
+ if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {_account_type_gslist_account_type_free(account_type_list);}, NULL, ("finalize error"));
+ ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {_account_type_gslist_account_type_free(account_type_list); }, NULL, ("finalize error"));
hstmt = NULL;
}
if (error_code == _ACCOUNT_ERROR_NONE || error_code == _ACCOUNT_ERROR_RECORD_NOT_FOUND) {
error_code = _account_type_query_all_from_global_db(&account_type_list);
if (rc != _ACCOUNT_ERROR_NONE && rc != _ACCOUNT_ERROR_RECORD_NOT_FOUND) {
- ACCOUNT_ERROR( "_account_type_query_all_from_global_db fail=[%d]", rc);
+ ACCOUNT_ERROR("_account_type_query_all_from_global_db fail=[%d]", rc);
_account_type_gslist_account_type_free(account_type_list);
return NULL;
}
}
_INFO("_account_type_query_all end");
+
return account_type_list;
}
// output parameter label must be free
int _account_type_query_label_by_locale_from_global_db(const char* app_id, const char* locale, char **label)
{
- int error_code = _ACCOUNT_ERROR_NONE;
+ int error_code = _ACCOUNT_ERROR_NONE;
account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0, binding_count = 1;
+ int rc = 0, binding_count = 1;
char* converted_locale = NULL;
ACCOUNT_RETURN_VAL((app_id != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("NO APP ID"));
converted_locale = _account_dup_text(locale);
gchar** tokens = g_strsplit(converted_locale, "-", 2);
- if(tokens != NULL) {
- if((char*)(tokens[1]) != NULL) {
+ if (tokens != NULL) {
+ if ((char*)(tokens[1]) != NULL) {
char* upper_token = g_ascii_strup(tokens[1], strlen(tokens[1]));
- if(upper_token != NULL) {
+ if (upper_token != NULL) {
_ACCOUNT_FREE(converted_locale);
converted_locale = g_strdup_printf("%s_%s", tokens[0], upper_token);
}
hstmt = _account_prepare_query(g_hAccountGlobalDB, query);
- if( _account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountGlobalDB));
+ if (_account_db_err_code(g_hAccountGlobalDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountGlobalDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
ACCOUNT_MEMSET(label_record, 0x00, sizeof(label_s));
- _account_type_convert_column_to_label(hstmt,label_record);
+ _account_type_convert_column_to_label(hstmt, label_record);
_ACCOUNT_FREE(*label);
//Making label newly created
}
_INFO("_account_type_query_label_by_locale_from_global_db() end : error_code = %d", error_code);
+
return error_code;
}
// output parameter label must be free
int _account_type_query_label_by_locale(const char* app_id, const char* locale, char **label)
{
- int error_code = _ACCOUNT_ERROR_NONE;
+ int error_code = _ACCOUNT_ERROR_NONE;
account_stmt hstmt = NULL;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0, binding_count = 1;
+ int rc = 0, binding_count = 1;
char* converted_locale = NULL;
ACCOUNT_RETURN_VAL((app_id != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("NO APP ID"));
converted_locale = _account_dup_text(locale);
gchar** tokens = g_strsplit(converted_locale, "-", 2);
- if(tokens != NULL) {
- if((char*)(tokens[1]) != NULL) {
+ if (tokens != NULL) {
+ if ((char*)(tokens[1]) != NULL) {
char* upper_token = g_ascii_strup(tokens[1], strlen(tokens[1]));
- if(upper_token != NULL) {
+ if (upper_token != NULL) {
_ACCOUNT_FREE(converted_locale);
converted_locale = g_strdup_printf("%s_%s", tokens[0], upper_token);
}
hstmt = _account_prepare_query(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
ACCOUNT_MEMSET(label_record, 0x00, sizeof(label_s));
- _account_type_convert_column_to_label(hstmt,label_record);
+ _account_type_convert_column_to_label(hstmt, label_record);
_ACCOUNT_FREE(*label);
//Making label newly created
error_code = _ACCOUNT_ERROR_NONE;
- CATCH:
+CATCH:
if (hstmt != NULL) {
rc = _account_query_finalize(hstmt);
ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
hstmt = NULL;
}
- if (error_code == _ACCOUNT_ERROR_RECORD_NOT_FOUND) {
+ if (error_code == _ACCOUNT_ERROR_RECORD_NOT_FOUND)
error_code = _account_type_query_label_by_locale_from_global_db(app_id, locale, label);
- }
_INFO("_account_type_query_label_by_locale() end : error_code = %d", error_code);
+
return error_code;
}
{
_INFO("_account_insert_custom start");
- int rc, count = 1;
+ int rc, count = 1;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- account_stmt hstmt = NULL;
+ account_stmt hstmt = NULL;
ACCOUNT_RETURN_VAL((account != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
- if (g_slist_length( account->custom_list)==0) {
- ACCOUNT_DEBUG( "_account_insert_custom, no custom data\n");
+ if (g_slist_length(account->custom_list) == 0) {
+ ACCOUNT_DEBUG("_account_insert_custom, no custom data\n");
return _ACCOUNT_ERROR_NONE;
}
rc = _account_get_record_count(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%d, %s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%d, %s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
if (rc <= 0) {
- ACCOUNT_SLOGE( "_account_insert_custom : related account item is not existed rc=%d , %s", rc, _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_SLOGE("_account_insert_custom : related account item is not existed rc=%d , %s", rc, _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_RECORD_NOT_FOUND;
}
hstmt = _account_prepare_query(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
rc = _account_query_step(hstmt);
if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
break;
}
}
_INFO("_account_insert_custom end");
+
return _ACCOUNT_ERROR_NONE;
}
static int _account_update_custom(account_s *account, int account_id)
{
- int rc, count = 1;
+ int rc, count = 1;
char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- account_stmt hstmt = NULL;
+ account_stmt hstmt = NULL;
ACCOUNT_RETURN_VAL((account != NULL), {}, _ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
- if (g_slist_length( account->custom_list)==0) {
- ACCOUNT_DEBUG( "_account_update_custom, no custom data\n");
+ if (g_slist_length(account->custom_list) == 0) {
+ ACCOUNT_DEBUG("_account_update_custom, no custom data\n");
return _ACCOUNT_ERROR_NONE;
}
rc = _account_get_record_count(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
pthread_mutex_unlock(&account_mutex);
return _ACCOUNT_ERROR_PERMISSION_DENIED;
- } else if( _account_db_err_code(g_hAccountDB) == SQLITE_BUSY ){
- ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg(g_hAccountDB));
+ } else if (_account_db_err_code(g_hAccountDB) == SQLITE_BUSY) {
+ ACCOUNT_ERROR("database busy(%s)", _account_db_err_msg(g_hAccountDB));
pthread_mutex_unlock(&account_mutex);
return _ACCOUNT_ERROR_DATABASE_BUSY;
}
if (rc <= 0) {
- ACCOUNT_SLOGE( "_account_update_custom : related account item is not existed rc=%d , %s", rc, _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_SLOGE("_account_update_custom : related account item is not existed rc=%d , %s", rc, _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_RECORD_NOT_FOUND;
}
rc = _account_query_step(hstmt);
if (rc == SQLITE_BUSY) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_DATABASE_BUSY;
} else if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_DB_FAILED;
}
hstmt = _account_prepare_query(g_hAccountDB, query);
- if( _account_db_err_code(g_hAccountDB) == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg(g_hAccountDB));
+ if (_account_db_err_code(g_hAccountDB) == SQLITE_PERM) {
+ ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(g_hAccountDB));
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
rc = _account_query_step(hstmt);
if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
+ ACCOUNT_ERROR("_account_query_step() failed(%d, %s)", rc, _account_db_err_msg(g_hAccountDB));
break;
}
#include <stdlib.h>
#include <signal.h>
#include <glib.h>
-#if !GLIB_CHECK_VERSION (2, 31, 0)
+#if !GLIB_CHECK_VERSION(2, 31, 0)
#include <glib/gmacros.h>
#endif
#include <cynara-client.h>
// one client can have multiple connections having different modes
//static GHashTable* mode_table = NULL;
-GDBusErrorEntry _account_svc_errors[] =
-{
+GDBusErrorEntry _account_svc_errors[] = {
{_ACCOUNT_ERROR_NONE, _ACCOUNT_SVC_ERROR_PREFIX".NoError"},
{_ACCOUNT_ERROR_OUT_OF_MEMORY, _ACCOUNT_SVC_ERROR_PREFIX".OutOfMemory"},
{_ACCOUNT_ERROR_INVALID_PARAMETER, _ACCOUNT_SVC_ERROR_PREFIX".InvalidParameter"},
{
const char *name = NULL;
name = g_dbus_method_invocation_get_sender(invoc);
- if (name == NULL)
- {
+ if (name == NULL) {
_ERR("g_dbus_method_invocation_get_sender failed");
return -1;
}
NULL,
&error);
- if (_ret != NULL)
- {
+ if (_ret != NULL) {
g_variant_get(_ret, "(u)", &pid);
g_variant_unref(_ret);
}
}
static GQuark
-__ACCOUNT_ERROR_quark (void)
+__ACCOUNT_ERROR_quark(void)
{
static volatile gsize quark_volatile = 0;
- g_dbus_error_register_error_domain (_ACCOUNT_SVC_ERROR_DOMAIN,
+ g_dbus_error_register_error_domain(_ACCOUNT_SVC_ERROR_DOMAIN,
&quark_volatile,
_account_svc_errors,
- G_N_ELEMENTS (_account_svc_errors));
+ G_N_ELEMENTS(_account_svc_errors));
return (GQuark) quark_volatile;
}
ret = cynara_check(p_cynara, client, session, user, privilege);
switch (ret) {
- case CYNARA_API_ACCESS_ALLOWED:
- _DBG("cynara_check success");
- return _ACCOUNT_ERROR_NONE;
- case CYNARA_API_ACCESS_DENIED:
- _ERR("cynara_check permission deined, privilege=%s, error = CYNARA_API_ACCESS_DENIED", privilege);
- return _ACCOUNT_ERROR_PERMISSION_DENIED;
- default:
- cynara_strerror(ret, err_buf, sizeof(err_buf));
- _ERR("cynara_check error : %s, privilege=%s, ret = %d", err_buf, privilege, ret);
- return _ACCOUNT_ERROR_PERMISSION_DENIED;
+ case CYNARA_API_ACCESS_ALLOWED:
+ _DBG("cynara_check success");
+ return _ACCOUNT_ERROR_NONE;
+ case CYNARA_API_ACCESS_DENIED:
+ _ERR("cynara_check permission deined, privilege=%s, error = CYNARA_API_ACCESS_DENIED", privilege);
+ return _ACCOUNT_ERROR_PERMISSION_DENIED;
+ default:
+ cynara_strerror(ret, err_buf, sizeof(err_buf));
+ _ERR("cynara_check error : %s, privilege=%s, ret = %d", err_buf, privilege, ret);
+ return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
}
//get GDBusConnection
gdbus_conn = g_dbus_method_invocation_get_connection(invocation);
- if(gdbus_conn == NULL)
- {
+ if (gdbus_conn == NULL) {
_ERR("g_dbus_method_invocation_get_connection failed");
return -1;
}
//get sender(unique_name)
sender = (char*) g_dbus_method_invocation_get_sender(invocation);
- if (sender == NULL)
- {
+ if (sender == NULL) {
_ERR("g_dbus_method_invocation_get_sender failed");
return -1;
}
ret = cynara_creds_gdbus_get_user(gdbus_conn, sender, USER_METHOD_DEFAULT, user);
- if (ret != CYNARA_API_SUCCESS)
- {
+ if (ret != CYNARA_API_SUCCESS) {
_ERR("cynara_creds_gdbus_get_user failed, ret = %d", ret);
return -1;
}
ret = cynara_creds_gdbus_get_client(gdbus_conn, sender, CLIENT_METHOD_DEFAULT, client);
- if (ret != CYNARA_API_SUCCESS)
- {
+ if (ret != CYNARA_API_SUCCESS) {
_ERR("cynara_creds_gdbus_get_client failed, ret = %d", ret);
return -1;
}
_INFO("client Id = [%u]", pid);
*session = cynara_session_from_pid(pid);
- if (*session == NULL)
- {
+ if (*session == NULL) {
_ERR("cynara_session_from_pid failed");
return -1;
}
+
return _ACCOUNT_ERROR_NONE;
}
char *user = NULL;
ret = __get_information_for_cynara_check(invocation, &client, &user, &session);
- if ( ret != _ACCOUNT_ERROR_NONE )
- {
+ if (ret != _ACCOUNT_ERROR_NONE) {
_ERR("__get_information_for_cynara_check failed");
g_free(client);
g_free(user);
_ACCOUNT_FREE(session);
+
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
ret = __check_privilege_by_cynara(client, session, user, privilege);
- if ( ret != _ACCOUNT_ERROR_NONE )
- {
+ if (ret != _ACCOUNT_ERROR_NONE) {
_ERR("__check_privilege_by_cynara failed, ret = %d", ret);
g_free(client);
g_free(user);
_ACCOUNT_FREE(session);
+
return _ACCOUNT_ERROR_PERMISSION_DENIED;
}
+
g_free(client);
g_free(user);
_ACCOUNT_FREE(session);
+
return _ACCOUNT_ERROR_NONE;
}
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
return_code = _check_priviliege_account_write(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_write failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(1, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
account = umarshal_account(account_data);
- if (account == NULL)
- {
+ if (account == NULL) {
_ERR("account unmarshalling failed");
return_code = _ACCOUNT_ERROR_DB_FAILED;
-
goto RETURN;
}
return_code = _account_insert_to_db(account, pid, (int)uid, &db_id);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_insert_to_db() error");
-
goto RETURN;
}
RETURN:
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("Account SVC is returning error [%d]", return_code);
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
account_manager_complete_account_add(obj, invocation, db_id);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_account_add end");
+
return true;
}
-gboolean account_manager_account_query_all(AccountManager *obj, GDBusMethodInvocation *invocation, gint uid)
+gboolean
+account_manager_account_query_all(AccountManager *obj, GDBusMethodInvocation *invocation, gint uid)
{
_INFO("account_manager_account_query_all start");
lifecycle_method_call_active();
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(0, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
//Mode checking not required, since default mode is read.
- GSList* account_list = NULL;
+ GSList *account_list = NULL;
account_list = _account_db_query_all(pid, (uid_t)uid);
- if (account_list == NULL)
- {
+ if (account_list == NULL) {
return_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND;
_ERR("No account found.");
goto RETURN;
RETURN:
- if (account_list_variant == NULL)
- {
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ if (account_list_variant == NULL) {
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
account_manager_complete_account_query_all(obj, invocation, account_list_variant);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_account_query_all end");
+
return true;
}
-gboolean account_manager_account_type_query_all(AccountManager *obj, GDBusMethodInvocation *invocation, gint uid)
+gboolean
+account_manager_account_type_query_all(AccountManager *obj, GDBusMethodInvocation *invocation, gint uid)
{
_INFO("account_manager_account_query_all start");
lifecycle_method_call_active();
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(0, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
//Mode checking not required, since default mode is read.
- GSList* account_type_list = NULL;
+ GSList *account_type_list = NULL;
account_type_list = _account_type_query_all();
- if (account_type_list == NULL)
- {
+ if (account_type_list == NULL) {
return_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND;
_ERR("No account type found.");
goto RETURN;
RETURN:
- if (account_type_list_variant == NULL)
- {
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ if (account_type_list_variant == NULL) {
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
account_manager_complete_account_type_query_all(obj, invocation, account_type_list_variant);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_account_query_all end");
+
return true;
}
-gboolean account_manager_account_type_add(AccountManager *obj, GDBusMethodInvocation *invocation, GVariant *account_type_data, gint uid, gpointer user_data)
+gboolean
+account_manager_account_type_add(AccountManager *obj, GDBusMethodInvocation *invocation, GVariant *account_type_data, gint uid, gpointer user_data)
{
_INFO("account_manager_account_type_add start");
lifecycle_method_call_active();
int db_id = -1;
- account_type_s* account_type = NULL;
+ account_type_s *account_type = NULL;
guint pid = _get_client_pid(invocation);
_INFO("client pid = [%u], uid = [%d]", pid, uid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
+
return_code = _check_priviliege_account_write(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_write failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(1, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
account_type = umarshal_account_type(account_type_data);
- if (account_type == NULL)
- {
+ if (account_type == NULL) {
_ERR("account_type unmarshalling failed");
return_code = _ACCOUNT_ERROR_DB_FAILED;
goto RETURN;
_INFO("before account_server_insert_account_type_to_user_db");
return_code = account_server_insert_account_type_to_user_db(account_type, &db_id, (uid_t)uid);
_INFO("after account_server_insert_account_type_to_user_db");
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_type_insert_to_db error");
goto RETURN;
}
RETURN:
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("Account SVC is returning error [%d]", return_code);
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
account_manager_complete_account_type_add(obj, invocation, db_id);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_account_type_add end");
+
return true;
}
-gboolean account_manager_account_delete_from_db_by_id(AccountManager *object,
+gboolean
+account_manager_account_delete_from_db_by_id(AccountManager *object,
GDBusMethodInvocation *invocation,
gint account_db_id,
gint uid)
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
+
return_code = _check_priviliege_account_write(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_write failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(1, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_delete(pid, uid, account_db_id);
_INFO("after _account_delete=[%d]", return_code);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_delete error");
goto RETURN;
}
RETURN:
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("Account SVC is returning error [%d]", return_code);
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
account_manager_complete_account_delete_from_db_by_id(object, invocation);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_account_delete_from_db_by_id end");
+
return true;
}
-gboolean account_manager_account_delete_from_db_by_user_name(AccountManager *object,
+gboolean
+account_manager_account_delete_from_db_by_user_name(AccountManager *object,
GDBusMethodInvocation *invocation,
const gchar *user_name,
const gchar *package_name,
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
+
return_code = _check_priviliege_account_write(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_write failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(1, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_delete_from_db_by_user_name(pid, uid, user_name, package_name);
_INFO("after _account_delete_from_db_by_user_name=[%d]", return_code);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_delete_from_db_by_user_name error");
goto RETURN;
}
RETURN:
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("Account SVC is returning error [%d]", return_code);
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
account_manager_complete_account_delete_from_db_by_id(object, invocation);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_account_delete_from_db_by_user_name end");
+
return true;
}
-gboolean account_manager_account_delete_from_db_by_package_name(AccountManager *object,
+gboolean
+account_manager_account_delete_from_db_by_package_name(AccountManager *object,
GDBusMethodInvocation *invocation,
const gchar *package_name,
gboolean permission,
guint pid = _get_client_pid(invocation);
_INFO("client Id = [%u]", pid);
- if( permission ) {
+ if (permission) {
return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
+
return_code = _check_priviliege_account_write(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_write failed, ret = %d", return_code);
goto RETURN;
}
}
return_code = _account_db_open(1, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = account_server_delete_account_by_package_name(package_name, permission, pid, (uid_t)uid);
_INFO("after account_delete_from_db_by_package_name=[%d]", return_code);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_delete_from_db_by_package_name error");
goto RETURN;
}
RETURN:
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("Account SVC is returning error [%d]", return_code);
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
account_manager_complete_account_delete_from_db_by_package_name(object, invocation);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_account_delete_from_db_by_package_name end");
+
return true;
}
-gboolean account_manager_account_update_to_db_by_id(AccountManager *object,
+gboolean
+account_manager_account_update_to_db_by_id(AccountManager *object,
GDBusMethodInvocation *invocation,
GVariant *account_data,
gint account_id,
_INFO("account_manager_account_update_to_db_by_id start");
lifecycle_method_call_active();
- account_s* account = NULL;
+ account_s *account = NULL;
guint pid = _get_client_pid(invocation);
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
+
return_code = _check_priviliege_account_write(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_write failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(1, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
account = umarshal_account(account_data);
- if (account == NULL)
- {
+ if (account == NULL) {
_ERR("Unmarshal failed");
return_code = _ACCOUNT_ERROR_DB_FAILED;
goto RETURN;
return_code = _account_update_to_db_by_id(pid, uid, account, account_id);
_INFO("after account_update_to_db_by_id=[%d]", return_code);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_update_to_db_by_id error");
goto RETURN;
}
RETURN:
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("Account SVC is returning error [%d]", return_code);
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
account_manager_complete_account_update_to_db_by_id(object, invocation);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_account_update_to_db_by_id end");
+
return true;
}
-gboolean account_manager_handle_account_update_to_db_by_user_name(AccountManager *object,
+gboolean
+account_manager_handle_account_update_to_db_by_user_name(AccountManager *object,
GDBusMethodInvocation *invocation,
GVariant *account_data,
const gchar *user_name,
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
+
return_code = _check_priviliege_account_write(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_write failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(1, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
account = umarshal_account(account_data);
- if (account == NULL)
- {
+ if (account == NULL) {
_ERR("Unmarshal failed");
return_code = _ACCOUNT_ERROR_DB_FAILED;
goto RETURN;
return_code = _account_update_to_db_by_user_name(pid, uid, account, user_name, package_name);
_INFO("after account_update_to_db_by_id=[%d]", return_code);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_update_to_db_by_id error");
goto RETURN;
}
RETURN:
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("Account SVC is returning error [%d]", return_code);
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
account_manager_complete_account_update_to_db_by_id(object, invocation);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_handle_account_update_to_db_by_user_name end");
+
return true;
}
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(0, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_type_query_label_by_locale(app_id, locale, &label_name);
_INFO("after _account_type_query_label_by_locale=[%d]", return_code);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_type_query_label_by_locale error");
goto RETURN;
}
RETURN:
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("Account SVC is returning error [%d]", return_code);
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
account_manager_complete_account_type_query_label_by_locale(object, invocation, label_name);
}
_ACCOUNT_FREE(label_name);
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_handle_account_type_query_label_by_locale end");
+
return true;
}
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(0, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
//Mode checking not required, since default mode is read.
- GSList* account_type_list = NULL;
+ GSList *account_type_list = NULL;
+
account_type_list = _account_type_query_by_provider_feature(key, &return_code);
- if (return_code != 0)
- {
+ if (return_code != 0) {
_ERR("_account_type_query_by_provider_feature=[%d]", return_code);
goto RETURN;
}
- if (account_type_list == NULL)
- {
+ if (account_type_list == NULL) {
return_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND;
_ERR("No account type found.");
goto RETURN;
}
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_type_query_by_provider_feature error");
goto RETURN;
}
RETURN:
- if (account_type_list_variant == NULL)
- {
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), _ACCOUNT_ERROR_RECORD_NOT_FOUND, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ if (account_type_list_variant == NULL) {
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), _ACCOUNT_ERROR_RECORD_NOT_FOUND, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
account_manager_complete_account_type_query_by_provider_feature(obj, invocation, account_type_list_variant);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_handle_account_type_query_by_provider_feature end");
+
return true;
}
-gboolean account_manager_account_get_total_count_from_db(AccountManager *object, GDBusMethodInvocation *invocation, gboolean include_hidden, gint uid)
+gboolean
+account_manager_account_get_total_count_from_db(AccountManager *object, GDBusMethodInvocation *invocation, gboolean include_hidden, gint uid)
{
_INFO("account_manager_account_get_total_count_from_db start");
lifecycle_method_call_active();
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(0, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
-
_INFO("before account_get_total_count_from_db");
return_code = _account_get_total_count_from_db(include_hidden, &count);
_INFO("before account_get_total_count_from_db=[%d], return_code");
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_get_total_count_from_db error");
goto RETURN;
}
RETURN:
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("Account SVC is returning error [%d]", return_code);
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
account_manager_complete_account_get_total_count_from_db(object, invocation, count);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_account_get_total_count_from_db end");
+
return true;
}
-gboolean account_manager_handle_account_query_account_by_account_id(AccountManager *object, GDBusMethodInvocation *invocation,
+gboolean
+account_manager_handle_account_query_account_by_account_id(AccountManager *object, GDBusMethodInvocation *invocation,
gint account_db_id, gint uid)
{
_INFO("account_manager_handle_account_query_account_by_account_id start");
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(0, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
account_data = create_empty_account_instance();
- if (account_data == NULL)
- {
+ if (account_data == NULL) {
_ERR("out of memory");
return_code = _ACCOUNT_ERROR_DB_FAILED;
goto RETURN;
}
+
_INFO("before _account_query_account_by_account_id");
return_code = _account_query_account_by_account_id(pid, (uid_t)uid, account_db_id, account_data);
_INFO("after _account_query_account_by_return_code=[%d]", return_code);
_INFO("user_name = %s, user_data_txt[0] = %s, user_data_int[1] = %d", account_data->user_name, account_data->user_data_txt[0], account_data->user_data_int[1]);
if (return_code == _ACCOUNT_ERROR_NONE)
- {
account_variant = marshal_account(account_data);
- }
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_type_query_label_by_locale error");
goto RETURN;
}
RETURN:
- if (account_variant == NULL || return_code != _ACCOUNT_ERROR_NONE)
- {
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+
+ if (account_variant == NULL || return_code != _ACCOUNT_ERROR_NONE) {
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
account_manager_complete_account_query_account_by_account_id(object, invocation, account_variant);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_handle_account_query_account_by_account_id end");
+
return true;
}
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(0, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
//Mode checking not required, since default mode is read.
- GList* account_list = NULL;
+ GList *account_list = NULL;
account_list = _account_query_account_by_user_name(pid, (uid_t)uid, user_name, &return_code);
- if (account_list == NULL)
- {
+ if (account_list == NULL) {
return_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND;
_ERR("No account found.");
goto RETURN;
_account_glist_account_free(account_list);
_INFO("after calling marshal_account_list_double");
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_query_account_by_user_name error");
goto RETURN;
}
RETURN:
- if (account_list_variant == NULL)
- {
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), _ACCOUNT_ERROR_RECORD_NOT_FOUND, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+
+ if (account_list_variant == NULL) {
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), _ACCOUNT_ERROR_RECORD_NOT_FOUND, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
account_manager_complete_account_query_account_by_user_name(obj, invocation, account_list_variant);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_handle_account_query_account_by_user_name end");
+
return true;
}
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(0, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
//Mode checking not required, since default mode is read.
- GList* account_list = NULL;
+ GList *account_list = NULL;
account_list = account_server_query_account_by_package_name(package_name, &return_code, pid, (uid_t)uid);
- if (account_list == NULL)
- {
+ if (account_list == NULL) {
return_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND;
_ERR("No account found.");
goto RETURN;
account_list_variant = marshal_account_list_double(account_list);
_account_glist_account_free(account_list);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_query_account_by_package_name error");
goto RETURN;
}
RETURN:
- if (account_list_variant == NULL)
- {
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ if (account_list_variant == NULL) {
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
account_manager_complete_account_query_account_by_package_name(obj, invocation, account_list_variant);
}
_INFO("account_manager_handle_account_query_account_by_package_name start");
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_handle_account_query_account_by_package_name start");
+
return true;
}
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(0, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
//Mode checking not required, since default mode is read.
- GList* account_list = NULL;
+ GList *account_list = NULL;
_INFO("before _account_query_account_by_capability");
account_list = _account_query_account_by_capability(pid, (uid_t)uid, capability_type, capability_value, &return_code);
_INFO("after _account_query_account_by_capability");
- if (account_list == NULL)
- {
+ if (account_list == NULL) {
return_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND;
_ERR("No account found.");
goto RETURN;
account_list_variant = marshal_account_list_double(account_list);
_account_glist_account_free(account_list);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_query_account_by_capability error");
goto RETURN;
}
RETURN:
- if (account_list_variant == NULL)
- {
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), _ACCOUNT_ERROR_RECORD_NOT_FOUND, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ if (account_list_variant == NULL) {
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), _ACCOUNT_ERROR_RECORD_NOT_FOUND, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
account_manager_complete_account_query_account_by_capability(obj, invocation, account_list_variant);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_handle_account_query_account_by_capability end");
+
return true;
}
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(0, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
goto RETURN;
//Mode checking not required, since default mode is read.
- GList* account_list = NULL;
+ GList *account_list = NULL;
account_list = _account_query_account_by_capability_type(pid, (uid_t)uid, capability_type, &return_code);
- if (account_list == NULL)
- {
+ if (account_list == NULL) {
return_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND;
_ERR("No account found.");
goto RETURN;
_account_glist_account_free(account_list);
_INFO("after calling marshal_account_list_double");
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_query_account_by_capability_type error");
goto RETURN;
}
RETURN:
- if (account_list_variant == NULL)
- {
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), _ACCOUNT_ERROR_RECORD_NOT_FOUND, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ if (account_list_variant == NULL) {
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), _ACCOUNT_ERROR_RECORD_NOT_FOUND, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
account_manager_complete_account_query_account_by_capability(obj, invocation, account_list_variant);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_handle_account_query_account_by_capability_type end");
+
return true;
}
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(0, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
//Mode checking not required, since default mode is read.
- GSList* capability_list = NULL;
+ GSList *capability_list = NULL;
capability_list = _account_get_capability_list_by_account_id(account_id, &return_code);
- if (capability_list == NULL)
- {
+ if (capability_list == NULL) {
return_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND;
_ERR("No capability found.");
goto RETURN;
_account_gslist_capability_free(capability_list);
_INFO("after calling marshal_capability_list");
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_get_capability_list_by_account_id error");
goto RETURN;
}
RETURN:
- if (capability_list_variant == NULL)
- {
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), _ACCOUNT_ERROR_RECORD_NOT_FOUND, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ if (capability_list_variant == NULL) {
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), _ACCOUNT_ERROR_RECORD_NOT_FOUND, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
account_manager_complete_account_query_capability_by_account_id(obj, invocation, capability_list_variant);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_handle_account_query_capability_by_account_id end");
+
return true;
}
-gboolean account_manager_handle_account_update_sync_status_by_id(AccountManager *object,
+gboolean
+account_manager_handle_account_update_sync_status_by_id(AccountManager *object,
GDBusMethodInvocation *invocation,
const int account_db_id,
const int sync_status,
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
+
return_code = _check_priviliege_account_write(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_write failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(1, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_update_sync_status_by_id(uid, account_db_id, sync_status);
_INFO("after _account_update_sync_status_by_id=[%d]", return_code);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_update_sync_status_by_id error");
goto RETURN;
}
RETURN:
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("Account SVC is returning error [%d]", return_code);
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
account_manager_complete_account_update_sync_status_by_id(object, invocation);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_handle_account_update_sync_status_by_id end");
+
return true;
}
-gboolean account_manager_handle_account_type_query_provider_feature_by_app_id(AccountManager *obj,
+gboolean
+account_manager_handle_account_type_query_provider_feature_by_app_id(AccountManager *obj,
GDBusMethodInvocation *invocation,
const gchar* app_id,
gint uid)
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(0, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
feature_record_list = _account_type_query_provider_feature_by_app_id(app_id, &return_code);
_INFO("after account_type_query_provider_feature_by_app_id=[%d]", return_code);
- if (feature_record_list == NULL)
- {
+ if (feature_record_list == NULL) {
_ERR("account feature_record_list is NULL");
return_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND;
goto RETURN;
feature_record_list_variant = provider_feature_list_to_variant(feature_record_list);
_account_type_gslist_feature_free(feature_record_list);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_type_query_provider_feature_by_app_id error");
goto RETURN;
}
RETURN:
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+
+ if (return_code != _ACCOUNT_ERROR_NONE) {
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
_INFO("Calling account_manager_complete_account_type_query_provider_feature_by_app_id");
account_manager_complete_account_type_query_provider_feature_by_app_id(obj, invocation, feature_record_list_variant);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_handle_account_type_query_provider_feature_by_app_id end");
+
return true;
}
-gboolean account_manager_handle_account_type_query_supported_feature(AccountManager *obj,
+gboolean
+account_manager_handle_account_type_query_supported_feature(AccountManager *obj,
GDBusMethodInvocation *invocation,
const gchar* app_id,
const gchar* capability,
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(0, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
is_supported = _account_type_query_supported_feature(app_id, capability, &return_code);
_INFO("after _account_type_query_supported_feature=[%d]", return_code);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_type_query_supported_feature error");
goto RETURN;
}
RETURN:
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+
+ if (return_code != _ACCOUNT_ERROR_NONE) {
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
_INFO("Calling account_manager_complete_account_type_query_provider_feature_by_app_id");
account_manager_complete_account_type_query_supported_feature(obj, invocation, is_supported);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_handle_account_type_query_supported_feature end");
+
return true;
}
-gboolean account_manager_handle_account_type_update_to_db_by_app_id (AccountManager *obj,
+gboolean
+account_manager_handle_account_type_update_to_db_by_app_id(AccountManager *obj,
GDBusMethodInvocation *invocation,
GVariant *account_type_variant,
const gchar *app_id,
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
+
return_code = _check_priviliege_account_write(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_write failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(1, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_type_update_to_db_by_app_id(account_type, app_id);
_INFO("after _account_type_update_to_db_by_app_id=[%d]", return_code);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_type_update_to_db_by_app_id error");
goto RETURN;
}
RETURN:
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+
+ if (return_code != _ACCOUNT_ERROR_NONE) {
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
_INFO("Calling account_manager_complete_account_type_update_to_db_by_app_id");
account_manager_complete_account_type_update_to_db_by_app_id(obj, invocation);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_handle_account_type_update_to_db_by_app_id end");
+
return true;
}
-gboolean account_manager_handle_account_type_delete_by_app_id (AccountManager *obj,
+gboolean
+account_manager_handle_account_type_delete_by_app_id(AccountManager *obj,
GDBusMethodInvocation *invocation,
const gchar *app_id,
gint uid)
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
+
return_code = _check_priviliege_account_write(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_write failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(1, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = account_server_delete_account_type_by_app_id_from_user_db(app_id);
_INFO("after account_server_delete_account_type_by_app_id_from_user_db=[%d]", return_code);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("account_server_delete_account_type_by_app_id error");
goto RETURN;
}
RETURN:
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+
+ if (return_code != _ACCOUNT_ERROR_NONE) {
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
_ERR("Calling account_manager_complete_account_type_update_to_db_by_app_id");
- account_manager_complete_account_type_delete_by_app_id (obj, invocation);
+ account_manager_complete_account_type_delete_by_app_id(obj, invocation);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_handle_account_type_delete_by_app_id end");
+
return true;
}
-gboolean account_manager_handle_account_type_query_label_by_app_id (AccountManager *obj,
+gboolean
+account_manager_handle_account_type_query_label_by_app_id(AccountManager *obj,
GDBusMethodInvocation *invocation,
const gchar *app_id,
gint uid)
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(0, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
_INFO("before _account_type_get_label_list_by_app_id");
- label_list = _account_type_get_label_list_by_app_id (app_id, &return_code);
+ label_list = _account_type_get_label_list_by_app_id(app_id, &return_code);
_INFO("after _account_type_get_label_list_by_app_id=[%d]", return_code);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_type_get_label_list_by_app_id = [%d]", return_code);
goto RETURN;
}
- label_list_variant = label_list_to_variant (label_list);
+ label_list_variant = label_list_to_variant(label_list);
_account_type_gslist_label_free(label_list);
RETURN:
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+
+ if (return_code != _ACCOUNT_ERROR_NONE) {
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
_ERR("Calling account_manager_complete_account_type_query_label_by_app_id");
- account_manager_complete_account_type_query_label_by_app_id (obj, invocation, label_list_variant);
+ account_manager_complete_account_type_query_label_by_app_id(obj, invocation, label_list_variant);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_handle_account_type_query_label_by_app_id end");
+
return true;
}
-gboolean account_manager_handle_account_type_query_by_app_id (AccountManager *obj,
+gboolean
+account_manager_handle_account_type_query_by_app_id(AccountManager *obj,
GDBusMethodInvocation *invocation,
const gchar *app_id,
gint uid)
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(0, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
_INFO("before _account_type_query_by_app_id");
- return_code = _account_type_query_by_app_id (app_id, &account_type);
+ return_code = _account_type_query_by_app_id(app_id, &account_type);
_INFO("after _account_type_query_by_app_id=[%d]", return_code);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_type_query_by_app_id = [%d]", return_code);
goto RETURN;
}
- if (account_type == NULL)
- {
+
+ if (account_type == NULL) {
_ERR("account_type read is NULL");
return_code = _ACCOUNT_ERROR_RECORD_NOT_FOUND;
goto RETURN;
}
- account_type_variant = marshal_account_type( account_type);
+ account_type_variant = marshal_account_type(account_type);
RETURN:
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("Account SVC is returning error [%d]", return_code);
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
_INFO("Calling account_manager_complete_account_type_query_by_app_id");
- account_manager_complete_account_type_query_by_app_id (obj, invocation, account_type_variant);
+ account_manager_complete_account_type_query_by_app_id(obj, invocation, account_type_variant);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return true;
}
-gboolean account_manager_handle_account_type_query_app_id_exist (AccountManager *obj,
+gboolean
+account_manager_handle_account_type_query_app_id_exist(AccountManager *obj,
GDBusMethodInvocation *invocation,
const gchar *app_id,
gint uid)
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(0, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = account_server_query_app_id_exist(app_id);
_INFO("after _account_server_query_app_id_exist=[%d]", return_code);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_type_query_app_id_exist_from_all_db = [%d]", return_code);
goto RETURN;
}
RETURN:
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("Account SVC is returning error [%d]", return_code);
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
_INFO("Calling account_manager_complete_account_type_query_by_app_id_exist");
- account_manager_complete_account_type_query_app_id_exist (obj, invocation);
+ account_manager_complete_account_type_query_app_id_exist(obj, invocation);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
lifecycle_method_call_inactive();
_INFO("account_manager_handle_account_type_query_app_id_exist end");
+
return true;
}
-gboolean account_manager_handle_account_update_to_db_by_id_ex (AccountManager *obj,
+gboolean
+account_manager_handle_account_update_to_db_by_id_ex(AccountManager *obj,
GDBusMethodInvocation *invocation,
GVariant *account_data,
gint account_id,
_INFO("client Id = [%u]", pid);
int return_code = _check_priviliege_account_read(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_read failed, ret = %d", return_code);
goto RETURN;
}
+
return_code = _check_priviliege_account_write(invocation);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_check_priviliege_account_write failed, ret = %d", return_code);
goto RETURN;
}
return_code = _account_db_open(1, pid, uid);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
return_code = _account_global_db_open();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_global_db_open() error, ret = %d", return_code);
-
goto RETURN;
}
account = umarshal_account(account_data);
- if (account == NULL)
- {
+ if (account == NULL) {
_ERR("Unmarshal failed");
return_code = _ACCOUNT_ERROR_INVALID_PARAMETER;
goto RETURN;
}
_INFO("before _account_update_to_db_by_id_ex");
- return_code = _account_update_to_db_by_id_ex (account, account_id);
+ return_code = _account_update_to_db_by_id_ex(account, account_id);
_INFO("after _account_update_to_db_by_id_ex()=[%d]", return_code);
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("_account_update_to_db_by_id_ex error");
goto RETURN;
}
RETURN:
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+
+ if (return_code != _ACCOUNT_ERROR_NONE) {
_ERR("Account SVC is returning error [%d]", return_code);
- GError* error = g_error_new (__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
- g_dbus_method_invocation_return_gerror (invocation, error);
+ GError* error = g_error_new(__ACCOUNT_ERROR_quark(), return_code, "RecordNotFound");
+ g_dbus_method_invocation_return_gerror(invocation, error);
g_error_free(error);
- }
- else
- {
+ } else {
_INFO("Calling account_manager_complete_account_update_to_db_by_id_ex");
- account_manager_complete_account_update_to_db_by_id_ex (obj, invocation);
+ account_manager_complete_account_update_to_db_by_id_ex(obj, invocation);
}
return_code = _account_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
return_code = _account_global_db_close();
- if (return_code != _ACCOUNT_ERROR_NONE)
- {
+ if (return_code != _ACCOUNT_ERROR_NONE) {
ACCOUNT_DEBUG("_account_global_db_close() fail[%d]", return_code);
return_code = _ACCOUNT_ERROR_NONE;
}
}
static void
-on_bus_acquired (GDBusConnection *connection, const gchar *name, gpointer user_data)
+on_bus_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
{
_INFO("on_bus_acquired [%s]", name);
GDBusInterfaceSkeleton* interface = NULL;
account_mgr_server_obj = account_manager_skeleton_new();
- if (account_mgr_server_obj == NULL)
- {
+ if (account_mgr_server_obj == NULL) {
_ERR("account_mgr_server_obj NULL!!");
return;
}
- interface = G_DBUS_INTERFACE_SKELETON(account_mgr_server_obj);
- if (!g_dbus_interface_skeleton_export(interface, connection, ACCOUNT_MGR_DBUS_PATH, NULL))
- {
+ interface = G_DBUS_INTERFACE_SKELETON(account_mgr_server_obj);
+ if (!g_dbus_interface_skeleton_export(interface, connection, ACCOUNT_MGR_DBUS_PATH, NULL)) {
_ERR("export failed!!");
return;
}
g_signal_connect(account_mgr_server_obj, "handle_account_type_query_provider_feature_by_app_id",
G_CALLBACK(account_manager_handle_account_type_query_provider_feature_by_app_id), NULL);
-
g_signal_connect(account_mgr_server_obj, "handle_account_type_query_supported_feature",
G_CALLBACK(account_manager_handle_account_type_query_supported_feature), NULL);
_INFO("connecting account signals end");
g_dbus_object_manager_server_set_connection(account_mgr_server_mgr, connection);
- if( connection == NULL ) {
+
+ if (connection == NULL)
_INFO("g_dbus_object_manager_server_set_connection failed");
- }
+
_INFO("on_bus_acquired end [%s]", name);
}
}
static void
-on_name_acquired (GDBusConnection *connection,
- const gchar *name,
- gpointer user_data)
+on_name_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
{
_INFO("on_name_acquired");
-
}
static void
-on_name_lost (GDBusConnection *connection,
- const gchar *name,
- gpointer user_data)
+on_name_lost(GDBusConnection *connection, const gchar *name, gpointer user_data)
{
_INFO("on_name_lost");
- exit (1);
+ exit(1);
}
static bool _initialize_dbus()
{
_INFO("__initialize_dbus Enter");
- owner_id = g_bus_own_name (G_BUS_TYPE_SYSTEM,
- "org.tizen.account.manager",
- G_BUS_NAME_OWNER_FLAGS_NONE,
- on_bus_acquired,
- on_name_acquired,
- on_name_lost,
- NULL,
- NULL);
+ owner_id = g_bus_own_name(G_BUS_TYPE_SYSTEM,
+ "org.tizen.account.manager",
+ G_BUS_NAME_OWNER_FLAGS_NONE,
+ on_bus_acquired,
+ on_name_acquired,
+ on_name_lost,
+ NULL,
+ NULL);
_INFO("owner_id=[%d]", owner_id);
- if(owner_id == 0)
- {
- _INFO("gdbus own failed!!");
- return false;
+ if (owner_id == 0) {
+ _INFO("gdbus own failed!!");
+ return false;
}
_INFO("g_bus_own_name SUCCESS");
+
return true;
}
static void _initialize()
{
-#if !GLIB_CHECK_VERSION(2,35,0)
+#if !GLIB_CHECK_VERSION(2, 35, 0)
g_type_init();
#endif
int ret = -1;
- if (_initialize_dbus() == false)
- { /* because dbus's initialize
- failed, we cannot continue any more. */
+ if (_initialize_dbus() == false) {
+ /* because dbus's initialize failed, we cannot continue any more. */
_ERR("DBUS Initialization Failed");
exit(1);
}
ret = cynara_initialize(&p_cynara, NULL);
- if(ret != CYNARA_API_SUCCESS) {
+ if (ret != CYNARA_API_SUCCESS) {
_ERR("CYNARA Initialization fail");
exit(1);
}
cynara_finish(p_cynara);
_INFO("Ending Accounts SVC");
+
return 0;
}