diff options
author | Fil <fil.bergamo@riseup.net> | 2018-09-02 17:25:27 +0200 |
---|---|---|
committer | Fil <fil.bergamo@riseup.net> | 2018-09-02 17:25:27 +0200 |
commit | 134315b00626c740d86ebc57e97ae7c36810f4b1 (patch) | |
tree | ecd9b5139ea8e67a48f5a70293f1470db9b98b44 | |
parent | 121a4bec96d2f9b842c6d393d2b9c6356a9a4405 (diff) | |
download | RepWifiApp-134315b00626c740d86ebc57e97ae7c36810f4b1.tar.gz RepWifiApp-134315b00626c740d86ebc57e97ae7c36810f4b1.tar.bz2 RepWifiApp-134315b00626c740d86ebc57e97ae7c36810f4b1.zip |
fix unable to connect to networks having single quotes in PSK or SSID.v0.9.1-betatesting
-rw-r--r-- | CHANGELOG | 3 | ||||
-rw-r--r-- | app/AndroidManifest.xml | 4 | ||||
-rw-r--r-- | app/src/fil/libre/repwifiapp/network/WpaCli.java | 27 |
3 files changed, 22 insertions, 12 deletions
@@ -1,3 +1,6 @@ +## [v0.9.1-beta] - 2018-09-02 +* FIXED unable to connect to networks having single quotes in PSK or SSID. + ## [v0.9-beta] - 2018-07-04 * FIXED Issue #1867 "Download app not working" (see below) * NEW: creates a network connection that is fully integrated with android's connectivity framework diff --git a/app/AndroidManifest.xml b/app/AndroidManifest.xml index 02b0b64..c215322 100644 --- a/app/AndroidManifest.xml +++ b/app/AndroidManifest.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="fil.libre.repwifiapp" - android:versionCode="9" - android:versionName="0.9-beta" > + android:versionCode="10" + android:versionName="0.9.1-beta" > <uses-sdk android:minSdkVersion="17" diff --git a/app/src/fil/libre/repwifiapp/network/WpaCli.java b/app/src/fil/libre/repwifiapp/network/WpaCli.java index 10f6b7c..cdaba39 100644 --- a/app/src/fil/libre/repwifiapp/network/WpaCli.java +++ b/app/src/fil/libre/repwifiapp/network/WpaCli.java @@ -18,7 +18,6 @@ // // ******************************************************************** - package fil.libre.repwifiapp.network; import fil.libre.repwifiapp.helpers.Logger; @@ -58,8 +57,8 @@ public abstract class WpaCli { try { // needs root (wpa_cli) - return executeCmd(BASE_COMMAND + " set_network " + networkID + " ssid '\"" + ssid - + "\"'"); + return executeCmd(BASE_COMMAND + " set_network " + networkID + " ssid '\"" + + escapeSingleQuotes(ssid) + "\"'"); } catch (Exception e) { Logger.logError("Error while setting network SSID", e); @@ -73,11 +72,10 @@ public abstract class WpaCli { try { // needs root (wpa_cli) - - String cmdSetPass = null; + String cmdSetPass = null; if (info.needsPassword()) { cmdSetPass = BASE_COMMAND + " set_network " + networkID + " psk '\"" - + info.getPassword() + "\"'"; + + escapeSingleQuotes(info.getPassword()) + "\"'"; } else { cmdSetPass = BASE_COMMAND + " set_network " + networkID + " key_mgmt NONE"; } @@ -210,7 +208,7 @@ public abstract class WpaCli { try { return executeCmd(BASE_COMMAND + " disconnect"); - + } catch (Exception e) { Logger.logError("Error while enabling network", e); return false; @@ -219,18 +217,18 @@ public abstract class WpaCli { public static boolean terminateSupplicant() { - if (!WpaSupplicant.isRunning()){ + if (!WpaSupplicant.isRunning()) { return true; } try { return executeCmd(BASE_COMMAND + " terminate"); - + } catch (Exception e) { Logger.logError("Error while enabling network", e); return false; } - + } private static boolean executeCmd(String cmdTxt) throws Exception { @@ -249,4 +247,13 @@ public abstract class WpaCli { } + private static String escapeSingleQuotes(String target) { + + + if (target == null) + return ""; + + return target.replace("'", "'\"'\"'"); + } + } |