]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
remove accidental commit
authorMark Andrews <marka@isc.org>
Tue, 16 Nov 2010 05:38:31 +0000 (05:38 +0000)
committerMark Andrews <marka@isc.org>
Tue, 16 Nov 2010 05:38:31 +0000 (05:38 +0000)
12 files changed:
bin/dig/dighost.c
bin/dig/host.c
bin/dig/nslookup.c
bin/named/unix/os.c
lib/dns/adb.c
lib/dns/rcode.c
lib/dns/rdata.c
lib/dns/rdatalist.c
lib/isc/httpd.c
lib/isc/netaddr.c
lib/isc/sockaddr.c
lib/isccfg/parser.c

index ecdbe75cbad1e3da3645aca552fa4132cc7ded22..a34fce35aa25205ee0b59840014a02544ab8c503 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: dighost.c,v 1.333 2010/11/16 00:45:34 marka Exp $ */
+/* $Id: dighost.c,v 1.334 2010/11/16 05:38:30 marka Exp $ */
 
 /*! \file
  *  \note
@@ -566,8 +566,10 @@ make_server(const char *servname, const char *userarg) {
        if (srv == NULL)
                fatal("memory allocation failure in %s:%d",
                      __FILE__, __LINE__);
-       strlcpy(srv->servername, servname, MXNAME);
-       strlcpy(srv->userarg, userarg, MXNAME);
+       strncpy(srv->servername, servname, MXNAME);
+       strncpy(srv->userarg, userarg, MXNAME);
+       srv->servername[MXNAME-1] = 0;
+       srv->userarg[MXNAME-1] = 0;
        ISC_LINK_INIT(srv, link);
        return (srv);
 }
index 400f911b43dbad4be03e00c88297e6c3407b0d66..d2ff52e08811bb5cd7ba8c24a61ecf312ef0379a 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: host.c,v 1.123 2010/11/16 00:46:00 marka Exp $ */
+/* $Id: host.c,v 1.124 2010/11/16 05:38:30 marka Exp $ */
 
 /*! \file */
 
@@ -824,8 +824,8 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
        if (isc_commandline_index >= argc)
                show_usage();
 
-       strlcpy(hostname, argv[isc_commandline_index], sizeof(hostname));
-
+       strncpy(hostname, argv[isc_commandline_index], sizeof(hostname));
+       hostname[sizeof(hostname)-1]=0;
        if (argc > isc_commandline_index + 1) {
                set_nameserver(argv[isc_commandline_index+1]);
                debug("server is %s", argv[isc_commandline_index+1]);
index 5d7607aaafa157f516d04befa7bf3c7fdb19aff6..9fff7f26dc4987577197444314a2a4277691ee5d 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: nslookup.c,v 1.125 2010/11/16 00:46:39 marka Exp $ */
+/* $Id: nslookup.c,v 1.126 2010/11/16 05:38:31 marka Exp $ */
 
 #include <config.h>
 
@@ -535,6 +535,12 @@ testclass(char *typetext) {
        }
 }
 
