()
| 523 | } |
| 524 | |
| 525 | private void |
| 526 | doxfr() throws IOException, ZoneTransferException { |
| 527 | sendQuery(); |
| 528 | while (state != END) { |
| 529 | byte [] in = client.recv(); |
| 530 | Message response = parseMessage(in); |
| 531 | if (response.getHeader().getRcode() == Rcode.NOERROR && |
| 532 | verifier != null) |
| 533 | { |
| 534 | TSIGRecord tsigrec = response.getTSIG(); |
| 535 | |
| 536 | int error = verifier.verify(response, in); |
| 537 | if (error != Rcode.NOERROR) |
| 538 | fail("TSIG failure"); |
| 539 | } |
| 540 | |
| 541 | Record [] answers = response.getSectionArray(Section.ANSWER); |
| 542 | |
| 543 | if (state == INITIALSOA) { |
| 544 | int rcode = response.getRcode(); |
| 545 | if (rcode != Rcode.NOERROR) { |
| 546 | if (qtype == Type.IXFR && |
| 547 | rcode == Rcode.NOTIMP) |
| 548 | { |
| 549 | fallback(); |
| 550 | doxfr(); |
| 551 | return; |
| 552 | } |
| 553 | fail(Rcode.string(rcode)); |
| 554 | } |
| 555 | |
| 556 | Record question = response.getQuestion(); |
| 557 | if (question != null && question.getType() != qtype) { |
| 558 | fail("invalid question section"); |
| 559 | } |
| 560 | |
| 561 | if (answers.length == 0 && qtype == Type.IXFR) { |
| 562 | fallback(); |
| 563 | doxfr(); |
| 564 | return; |
| 565 | } |
| 566 | } |
| 567 | |
| 568 | for (int i = 0; i < answers.length; i++) { |
| 569 | parseRR(answers[i]); |
| 570 | } |
| 571 | |
| 572 | if (state == END && verifier != null && |
| 573 | !response.isVerified()) |
| 574 | fail("last message must be signed"); |
| 575 | } |
| 576 | } |
| 577 | |
| 578 | /** |
| 579 | * Does the zone transfer. |
no test coverage detected