diff options
| -rw-r--r-- | AndroidManifest.xml | 4 | ||||
| -rw-r--r-- | res/values/strings.xml | 1 | ||||
| -rw-r--r-- | src/de/blinkt/openvpn/ConfigParser.java | 20 | ||||
| -rw-r--r-- | src/de/blinkt/openvpn/LaunchVPN.java | 6 | ||||
| -rw-r--r-- | src/de/blinkt/openvpn/OpenVpnService.java | 6 | ||||
| -rw-r--r-- | src/de/blinkt/openvpn/ShowConfigFragment.java | 2 | ||||
| -rw-r--r-- | src/de/blinkt/openvpn/VpnProfile.java | 14 | 
7 files changed, 29 insertions, 24 deletions
| diff --git a/AndroidManifest.xml b/AndroidManifest.xml index effc6475..0adf7b44 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -17,8 +17,8 @@  <manifest xmlns:android="http://schemas.android.com/apk/res/android"      package="de.blinkt.openvpn" -    android:versionCode="37" -    android:versionName="0.5.12" > +    android:versionCode="38" +    android:versionName="0.5.12a" >      <uses-permission android:name="android.permission.INTERNET" />      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> diff --git a/res/values/strings.xml b/res/values/strings.xml index b6d43e91..6e280c19 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -234,6 +234,7 @@      <string name="advanced">Advanced</string>      <string name="export_config_title">ICS Openvpn Config</string>      <string name="warn_no_dns">No DNS servers being used. Name resolution may not work. Consider setting custom DNS Servers</string> +    <string name="dns_add_error">Could not add DNS Server \"%1$s\", rejected by the system: %2$s</string>  </resources>
\ No newline at end of file diff --git a/src/de/blinkt/openvpn/ConfigParser.java b/src/de/blinkt/openvpn/ConfigParser.java index e1b426fa..f9eac745 100644 --- a/src/de/blinkt/openvpn/ConfigParser.java +++ b/src/de/blinkt/openvpn/ConfigParser.java @@ -282,18 +282,20 @@ public class ConfigParser {  		// Also recognize tls-auth [inline] direction ...   		Vector<Vector<String>> tlsauthoptions = getAllOption("tls-auth", 1, 2); -		for(Vector<String> tlsauth:tlsauthoptions) { -			if(tlsauth!=null)  -			{ -				if(!tlsauth.get(1).equals("[inline]")) { -					np.mTLSAuthFilename=tlsauth.get(1); -					np.mUseTLSAuth=true; +		if(tlsauthoptions!=null) { +			for(Vector<String> tlsauth:tlsauthoptions) { +				if(tlsauth!=null)  +				{ +					if(!tlsauth.get(1).equals("[inline]")) { +						np.mTLSAuthFilename=tlsauth.get(1); +						np.mUseTLSAuth=true; +					} +					if(tlsauth.size()==3) +						np.mTLSAuthDirection=tlsauth.get(2);  				} -				if(tlsauth.size()==3) -					np.mTLSAuthDirection=tlsauth.get(2);  			}  		} - +		  		Vector<String> direction = getOption("key-direction", 1, 1);  		if(direction!=null)  			np.mTLSAuthDirection=direction.get(1); diff --git a/src/de/blinkt/openvpn/LaunchVPN.java b/src/de/blinkt/openvpn/LaunchVPN.java index 7c988b69..b057a392 100644 --- a/src/de/blinkt/openvpn/LaunchVPN.java +++ b/src/de/blinkt/openvpn/LaunchVPN.java @@ -340,7 +340,7 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener {  	}  	void launchVPN () { -		int vpnok = mSelectedProfile.checkProfile(); +		int vpnok = mSelectedProfile.checkProfile(this);  		if(vpnok!= R.string.no_error_found) {  			showConfigErrorDialog(vpnok);  			return; @@ -398,8 +398,8 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener {  			OpenVPN.logMessage(0, "", getString(R.string.building_configration));  			Intent startVPN = mSelectedProfile.prepareIntent(getBaseContext()); - -			startService(startVPN); +			if(startVPN!=null) +				startService(startVPN);  			finish();  		} diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java index 102e5d59..c28802f6 100644 --- a/src/de/blinkt/openvpn/OpenVpnService.java +++ b/src/de/blinkt/openvpn/OpenVpnService.java @@ -239,7 +239,11 @@ public class OpenVpnService extends VpnService implements StateListener {  		for (String dns : mDnslist ) { -			builder.addDnsServer(dns); +			try { +				builder.addDnsServer(dns); +			} catch (IllegalArgumentException iae) { +				OpenVPN.logError(R.string.dns_add_error, dns,iae.getLocalizedMessage()); +			}  		} diff --git a/src/de/blinkt/openvpn/ShowConfigFragment.java b/src/de/blinkt/openvpn/ShowConfigFragment.java index 8c8ab315..2f6c23d7 100644 --- a/src/de/blinkt/openvpn/ShowConfigFragment.java +++ b/src/de/blinkt/openvpn/ShowConfigFragment.java @@ -21,7 +21,7 @@ public class ShowConfigFragment extends Fragment {  		View v=inflater.inflate(R.layout.viewconfig, container,false);  		TextView cv = (TextView) v.findViewById(R.id.configview); -		int check=vp.checkProfile(); +		int check=vp.checkProfile(getActivity());  		if(check!=R.string.no_error_found) {  			cv.setText(check);  			configtext = getString(check); diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java index 64ca3db6..8d506f9b 100644 --- a/src/de/blinkt/openvpn/VpnProfile.java +++ b/src/de/blinkt/openvpn/VpnProfile.java @@ -447,7 +447,8 @@ public class VpnProfile implements  Serializable{  		Intent intent = new Intent(context,OpenVpnService.class);  		if(mAuthenticationType == VpnProfile.TYPE_KEYSTORE || mAuthenticationType == VpnProfile.TYPE_USERPASS_KEYSTORE) { -			saveCertificates(context); +			if(!saveCertificates(context)) +				return null;  		}  		intent.putExtra(prefix + ".ARGV" , buildOpenvpnArgv(context.getCacheDir())); @@ -468,7 +469,7 @@ public class VpnProfile implements  Serializable{  		return intent;  	} -	private void saveCertificates(Context context) { +	private boolean saveCertificates(Context context) {  		PrivateKey privateKey = null;  		X509Certificate[] cachain=null;  		try { @@ -521,7 +522,7 @@ public class VpnProfile implements  Serializable{  			} -			return; +			return true;  		} catch (InterruptedException e) {  			e.printStackTrace();  		} catch (FileNotFoundException e) { @@ -533,7 +534,7 @@ public class VpnProfile implements  Serializable{  		} catch (KeyChainException e) {  			OpenVPN.logMessage(0,"",context.getString(R.string.keychain_access));  		} - +		return false;  	}  	private Certificate getCacertFromFile() throws FileNotFoundException, CertificateException {  		 CertificateFactory certFact = CertificateFactory.getInstance("X.509"); @@ -550,7 +551,7 @@ public class VpnProfile implements  Serializable{  	//! Return an error if somethign is wrong -	int checkProfile() { +	int checkProfile(Context context) {  		if(mAuthenticationType==TYPE_KEYSTORE || mAuthenticationType==TYPE_USERPASS_KEYSTORE) {  			if(mAlias==null)   				return R.string.no_keystore_cert_selected; @@ -690,9 +691,6 @@ public class VpnProfile implements  Serializable{  	public PrivateKey getKeystoreKey() {  		return mPrivateKey;  	} - - -  } | 
