diff options
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java | 15 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/VpnStatus.java | 6 |
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)); } |