result = strdup(APP_INFO_DB_FILE);
journal = strdup(APP_INFO_DB_FILE_JOURNAL);
/* chsmack */
- if (smack_setlabel(result, SMACK_LABEL, SMACK_LABEL_ACCESS)) {
- _E("failed chsmack -a \"%s\" %s", SMACK_LABEL, result);
- } else {
- _D("chsmack -a \"%s\" %s", SMACK_LABEL, result);
- }
- if (smack_setlabel(journal, SMACK_LABEL, SMACK_LABEL_ACCESS)) {
- _E("failed chsmack -a \"%s\" %s", SMACK_LABEL, journal);
- } else {
- _D("chsmack -a \"%s\" %s", SMACK_LABEL, journal);
- }
+ /*Check if we have permission to do it*/
+ if (geteuid() == 0) {
+ if (smack_setlabel(result, SMACK_LABEL, SMACK_LABEL_ACCESS)) {
+ _E("failed chsmack -a \"%s\" %s", SMACK_LABEL, result);
+ } else {
+ _D("chsmack -a \"%s\" %s", SMACK_LABEL, result);
+ }
+ if (smack_setlabel(journal, SMACK_LABEL, SMACK_LABEL_ACCESS)) {
+ _E("failed chsmack -a \"%s\" %s", SMACK_LABEL, journal);
+ } else {
+ _D("chsmack -a \"%s\" %s", SMACK_LABEL, journal);
+ }
+ }
}
dir = strrchr(result, '/');
if(!dir)
return result;
-
- int ret;
- mkdir(dir + 1, S_IRWXU | S_IRGRP | S_IXGRP | S_IXOTH);
- ret = chown(dir + 1, uid, grpinfo->gr_gid);
- if (ret == -1) {
- char buf[BUFSIZE];
- strerror_r(errno, buf, sizeof(buf));
- _E("FAIL : chown %s %d.%d, because %s", dir + 1, uid, grpinfo->gr_gid, buf);
+ if ((uid != GLOBAL_USER)||((uid == GLOBAL_USER)&& (geteuid() == 0 ))) {
+ int ret;
+ mkdir(dir + 1, S_IRWXU | S_IRGRP | S_IXGRP | S_IXOTH);
+ ret = chown(dir + 1, uid, grpinfo->gr_gid);
+ if (ret == -1) {
+ char buf[BUFSIZE];
+ strerror_r(errno, buf, sizeof(buf));
+ _E("FAIL : chown %s %d.%d, because %s", dir + 1, uid, grpinfo->gr_gid, buf);
+ }
}
-
return result;
}
_D("chsmack -a \"%s\" %s", SMACK_LABEL, result);
}
}
-
- int ret;
- mkdir(result, S_IRWXU | S_IRGRP | S_IXGRP | S_IXOTH);
- ret = chown(result, uid, grpinfo->gr_gid);
- if (ret == -1) {
- char buf[BUFSIZE];
- strerror_r(errno, buf, sizeof(buf));
- _E("FAIL : chown %s %d.%d, because %s", result, uid, grpinfo->gr_gid, buf);
+ if ((uid != GLOBAL_USER)||((uid == GLOBAL_USER)&& (geteuid() == 0 ))) {
+ int ret;
+ mkdir(result, S_IRWXU | S_IRGRP | S_IXGRP | S_IXOTH);
+ ret = chown(result, uid, grpinfo->gr_gid);
+ if (ret == -1) {
+ char buf[BUFSIZE];
+ strerror_r(errno, buf, sizeof(buf));
+ _E("FAIL : chown %s %d.%d, because %s", result, uid, grpinfo->gr_gid, buf);
+ }
}
return result;
}
char query_view_app[AIL_SQL_QUERY_MAX_LEN];
char query_view_local[AIL_SQL_QUERY_MAX_LEN];
snprintf(query_attach, AIL_SQL_QUERY_MAX_LEN, QUERY_ATTACH, ail_get_app_DB(GLOBAL_USER));
- _E("info : execute query_attach : %s", query_attach );
+ _D("info : execute query_attach : %s", query_attach );
if (db_exec_usr_ro(query_attach) < 0) {
return AIL_ERROR_DB_FAILED;
}
snprintf(query_view_app, AIL_SQL_QUERY_MAX_LEN, QUERY_CREATE_VIEW_APP);
- _E("info : execute query_attach : %s", query_view_app );
+ _D("info : execute query_attach : %s", query_view_app );
if (db_exec_usr_ro(query_view_app) < 0) {
return AIL_ERROR_DB_FAILED;
}
snprintf(query_view_local, AIL_SQL_QUERY_MAX_LEN, QUERY_CREATE_VIEW_LOCAL);
- _E("info : execute query_attach : %s", query_view_local );
+ _D("info : execute query_attach : %s", query_view_local );
if (db_exec_usr_ro(query_view_local) < 0) {
return AIL_ERROR_DB_FAILED;
}
char* theme = NULL;
char* icon_with_path = NULL;
int len;
+ char *app_path = NULL;
package = _get_package_from_icon(icon);
retv_if(!package, NULL);
sqlite3_snprintf( len, icon_with_path, "%s%q", ail_get_icon_path(uid), icon);
else
sqlite3_snprintf( len, icon_with_path, "%s/%q/small/%q", ail_get_icon_path(GLOBAL_USER), theme, icon);
- if (!access (icon_with_path, F_OK))
- sqlite3_snprintf( len, icon_with_path, "%s/%q/res/icons/%q/small/%q", tzplatform_getenv(TZ_SYS_RO_APP), package, theme, icon);
- else if (!access (icon_with_path, F_OK))
- sqlite3_snprintf( len, icon_with_path, "%s/%q/res/icons/%q/small/%q", tzplatform_getenv(TZ_SYS_RW_APP), package, theme, icon);
- else
- _D("Cannot find icon path");
+
+ if (access (icon_with_path, F_OK)) {
+ app_path = tzplatform_getenv(TZ_SYS_RW_APP);
+ if (app_path)
+ sqlite3_snprintf( len, icon_with_path, "%s/%q/res/icons/%q/small/%q",app_path, package, theme, icon);
+ if (access (icon_with_path, F_OK))
+ _E("Cannot find icon path");
+ }
free(theme);
free(package);
_D("Icon path : %s", icon_with_path);
-
-
return icon_with_path;
} else {
char* confirmed_icon = NULL;