Merge pull request #7654 from thunderbird/fix_mx_lookup_dnssec
Use `DnssecResolverApi` in `MiniDnsMxResolver` to actually use DNSSEC
This commit is contained in:
commit
568c1117dd
2 changed files with 13 additions and 2 deletions
|
@ -2,12 +2,12 @@ package app.k9mail.autodiscovery.autoconfig
|
|||
|
||||
import app.k9mail.core.common.net.Domain
|
||||
import app.k9mail.core.common.net.toDomainOrNull
|
||||
import org.minidns.hla.ResolverApi
|
||||
import org.minidns.hla.DnssecResolverApi
|
||||
import org.minidns.record.MX
|
||||
|
||||
internal class MiniDnsMxResolver : MxResolver {
|
||||
override fun lookup(domain: Domain): MxLookupResult {
|
||||
val result = ResolverApi.INSTANCE.resolve(domain.value, MX::class.java)
|
||||
val result = DnssecResolverApi.INSTANCE.resolve(domain.value, MX::class.java)
|
||||
|
||||
val mxNames = result.answersOrEmptySet
|
||||
.sortedBy { it.priority }
|
||||
|
|
|
@ -9,6 +9,7 @@ import assertk.assertions.index
|
|||
import assertk.assertions.isEmpty
|
||||
import assertk.assertions.isEqualTo
|
||||
import assertk.assertions.isFalse
|
||||
import assertk.assertions.isTrue
|
||||
import kotlin.test.Ignore
|
||||
import kotlin.test.Test
|
||||
|
||||
|
@ -34,6 +35,16 @@ class MiniDnsMxResolverTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Requires internet")
|
||||
fun `MX lookup for known domain using DNSSEC`() {
|
||||
val domain = "posteo.de".toDomain()
|
||||
|
||||
val result = resolver.lookup(domain)
|
||||
|
||||
assertThat(result.isTrusted).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Requires internet")
|
||||
fun `MX lookup for non-existent domain`() {
|
||||
|
|
Loading…
Reference in a new issue