From 5dcf48a2c5956a763694f24472bcd48434fc1c94 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Fri, 27 Apr 2012 15:33:58 -0700 Subject: Fix truncation of ASEC ids Change-Id: I1e6bfcc6b0a5be47e6fd19922fc81669f61b5dba --- CommandListener.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommandListener.cpp b/CommandListener.cpp index d75d76c..dff4625 100644 --- a/CommandListener.cpp +++ b/CommandListener.cpp @@ -290,7 +290,7 @@ void CommandListener::AsecCmd::listAsecsInDirectory(SocketClient *cli, const cha !strcmp(&dent->d_name[name_len - 5], ".asec")) { char id[255]; memset(id, 0, sizeof(id)); - strlcpy(id, dent->d_name, name_len - 5); + strlcpy(id, dent->d_name, name_len - 4); cli->sendMsg(ResponseCode::AsecListResult, id, false); } } -- cgit v1.1 From 59f31de0d445b61a1f04d1362c276a960ebbea70 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Thu, 10 May 2012 15:39:53 -0700 Subject: Only set permissions on dirs or files Traversal would mark directories with the correct permissions, but they're visited again in post-order which is a different fts_info flag. Then it would set that to regular file permissions. Explicitly check to make sure we're looking at a file instead. Bug: 6478606 Change-Id: I13cab3e69f451da6a994fa974d575ef366f82025 --- VolumeManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VolumeManager.cpp b/VolumeManager.cpp index 3a63a19..fe1ce8e 100644 --- a/VolumeManager.cpp +++ b/VolumeManager.cpp @@ -571,7 +571,7 @@ int VolumeManager::fixupAsecPermissions(const char *id, gid_t gid, const char* f if (ftsent->fts_info & FTS_D) { result |= fchmod(fd, 0711); - } else { + } else if (ftsent->fts_info & FTS_F) { result |= fchmod(fd, privateFile ? 0640 : 0644); } close(fd); -- cgit v1.1 From 4817b30fb3572e1dee0724eb202f2ea604feaf8f Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Thu, 10 May 2012 16:45:29 -0700 Subject: Native library loading needs to read directory When calling System.loadLibrary(), it needs to be able to read the directory to load the file. We could probably fix that, but changing permissions here is faster. Bug: 6478606 Change-Id: I296b0805839da5a19950157f9a16755a4d258ca8 --- VolumeManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VolumeManager.cpp b/VolumeManager.cpp index fe1ce8e..4c1621b 100644 --- a/VolumeManager.cpp +++ b/VolumeManager.cpp @@ -570,7 +570,7 @@ int VolumeManager::fixupAsecPermissions(const char *id, gid_t gid, const char* f result |= fchown(fd, AID_SYSTEM, privateFile? gid : AID_SYSTEM); if (ftsent->fts_info & FTS_D) { - result |= fchmod(fd, 0711); + result |= fchmod(fd, 0755); } else if (ftsent->fts_info & FTS_F) { result |= fchmod(fd, privateFile ? 0640 : 0644); } -- cgit v1.1