diff options
author | Arne Schwabe <arne@rfc2549.org> | 2013-02-07 23:59:39 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2013-02-07 23:59:39 +0100 |
commit | fa9f76f27cf1a50122227e8ff9e98adb8eeb44f0 (patch) | |
tree | fd3d75982335fdef8ce507a20fcd825ca8196908 /src/de | |
parent | 811436bea4925a657ce8a986c64513f76a5f2aa5 (diff) |
More fixes for OpenVPN v3 Core
--HG--
branch : ovpn3
Diffstat (limited to 'src/de')
-rw-r--r-- | src/de/blinkt/openvpn/OpenVPNThreadv3.java | 14 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/OpenVpnService.java | 15 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/VpnProfile.java | 7 |
3 files changed, 22 insertions, 14 deletions
diff --git a/src/de/blinkt/openvpn/OpenVPNThreadv3.java b/src/de/blinkt/openvpn/OpenVPNThreadv3.java index 5981ffbb..36fcc985 100644 --- a/src/de/blinkt/openvpn/OpenVPNThreadv3.java +++ b/src/de/blinkt/openvpn/OpenVPNThreadv3.java @@ -191,11 +191,15 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable } @Override - public void event(ClientAPI_Event arg0) { - if(arg0.getError()) - OpenVPN.logError(String.format("EVENT(Error): %s: %s",arg0.getName(),arg0.getInfo())); - else - OpenVPN.logInfo(String.format("EVENT %s: %s",arg0.getName(),arg0.getInfo())); + public void event(ClientAPI_Event event) { + OpenVPN.updateStateString(event.getName(), event.getInfo()); + if(event.getError()) + OpenVPN.logError(String.format("EVENT(Error): %s: %s",event.getName(),event.getInfo())); + } + + public void stopVPN() { + stop(); + } } diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java index bf48bb3f..675e44b9 100644 --- a/src/de/blinkt/openvpn/OpenVpnService.java +++ b/src/de/blinkt/openvpn/OpenVpnService.java @@ -88,6 +88,8 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac private static boolean mNotificationalwaysVisible=false; private final IBinder mBinder = new LocalBinder(); + private boolean mOvpn3; + private OpenVPNThreadv3 mOpenVPN3; public class LocalBinder extends Binder { public OpenVpnService getService() { @@ -107,7 +109,10 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac @Override public void onRevoke() { - OpenVpnManagementThread.stopOpenVPN(); + if(!mOvpn3) + OpenVpnManagementThread.stopOpenVPN(); + else + mOpenVPN3.stopVPN(); endVpnService(); } @@ -309,14 +314,14 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac // Start a new session by creating a new thread. SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); - boolean ovpn3 = prefs.getBoolean("ovpn3", false); + mOvpn3 = prefs.getBoolean("ovpn3", false); Runnable processThread; - if(ovpn3) { + if(mOvpn3) { - OpenVPNThreadv3 v3Thread = new OpenVPNThreadv3(this,mProfile); + mOpenVPN3 = new OpenVPNThreadv3(this,mProfile); - processThread = v3Thread; + processThread = mOpenVPN3; } else { diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java index 2f2a10a8..ea034b55 100644 --- a/src/de/blinkt/openvpn/VpnProfile.java +++ b/src/de/blinkt/openvpn/VpnProfile.java @@ -782,8 +782,8 @@ public class VpnProfile implements Serializable{ rsasinger.init(Cipher.ENCRYPT_MODE, privkey); byte[] signed_bytes = rsasinger.doFinal(data); - String signed_string = Base64.encodeToString(signed_bytes, Base64.NO_WRAP); - ; + return Base64.encodeToString(signed_bytes, Base64.NO_WRAP); + } catch (NoSuchAlgorithmException e){ err =e; } catch (InvalidKeyException e) { @@ -824,8 +824,7 @@ public class VpnProfile implements Serializable{ getPkeyContext.setAccessible(false); byte[] signed_bytes = rsasign(data, pkey); - String signed_string = Base64.encodeToString(signed_bytes, Base64.NO_WRAP); - return signed_string; + return Base64.encodeToString(signed_bytes, Base64.NO_WRAP); } catch (NoSuchMethodException e) { err=e; |