]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
temporary error print during axfr
authorJelte Jansen <jeltejan@NLnetLabs.nl>
Mon, 11 Sep 2006 10:10:23 +0000 (10:10 +0000)
committerJelte Jansen <jeltejan@NLnetLabs.nl>
Mon, 11 Sep 2006 10:10:23 +0000 (10:10 +0000)
drill/drill.c
resolver.c

index 2ee504b574752bef3ea26997f33dd62e14d74975..37b57a6f13536575382043e0f3e7244f9871cf74 100644 (file)
@@ -692,13 +692,13 @@ main(int argc, char *argv[])
                                if (type == LDNS_RR_TYPE_AXFR) {
                                        status = ldns_axfr_start(res, qname, clas);
                                        if(status != LDNS_STATUS_OK) {
-                                               error("starting axfr: %s", 
+                                               error("Error starting axfr: %s", 
                                                        ldns_get_errorstr_by_id(status));
                                        }
 
                                        axfr_rr = ldns_axfr_next(res);
                                        if(!axfr_rr) {
-                                               printf("AXFR failed.\n");
+                                               fprintf(stderr, "AXFR failed.\n");
                                                ldns_pkt_print(stdout, 
                                                        ldns_axfr_last_pkt(res));
                                                goto exit;
index c7adacaef2dda399690fc1b091a7d8a921d1f72f..cfd3759a49d1a415c14aacf58778b88f4bfa89e9 100644 (file)
@@ -981,6 +981,8 @@ ldns_axfr_next(ldns_resolver *resolver)
        ldns_rr *cur_rr;
        uint8_t *packet_wire;
        size_t packet_wire_size;
+       ldns_lookup_table *rcode;
+       ldns_status status;
        
        /* check if start() has been called */
        if (!resolver || resolver->_socket == 0) {
@@ -1012,13 +1014,18 @@ ldns_axfr_next(ldns_resolver *resolver)
                if(!packet_wire) 
                        return NULL;
                
-               (void) ldns_wire2pkt(&resolver->_cur_axfr_pkt, packet_wire, 
+               status = ldns_wire2pkt(&resolver->_cur_axfr_pkt, packet_wire, 
                                     packet_wire_size);
                free(packet_wire);
 
                resolver->_axfr_i = 0;
-               if (ldns_pkt_get_rcode(resolver->_cur_axfr_pkt) != 0) {
-                       /* error */
+               if (status != LDNS_STATUS_OK) {
+                       /* TODO: make status return type of this function (...api change) */
+                       fprintf(stderr, "Error parsing rr during AXFR: %s\n", ldns_get_errorstr_by_id(status));
+                       return NULL;
+               } else if (ldns_pkt_get_rcode(resolver->_cur_axfr_pkt) != 0) {
+                       rcode = ldns_lookup_by_id(ldns_rcodes, (int) ldns_pkt_get_rcode(resolver->_cur_axfr_pkt));
+                       fprintf(stderr, "Error in AXFR: %s\n", rcode->name);
                        return NULL;
                } else {
                        return ldns_axfr_next(resolver);