am 074dc2eb: Merge "Don\'t restore EAP-TLS networks from backup" into klp-dev
* commit '074dc2eb2da23976bc2916cfe7c61dfcd9977e8f': Don't restore EAP-TLS networks from backup
This commit is contained in:
@@ -137,6 +137,7 @@ public class SettingsBackupAgent extends BackupAgentHelper {
|
|||||||
static class Network {
|
static class Network {
|
||||||
String ssid = ""; // equals() and hashCode() need these to be non-null
|
String ssid = ""; // equals() and hashCode() need these to be non-null
|
||||||
String key_mgmt = "";
|
String key_mgmt = "";
|
||||||
|
boolean certUsed = false;
|
||||||
final ArrayList<String> rawLines = new ArrayList<String>();
|
final ArrayList<String> rawLines = new ArrayList<String>();
|
||||||
|
|
||||||
public static Network readFromStream(BufferedReader in) {
|
public static Network readFromStream(BufferedReader in) {
|
||||||
@@ -167,6 +168,12 @@ public class SettingsBackupAgent extends BackupAgentHelper {
|
|||||||
ssid = line;
|
ssid = line;
|
||||||
} else if (line.startsWith("key_mgmt")) {
|
} else if (line.startsWith("key_mgmt")) {
|
||||||
key_mgmt = line;
|
key_mgmt = line;
|
||||||
|
} else if (line.startsWith("client_cert=")) {
|
||||||
|
certUsed = true;
|
||||||
|
} else if (line.startsWith("ca_cert=")) {
|
||||||
|
certUsed = true;
|
||||||
|
} else if (line.startsWith("ca_path=")) {
|
||||||
|
certUsed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,6 +253,13 @@ public class SettingsBackupAgent extends BackupAgentHelper {
|
|||||||
|
|
||||||
public void write(Writer w) throws IOException {
|
public void write(Writer w) throws IOException {
|
||||||
for (Network net : mNetworks) {
|
for (Network net : mNetworks) {
|
||||||
|
if (net.certUsed) {
|
||||||
|
// Networks that use certificates for authentication can't be restored
|
||||||
|
// because the certificates they need don't get restored (because they
|
||||||
|
// are stored in keystore, and can't be restored)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
net.write(w);
|
net.write(w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user