From d8a10a7d9f9de6dd86ed382c3eb7a22bbd8cd21e Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Mon, 16 Mar 2015 10:33:54 +0100 Subject: Only return not deleted profiles on the external API --- main/src/main/java/de/blinkt/openvpn/VpnProfile.java | 2 +- .../src/main/java/de/blinkt/openvpn/activities/VPNPreferences.java | 5 +---- .../main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java | 7 ++++--- main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java | 1 - 4 files changed, 6 insertions(+), 9 deletions(-) (limited to 'main/src') diff --git a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java index 1587e2cd..73e095ad 100644 --- a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java +++ b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java @@ -94,7 +94,7 @@ public class VpnProfile implements Serializable, Cloneable { // variable named wrong and should haven beeen transient // but needs to keep wrong name to guarante loading of old // profiles - public transient boolean profileDleted = false; + public transient boolean profileDeleted = false; public int mAuthenticationType = TYPE_KEYSTORE; public String mName; public String mAlias; diff --git a/main/src/main/java/de/blinkt/openvpn/activities/VPNPreferences.java b/main/src/main/java/de/blinkt/openvpn/activities/VPNPreferences.java index c8f34519..f56a2d48 100644 --- a/main/src/main/java/de/blinkt/openvpn/activities/VPNPreferences.java +++ b/main/src/main/java/de/blinkt/openvpn/activities/VPNPreferences.java @@ -9,7 +9,6 @@ import android.annotation.TargetApi; import android.app.ActionBar; import android.app.Activity; import android.app.AlertDialog; -import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Build; @@ -18,8 +17,6 @@ import android.preference.PreferenceActivity; import android.support.v4n.view.ViewPager; import android.view.Menu; import android.view.MenuItem; -import android.widget.EditText; -import android.widget.Toast; import de.blinkt.openvpn.R; import de.blinkt.openvpn.VpnProfile; @@ -81,7 +78,7 @@ public class VPNPreferences extends Activity { getProfile(); // When a profile is deleted from a category fragment in hadset mod we need to finish // this activity as well when returning - if (mProfile==null || mProfile.profileDleted) { + if (mProfile==null || mProfile.profileDeleted) { setResult(VPNProfileList.RESULT_VPN_DELETED); finish(); } diff --git a/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java b/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java index 16f7abcf..27143781 100644 --- a/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java +++ b/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java @@ -24,7 +24,6 @@ import android.os.ParcelFileDescriptor; import android.os.RemoteCallbackList; import android.os.RemoteException; -import java.io.FileDescriptor; import java.io.IOException; import java.io.StringReader; import java.lang.ref.WeakReference; @@ -115,8 +114,10 @@ public class ExternalOpenVPNService extends Service implements StateListener { List profiles = new LinkedList(); - for (VpnProfile vp : pm.getProfiles()) - profiles.add(new APIVpnProfile(vp.getUUIDString(), vp.mName, vp.mUserEditable)); + for (VpnProfile vp : pm.getProfiles()) { + if (!vp.profileDeleted) + profiles.add(new APIVpnProfile(vp.getUUIDString(), vp.mName, vp.mUserEditable)); + } return profiles; } diff --git a/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java b/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java index 5f5d486c..fe51aff2 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java +++ b/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java @@ -581,7 +581,6 @@ public class ConfigParser { np.mAuthenticationType = VpnProfile.TYPE_USERPASS_KEYSTORE; } if (authuser.size() > 1) { - // Set option value to password get to embed later. np.mUsername = null; useEmbbedUserAuth(np, authuser.get(1)); } -- cgit v1.2.3