diff options
Diffstat (limited to 'src/se/leap')
-rw-r--r-- | src/se/leap/bitmaskclient/ConfigHelper.java | 3 | ||||
-rw-r--r-- | src/se/leap/bitmaskclient/EIP.java | 15 | ||||
-rw-r--r-- | src/se/leap/bitmaskclient/LogInDialog.java | 4 | ||||
-rw-r--r-- | src/se/leap/openvpn/ConfigParser.java | 6 | ||||
-rw-r--r-- | src/se/leap/openvpn/OpenVpnService.java | 5 | ||||
-rw-r--r-- | src/se/leap/openvpn/VpnProfile.java | 1 |
6 files changed, 28 insertions, 6 deletions
diff --git a/src/se/leap/bitmaskclient/ConfigHelper.java b/src/se/leap/bitmaskclient/ConfigHelper.java index a29ff301..dd7049a7 100644 --- a/src/se/leap/bitmaskclient/ConfigHelper.java +++ b/src/se/leap/bitmaskclient/ConfigHelper.java @@ -58,7 +58,8 @@ public class ConfigHelper { private static boolean checkSharedPrefs() { try { - shared_preferences = Dashboard.getAppContext().getSharedPreferences(Dashboard.SHARED_PREFERENCES,Context.MODE_PRIVATE); + if(shared_preferences == null) + shared_preferences = Dashboard.getAppContext().getSharedPreferences(Dashboard.SHARED_PREFERENCES,Context.MODE_PRIVATE); } catch (Exception e) { return false; } diff --git a/src/se/leap/bitmaskclient/EIP.java b/src/se/leap/bitmaskclient/EIP.java index f9384ff6..22f7558d 100644 --- a/src/se/leap/bitmaskclient/EIP.java +++ b/src/se/leap/bitmaskclient/EIP.java @@ -431,6 +431,7 @@ public final class EIP extends IntentService { String ports = "ports"; String protos = "protocols"; String capabilities = "capabilities"; + String location = "location"; Vector<String> arg = new Vector<String>(); Vector<Vector<String>> args = new Vector<Vector<String>>(); @@ -457,7 +458,7 @@ public final class EIP extends IntentService { } try { - arg.add("remote"); + arg.add(remote); arg.add(mGateway.getString(remote)); } catch (JSONException e) { // TODO Auto-generated catch block @@ -467,7 +468,19 @@ public final class EIP extends IntentService { options.put("remote", (Vector<Vector<String>>) args.clone() ); arg.clear(); args.clear(); + + try { + arg.add(location); + arg.add(mGateway.getString(location)); + } catch (JSONException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + args.add((Vector<String>) arg.clone()); + options.put("location", (Vector<Vector<String>>) args.clone() ); + arg.clear(); + args.clear(); JSONArray protocolsJSON = null; arg.add("proto"); try { diff --git a/src/se/leap/bitmaskclient/LogInDialog.java b/src/se/leap/bitmaskclient/LogInDialog.java index 3651e9ba..81a3f764 100644 --- a/src/se/leap/bitmaskclient/LogInDialog.java +++ b/src/se/leap/bitmaskclient/LogInDialog.java @@ -86,8 +86,8 @@ public class LogInDialog extends DialogFragment { builder.setView(log_in_dialog_view) .setPositiveButton(R.string.login_button, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { - String username = username_field.getText().toString().trim(); - String password = password_field.getText().toString().trim(); + String username = username_field.getText().toString(); + String password = password_field.getText().toString(); dialog.dismiss(); interface_with_Dashboard.authenticate(username, password); } diff --git a/src/se/leap/openvpn/ConfigParser.java b/src/se/leap/openvpn/ConfigParser.java index 3d369fa6..36585d29 100644 --- a/src/se/leap/openvpn/ConfigParser.java +++ b/src/se/leap/openvpn/ConfigParser.java @@ -355,6 +355,12 @@ public class ConfigParser { np.mServerName = remote.get(1); } } + + // Parse remote config + Vector<String> location = getOption("location",1,2); + if(location != null && location.size() == 2){ + np.mLocation = location.get(1).replace("__", ", "); + } Vector<Vector<String>> dhcpoptions = getAllOption("dhcp-option", 2, 2); if(dhcpoptions!=null) { diff --git a/src/se/leap/openvpn/OpenVpnService.java b/src/se/leap/openvpn/OpenVpnService.java index 620de204..1ef291df 100644 --- a/src/se/leap/openvpn/OpenVpnService.java +++ b/src/se/leap/openvpn/OpenVpnService.java @@ -350,12 +350,13 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac bconfig[4] = getString(R.string.routes_info, joinString(mRoutes)); bconfig[5] = getString(R.string.routes_info6, joinString(mRoutesv6)); - String session = mProfile.mName; + String session = mProfile.mLocation; + /* we don't want the IP address in the notification bar if(mLocalIP!=null && mLocalIPv6!=null) session = getString(R.string.session_ipv6string,session, mLocalIP, mLocalIPv6); else if (mLocalIP !=null) session= getString(R.string.session_ipv4string, session, mLocalIP); - + */ builder.setSession(session); diff --git a/src/se/leap/openvpn/VpnProfile.java b/src/se/leap/openvpn/VpnProfile.java index 41cf574b..99e1c676 100644 --- a/src/se/leap/openvpn/VpnProfile.java +++ b/src/se/leap/openvpn/VpnProfile.java @@ -68,6 +68,7 @@ public class VpnProfile implements Serializable{ private UUID mUuid; public int mAuthenticationType = TYPE_CERTIFICATES ; public String mName; + public String mLocation; public String mAlias; public String mClientCertFilename; public String mTLSAuthDirection=""; |