]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1272] gsoc_sntp IPv6 build problems under HP-UX 10.
authorDave Hart <hart@ntp.org>
Wed, 29 Jul 2009 04:13:53 +0000 (04:13 +0000)
committerDave Hart <hart@ntp.org>
Wed, 29 Jul 2009 04:13:53 +0000 (04:13 +0000)
[Bug 1273] CID 10: Palisade leaks unit struct in error path.
[Bug 1274] CID 67: ensure resolve_hosts() output count and pointers
  are consistent.
[Bug 1275] CID 45: CID 46: old sntp uses uninitialized guesses[0],
  precs[0].

bk: 4a6fcc81YCfkVsqQErbUm7HWzRPmuw

ChangeLog
gsoc_sntp/networking.c
ntpd/ntp_io.c
ntpd/refclock_palisade.c
sntp/main.c

index 58a73dbeadd129736d39a234e63971157de8b557..df763be6b8b414a6cfb1129e406af744a292fd3c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+* [Bug 1272] gsoc_sntp IPv6 build problems under HP-UX 10.
+* [Bug 1273] CID 10: Palisade leaks unit struct in error path.
+* [Bug 1274] CID 67: ensure resolve_hosts() output count and pointers
+  are consistent.
+* [Bug 1275] CID 45: CID 46: old sntp uses uninitialized guesses[0],
+  precs[0].
 (4.2.5p195) 2009/07/27 Released by Harlan Stenn <stenn@ntp.org>
 * cvo.sh: Add support for CentOS, Fedora, Slackware, SuSE.
 (4.2.5p194) 2009/07/26 Released by Harlan Stenn <stenn@ntp.org>
index 2049e59e22fd36b2d3b5b7cb9ae45af7cdd028e0..35373c1101938bca6d48bda1fa4a8000f65f99dc 100644 (file)
@@ -20,7 +20,7 @@
 char adr_buf[INET6_ADDRSTRLEN];
 
 
-/* resolve_hosts consumes an arry of hostnames/addresses and its length, stores a pointer
+/* resolve_hosts consumes an array of hostnames/addresses and its length, stores a pointer
  * to the array with the resolved hosts in res and returns the size of the array res.
  * pref_family enforces IPv4 or IPv6 depending on commandline options and system 
  * capability. If pref_family is NULL or PF_UNSPEC any compatible family will be accepted.
@@ -91,8 +91,12 @@ resolve_hosts (
                }
        }
 
-       /* Make a list of the addrinfo list entries, start by counting them */
-       *res = realloc(tres, sizeof(struct addrinfo *) * resc);
+       if (resc)
+               *res = realloc(tres, sizeof(struct addrinfo *) * resc);
+       else {
+               free(tres);
+               *res = NULL;
+       }
 
        return resc;
 }
@@ -239,6 +243,7 @@ recv_bcst_data (
                        }
                }
        }
+#ifdef ISC_PLATFORM_HAVEIPV6
        else if (IS_IPV6(sas)) {
                struct ipv6_mreq mdevadr;
 
@@ -279,6 +284,7 @@ recv_bcst_data (
                        }
                }
        }
+#endif /* ISC_PLATFORM_HAVEIPV6 */
        
        FD_ZERO(&bcst_fd);
        FD_SET(rsock, &bcst_fd);
@@ -322,8 +328,10 @@ recv_bcst_data (
 
        if (IS_IPV4(sas)) 
                setsockopt(rsock, IPPROTO_IP, IP_DROP_MEMBERSHIP, &btrue, sizeof(btrue));
+#ifdef ISC_PLATFORM_HAVEIPV6
        else if (IS_IPV6(sas))
                setsockopt(rsock, IPPROTO_IPV6, IPV6_LEAVE_GROUP, &btrue, sizeof(btrue));
+#endif
                
        return recv_bytes;
 }
index af7c971f8ee2b0a0107c134f65715b858d7cfcda..bc19f3435dbbbd4f2bdda4d3bc806df528b6697a 100644 (file)
@@ -1261,7 +1261,7 @@ set_wildcard_reuse(
 
                DPRINTF(4, ("set SO_REUSEADDR to %s on %s\n", 
                            on ? "on" : "off",
-                           stoa(any)));
+                           stoa(&any->sin)));
        }
 }
 #endif /* OS_NEEDS_REUSEADDR_FOR_IFADDRBIND */
index f65be24b1a38dd9abd58da8b4c4f29c55732dd0f..5969b6e9a0c2eacf21ddca4762323d205b167712 100644 (file)
@@ -264,6 +264,7 @@ palisade_start (
 #ifdef DEBUG
                 printf("Palisade(%d) tcgetattr(fd, &tio)\n",unit);
 #endif
+               close(fd);
                 return (0);
         }
 
@@ -275,15 +276,6 @@ palisade_start (
         */
        up = (struct palisade_unit *) emalloc(sizeof(struct palisade_unit));
              
-       if (!(up)) {
-                msyslog(LOG_ERR, "Palisade(%d) emalloc: %m",unit);
-#ifdef DEBUG
-                printf("Palisade(%d) emalloc\n",unit);
-#endif
-               (void) close(fd);
-               return (0);
-       }
-
        memset((char *)up, 0, sizeof(struct palisade_unit));
 
        up->type = CLK_TYPE(peer);
@@ -309,6 +301,8 @@ palisade_start (
 #ifdef DEBUG
                 printf("Palisade(%d) tcsetattr(fd, &tio)\n",unit);
 #endif
+               close(fd);
+               free(up);
                 return 0;
         }
 
index e40294ec89761cb2394f739d6bf7f5c05558c562..0a2b55986f19c9fb1517e9acf1376141ab97b744 100644 (file)
@@ -1386,6 +1386,9 @@ triggered if the signal handling works. */
     ntp_data data;
     char text[100];
 
+    guesses[0] = 0;
+    precs[0] = 0;
+
     if (verbose > 2) {
         format_time(text,50,0.0,-1.0,0.0,-1.0,-10);
         fprintf(stderr,"Started=%.6f %s\n",current_time(JAN_1970),text);