summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorDave Burke <daveburke@google.com>2012-10-23 23:12:19 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-10-23 23:12:19 -0700
commit383fa18b511c195cc51a96c5504442bfec998e9f (patch)
treed8b158e6fc1205970a0f2c43557acba84a4fbfd5 /cmds
parent4525f5b69cb44a9a0c92f9c525fc47541f456621 (diff)
downloadframeworks_base-383fa18b511c195cc51a96c5504442bfec998e9f.zip
frameworks_base-383fa18b511c195cc51a96c5504442bfec998e9f.tar.gz
frameworks_base-383fa18b511c195cc51a96c5504442bfec998e9f.tar.bz2
Revert "Check non-primary user dirs during package scan"
This reverts commit 4525f5b69cb44a9a0c92f9c525fc47541f456621 Change-Id: I31b7a0860972532478ab3420556b806bfa78739a
Diffstat (limited to 'cmds')
-rw-r--r--cmds/installd/commands.c33
1 files changed, 9 insertions, 24 deletions
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index e3acad9..8e4d7ed 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -141,54 +141,39 @@ int renamepkg(const char *oldpkgname, const char *newpkgname)
return 0;
}
-int fix_uid(const char *pkgname, uid_t uid, uid_t userId)
+int fix_uid(const char *pkgname, uid_t uid, gid_t gid)
{
char pkgdir[PKG_PATH_MAX];
struct stat s;
int rc = 0;
- if (uid < AID_SYSTEM) {
- ALOGE("invalid uid: %d\n", uid);
+ if ((uid < AID_SYSTEM) || (gid < AID_SYSTEM)) {
+ ALOGE("invalid uid/gid: %d %d\n", uid, gid);
return -1;
}
- if (create_pkg_path(pkgdir, pkgname, PKG_DIR_POSTFIX, userId)) {
+ if (create_pkg_path(pkgdir, pkgname, PKG_DIR_POSTFIX, 0)) {
ALOGE("cannot create package path\n");
return -1;
}
if (stat(pkgdir, &s) < 0) return -1;
- if (((s.st_uid != 0) && (s.st_uid != AID_INSTALL))
- || ((s.st_gid != 0) && (s.st_gid != AID_INSTALL))) {
- ALOGE("fixing uid of pkg not owned by install or root: %s %lu %lu\n", pkgdir, s.st_uid,
- s.st_gid);
- return -1;
- }
-
- if (chown(pkgdir, AID_INSTALL, AID_INSTALL) < 0) {
- ALOGE("cannot chown dir '%s': %s\n", pkgdir, strerror(errno));
- unlink(pkgdir);
+ if (s.st_uid != 0 || s.st_gid != 0) {
+ ALOGE("fixing uid of non-root pkg: %s %lu %lu\n", pkgdir, s.st_uid, s.st_gid);
return -1;
}
if (chmod(pkgdir, 0751) < 0) {
ALOGE("cannot chmod dir '%s': %s\n", pkgdir, strerror(errno));
unlink(pkgdir);
- return -1;
+ return -errno;
}
- if (chown(pkgdir, uid, uid) < 0) {
+ if (chown(pkgdir, uid, gid) < 0) {
ALOGE("cannot chown dir '%s': %s\n", pkgdir, strerror(errno));
unlink(pkgdir);
- return -1;
- }
-#ifdef HAVE_SELINUX
- if (selinux_android_setfilecon(pkgdir, pkgname, uid) < 0) {
- ALOGE("cannot setfilecon dir '%s': %s\n", pkgdir, strerror(errno));
- unlink(pkgdir);
- return -1;
+ return -errno;
}
-#endif
return 0;
}