mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 19:52:17 -05:00
fixed security issue -- account databases previously world-readable and accessible to any app if UUID is known.
This commit is contained in:
parent
b5a57fe40c
commit
ed4c74983e
@ -6,6 +6,7 @@ import java.util.concurrent.locks.ReadWriteLock;
|
|||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
|
import android.content.Context;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.database.sqlite.SQLiteException;
|
import android.database.sqlite.SQLiteException;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -370,12 +371,12 @@ public class LockableDatabase {
|
|||||||
try {
|
try {
|
||||||
final File databaseFile = prepareStorage(mStorageProviderId);
|
final File databaseFile = prepareStorage(mStorageProviderId);
|
||||||
try {
|
try {
|
||||||
mDb = SQLiteDatabase.openOrCreateDatabase(databaseFile, null);
|
mDb = application.openOrCreateDatabase(databaseFile.getPath(), Context.MODE_PRIVATE, null);
|
||||||
} catch (SQLiteException e) {
|
} catch (SQLiteException e) {
|
||||||
// try to gracefully handle DB corruption - see issue 2537
|
// try to gracefully handle DB corruption - see issue 2537
|
||||||
Log.w(K9.LOG_TAG, "Unable to open DB " + databaseFile + " - removing file and retrying", e);
|
Log.w(K9.LOG_TAG, "Unable to open DB " + databaseFile + " - removing file and retrying", e);
|
||||||
databaseFile.delete();
|
databaseFile.delete();
|
||||||
mDb = SQLiteDatabase.openOrCreateDatabase(databaseFile, null);
|
mDb = application.openOrCreateDatabase(databaseFile.getPath(), Context.MODE_PRIVATE, null);
|
||||||
}
|
}
|
||||||
if (mDb.getVersion() != mSchemaDefinition.getVersion()) {
|
if (mDb.getVersion() != mSchemaDefinition.getVersion()) {
|
||||||
mSchemaDefinition.doDbUpgrade(mDb);
|
mSchemaDefinition.doDbUpgrade(mDb);
|
||||||
|
Loading…
Reference in New Issue
Block a user