+static void
+safecpy(char *dest, char *src, int size) {
+       strncpy(dest, src, size);
+       dest[size-1] = 0;
+}
+
 static void
 set_port(const char *value) {
        isc_uint32_t n;
@@ -565,34 +571,34 @@ setoption(char *opt) {
                show_settings(ISC_TRUE, ISC_FALSE);
        } else if (strncasecmp(opt, "class=", 6) == 0) {
                if (testclass(&opt[6]))
-                       strlcpy(defclass, &opt[6], sizeof(defclass));
+                       safecpy(defclass, &opt[6], sizeof(defclass));
        } else if (strncasecmp(opt, "cl=", 3) == 0) {
                if (testclass(&opt[3]))
-                       strlcpy(defclass, &opt[3], sizeof(defclass));
+                       safecpy(defclass, &opt[3], sizeof(defclass));
        } else if (strncasecmp(opt, "type=", 5) == 0) {
                if (testtype(&opt[5]))
-                       strlcpy(deftype, &opt[5], sizeof(deftype));
+                       safecpy(deftype, &opt[5], sizeof(deftype));
        } else if (strncasecmp(opt, "ty=", 3) == 0) {
                if (testtype(&opt[3]))
-                       strlcpy(deftype, &opt[3], sizeof(deftype));
+                       safecpy(deftype, &opt[3], sizeof(deftype));
        } else if (strncasecmp(opt, "querytype=", 10) == 0) {
                if (testtype(&opt[10]))
-                       strlcpy(deftype, &opt[10], sizeof(deftype));
+                       safecpy(deftype, &opt[10], sizeof(deftype));
        } else if (strncasecmp(opt, "query=", 6) == 0) {
                if (testtype(&opt[6]))
-                       strlcpy(deftype, &opt[6], sizeof(deftype));
+                       safecpy(deftype, &opt[6], sizeof(deftype));
        } else if (strncasecmp(opt, "qu=", 3) == 0) {
                if (testtype(&opt[3]))
-                       strlcpy(deftype, &opt[3], sizeof(deftype));
+                       safecpy(deftype, &opt[3], sizeof(deftype));
        } else if (strncasecmp(opt, "q=", 2) == 0) {
                if (testtype(&opt[2]))
-                       strlcpy(deftype, &opt[2], sizeof(deftype));
+                       safecpy(deftype, &opt[2], sizeof(deftype));
        } else if (strncasecmp(opt, "domain=", 7) == 0) {
-               strlcpy(domainopt, &opt[7], sizeof(domainopt));
+               safecpy(domainopt, &opt[7], sizeof(domainopt));
                set_search_domain(domainopt);
                usesearch = ISC_TRUE;
        } else if (strncasecmp(opt, "do=", 3) == 0) {
-               strlcpy(domainopt, &opt[3], sizeof(domainopt));
+               safecpy(domainopt, &opt[3], sizeof(domainopt));
                set_search_domain(domainopt);
                usesearch = ISC_TRUE;
        } else if (strncasecmp(opt, "port=", 5) == 0) {
@@ -671,11 +677,11 @@ addlookup(char *opt) {
        lookup = make_empty_lookup();
        if (get_reverse(store, sizeof(store), opt, lookup->ip6_int, ISC_TRUE)
            == ISC_R_SUCCESS) {
-               strlcpy(lookup->textname, store, sizeof(lookup->textname));
+               safecpy(lookup->textname, store, sizeof(lookup->textname));
                lookup->rdtype = dns_rdatatype_ptr;
                lookup->rdtypeset = ISC_TRUE;
        } else {
-               strlcpy(lookup->textname, opt, sizeof(lookup->textname));
+               safecpy(lookup->textname, opt, sizeof(lookup->textname));
                lookup->rdtype = rdtype;
                lookup->rdtypeset = ISC_TRUE;
        }
index 7ea07fdd8d8e093877e9a4c90b932f2c8965ccc1..a262fdb84878908ce03abce05e3562db08d3f132 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: os.c,v 1.102 2010/11/16 00:47:48 marka Exp $ */
+/* $Id: os.c,v 1.103 2010/11/16 05:38:31 marka Exp $ */
 
 /*! \file */
 
@@ -950,7 +950,7 @@ ns_os_shutdownmsg(char *command, isc_buffer_t *text) {
                     isc_buffer_availablelength(text),
                     "pid: %ld", (long)pid);
        /* Only send a message if it is complete. */
-       if (n > 0 && n < isc_buffer_availablelength(text))
+       if (n < isc_buffer_availablelength(text))
                isc_buffer_add(text, n);
 }
 
index dfff33bb514eb7ba5c9a36fd97a47b609b722fd5..d324453eebee45f2e4f3a880320845cc602e5af5 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: adb.c,v 1.250 2010/11/16 00:49:18 marka Exp $ */
+/* $Id: adb.c,v 1.251 2010/11/16 05:38:31 marka Exp $ */
 
 /*! \file
  *
@@ -2350,7 +2350,6 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
         */
        bucket = DNS_ADB_INVALIDBUCKET;
        adbname = find_name_and_lock(adb, name, find->options, &bucket);
-       INSIST(bucket != DNS_ADB_INVALIDBUCKET);
        if (adb->name_sd[bucket]) {
                DP(DEF_LEVEL,
                   "dns_adb_createfind: returning ISC_R_SHUTTINGDOWN");
@@ -3473,7 +3472,6 @@ dns_adb_findaddrinfo(dns_adb_t *adb, isc_sockaddr_t *sa,
        result = ISC_R_SUCCESS;
        bucket = DNS_ADB_INVALIDBUCKET;
        entry = find_entry_and_lock(adb, sa, &bucket, now);
-       INSIST(bucket != DNS_ADB_INVALIDBUCKET);
        if (adb->entry_sd[bucket]) {
                result = ISC_R_SHUTTINGDOWN;
                goto unlock;
index fefc2c1c3d50f98cc83c38b1a8d8fd34a907a136..efbb7dad597ac5573f618c654aba7d4d23e104d5 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: rcode.c,v 1.13 2010/11/16 00:53:36 marka Exp $ */
+/* $Id: rcode.c,v 1.14 2010/11/16 05:38:31 marka Exp $ */
 
 #include <config.h>
 #include <ctype.h>
@@ -493,9 +493,6 @@ dns_rdataclass_format(dns_rdataclass_t rdclass,
        isc_result_t result;
        isc_buffer_t buf;
 
-       if (size == 0U)
-               return;
-
        isc_buffer_init(&buf, array, size);
        result = dns_rdataclass_totext(rdclass, &buf);
        /*
@@ -507,6 +504,8 @@ dns_rdataclass_format(dns_rdataclass_t rdclass,
                else
                        result = ISC_R_NOSPACE;
        }
-       if (result != ISC_R_SUCCESS)
-               strlcpy(array, "<unknown>", size);
+       if (result != ISC_R_SUCCESS) {
+               snprintf(array, size, "<unknown>");
+               array[size - 1] = '\0';
+       }
 }
index 0c76ad723784eee558175e9df0f15a49a90515bc..ed3a8029b16a6f1e7c817841e59009c6a67fd1db 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: rdata.c,v 1.205 2010/11/16 00:53:36 marka Exp $ */
+/* $Id: rdata.c,v 1.206 2010/11/16 05:38:31 marka Exp $ */
 
 /*! \file */
 
@@ -963,9 +963,6 @@ dns_rdatatype_format(dns_rdatatype_t rdtype,
        isc_result_t result;
        isc_buffer_t buf;
 
-       if (size == 0U)
-               return;
-
        isc_buffer_init(&buf, array, size);
        result = dns_rdatatype_totext(rdtype, &buf);
        /*
@@ -977,8 +974,10 @@ dns_rdatatype_format(dns_rdatatype_t rdtype,
                else
                        result = ISC_R_NOSPACE;
        }
-       if (result != ISC_R_SUCCESS)
-               strlcpy(array, "<unknown>", size);
+       if (result != ISC_R_SUCCESS) {
+               snprintf(array, size, "<unknown>");
+               array[size - 1] = '\0';
+       }
 }
 
 /*
index 535a2711556ecacf5487d060fbcc997a721971b1..33b22bca726420af565bb15b76700571357f3807 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: rdatalist.c,v 1.39 2010/11/16 00:50:28 marka Exp $ */
+/* $Id: rdatalist.c,v 1.40 2010/11/16 05:38:31 marka Exp $ */
 
 /*! \file */
 
@@ -54,8 +54,6 @@ static dns_rdatasetmethods_t methods = {
 void
 dns_rdatalist_init(dns_rdatalist_t *rdatalist) {
 
-       REQUIRE(rdatalist != NULL);
-
        /*
         * Initialize rdatalist.
         */
@@ -127,8 +125,6 @@ isc_result_t
 isc__rdatalist_next(dns_rdataset_t *rdataset) {
        dns_rdata_t *rdata;
 
-       REQUIRE(rdataset != NULL);
-
        rdata = rdataset->private2;
        if (rdata == NULL)
                return (ISC_R_NOMORE);
@@ -145,8 +141,6 @@ void
 isc__rdatalist_current(dns_rdataset_t *rdataset, dns_rdata_t *rdata) {
        dns_rdata_t *list_rdata;
 
-       REQUIRE(rdataset != NULL);
-
        list_rdata = rdataset->private2;
        INSIST(list_rdata != NULL);
 
@@ -155,10 +149,6 @@ isc__rdatalist_current(dns_rdataset_t *rdataset, dns_rdata_t *rdata) {
 
 void
 isc__rdatalist_clone(dns_rdataset_t *source, dns_rdataset_t *target) {
-
-       REQUIRE(source != NULL);
-       REQUIRE(target != NULL);
-
        *target = *source;
 
        /*
@@ -173,8 +163,6 @@ isc__rdatalist_count(dns_rdataset_t *rdataset) {
        dns_rdata_t *rdata;
        unsigned int count;
 
-       REQUIRE(rdataset != NULL);
-
        rdatalist = rdataset->private1;
 
        count = 0;
@@ -193,8 +181,6 @@ isc__rdatalist_addnoqname(dns_rdataset_t *rdataset, dns_name_t *name) {
        dns_rdataset_t *rdset;
        dns_ttl_t ttl;
 
-       REQUIRE(rdataset != NULL);
-
        for (rdset = ISC_LIST_HEAD(name->list);
             rdset != NULL;
             rdset = ISC_LIST_NEXT(rdset, link))
@@ -242,9 +228,7 @@ isc__rdatalist_getnoqname(dns_rdataset_t *rdataset, dns_name_t *name,
        dns_rdataset_t *tnegsig = NULL;
        dns_name_t *noqname = rdataset->private6;
 
-       REQUIRE(rdataset != NULL);
        REQUIRE((rdataset->attributes & DNS_RDATASETATTR_NOQNAME) != 0);
-
        (void)dns_name_dynamic(noqname);        /* Sanity Check. */
 
        for (rdataset = ISC_LIST_HEAD(noqname->list);
@@ -284,8 +268,6 @@ isc__rdatalist_addclosest(dns_rdataset_t *rdataset, dns_name_t *name) {
        dns_rdataset_t *rdset;
        dns_ttl_t ttl;
 
-       REQUIRE(rdataset != NULL);
-
        for (rdset = ISC_LIST_HEAD(name->list);
             rdset != NULL;
             rdset = ISC_LIST_NEXT(rdset, link))
@@ -333,9 +315,7 @@ isc__rdatalist_getclosest(dns_rdataset_t *rdataset, dns_name_t *name,
        dns_rdataset_t *tnegsig = NULL;
        dns_name_t *closest = rdataset->private7;
 
-       REQUIRE(rdataset != NULL);
        REQUIRE((rdataset->attributes & DNS_RDATASETATTR_CLOSEST) != 0);
-
        (void)dns_name_dynamic(closest);        /* Sanity Check. */
 
        for (rdataset = ISC_LIST_HEAD(closest->list);
index 8c71b5541ce5986c7ebae384ad6cce10b29c103d..907a275dde2bcdb9c627999fed390bc1303ff036 100644 (file)
@@ -14,7 +14,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: httpd.c,v 1.19 2010/11/16 00:51:41 marka Exp $ */
+/* $Id: httpd.c,v 1.20 2010/11/16 05:38:31 marka Exp $ */
 
 /*! \file */
 
@@ -821,7 +821,7 @@ isc_httpd_response(isc_httpd_t *httpd)
        needlen += 3 + 1;  /* room for response code, always 3 bytes */
        needlen += strlen(httpd->retmsg) + 2;  /* return msg + CRLF */
 
-       while (isc_buffer_availablelength(&httpd->headerbuffer) < needlen) {
+       if (isc_buffer_availablelength(&httpd->headerbuffer) < needlen) {
                result = grow_headerspace(httpd);
                if (result != ISC_R_SUCCESS)
                        return (result);
@@ -846,7 +846,7 @@ isc_httpd_addheader(isc_httpd_t *httpd, const char *name,
                needlen += 2 + strlen(val); /* :<space> and val */
        needlen += 2; /* CRLF */
 
-       while (isc_buffer_availablelength(&httpd->headerbuffer) < needlen) {
+       if (isc_buffer_availablelength(&httpd->headerbuffer) < needlen) {
                result = grow_headerspace(httpd);
                if (result != ISC_R_SUCCESS)
                        return (result);
@@ -869,7 +869,7 @@ isc_httpd_endheaders(isc_httpd_t *httpd)
 {
        isc_result_t result;
 
-       while (isc_buffer_availablelength(&httpd->headerbuffer) < 2) {
+       if (isc_buffer_availablelength(&httpd->headerbuffer) < 2) {
                result = grow_headerspace(httpd);
                if (result != ISC_R_SUCCESS)
                        return (result);
@@ -893,7 +893,7 @@ isc_httpd_addheaderuint(isc_httpd_t *httpd, const char *name, int val) {
        needlen += 2 + strlen(buf); /* :<space> and val */
        needlen += 2; /* CRLF */
 
-       while (isc_buffer_availablelength(&httpd->headerbuffer) < needlen) {
+       if (isc_buffer_availablelength(&httpd->headerbuffer) < needlen) {
                result = grow_headerspace(httpd);
                if (result != ISC_R_SUCCESS)
                        return (result);
index 6855abbf8c8ad6de70d3e2b1105866390528020b..6aebcd6e0e354ec2b8e50d07de051b290ba4a337 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: netaddr.c,v 1.39 2010/11/16 00:43:02 marka Exp $ */
+/* $Id: netaddr.c,v 1.40 2010/11/16 05:38:31 marka Exp $ */
 
 /*! \file */
 
@@ -188,9 +188,6 @@ isc_netaddr_format(const isc_netaddr_t *na, char *array, unsigned int size) {
        isc_buffer_init(&buf, array, size);
        result = isc_netaddr_totext(na, &buf);
 
-       if (size == 0)
-               return;
-
        /*
         * Null terminate.
         */
index a3bb53afd49e6c062b933c7528963e5dcdbadea3..69c64adf001e553d702f6ffe57f4c6fd485baa19 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: sockaddr.c,v 1.71 2010/11/16 00:42:35 marka Exp $ */
+/* $Id: sockaddr.c,v 1.72 2010/11/16 05:38:31 marka Exp $ */
 
 /*! \file */
 
@@ -182,9 +182,6 @@ isc_sockaddr_format(const isc_sockaddr_t *sa, char *array, unsigned int size) {
        isc_result_t result;
        isc_buffer_t buf;
 
-       if (size == 0U)
-               return;
-
        isc_buffer_init(&buf, array, size);
        result = isc_sockaddr_totext(sa, &buf);
        if (result != ISC_R_SUCCESS) {
index d14f28fb5bafb04de6451917eeb4ab1a7cf560bb..d443cd7120be1d552d31a1f3015912721f4f61eb 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: parser.c,v 1.136 2010/11/16 00:41:32 marka Exp $ */
+/* $Id: parser.c,v 1.137 2010/11/16 05:38:31 marka Exp $ */
 
 /*! \file */
 
@@ -2006,12 +2006,8 @@ cfg_obj_isnetprefix(const cfg_obj_t *obj) {
 
 void
 cfg_obj_asnetprefix(const cfg_obj_t *obj, isc_netaddr_t *netaddr,
-                   unsigned int *prefixlen)
-{
+                   unsigned int *prefixlen) {
        REQUIRE(obj != NULL && obj->type->rep == &cfg_rep_netprefix);
-       REQUIRE(netaddr != NULL);
-       REQUIRE(prefixlen != NULL);
-
        *netaddr = obj->value.netprefix.address;
        *prefixlen = obj->value.netprefix.prefixlen;
 }