summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers/downloads
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2016-08-09 20:01:43 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-08-09 20:01:43 +0000
commitf4607cbdb81dc7461204acf6e1db033b7bbface5 (patch)
treee51c61a86675375443f9a67c5f1355dae48e5f9c /src/com/android/providers/downloads
parent7b7fa39decefca0ff83b1e3758cba11df90f94cd (diff)
parent80ab64c562842fef49509dbf876cd29ef55c0727 (diff)
downloadandroid_packages_providers_DownloadProvider-f4607cbdb81dc7461204acf6e1db033b7bbface5.tar.gz
android_packages_providers_DownloadProvider-f4607cbdb81dc7461204acf6e1db033b7bbface5.tar.bz2
android_packages_providers_DownloadProvider-f4607cbdb81dc7461204acf6e1db033b7bbface5.zip
Enforce calling identity before clearing. am: 8be3a92eb0 am: ec19fe6485 am: b3ce7976f2 am: 860239d87e am: 616f47abce am: a9ea617232 am: 567e549614 am: 14ae5650e4
am: 80ab64c562 Change-Id: I8ef0c4042a97682885897dc23c7a676d4d746ca6
Diffstat (limited to 'src/com/android/providers/downloads')
-rw-r--r--src/com/android/providers/downloads/DownloadProvider.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/com/android/providers/downloads/DownloadProvider.java b/src/com/android/providers/downloads/DownloadProvider.java
index d30018f7..a4bc9fef 100644
--- a/src/com/android/providers/downloads/DownloadProvider.java
+++ b/src/com/android/providers/downloads/DownloadProvider.java
@@ -1260,6 +1260,19 @@ public final class DownloadProvider extends ContentProvider {
logVerboseOpenFileInfo(uri, mode);
}
+ // Perform normal query to enforce caller identity access before
+ // clearing it to reach internal-only columns
+ final Cursor probeCursor = query(uri, new String[] {
+ Downloads.Impl._DATA }, null, null, null);
+ try {
+ if ((probeCursor == null) || (probeCursor.getCount() == 0)) {
+ throw new FileNotFoundException(
+ "No file found for " + uri + " as UID " + Binder.getCallingUid());
+ }
+ } finally {
+ IoUtils.closeQuietly(probeCursor);
+ }
+
final Cursor cursor = queryCleared(uri, new String[] {
Downloads.Impl._DATA, Downloads.Impl.COLUMN_STATUS,
Downloads.Impl.COLUMN_DESTINATION, Downloads.Impl.COLUMN_MEDIA_SCANNED }, null,