summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2010-05-26 13:05:53 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-05-26 13:05:53 -0700
commit384177829839040da033d0b4560840fbf4d73b45 (patch)
tree04a56da11aa2a6888969f2c52a1c907f47033848 /services/java/com/android/server
parenta581a7764041e1444da42a287abef88fd1db5b66 (diff)
parentc8390047bd2344032aca915816a8b91590835105 (diff)
downloadframeworks_base-384177829839040da033d0b4560840fbf4d73b45.zip
frameworks_base-384177829839040da033d0b4560840fbf4d73b45.tar.gz
frameworks_base-384177829839040da033d0b4560840fbf4d73b45.tar.bz2
am c8390047: am 9ecca85f: Merge "Fix escaping of characters" into froyo
Merge commit 'c8390047bd2344032aca915816a8b91590835105' into kraken * commit 'c8390047bd2344032aca915816a8b91590835105': Fix escaping of characters
Diffstat (limited to 'services/java/com/android/server')
-rw-r--r--services/java/com/android/server/NetworkManagementService.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java
index 552bed4..5e0439c 100644
--- a/services/java/com/android/server/NetworkManagementService.java
+++ b/services/java/com/android/server/NetworkManagementService.java
@@ -494,15 +494,20 @@ class NetworkManagementService extends INetworkManagementService.Stub {
* argv8 - Max SCB
*/
String str = String.format("softap set " + wlanIface + " " + softapIface +
- " \"%s\" %s %s", wifiConfig.SSID,
+ " %s %s %s", convertQuotedString(wifiConfig.SSID),
wifiConfig.allowedKeyManagement.get(KeyMgmt.WPA_PSK) ?
"wpa2-psk" : "open",
- wifiConfig.preSharedKey);
+ convertQuotedString(wifiConfig.preSharedKey));
mConnector.doCommand(str);
}
mConnector.doCommand(String.format("softap startap"));
}
+ private String convertQuotedString(String s) {
+ /* Replace \ with \\, then " with \" and add quotes at end */
+ return '"' + s.replaceAll("\\\\","\\\\\\\\").replaceAll("\"","\\\\\"") + '"';
+ }
+
public void stopAccessPoint() throws IllegalStateException {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.CHANGE_NETWORK_STATE, "NetworkManagementService");
@@ -521,10 +526,10 @@ class NetworkManagementService extends INetworkManagementService.Stub {
mConnector.doCommand(String.format("softap set " + wlanIface + " " + softapIface));
} else {
String str = String.format("softap set " + wlanIface + " " + softapIface +
- " \"%s\" %s %s", wifiConfig.SSID,
+ " %s %s %s", convertQuotedString(wifiConfig.SSID),
wifiConfig.allowedKeyManagement.get(KeyMgmt.WPA_PSK) ?
"wpa2-psk" : "open",
- wifiConfig.preSharedKey);
+ convertQuotedString(wifiConfig.preSharedKey));
mConnector.doCommand(str);
}
}