From: Dave Hart Date: Tue, 6 Oct 2009 03:49:05 +0000 (+0000) Subject: [Bug 1135] ntpq uses sizeof(u_long) where sizeof(u_int32) is meant. X-Git-Tag: NTP_4_2_5P228~2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7acf56b9c94e8226c96074b3935c596c78df6480;p=thirdparty%2Fntp.git [Bug 1135] ntpq uses sizeof(u_long) where sizeof(u_int32) is meant. add new file ntpd/complete.conf to ntpd/Makefile.am EXTRA_DIST bk: 4acabe31Z59qdFkZm3rM80KSSZVeVg --- diff --git a/ChangeLog b/ChangeLog index b0c29aeab..8274b8652 100644 --- 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 * [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 * [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 option for future build-time testing of saveconfig fidelity. diff --git a/Makefile.am b/Makefile.am index 4d476d553..9f77b05bf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 \ diff --git a/ntpd/Makefile.am b/ntpd/Makefile.am index 1f2648bf3..74819341c 100644 --- a/ntpd/Makefile.am +++ b/ntpd/Makefile.am @@ -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@ diff --git a/ntpq/ntpq.c b/ntpq/ntpq.c index c432376ed..0bf916ed9 100644 --- a/ntpq/ntpq.c +++ b/ntpq/ntpq.c @@ -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; } /*