]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1135] ntpq uses sizeof(u_long) where sizeof(u_int32) is meant.
authorDave Hart <hart@ntp.org>
Tue, 6 Oct 2009 03:49:05 +0000 (03:49 +0000)
committerDave Hart <hart@ntp.org>
Tue, 6 Oct 2009 03:49:05 +0000 (03:49 +0000)
add new file ntpd/complete.conf to ntpd/Makefile.am EXTRA_DIST

bk: 4acabe31Z59qdFkZm3rM80KSSZVeVg

ChangeLog
Makefile.am
ntpd/Makefile.am
ntpq/ntpq.c

index b0c29aeab8bdd9cffeb38fb671dc7ecdbf96678f..8274b8652b52b013e318faa9ae97fc521c74dca4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+* [Bug 1135] ntpq uses sizeof(u_long) where sizeof(u_int32) is meant.
 (4.2.5p227) 2009/10/05 Released by Harlan Stenn <stenn@ntp.org>
 * [Bug 1135] :config fails with "Server disallowed request"
 * [Bug 1330] disallow interface/nic rules when --novirtualips or
@@ -7,7 +8,7 @@
 * Documentation updates from Dave Hart/Dave Mills.
 (4.2.5p226) 2009/10/04 Released by Harlan Stenn <stenn@ntp.org>
 * [Bug 1318] Allow multiple -g options on ntpd command line.
-* [Bug 1327] ntpq, ntpdc, ntp-keygen -d and -D should work with configure
+* [Bug 1327] ntpq, ntpdc, ntp-keygen -d & -D should work with configure
   --disable-debugging.
 * Add ntpd --saveconfigquit <filename> option for future build-time
   testing of saveconfig fidelity.
index 4d476d553679d4385e86e5be9780f842feb4be7c..9f77b05bfec7cfd13f6e4827993cef67ac11b814 100644 (file)
@@ -51,7 +51,7 @@ DIST_SUBDIRS=         \
        util            \
        $(NULL)
 
-DISTCHECK_CONFIGURE_FLAGS=     --with-arlib --enable-local-libopts
+DISTCHECK_CONFIGURE_FLAGS=     -C --with-arlib --enable-local-libopts
 
 EXTRA_DIST =           \
        COPYRIGHT       \
index 1f2648bf370a564d91d9e1c335f380a00f4ea94c..74819341cb9bf6ea1ec18b046cad28de01de78aa 100644 (file)
@@ -77,10 +77,14 @@ ntpdsim_CFLAGS = $(CFLAGS) -DSIM
 check_y2k_LDADD = $(LDADD) ../libntp/libntp.a
 DISTCLEANFILES = .version version.c
 CLEANFILES = check-saveconfig compsave.conf
-EXTRA_DIST = ntpd-opts.def ntpdbase-opts.def \
+EXTRA_DIST = \
+       complete.conf           \
+       ntpd-opts.def           \
+       ntpdbase-opts.def       \
        refclock_msfees.c       \
        refclock_trak.c         \
-       $(BUILT_SOURCES)
+       $(BUILT_SOURCES)        \
+       $(NULL)
 ETAGS_ARGS = Makefile.am
 ###                                                    Y2Kfixes
 check_PROGRAMS = @MAKE_CHECK_Y2K@
index c432376ed19c184b8828a1d89f245935cf16c1dc..0bf916ed9879725ac31cf1d1066383e6c791757e 100644 (file)
@@ -1030,8 +1030,8 @@ getresponse(
                }
 
                if (debug >= 3 && shouldbesize > n) {
-                       u_long key;
-                       u_long *lpkt;
+                       u_int32 key;
+                       u_int32 *lpkt;
                        int maclen;
 
                        /*
@@ -1046,15 +1046,15 @@ getresponse(
                                printf(
                                        "Packet shows signs of authentication (total %d, data %d, mac %d)\n",
                                        n, shouldbesize, maclen);
-                               lpkt = (u_long *)&rpkt;
+                               lpkt = (u_int32 *)&rpkt;
                                printf("%08lx %08lx %08lx %08lx %08lx %08lx\n",
-                                      (u_long)ntohl(lpkt[(n - maclen)/sizeof(u_long) - 3]),
-                                      (u_long)ntohl(lpkt[(n - maclen)/sizeof(u_long) - 2]),
-                                      (u_long)ntohl(lpkt[(n - maclen)/sizeof(u_long) - 1]),
-                                      (u_long)ntohl(lpkt[(n - maclen)/sizeof(u_long)]),
-                                      (u_long)ntohl(lpkt[(n - maclen)/sizeof(u_long) + 1]),
-                                      (u_long)ntohl(lpkt[(n - maclen)/sizeof(u_long) + 2]));
-                               key = ntohl(lpkt[(n - maclen) / sizeof(u_long)]);
+                                      (u_long)ntohl(lpkt[(n - maclen)/sizeof(u_int32) - 3]),
+                                      (u_long)ntohl(lpkt[(n - maclen)/sizeof(u_int32) - 2]),
+                                      (u_long)ntohl(lpkt[(n - maclen)/sizeof(u_int32) - 1]),
+                                      (u_long)ntohl(lpkt[(n - maclen)/sizeof(u_int32)]),
+                                      (u_long)ntohl(lpkt[(n - maclen)/sizeof(u_int32) + 1]),
+                                      (u_long)ntohl(lpkt[(n - maclen)/sizeof(u_int32) + 2]));
+                               key = ntohl(lpkt[(n - maclen) / sizeof(u_int32)]);
                                printf("Authenticated with keyid %lu\n", (u_long)key);
                                if (key != 0 && key != info_auth_keyid) {
                                        printf("We don't know that key\n");
@@ -1233,19 +1233,18 @@ sendrequest(
        qpkt.offset = 0;
        qpkt.count = htons((u_short)qsize);
 
+       pktsize = CTL_HEADER_LEN;
+
        /*
-        * If we have data, copy it in and pad it out to a 64
-        * bit boundary.
+        * If we have data, copy and pad it out to a 32-bit boundary.
         */
        if (qsize > 0) {
-               memmove((char *)qpkt.data, qdata, (unsigned)qsize);
-               pktsize = qsize + CTL_HEADER_LEN;
-               while (pktsize & (sizeof(u_long) - 1)) {
+               memcpy(qpkt.data, qdata, (unsigned)qsize);
+               pktsize += qsize;
+               while (pktsize & (sizeof(u_int32) - 1)) {
                        qpkt.data[qsize++] = 0;
                        pktsize++;
                }
-       } else {
-               pktsize = CTL_HEADER_LEN;
        }
 
        /*