aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src
diff options
context:
space:
mode:
authorTim Bray <tbray@textuality.com>2014-11-19 14:35:05 -0800
committerTim Bray <tbray@textuality.com>2014-11-19 14:35:05 -0800
commitb5cdeb7f5a54be7443894ca2cb4bd27359fae9ce (patch)
tree52b61ea702ed09bc9e722669dc5f8732a7e3aa2e /OpenKeychain/src
parent0f59e6bd950087d99a0909e55276e649639bb51b (diff)
downloadopen-keychain-b5cdeb7f5a54be7443894ca2cb4bd27359fae9ce.tar.gz
open-keychain-b5cdeb7f5a54be7443894ca2cb4bd27359fae9ce.tar.bz2
open-keychain-b5cdeb7f5a54be7443894ca2cb4bd27359fae9ce.zip
Prevent multiple cloud-trust-search launches. Handle DNS query failure gracefully. Fixes #1007 & #1008.
Diffstat (limited to 'OpenKeychain/src')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java8
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyTrustFragment.java1
-rw-r--r--OpenKeychain/src/main/res/values/strings.xml1
3 files changed, 9 insertions, 1 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
index 8a670df25..954963fb6 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
@@ -85,6 +85,7 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import de.measite.minidns.Client;
+import de.measite.minidns.DNSMessage;
import de.measite.minidns.Question;
import de.measite.minidns.Record;
import de.measite.minidns.record.Data;
@@ -330,7 +331,12 @@ public class KeychainIntentService extends IntentService implements Progressable
String domain = prover.dnsTxtCheckRequired();
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[]>>();
for (Record r : records) {
Data d = r.getPayload();
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyTrustFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyTrustFragment.java
index ef14299b1..c85571493 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyTrustFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyTrustFragment.java
@@ -190,6 +190,7 @@ public class ViewKeyTrustFragment extends LoaderFragment implements
mStartSearch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
+ mStartSearch.setEnabled(false);
new DescribeKey().execute(fingerprint);
}
});
diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml
index 27c81fe21..59c0ce408 100644
--- a/OpenKeychain/src/main/res/values/strings.xml
+++ b/OpenKeychain/src/main/res/values/strings.xml
@@ -561,6 +561,7 @@
<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_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_message_payload_mismatch">"Decrypted proof post does not match expected value"</string>
<string name="keybase_message_fetching_data">"Fetching proof evidence"</string>