]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
798. [bug] nsupdate should be able to reject bad input lines
authorBrian Wellington <source@isc.org>
Thu, 29 Mar 2001 23:51:36 +0000 (23:51 +0000)
committerBrian Wellington <source@isc.org>
Thu, 29 Mar 2001 23:51:36 +0000 (23:51 +0000)
and continue. [RT #1130]

CHANGES
bin/nsupdate/nsupdate.c

diff --git a/CHANGES b/CHANGES
index 391eee464a3d15689be106115c4750fbab482044..5ec36e305fd79b6101e6f9f08976a8710ec4eac2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+ 798.  [bug]           nsupdate should be able to reject bad input lines
+                       and continue. [RT #1130]
+
  797.  [func]          Issue a warning if the 'directory' option contains
                        a relative path. [RT #269]
 
index 30339097196ffa3948468360e1165765c0bdbbcf..364a72aef76f36ee06c75701873426ade7ecd64a 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: nsupdate.c,v 1.85 2001/03/28 02:42:51 bwelling Exp $ */
+/* $Id: nsupdate.c,v 1.86 2001/03/29 23:51:36 bwelling Exp $ */
 
 #include <config.h>
 
@@ -747,10 +747,12 @@ parse_rdata(char **cmdlinep, dns_rdataclass_t rdataclass,
                        bufsz *= 2;
                        isc_lex_destroy(&lex);
                } while (result == ISC_R_NOSPACE);
-               check_result(result, "dns_rdata_fromtext");
                dns_message_takebuffer(msg, &buf);
-               if (result != ISC_R_SUCCESS)
-                       return (STATUS_MORE);
+               if (result != ISC_R_SUCCESS) {
+                       fprintf(stderr, "invalid rdata format: %s\n",
+                               isc_result_totext(result));
+                       return (STATUS_SYNTAX);
+               }
        } else {
                rdata->flags = DNS_RDATA_UPDATE;
        }
@@ -787,8 +789,7 @@ make_prereq(char *cmdline, isc_boolean_t ispositive, isc_boolean_t isrrset) {
                word = nsu_strsep(&cmdline, " \t\r\n");
                if (*word == 0) {
                        fprintf(stderr, "failed to read class or type\n");
-                       dns_message_puttempname(updatemsg, &name);
-                       return (STATUS_SYNTAX);
+                       goto failure;
                }
                region.base = word;
                region.length = strlen(word);
@@ -800,17 +801,22 @@ make_prereq(char *cmdline, isc_boolean_t ispositive, isc_boolean_t isrrset) {
                        word = nsu_strsep(&cmdline, " \t\r\n");
                        if (*word == 0) {
                                fprintf(stderr, "failed to read type\n");
-                               dns_message_puttempname(updatemsg, &name);
-                               return (STATUS_SYNTAX);
+                               goto failure;
                        }
                        region.base = word;
                        region.length = strlen(word);
                        result = dns_rdatatype_fromtext(&rdatatype, &region);
-                       check_result(result, "dns_rdatatype_fromtext");
+                       if (result != ISC_R_SUCCESS) {
+                               fprintf(stderr, "invalid type: %s\n");
+                               goto failure;
+                       }
                } else {
                        rdataclass = dns_rdataclass_in;
                        result = dns_rdatatype_fromtext(&rdatatype, &region);
-                       check_result(result, "dns_rdatatype_fromtext");
+                       if (result != ISC_R_SUCCESS) {
+                               fprintf(stderr, "invalid type: %s\n");
+                               goto failure;
+                       }
                }
        } else
                rdatatype = dns_rdatatype_any;
@@ -853,6 +859,11 @@ make_prereq(char *cmdline, isc_boolean_t ispositive, isc_boolean_t isrrset) {
        ISC_LIST_APPEND(name->list, rdataset, link);
        dns_message_addname(updatemsg, name, DNS_SECTION_PREREQUISITE);
        return (STATUS_MORE);
+
+ failure:
+       if (name != NULL)
+               dns_message_puttempname(updatemsg, &name);
+       return (STATUS_SYNTAX);
 }
 
 static isc_uint16_t