summaryrefslogtreecommitdiffstats
path: root/sip
diff options
context:
space:
mode:
authorBrad Ebinger <breadley@google.com>2016-10-10 19:42:41 +0000
committerBrad Ebinger <breadley@google.com>2016-10-10 19:48:24 +0000
commitc3bd9d08a5b5fc810d27a65331e34a333d063a91 (patch)
tree22e9a5d7790a57d7f341f1d36ec4ce8269c7183b /sip
parentc70cf1f8179be4eee95dd79cfcdb09b955a632f6 (diff)
downloadandroid_packages_services_Telephony-c3bd9d08a5b5fc810d27a65331e34a333d063a91.tar.gz
android_packages_services_Telephony-c3bd9d08a5b5fc810d27a65331e34a333d063a91.tar.bz2
android_packages_services_Telephony-c3bd9d08a5b5fc810d27a65331e34a333d063a91.zip
Revert "Restrict SipProfiles to profiles directory"
This reverts commit 4c761b96c2ee36410603df8e8a4fb4e07c12ede0. Change-Id: Ib4c2476b1f5c39b49dac8f0f828676dac14ccf99
Diffstat (limited to 'sip')
-rw-r--r--sip/src/com/android/services/telephony/sip/SipEditor.java2
-rw-r--r--sip/src/com/android/services/telephony/sip/SipProfileDb.java29
2 files changed, 4 insertions, 27 deletions
diff --git a/sip/src/com/android/services/telephony/sip/SipEditor.java b/sip/src/com/android/services/telephony/sip/SipEditor.java
index 1cee25b24..8bc7734de 100644
--- a/sip/src/com/android/services/telephony/sip/SipEditor.java
+++ b/sip/src/com/android/services/telephony/sip/SipEditor.java
@@ -258,7 +258,7 @@ public class SipEditor extends PreferenceActivity
*
* @param p The {@link SipProfile} to delete.
*/
- private void deleteAndUnregisterProfile(SipProfile p) throws IOException {
+ private void deleteAndUnregisterProfile(SipProfile p) {
if (p == null) return;
mProfileDb.deleteProfile(p);
mSipAccountRegistry.stopSipService(this, p.getProfileName());
diff --git a/sip/src/com/android/services/telephony/sip/SipProfileDb.java b/sip/src/com/android/services/telephony/sip/SipProfileDb.java
index bb1c7ecd3..e7b201b25 100644
--- a/sip/src/com/android/services/telephony/sip/SipProfileDb.java
+++ b/sip/src/com/android/services/telephony/sip/SipProfileDb.java
@@ -21,7 +21,6 @@ import com.android.internal.os.AtomicFile;
import android.content.Context;
import android.net.sip.SipProfile;
import android.text.TextUtils;
-import android.util.EventLog;
import android.util.Log;
import java.io.File;
@@ -67,13 +66,9 @@ class SipProfileDb {
mSipPreferences = new SipPreferences(mContext);
}
- public void deleteProfile(SipProfile p) throws IOException {
+ public void deleteProfile(SipProfile p) {
synchronized(SipProfileDb.class) {
- File profileFile = new File(mProfilesDirectory, p.getProfileName());
- if (!isChild(new File(mProfilesDirectory), profileFile)) {
- throw new IOException("Invalid Profile Credentials!");
- }
- deleteProfile(profileFile);
+ deleteProfile(new File(mProfilesDirectory + p.getProfileName()));
if (mProfilesCount < 0) retrieveSipProfileListInternal();
}
}
@@ -98,10 +93,7 @@ class SipProfileDb {
public void saveProfile(SipProfile p) throws IOException {
synchronized(SipProfileDb.class) {
if (mProfilesCount < 0) retrieveSipProfileListInternal();
- File f = new File(mProfilesDirectory, p.getProfileName());
- if (!isChild(new File(mProfilesDirectory), f)) {
- throw new IOException("Invalid Profile Credentials!");
- }
+ File f = new File(mProfilesDirectory + p.getProfileName());
if (!f.exists()) f.mkdirs();
AtomicFile atomicFile = new AtomicFile(new File(f, PROFILE_OBJ_FILE));
FileOutputStream fos = null;
@@ -181,19 +173,4 @@ class SipProfileDb {
private static void log(String msg) {
Log.d(SipUtil.LOG_TAG, PREFIX + msg);
}
-
- /**
- * Verifies that the file is a direct child of the base directory.
- */
- private boolean isChild(File base, File file) {
- if (base == null || file == null) {
- return false;
- }
- if (!base.equals(file.getAbsoluteFile().getParentFile())) {
- Log.w(SipUtil.LOG_TAG, "isChild, file is not a child of the base dir.");
- EventLog.writeEvent(0x534e4554, "31530456", -1, "");
- return false;
- }
- return true;
- }
}