return return_code;
}
+void _account_get_appid_from_db(pkgmgrinfo_appinfo_h *ahandle, pkgmgrinfo_pkginfo_h *phandle, char **package_id, const char *appid, uid_t uid, GSList **appid_list)
+{
+ _INFO("_account_get_appid_from_db start");
+ int pkgmgr_ret = -1;
+
+ pkgmgrinfo_appinfo_h app_handle = NULL;
+ pkgmgrinfo_pkginfo_h pkg_handle = NULL;
+ char *pkg_id = NULL;
+ GSList *list = NULL;
+
+ if (uid == OWNER_ROOT || uid == GLOBAL_USER)
+ pkgmgr_ret = pkgmgrinfo_appinfo_get_appinfo(appid, &app_handle);
+ else
+ pkgmgr_ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, uid, &app_handle);
+
+ if (pkgmgr_ret != PMINFO_R_OK)
+ ACCOUNT_DEBUG("pkgmgrinfo_appinfo_get_appinfo(%d)", pkgmgr_ret);
+
+ pkgmgr_ret = pkgmgrinfo_appinfo_get_pkgid(app_handle, &pkg_id);
+ if (pkgmgr_ret != PMINFO_R_OK)
+ ACCOUNT_DEBUG("pkgmgrinfo_appinfo_get_pkgid(%d)", pkgmgr_ret);
+
+ if (uid == OWNER_ROOT || uid == GLOBAL_USER)
+ pkgmgr_ret = pkgmgrinfo_pkginfo_get_pkginfo(pkg_id, &pkg_handle);
+ else
+ pkgmgr_ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkg_id, uid, &pkg_handle);
+
+ if (pkgmgr_ret != PMINFO_R_OK)
+ ACCOUNT_DEBUG("pkgmgrinfo_pkginfo_get_pkginfo(%d)", pkgmgr_ret);
+
+ if (uid == OWNER_ROOT || uid == GLOBAL_USER)
+ pkgmgr_ret = pkgmgrinfo_appinfo_get_list(pkg_handle, PMINFO_ALL_APP, _account_get_current_appid_cb, (void *)&list);
+ else
+ pkgmgr_ret = pkgmgrinfo_appinfo_get_usr_list(pkg_handle, PMINFO_ALL_APP, _account_get_current_appid_cb, (void *)&list, uid);
+
+ if (pkgmgr_ret != PMINFO_R_OK)
+ ACCOUNT_DEBUG("pkgmgrinfo_appinfo_get_list(%d)", pkgmgr_ret);
+
+ *ahandle = app_handle;
+ *phandle = pkg_handle;
+ *package_id = pkg_id;
+ *appid_list = list;
+
+ _INFO("_account_get_appid_from_db end");
+ return;
+}
+
int _account_get_represented_appid_from_db(sqlite3 *account_user_db, sqlite3 *account_global_db, const char *appid, uid_t uid, char **verified_appid)
{
int error_code = _ACCOUNT_ERROR_NOT_REGISTERED_PROVIDER;
char *package_id = NULL;
GSList *appid_list = NULL;
GSList *iter = NULL;
+ int pkgmgr_ret = -1;
if (!appid) {
ACCOUNT_ERROR("input param is null\n");
}
return _ACCOUNT_ERROR_NONE;
}
- /* Get app id family which is stored in account database */
- int pkgmgr_ret = -1;
-
- if (uid == OWNER_ROOT || uid == GLOBAL_USER)
- pkgmgr_ret = pkgmgrinfo_appinfo_get_appinfo(appid, &ahandle);
- else
- pkgmgr_ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, uid, &ahandle);
-
- if (pkgmgr_ret != PMINFO_R_OK)
- ACCOUNT_DEBUG("pkgmgrinfo_appinfo_get_appinfo(%d)", pkgmgr_ret);
-
- pkgmgr_ret = pkgmgrinfo_appinfo_get_pkgid(ahandle, &package_id);
- if (pkgmgr_ret != PMINFO_R_OK)
- ACCOUNT_DEBUG("pkgmgrinfo_appinfo_get_pkgid(%d)", pkgmgr_ret);
-
- if (uid == OWNER_ROOT || uid == GLOBAL_USER)
- pkgmgr_ret = pkgmgrinfo_pkginfo_get_pkginfo(package_id, &phandle);
- else
- pkgmgr_ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(package_id, uid, &phandle);
-
- if (pkgmgr_ret != PMINFO_R_OK)
- ACCOUNT_DEBUG("pkgmgrinfo_pkginfo_get_pkginfo(%d)", pkgmgr_ret);
- if (uid == OWNER_ROOT || uid == GLOBAL_USER)
- pkgmgr_ret = pkgmgrinfo_appinfo_get_list(phandle, PMINFO_ALL_APP, _account_get_current_appid_cb, (void *)&appid_list);
- else
- pkgmgr_ret = pkgmgrinfo_appinfo_get_usr_list(phandle, PMINFO_ALL_APP, _account_get_current_appid_cb, (void *)&appid_list, uid);
+ /* Get app id family which is stored in account database */
+ _account_get_appid_from_db(&ahandle, &phandle, &package_id, appid, uid, &appid_list);
- if (pkgmgr_ret != PMINFO_R_OK)
- ACCOUNT_DEBUG("pkgmgrinfo_appinfo_get_list(%d)", pkgmgr_ret);
+ ACCOUNT_RETURN_VAL((ahandle != NULL), {}, _ACCOUNT_ERROR_NO_DATA, ("appinfo handle is NULL"));
+ ACCOUNT_RETURN_VAL((phandle != NULL), {}, _ACCOUNT_ERROR_NO_DATA, ("pkginfo handle is NULL"));
+ ACCOUNT_RETURN_VAL((package_id != NULL), {}, _ACCOUNT_ERROR_NO_DATA, ("package_id is NULL"));
+ ACCOUNT_RETURN_VAL((appid_list != NULL), {}, _ACCOUNT_ERROR_NO_DATA, ("appid_list is NULL"));
/* Compare current app id with the stored app id family */
for (iter = appid_list; iter != NULL; iter = g_slist_next(iter)) {
char *package_id = NULL;
GSList *appid_list = NULL;
GSList *iter = NULL;
+ int pkgmgr_ret = -1;
if (!appid) {
ACCOUNT_ERROR("input param -appid is null\n");
}
/* Get app id family which is stored in account database */
- int pkgmgr_ret = -1;
- if (uid == OWNER_ROOT || uid == GLOBAL_USER)
- pkgmgr_ret = pkgmgrinfo_appinfo_get_appinfo(appid, &ahandle);
- else
- pkgmgr_ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, uid, &ahandle);
-
- if (pkgmgr_ret != PMINFO_R_OK)
- ACCOUNT_DEBUG("pkgmgrinfo_appinfo_get_appinfo(%d)", pkgmgr_ret);
-
- pkgmgr_ret = pkgmgrinfo_appinfo_get_pkgid(ahandle, &package_id);
- if (pkgmgr_ret != PMINFO_R_OK)
- ACCOUNT_DEBUG("pkgmgrinfo_appinfo_get_pkgid(%d)", pkgmgr_ret);
-
- if (uid == OWNER_ROOT || uid == GLOBAL_USER)
- pkgmgr_ret = pkgmgrinfo_pkginfo_get_pkginfo(package_id, &phandle);
- else
- pkgmgr_ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(package_id, uid, &phandle);
+ _account_get_appid_from_db(&ahandle, &phandle, &package_id, appid, uid, &appid_list);
- if (pkgmgr_ret != PMINFO_R_OK)
- ACCOUNT_DEBUG("pkgmgrinfo_pkginfo_get_pkginfo(%d)", pkgmgr_ret);
-
- if (uid == OWNER_ROOT || uid == GLOBAL_USER)
- pkgmgr_ret = pkgmgrinfo_appinfo_get_list(phandle, PMINFO_ALL_APP, _account_get_current_appid_cb, (void *)&appid_list);
- else
- pkgmgr_ret = pkgmgrinfo_appinfo_get_usr_list(phandle, PMINFO_ALL_APP, _account_get_current_appid_cb, (void *)&appid_list, uid);
-
- if (pkgmgr_ret != PMINFO_R_OK)
- ACCOUNT_DEBUG("pkgmgrinfo_appinfo_get_list(%d)", pkgmgr_ret);
+ ACCOUNT_RETURN_VAL((ahandle != NULL), {}, _ACCOUNT_ERROR_NO_DATA, ("appinfo handle is NULL"));
+ ACCOUNT_RETURN_VAL((phandle != NULL), {}, _ACCOUNT_ERROR_NO_DATA, ("pkginfo handle is NULL"));
+ ACCOUNT_RETURN_VAL((package_id != NULL), {}, _ACCOUNT_ERROR_NO_DATA, ("package_id is NULL"));
+ ACCOUNT_RETURN_VAL((appid_list != NULL), {}, _ACCOUNT_ERROR_NO_DATA, ("appid_list is NULL"));
/* Compare current app id with the stored app id family */
for (iter = appid_list; iter != NULL; iter = g_slist_next(iter)) {