Merge "BackupManagerService files need new security labeling."
This commit is contained in:
@@ -27,6 +27,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
|
|||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
import android.os.SELinux;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.android.org.bouncycastle.util.encoders.Base64;
|
import com.android.org.bouncycastle.util.encoders.Base64;
|
||||||
@@ -64,6 +65,10 @@ public class LocalTransport extends IBackupTransport.Stub {
|
|||||||
|
|
||||||
public LocalTransport(Context context) {
|
public LocalTransport(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
mDataDir.mkdirs();
|
||||||
|
if (!SELinux.restorecon(mDataDir)) {
|
||||||
|
Log.e(TAG, "SELinux restorecon failed for " + mDataDir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Intent configurationIntent() {
|
public Intent configurationIntent() {
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ import android.os.ParcelFileDescriptor;
|
|||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
import android.os.SELinux;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
@@ -743,6 +744,9 @@ class BackupManagerService extends IBackupManager.Stub {
|
|||||||
// correct directory.
|
// correct directory.
|
||||||
mBaseStateDir = new File(Environment.getSecureDataDirectory(), "backup");
|
mBaseStateDir = new File(Environment.getSecureDataDirectory(), "backup");
|
||||||
mBaseStateDir.mkdirs();
|
mBaseStateDir.mkdirs();
|
||||||
|
if (!SELinux.restorecon(mBaseStateDir)) {
|
||||||
|
Slog.e(TAG, "SELinux restorecon failed on " + mBaseStateDir);
|
||||||
|
}
|
||||||
mDataDir = Environment.getDownloadCacheDirectory();
|
mDataDir = Environment.getDownloadCacheDirectory();
|
||||||
|
|
||||||
mPasswordHashFile = new File(mBaseStateDir, "pwhash");
|
mPasswordHashFile = new File(mBaseStateDir, "pwhash");
|
||||||
@@ -2133,6 +2137,10 @@ class BackupManagerService extends IBackupManager.Stub {
|
|||||||
ParcelFileDescriptor.MODE_CREATE |
|
ParcelFileDescriptor.MODE_CREATE |
|
||||||
ParcelFileDescriptor.MODE_TRUNCATE);
|
ParcelFileDescriptor.MODE_TRUNCATE);
|
||||||
|
|
||||||
|
if (!SELinux.restorecon(mBackupDataName)) {
|
||||||
|
Slog.e(TAG, "SELinux restorecon failed on " + mBackupDataName);
|
||||||
|
}
|
||||||
|
|
||||||
mNewState = ParcelFileDescriptor.open(mNewStateName,
|
mNewState = ParcelFileDescriptor.open(mNewStateName,
|
||||||
ParcelFileDescriptor.MODE_READ_WRITE |
|
ParcelFileDescriptor.MODE_READ_WRITE |
|
||||||
ParcelFileDescriptor.MODE_CREATE |
|
ParcelFileDescriptor.MODE_CREATE |
|
||||||
@@ -4572,6 +4580,10 @@ class BackupManagerService extends IBackupManager.Stub {
|
|||||||
ParcelFileDescriptor.MODE_CREATE |
|
ParcelFileDescriptor.MODE_CREATE |
|
||||||
ParcelFileDescriptor.MODE_TRUNCATE);
|
ParcelFileDescriptor.MODE_TRUNCATE);
|
||||||
|
|
||||||
|
if (!SELinux.restorecon(mBackupDataName)) {
|
||||||
|
Slog.e(TAG, "SElinux restorecon failed for " + mBackupDataName);
|
||||||
|
}
|
||||||
|
|
||||||
if (mTransport.getRestoreData(mBackupData) != BackupConstants.TRANSPORT_OK) {
|
if (mTransport.getRestoreData(mBackupData) != BackupConstants.TRANSPORT_OK) {
|
||||||
// Transport-level failure, so we wind everything up and
|
// Transport-level failure, so we wind everything up and
|
||||||
// terminate the restore operation.
|
// terminate the restore operation.
|
||||||
|
|||||||
Reference in New Issue
Block a user