summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2014-11-26 18:34:43 +0100
committerArne Schwabe <arne@rfc2549.org>2014-11-26 18:34:43 +0100
commit47c84cf818ed14b857a070a95a994be8c673c3d1 (patch)
tree0775eafc6935ab104bbfca839d0cc31d84bd0cfe /main
parent7fb4309fddef72d3f23fa04209f5e3bef3859436 (diff)
Make starting profiles from external more robust
--HG-- extra : rebase_source : 96b69ad679621788b29f399983a6caa6bb069897
Diffstat (limited to 'main')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java15
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/VpnStatus.java6
2 files changed, 18 insertions, 3 deletions
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 a3974f54..ec38b7ce 100644
--- a/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java
+++ b/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java
@@ -123,8 +123,12 @@ public class ExternalOpenVPNService extends Service implements StateListener {
private void startProfile(VpnProfile vp)
{
Intent vpnPermissionIntent = VpnService.prepare(ExternalOpenVPNService.this);
- /* Check if we need to show the confirmation dialog */
- if(vpnPermissionIntent != null){
+ /* Check if we need to show the confirmation dialog,
+ * Check if we need to ask for username/password */
+
+ int needpw = vp.needUserPWInput(false);
+
+ if(vpnPermissionIntent != null || needpw != 0){
Intent shortVPNIntent = new Intent(Intent.ACTION_MAIN);
shortVPNIntent.setClass(getBaseContext(), de.blinkt.openvpn.LaunchVPN.class);
shortVPNIntent.putExtra(de.blinkt.openvpn.LaunchVPN.EXTRA_KEY, vp.getUUIDString());
@@ -142,6 +146,9 @@ public class ExternalOpenVPNService extends Service implements StateListener {
checkOpenVPNPermission();
VpnProfile vp = ProfileManager.get(getBaseContext(), profileUUID);
+ if (vp.checkProfile(getApplicationContext()) != R.string.no_error_found)
+ throw new RemoteException(getString(vp.checkProfile(getApplicationContext())));
+
startProfile(vp);
}
@@ -155,6 +162,10 @@ public class ExternalOpenVPNService extends Service implements StateListener {
if (vp.checkProfile(getApplicationContext()) != R.string.no_error_found)
throw new RemoteException(getString(vp.checkProfile(getApplicationContext())));
+ /*int needpw = vp.needUserPWInput(false);
+ if(needpw !=0)
+ throw new RemoteException("The inline file would require user input: " + getString(needpw));
+ */
ProfileManager.setTemporaryProfile(vp);
startProfile(vp);
diff --git a/main/src/main/java/de/blinkt/openvpn/core/VpnStatus.java b/main/src/main/java/de/blinkt/openvpn/core/VpnStatus.java
index 8bf3a443..d1269380 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/VpnStatus.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/VpnStatus.java
@@ -480,7 +480,11 @@ public class VpnStatus {
newLogItem(new LogItem(LogLevel.INFO, message));
}
- public static void logInfo(int resourceId, Object... args) {
+ public static void logDebug(String message) {
+ newLogItem(new LogItem(LogLevel.DEBUG, message));
+ }
+
+ public static void logInfo(int resourceId, Object... args) {
newLogItem(new LogItem(LogLevel.INFO, resourceId, args));
}