diff options
author | Arne Schwabe <arne@rfc2549.org> | 2019-10-28 14:47:11 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2019-10-28 14:47:11 +0100 |
commit | 718b2233054c6bd7b88e5ddb9303696ee7e5646e (patch) | |
tree | f74b31a9dfa21aca4cc4735842216d4340e60a36 /main | |
parent | 4602bc95bfe6436ffc5191a37673b52e7f5b6a7c (diff) |
Fix issue with setting static keys
Diffstat (limited to 'main')
4 files changed, 24 insertions, 7 deletions
diff --git a/main/src/test/java/de/blinkt/openvpn/core/TestConfigGenerator.java b/main/src/test/java/de/blinkt/openvpn/core/TestConfigGenerator.java index 892a5807..8a028218 100644 --- a/main/src/test/java/de/blinkt/openvpn/core/TestConfigGenerator.java +++ b/main/src/test/java/de/blinkt/openvpn/core/TestConfigGenerator.java @@ -65,5 +65,12 @@ public class TestConfigGenerator { } + @Test + public void testEscape() + { + String uglyPassword = "^OrFg1{G^SS8b4J@B$Y1Dr\\GwG-dw3aBJ/R@WI*doCVP',+:>zjqC[&b6[8=KL:`{l&:i!_4*npE?4k2c^(n>9Tjp~u2Z]l8(y&Gg<-cwR2k=yKK:-%f-ezQ\"^g)[d,kbsu$cqih\\wA~on$~)QSODtip2cd,+->qv,roF*9>6q:lTepm=r?Y-+(K]ERGn\"+AiLj<(R_'BOg:vsh0wh]BQ-PVo534;l%R*FF!+,$?Q00%839(k?E!x0R[Lx6qK\\&"; + String escapedUglyPassword = VpnProfile.openVpnEscape(uglyPassword); + } + } diff --git a/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Basic.java b/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Basic.java index 81da76fe..294b33fb 100644 --- a/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Basic.java +++ b/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Basic.java @@ -128,6 +128,9 @@ public class Settings_Basic extends KeyChainSettingsFragment implements OnItemSe mView.findViewById(R.id.userpassword).setVisibility(View.GONE); mView.findViewById(R.id.key_password_layout).setVisibility(View.GONE); mView.findViewById(R.id.external_auth).setVisibility(View.GONE); + mView.findViewById(R.id.crlfile).setVisibility(View.VISIBLE); + + // Fall through are by design switch (type) { @@ -150,6 +153,7 @@ public class Settings_Basic extends KeyChainSettingsFragment implements OnItemSe case VpnProfile.TYPE_STATICKEYS: mView.findViewById(R.id.statickeys).setVisibility(View.VISIBLE); + mView.findViewById(R.id.crlfile).setVisibility(View.GONE); break; case VpnProfile.TYPE_USERPASS_KEYSTORE: diff --git a/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_IP.java b/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_IP.java index daf407b8..bd2ad5f2 100644 --- a/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_IP.java +++ b/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_IP.java @@ -25,8 +25,9 @@ public class Settings_IP extends OpenVpnPreferencesFragment implements OnPrefere private CheckBoxPreference mNobind; @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + public void onResume() + { + super.onResume(); // Make sure default values are applied. In a real app, you would @@ -60,7 +61,10 @@ public class Settings_IP extends OpenVpnPreferencesFragment implements OnPrefere @Override protected void loadSettings() { - mUsePull.setChecked(mProfile.mUsePull); + if (mProfile.mAuthenticationType == VpnProfile.TYPE_STATICKEYS) + mUsePull.setEnabled(false); + else + mUsePull.setChecked(mProfile.mUsePull); mIPv4.setText(mProfile.mIPv4Address); mIPv6.setText(mProfile.mIPv6Address); mDNS1.setText(mProfile.mDNS1); @@ -68,10 +72,13 @@ public class Settings_IP extends OpenVpnPreferencesFragment implements OnPrefere mOverrideDNS.setChecked(mProfile.mOverrideDNS); mSearchdomain.setText(mProfile.mSearchDomain); mNobind.setChecked(mProfile.mNobind); - if (mProfile.mAuthenticationType == VpnProfile.TYPE_STATICKEYS) - mUsePull.setChecked(false); - mUsePull.setEnabled(mProfile.mAuthenticationType != VpnProfile.TYPE_STATICKEYS); + + //mUsePull.setEnabled(mProfile.mAuthenticationType != VpnProfile.TYPE_STATICKEYS); + mUsePull.setEnabled(true); + + if (mProfile.mAuthenticationType == VpnProfile.TYPE_STATICKEYS) + mUsePull.setChecked(false); // Sets Summary onPreferenceChange(mIPv4, mIPv4.getText()); diff --git a/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Routing.java b/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Routing.java index 53f88bbf..91a41ef3 100644 --- a/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Routing.java +++ b/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Routing.java @@ -77,7 +77,6 @@ public class Settings_Routing extends OpenVpnPreferencesFragment implements OnPr onPreferenceChange(mExcludedRoutes, mExcludedRoutes.getText()); onPreferenceChange(mExcludedRoutesv6, mExcludedRoutesv6.getText()); - mRouteNoPull.setEnabled(mProfile.mUsePull); } |