Merge commit 'c8390047bd2344032aca915816a8b91590835105' into kraken * commit 'c8390047bd2344032aca915816a8b91590835105': Fix escaping of characters
This commit is contained in:
@@ -494,15 +494,20 @@ class NetworkManagementService extends INetworkManagementService.Stub {
|
|||||||
* argv8 - Max SCB
|
* argv8 - Max SCB
|
||||||
*/
|
*/
|
||||||
String str = String.format("softap set " + wlanIface + " " + softapIface +
|
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) ?
|
wifiConfig.allowedKeyManagement.get(KeyMgmt.WPA_PSK) ?
|
||||||
"wpa2-psk" : "open",
|
"wpa2-psk" : "open",
|
||||||
wifiConfig.preSharedKey);
|
convertQuotedString(wifiConfig.preSharedKey));
|
||||||
mConnector.doCommand(str);
|
mConnector.doCommand(str);
|
||||||
}
|
}
|
||||||
mConnector.doCommand(String.format("softap startap"));
|
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 {
|
public void stopAccessPoint() throws IllegalStateException {
|
||||||
mContext.enforceCallingOrSelfPermission(
|
mContext.enforceCallingOrSelfPermission(
|
||||||
android.Manifest.permission.CHANGE_NETWORK_STATE, "NetworkManagementService");
|
android.Manifest.permission.CHANGE_NETWORK_STATE, "NetworkManagementService");
|
||||||
@@ -521,10 +526,10 @@ class NetworkManagementService extends INetworkManagementService.Stub {
|
|||||||
mConnector.doCommand(String.format("softap set " + wlanIface + " " + softapIface));
|
mConnector.doCommand(String.format("softap set " + wlanIface + " " + softapIface));
|
||||||
} else {
|
} else {
|
||||||
String str = String.format("softap set " + wlanIface + " " + softapIface +
|
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) ?
|
wifiConfig.allowedKeyManagement.get(KeyMgmt.WPA_PSK) ?
|
||||||
"wpa2-psk" : "open",
|
"wpa2-psk" : "open",
|
||||||
wifiConfig.preSharedKey);
|
convertQuotedString(wifiConfig.preSharedKey));
|
||||||
mConnector.doCommand(str);
|
mConnector.doCommand(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user