1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-26 08:12:05 +01:00

Check answer data in MiniDnsResolver

for the correct RR type.
This commit is contained in:
Florian Schmaus 2016-04-10 20:08:10 +02:00
parent e6db731810
commit e1dfb53483

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2014 Florian Schmaus * Copyright 2014-2016 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -32,6 +32,7 @@ import de.measite.minidns.Question;
import de.measite.minidns.Record; import de.measite.minidns.Record;
import de.measite.minidns.Record.CLASS; import de.measite.minidns.Record.CLASS;
import de.measite.minidns.Record.TYPE; import de.measite.minidns.Record.TYPE;
import de.measite.minidns.record.Data;
import de.measite.minidns.record.SRV; import de.measite.minidns.record.SRV;
@ -81,7 +82,11 @@ public class MiniDnsResolver implements SmackInitializer, DNSResolver {
return res; return res;
} }
for (Record record : message.getAnswers()) { for (Record record : message.getAnswers()) {
SRV srv = (SRV) record.getPayload(); Data data = record.getPayload();
if (!(data instanceof SRV)) {
continue;
}
SRV srv = (SRV) data;
res.add(new SRVRecord(srv.getName(), srv.getPort(), srv.getPriority(), srv.getWeight())); res.add(new SRVRecord(srv.getName(), srv.getPort(), srv.getPriority(), srv.getWeight()));
} }
return res; return res;