char *getUserPkgParserDBPath(void);
char *getUserPkgParserDBPathUID(uid_t uid);
char *getUserPkgCertDBPath(void);
-char *getUserPkgCertDBPathUID(uid_t uid);
const char *getUserManifestPath(uid_t uid, bool readonly);
/**
if (pkgmgr_parser_initialize_parser_db(uid))
return PM_PARSER_R_ERROR;
- if (pkgmgr_parser_initialize_cert_db())
- return PM_PARSER_R_ERROR;
+ if (uid == OWNER_ROOT || uid == GLOBAL_USER)
+ if (pkgmgr_parser_initialize_cert_db())
+ return PM_PARSER_R_ERROR;
return PM_PARSER_R_OK;
}
}
/* open unified global cert db */
- dbpath = getUserPkgCertDBPathUID(GLOBAL_USER);
+ dbpath = getUserPkgCertDBPath();
if (dbpath == NULL)
return PMINFO_R_ERROR;
char *dbpath;
/* open unified global cert db */
- dbpath = getUserPkgCertDBPathUID(GLOBAL_USER);
+ dbpath = getUserPkgCertDBPath();
if (dbpath == NULL)
return PMINFO_R_ERROR;
_check_create_cert_db();
/* open unified global cert db */
- dbpath = getUserPkgCertDBPathUID(GLOBAL_USER);
+ dbpath = getUserPkgCertDBPath();
if (dbpath == NULL)
return PMINFO_R_ERROR;
}
/* open unified global cert db */
- dbpath = getUserPkgCertDBPathUID(GLOBAL_USER);
+ dbpath = getUserPkgCertDBPath();
if (dbpath == NULL)
return PMINFO_R_ERROR;
API char *getUserPkgCertDBPath(void)
{
- return getUserPkgCertDBPathUID(_getuid());
-}
-
-API char *getUserPkgCertDBPathUID(uid_t uid)
-{
- char pkgmgr_cert_db[PATH_MAX];
- uid_t uid_caller = getuid();
- gid_t gid = ROOT_UID;
char *db_path;
+ char pkgmgr_cert_db[PATH_MAX];
- db_path = _get_db_path(uid);
- if (db_path == NULL) {
- _LOGE("Failed to get db path %d", uid);
- return NULL;
- }
+ db_path = _get_db_path(GLOBAL_USER);
snprintf(pkgmgr_cert_db, sizeof(pkgmgr_cert_db),
"%s/.pkgmgr_cert.db", db_path);
-
- if (uid != GLOBAL_USER && uid != ROOT_UID) {
- tzplatform_set_user(uid);
- gid = _get_gid(tzplatform_getenv(TZ_SYS_USER_GROUP));
- tzplatform_reset_user();
- }
-
- /* just allow certain users to create the dbspace directory if needed. */
- if (uid_caller == ROOT_UID || uid_caller == APPFW_UID || uid_caller == uid)
- _mkdir_for_user(db_path, uid, gid);
-
free(db_path);
return strdup(pkgmgr_cert_db);