Prevent multiple cloud-trust-search launches. Handle DNS query failure gracefully. Fixes #1007 & #1008.

This commit is contained in:
Tim Bray 2014-11-19 14:35:05 -08:00
parent 0f59e6bd95
commit b5cdeb7f5a
3 changed files with 9 additions and 1 deletions

View File

@ -85,6 +85,7 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import de.measite.minidns.Client; import de.measite.minidns.Client;
import de.measite.minidns.DNSMessage;
import de.measite.minidns.Question; import de.measite.minidns.Question;
import de.measite.minidns.Record; import de.measite.minidns.Record;
import de.measite.minidns.record.Data; import de.measite.minidns.record.Data;
@ -330,7 +331,12 @@ public class KeychainIntentService extends IntentService implements Progressable
String domain = prover.dnsTxtCheckRequired(); String domain = prover.dnsTxtCheckRequired();
if (domain != null) { if (domain != null) {
Record[] records = new Client().query(new Question(domain, Record.TYPE.TXT)).getAnswers(); DNSMessage dnsQuery = new Client().query(new Question(domain, Record.TYPE.TXT));
if (dnsQuery == null) {
sendProofError(prover.getLog(), getString(R.string.keybase_dns_query_failure));
return;
}
Record[] records = dnsQuery.getAnswers();
List<List<byte[]>> extents = new ArrayList<List<byte[]>>(); List<List<byte[]>> extents = new ArrayList<List<byte[]>>();
for (Record r : records) { for (Record r : records) {
Data d = r.getPayload(); Data d = r.getPayload();

View File

@ -190,6 +190,7 @@ public class ViewKeyTrustFragment extends LoaderFragment implements
mStartSearch.setOnClickListener(new View.OnClickListener() { mStartSearch.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
mStartSearch.setEnabled(false);
new DescribeKey().execute(fingerprint); new DescribeKey().execute(fingerprint);
} }
}); });

View File

@ -561,6 +561,7 @@
<string name="keybase_proof_failure">"Unfortunately this proof cannot be verified."</string> <string name="keybase_proof_failure">"Unfortunately this proof cannot be verified."</string>
<string name="keybase_unknown_proof_failure">"Unrecognized problem with proof checker"</string> <string name="keybase_unknown_proof_failure">"Unrecognized problem with proof checker"</string>
<string name="keybase_problem_fetching_evidence">"Problem with proof evidence"</string> <string name="keybase_problem_fetching_evidence">"Problem with proof evidence"</string>
<string name="keybase_dns_query_failure">"DNS TXT Record retrieval failed"</string>
<string name="keybase_no_prover_found">"No proof checker found for"</string> <string name="keybase_no_prover_found">"No proof checker found for"</string>
<string name="keybase_message_payload_mismatch">"Decrypted proof post does not match expected value"</string> <string name="keybase_message_payload_mismatch">"Decrypted proof post does not match expected value"</string>
<string name="keybase_message_fetching_data">"Fetching proof evidence"</string> <string name="keybase_message_fetching_data">"Fetching proof evidence"</string>