diff options
| -rw-r--r-- | icsopenvpn.iml | 5 | ||||
| -rw-r--r-- | src/de/blinkt/openvpn/core/OpenVpnService.java | 8 | ||||
| -rw-r--r-- | src/de/blinkt/openvpn/core/X509Utils.java | 16 | ||||
| -rw-r--r-- | src/de/blinkt/openvpn/fragments/OpenVpnPreferencesFragment.java | 10 | 
4 files changed, 20 insertions, 19 deletions
diff --git a/icsopenvpn.iml b/icsopenvpn.iml index 922231a6..48d3ed0d 100644 --- a/icsopenvpn.iml +++ b/icsopenvpn.iml @@ -11,12 +11,11 @@      <facet type="android-gradle" name="Android-Gradle">        <configuration>          <option name="GRADLE_PROJECT_PATH" value=":" /> -        <option name="PROJECT_ABSOLUTE_PATH" value="$MODULE_DIR$" /> -        <option name="GRADLE_HOME_DIR_PATH" />        </configuration>      </facet>    </component> -  <component name="NewModuleRootManager" inherit-compiler-output="true"> +  <component name="NewModuleRootManager" inherit-compiler-output="false"> +    <output url="file://$MODULE_DIR$/build/classes/debug" />      <exclude-output />      <content url="file://$MODULE_DIR$">        <sourceFolder url="file://$MODULE_DIR$/build/source/r/debug" isTestSource="false" /> diff --git a/src/de/blinkt/openvpn/core/OpenVpnService.java b/src/de/blinkt/openvpn/core/OpenVpnService.java index 0bfc150a..6aacf891 100644 --- a/src/de/blinkt/openvpn/core/OpenVpnService.java +++ b/src/de/blinkt/openvpn/core/OpenVpnService.java @@ -155,7 +155,6 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac      private int getIconByConnectionStatus(ConnectionStatus level) {         switch (level) {             case LEVEL_CONNECTED: -           case UNKNOWN_LEVEL:                 return R.drawable.ic_stat_vpn;             case LEVEL_AUTH_FAILED:             case LEVEL_NONETWORK: @@ -168,6 +167,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac                 return R.drawable.ic_stat_vpn_empty_halo;             case LEVEL_VPNPAUSED:                 return android.R.drawable.ic_media_pause; +           case UNKNOWN_LEVEL:             default:                 return R.drawable.ic_stat_vpn; @@ -228,7 +228,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac  		// Let the configure Button show the Log  		Intent intent = new Intent(getBaseContext(),LogWindow.class);  		intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); -		PendingIntent startLW = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0); +		PendingIntent startLW = PendingIntent.getActivity(this, 0, intent, 0);  		intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);  		return startLW; @@ -373,8 +373,8 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac  		ProfileManager.setConnectedVpnProfile(this, mProfile); -		return START_NOT_STICKY; -	} +        return START_NOT_STICKY; +    }  	private OpenVPNManagement instantiateOpenVPN3Core() {  		return null; diff --git a/src/de/blinkt/openvpn/core/X509Utils.java b/src/de/blinkt/openvpn/core/X509Utils.java index ff1e932f..b533c886 100644 --- a/src/de/blinkt/openvpn/core/X509Utils.java +++ b/src/de/blinkt/openvpn/core/X509Utils.java @@ -18,10 +18,18 @@ public class X509Utils {  		InputStream inStream; -		if(certfilename.startsWith(VpnProfile.INLINE_TAG)) -			inStream = new ByteArrayInputStream(certfilename.replace(VpnProfile.INLINE_TAG,"").getBytes()); -		else  +		if(certfilename.startsWith(VpnProfile.INLINE_TAG)) { +            // The java certifcate reader is ... kind of stupid +            // It does NOT ignore chars before the --BEGIN ... +            int subIndex = certfilename.indexOf("-----BEGIN CERTIFICATE-----"); +            subIndex = Math.max(0,subIndex); +			inStream = new ByteArrayInputStream(certfilename.substring(subIndex).getBytes()); + + +        } else {  			inStream = new FileInputStream(certfilename); +        } +  		return certFact.generateCertificate(inStream);  	} @@ -55,7 +63,7 @@ public class X509Utils {  				OpenVPN.logError("Could not read certificate" + e.getLocalizedMessage());  			}  		} -		return "Could not read/parse certificate"; +		return "Cannot display certificate information";  	}      public static String getCertificateFriendlyName(X509Certificate cert) { diff --git a/src/de/blinkt/openvpn/fragments/OpenVpnPreferencesFragment.java b/src/de/blinkt/openvpn/fragments/OpenVpnPreferencesFragment.java index ae9f2004..f23a50db 100644 --- a/src/de/blinkt/openvpn/fragments/OpenVpnPreferencesFragment.java +++ b/src/de/blinkt/openvpn/fragments/OpenVpnPreferencesFragment.java @@ -38,14 +38,8 @@ public abstract class OpenVpnPreferencesFragment extends PreferenceFragment {  			loadSettings();
  		}
  	}
 -	
 -	@Override
 -	public void onStop() {
 -		// TODO Auto-generated method stub
 -		super.onStop();
 -	}
 -	
 -	@Override
 +
 +    @Override
  	public void onSaveInstanceState (Bundle outState) {
  		super.onSaveInstanceState(outState);
  		saveSettings();
  | 
