From ec65a38af4edc986f7f1a90e446cc8713c9ca05e Mon Sep 17 00:00:00 2001 From: schwabe Date: Sun, 29 Apr 2012 16:05:44 +0200 Subject: Version 0.4 had a User/password and static keys options that will not work. Fix that --- AndroidManifest.xml | 4 +-- res/layout/basic_settings.xml | 47 +++++++++++++++++--------------- res/values/strings.xml | 1 + src/de/blinkt/openvpn/BasicSettings.java | 10 ++++++- src/de/blinkt/openvpn/VpnProfile.java | 16 +++++++++-- 5 files changed, 50 insertions(+), 28 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 91c93336..b7b7d198 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -18,11 +18,11 @@ + android:versionName="0.0.4a" > - + diff --git a/res/layout/basic_settings.xml b/res/layout/basic_settings.xml index f6673491..37d2c733 100644 --- a/res/layout/basic_settings.xml +++ b/res/layout/basic_settings.xml @@ -33,11 +33,7 @@ - - - + android:inputType="text" /> --> - + + + + - - - - - + + - - + + + - - - - - - + + \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index a837840e..2a2135a3 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -103,4 +103,5 @@ An error has been found in your VPN configuration: Cannot parse the IPv4 address Cannot parse the custom routes + Leave empty to query on demand diff --git a/src/de/blinkt/openvpn/BasicSettings.java b/src/de/blinkt/openvpn/BasicSettings.java index 7c39eb94..51a4c2bc 100644 --- a/src/de/blinkt/openvpn/BasicSettings.java +++ b/src/de/blinkt/openvpn/BasicSettings.java @@ -173,10 +173,12 @@ public class BasicSettings extends Fragment implements View.OnClickListener, OnI mView.findViewById(R.id.certs).setVisibility(View.GONE); mView.findViewById(R.id.statickeys).setVisibility(View.GONE); mView.findViewById(R.id.keystore).setVisibility(View.GONE); + mView.findViewById(R.id.cacert).setVisibility(View.GONE); switch(type) { case VpnProfile.TYPE_CERTIFICATES: mView.findViewById(R.id.certs).setVisibility(View.VISIBLE); + mView.findViewById(R.id.cacert).setVisibility(View.VISIBLE); break; case VpnProfile.TYPE_PKCS12: mView.findViewById(R.id.pkcs12).setVisibility(View.VISIBLE); @@ -190,6 +192,8 @@ public class BasicSettings extends Fragment implements View.OnClickListener, OnI case VpnProfile.TYPE_USERPASS: mView.findViewById(R.id.userpassword).setVisibility(View.VISIBLE); + mView.findViewById(R.id.cacert).setVisibility(View.VISIBLE); + break; } @@ -208,7 +212,9 @@ public class BasicSettings extends Fragment implements View.OnClickListener, OnI mType.setSelection(mProfile.mAuthenticationType); mpkcs12.setData(mProfile.mPKCS12Filename); mPKCS12Password.setText(mProfile.mPKCS12Password); - + mUserName.setText(mProfile.mUsername); + mPassword.setText(mProfile.mPassword); + setAlias(); } @@ -229,6 +235,8 @@ public class BasicSettings extends Fragment implements View.OnClickListener, OnI mProfile.mPKCS12Filename = mpkcs12.getData(); mProfile.mPKCS12Password = mPKCS12Password.getText().toString(); + mProfile.mPassword = mPassword.getText().toString(); + mProfile.mUsername = mUserName.getText().toString(); } diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java index 2df4ec39..201bc111 100644 --- a/src/de/blinkt/openvpn/VpnProfile.java +++ b/src/de/blinkt/openvpn/VpnProfile.java @@ -70,8 +70,8 @@ public class VpnProfile implements Serializable{ public boolean mCheckRemoteCN=false; public boolean mExpectTLSCert=true; public String mRemoteCN=""; - private String mPassword; - private String mUsername; + public String mPassword=""; + public String mUsername=""; public boolean mRoutenopull=false; @@ -225,6 +225,13 @@ public class VpnProfile implements Serializable{ cfg+="\n"; cfg+="management-query-passwords\n"; break; + case VpnProfile.TYPE_USERPASS: + cfg+="ca " + mCaFilename + "\n"; + cfg+="auth-user-pass\n"; + cfg+="management-query-passwords\n"; + break; + + } @@ -233,7 +240,10 @@ public class VpnProfile implements Serializable{ } if(mUseTLSAuth) { - cfg+="tls-auth "; + if(mAuthenticationType==TYPE_STATICKEYS) + cfg+="static "; + else + cfg+="tls-auth "; cfg+=mTLSAuthFilename; cfg+=" "; cfg+= mTLSAuthDirection; -- cgit v1.2.3