--- rdate-1.2.orig/debian/control +++ rdate-1.2/debian/control @@ -0,0 +1,26 @@ +Source: rdate +Section: net +Priority: optional +Maintainer: Anibal Monsalve Salazar +Build-Depends: debhelper (>= 7), autotools-dev, quilt, libbsd-dev (>= 0.1.5-3) +Standards-Version: 3.8.3 +Homepage: http://sourceforge.net/projects/openrdate/ + +Package: rdate +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Replaces: netstd +Description: sets the system's date from a remote host + rdate displays and sets the local date and time from the host name + or address given as the argument. The time source may be an RFC 868 + TCP protocol server, which is usually implemented as a built-in + service of inetd(8), or an RFC 2030 protocol SNTP/NTP server. By + default, rdate uses the RFC 868 TCP protocol. + +Package: rdate-udeb +Section: debian-installer +Priority: optional +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +XC-Package-Type: udeb +Description: sets the system's date from a remote host --- rdate-1.2.orig/debian/README.source +++ rdate-1.2/debian/README.source @@ -0,0 +1,5 @@ +Before editing the source package, apply the patches in +debian/patches. + +For information about the patch system used for the source +package refer to /usr/share/doc/quilt/README.source --- rdate-1.2.orig/debian/docs +++ rdate-1.2/debian/docs @@ -0,0 +1,2 @@ +NEWS +README --- rdate-1.2.orig/debian/rdate-udeb.dirs +++ rdate-1.2/debian/rdate-udeb.dirs @@ -0,0 +1 @@ +usr/bin --- rdate-1.2.orig/debian/compat +++ rdate-1.2/debian/compat @@ -0,0 +1 @@ +7 --- rdate-1.2.orig/debian/watch +++ rdate-1.2/debian/watch @@ -0,0 +1,2 @@ +version=3 +https://sourceforge.net/projects/openrdate/files/ .*openrdate-([\d\.]+).tar.gz/download --- rdate-1.2.orig/debian/rules +++ rdate-1.2/debian/rules @@ -0,0 +1,68 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +export DH_VERBOSE=1 + +include /usr/share/quilt/quilt.make + +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + +CFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -Os +endif + +config.status: configure + dh_testdir + # Add here commands to configure the package. + cp -f /usr/share/misc/config.sub /usr/share/misc/config.guess . + ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs" + +build: patch build-stamp + +build-stamp: config.status + dh_testdir + touch $@ + +clean: unpatch + dh_testdir + dh_testroot + rm -f build-stamp + [ ! -f Makefile ] || $(MAKE) distclean + rm -f src/arc4random.c src/arc4random.h + rm -f config.sub config.guess + dh_clean + +install: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs + $(MAKE) DESTDIR=$(CURDIR)/debian/rdate install + cp -p debian/rdate/usr/bin/rdate debian/rdate-udeb/usr/bin + +binary-indep: build install + +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs ChangeLog + dh_installdocs + dh_installexamples + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums -a --no-package=rdate-udeb + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- rdate-1.2.orig/debian/copyright +++ rdate-1.2/debian/copyright @@ -0,0 +1,139 @@ +This package was debianized by Anibal Monsalve Salazar on +Sun, 08 Jul 2007 20:52:51 +1000. + +It was downloaded from http://sourceforge.net/projects/openrdate/ + +Upstream Author: + + David Snyder + + The original authors and copywrite holders of this code are as follows: + + David Mazieres + Thomas Roessler - thanx for the arc4random code! + N.M. Maclaren + Thorston "mirabile" Glaser + Christos Zoulas + +Copyright: + + Copyright 1996 David Mazieres . + Copyright (c) 2002 Thorsten Glaser. All rights reserved. + Copyright (c) 1996, 1997 by N.M. Maclaren. All rights reserved. + Copyright (c) 1996, 1997 by University of Cambridge. All rights reserved. + Copyright (c) 2002 by Thorsten "mirabile" Glaser. + Copyright (c) 1994 Christos Zoulas. All rights reserved. + +License: + +The code for openrdate is under various versions of the BSD-license. +The following are the different licenses and the files they apply to. + +arc4random.c, arc4random.h: +/* + * Arc4 random number generator for OpenBSD. + * Copyright 1996 David Mazieres . + * + * Modification and redistribution in source and binary forms is + * permitted provided that due credit is given to the author and the + * OpenBSD project by leaving this copyright notice intact. + */ + +ntpleaps.c, ntpleaps.h: +/* + * Copyright (c) 2002 Thorsten Glaser. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +ntp.c: +/* + * Copyright (c) 1996, 1997 by N.M. Maclaren. All rights reserved. + * Copyright (c) 1996, 1997 by University of Cambridge. All rights reserved. + * Copyright (c) 2002 by Thorsten "mirabile" Glaser. + * + * With very slight modifications by David Snyder, copywrite (c) 2004 + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the author nor the university may be used to + * endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +rdate.c, rfc868time.c: +/* + * Copyright (c) 1994 Christos Zoulas + * All rights reserved. + * + * With slight modifications by David Snyder, copywrite (c) 2005 + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christos Zoulas. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +The Debian packaging is (C) 2007, Anibal Monsalve Salazar and +is licensed under the GPL, see `/usr/share/common-licenses/GPL'. --- rdate-1.2.orig/debian/dirs +++ rdate-1.2/debian/dirs @@ -0,0 +1 @@ +usr/bin --- rdate-1.2.orig/debian/changelog +++ rdate-1.2/debian/changelog @@ -0,0 +1,170 @@ +rdate (1:1.2-4) unstable; urgency=low + + * Connect to an NTP server over IPv6 + Patch by Jakub Wilk + Closes: 515219 + * Fix out-of-date-standards-version + * Fix patch-system-but-no-source-readme + * Update debian/watch + + -- Anibal Monsalve Salazar Wed, 26 Aug 2009 12:43:48 +1000 + +rdate (1:1.2-3) unstable; urgency=low + + [ Cyril Brulebois ] + * Use arc4random from libbsd: + - Add patch to drop the embedded code copy: 08-538695-use-libbsd.patch + - Add libbsd-dev to Build-Depends. + - Closes: 538695 + + [ Anibal Monsalve Salazar ] + * Standards-Version is 3.8.2 + + -- Anibal Monsalve Salazar Thu, 30 Jul 2009 15:27:14 +0200 + +rdate (1:1.2-1) unstable; urgency=low + + * New upstream release + - Don't use the deprecated sysctl system call with 1.40; closes: #483470 + * Build depend on quilt + * Standards Version is 3.8.1 + * DH compatibility is 7 + * Run dh_prep instead of dh_clean -k + + -- Anibal Monsalve Salazar Sat, 23 May 2009 16:56:55 +1000 + +rdate (1:1.1.3-2) unstable; urgency=low + + [ Jérémy Bobbio ] + * When "-vv" is specified, rdate now displays a dot each time it tries + to send a packet to the NTP server. This is needed to implement + cancelation of time synchronisation in the debian-installer. + Closes: 491540. + + [ Anibal Monsalve Salazar ] + * Standards-Version is 3.8.0 + + -- Anibal Monsalve Salazar Sun, 20 Jul 2008 20:36:19 +1000 + +rdate (1:1.1.3-1) unstable; urgency=low + + * New upstream release + * Added debian/watch + * Added homepage control header + * Bumped Standards-Version to 3.7.3 + + -- Anibal Monsalve Salazar Fri, 29 Feb 2008 23:30:03 +1100 + +rdate (1:1.1.2-5) unstable; urgency=low + + * Allowed "rdate -o 123 -n" w/o needing libnss_files and + /etc/services, closes: #434452. + Patch by Joey Hess . + + -- Anibal Monsalve Salazar Tue, 24 Jul 2007 09:50:19 +1000 + +rdate (1:1.1.2-4) unstable; urgency=low + + * The packages description mentions SNTP support. Closes: #434244. + * Minimised the size of the rdate binary in the udeb. Closes: #434441. + + -- Anibal Monsalve Salazar Tue, 24 Jul 2007 08:29:49 +1000 + +rdate (1:1.1.2-3) unstable; urgency=low + + * Fixed "unaligned access in ntp code triggers SIGBUS on sparc, + others", closes: #434140. + Patch by Steve Langasek . + + -- Anibal Monsalve Salazar Sun, 22 Jul 2007 11:29:36 +1000 + +rdate (1:1.1.2-2) unstable; urgency=low + + * New binary package rdate-udeb as per D-I meeting during debconf7 + in Edinburgh. + + -- Anibal Monsalve Salazar Sat, 21 Jul 2007 15:17:52 +1000 + +rdate (1:1.1.2-1) unstable; urgency=low + + * New upstream release. + + -- Anibal Monsalve Salazar Sun, 08 Jul 2007 20:52:51 +1000 + +rdate (1.4-8) unstable; urgency=low + + * Set DH_COMPAT to 5. + * Set Standards-Version to 3.7.2. + + -- Anibal Monsalve Salazar Thu, 22 Jun 2006 18:45:50 +1000 + +rdate (1.4-7) unstable; urgency=low + + * Fixed "'Usage' is missing recently added 'u' option.", closes: + #339798. Patch by Gonzalo Paniagua Javier . + * Set Standards-Version to 3.6.2 and added homepage to description. + * Added watch file. + * Fixed lintian error "package-uses-deprecated-debhelper-compat- + version 2". + + -- Anibal Monsalve Salazar Sun, 27 Nov 2005 09:34:00 +1100 + +rdate (1.4-6) unstable; urgency=low + + * Fixed "rdate should have an option to use UDP" (Closes: #291522). + Patch by Adrian Frith . + * New maintainer's email address. + + -- Anibal Monsalve Salazar Mon, 07 Feb 2005 23:15:12 +1100 + +rdate (1.4-5) unstable; urgency=low + + * New maintainer. + + -- Anibal Monsalve Salazar Thu, 20 May 2004 10:06:28 +1000 + +rdate (1.4-4) unstable; urgency=low + + * Documented port argument. + * Print time using locale information (closes: #185143). + + -- Herbert Xu Sat, 5 Apr 2003 16:48:48 +1000 + +rdate (1.4-3) unstable; urgency=low + + * Added build-time dependency on pmake (closes: #168030, 168035). + + -- Herbert Xu Thu, 7 Nov 2002 07:10:57 +1100 + +rdate (1.4-2) unstable; urgency=low + + * Added optional port argument (closes: #156101). + * Added build-time dependency on debhelper. + + -- Herbert Xu Wed, 6 Nov 2002 20:06:24 +1100 + +rdate (1.4-1) unstable; urgency=low + + * Synchronised with NetBSD 20020411: + . Adds support for IPv6. + + -- Herbert Xu Thu, 11 Apr 2002 20:26:19 +1000 + +rdate (1.3-3) frozen unstable; urgency=low + + * Corrected the license in copyright (closes: #52289). + + -- Herbert Xu Fri, 26 Nov 1999 08:36:31 +1100 + +rdate (1.3-2) unstable; urgency=low + + * Fixed an Alpha bug introduced when applying the netstd patch. + + -- Herbert Xu Fri, 26 Nov 1999 08:36:31 +1100 + +rdate (1.3-1) unstable; urgency=low + + * Initial release. + + -- Herbert Xu Fri, 5 Nov 1999 20:22:06 +1100 + --- rdate-1.2.orig/debian/patches/series +++ rdate-1.2/debian/patches/series @@ -0,0 +1,5 @@ +02-434140-unaligned-read.patch +04-434452-avoid-libnss-files-library.patch +06-491540-add-progress.patch +08-538695-use-libbsd.patch +10-515219-socklen.patch --- rdate-1.2.orig/debian/patches/02-434140-unaligned-read.patch +++ rdate-1.2/debian/patches/02-434140-unaligned-read.patch @@ -0,0 +1,24 @@ +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=434140 + +unaligned access in ntp code triggers SIGBUS on sparc, others + +Frans Pop's testing of rdate on sparc reveals that the ntp option fails with +a SIGBUS, because the ntp code performs an unaligned 64-bit read when from +the packet data. This definitely affects sparc, and will also affect a +number of other archs, either causing an unnecessary performance penalty or +causing the same SIGBUS. + +Steve Langasek Sat, 21 Jul 2007 13:51:43 -0700 + +diff -up a/src/ntp.c b/src/ntp.c +--- a/src/ntp.c 2007-11-11 17:04:33.000000000 +1100 ++++ b/src/ntp.c 2009-05-26 11:44:38.000000000 +1000 +@@ -429,7 +429,7 @@ unpack_ntp(struct ntp_data *data, u_char + data->transmit = d / NTP_SCALE; + + /* See write_packet for why this isn't an endian problem. */ +- data->recvck = *(u_int64_t *)(packet + NTP_ORIGINATE); ++ memcpy(&data->recvck,packet+NTP_ORIGINATE,8); + } + + /* --- rdate-1.2.orig/debian/patches/08-538695-use-libbsd.patch +++ rdate-1.2/debian/patches/08-538695-use-libbsd.patch @@ -0,0 +1,80 @@ +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -1,8 +1,7 @@ + noinst_LIBRARIES=librdate.a + +-librdate_a_SOURCES= arc4random.c \ ++librdate_a_SOURCES= \ + ntp.c \ + ntpleaps.c \ + rfc868time.c \ +- ntpleaps.h \ +- arc4random.h ++ ntpleaps.h +--- a/src/ntp.c ++++ b/src/ntp.c +@@ -50,7 +50,7 @@ + #include + + #include "ntpleaps.h" +-#include "arc4random.h" ++#include + + /* + * NTP definitions. Note that these assume 8-bit bytes - sigh. There +--- a/Makefile.am ++++ b/Makefile.am +@@ -6,7 +6,7 @@ rdate_SOURCES= \ + src/rdate.c + + rdate_LDADD= \ +- src/librdate.a ++ src/librdate.a -lbsd + + man_MANS= \ + docs/rdate.8 +--- a/Makefile.in ++++ b/Makefile.in +@@ -183,7 +183,7 @@ rdate_SOURCES = \ + src/rdate.c + + rdate_LDADD = \ +- src/librdate.a ++ src/librdate.a -lbsd + + man_MANS = \ + docs/rdate.8 +--- a/src/Makefile.in ++++ b/src/Makefile.in +@@ -50,7 +50,7 @@ AR = ar + ARFLAGS = cru + librdate_a_AR = $(AR) $(ARFLAGS) + librdate_a_LIBADD = +-am_librdate_a_OBJECTS = arc4random.$(OBJEXT) ntp.$(OBJEXT) \ ++am_librdate_a_OBJECTS = ntp.$(OBJEXT) \ + ntpleaps.$(OBJEXT) rfc868time.$(OBJEXT) + librdate_a_OBJECTS = $(am_librdate_a_OBJECTS) + DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +@@ -155,12 +155,11 @@ sharedstatedir = @sharedstatedir@ + sysconfdir = @sysconfdir@ + target_alias = @target_alias@ + noinst_LIBRARIES = librdate.a +-librdate_a_SOURCES = arc4random.c \ ++librdate_a_SOURCES = \ + ntp.c \ + ntpleaps.c \ + rfc868time.c \ +- ntpleaps.h \ +- arc4random.h ++ ntpleaps.h + + all: all-am + +@@ -209,7 +208,6 @@ mostlyclean-compile: + distclean-compile: + -rm -f *.tab.c + +-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arc4random.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntp.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntpleaps.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfc868time.Po@am__quote@ --- rdate-1.2.orig/debian/patches/10-515219-socklen.patch +++ rdate-1.2/debian/patches/10-515219-socklen.patch @@ -0,0 +1,60 @@ +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=515219 + +It is not possible to connect to an NTP server over IPv6. The +following patch fixes this bug. + +Signed-off-by: Jakub Wilk + +diff --git a/src/ntp.c b/src/ntp.c +--- a/src/ntp.c ++++ b/src/ntp.c +@@ -91,10 +91,6 @@ + #define MILLION_L 1000000l /* For conversion to/from timeval */ + #define MILLION_D 1.0e6 /* Must be equal to MILLION_L */ + +-#ifdef __GLIBC__ +-#define SA_LEN(x) sizeof(*x) +-#endif +- + struct ntp_data { + u_char status; + u_char version; +@@ -111,7 +107,7 @@ + }; + + void ntp_client(const char *, int, struct timeval *, struct timeval *, int, int, int); +-int sync_ntp(int, const struct sockaddr *, double *, double *, int); ++int sync_ntp(int, const struct sockaddr *, socklen_t, double *, double *, int); + int write_packet(int, struct ntp_data *); + int read_packet(int, struct ntp_data *, double *, double *); + void unpack_ntp(struct ntp_data *, u_char *); +@@ -155,7 +151,8 @@ + ((struct sockaddr_in*)res->ai_addr)->sin_port = htons(port); + } + +- ret = sync_ntp(s, res->ai_addr, &offset, &error, verbose); ++ ret = sync_ntp(s, res->ai_addr, res->ai_addrlen, &offset, ++ &error, verbose); + if (ret < 0) { + #ifdef DEBUG + fprintf(stderr, "try the next address\n"); +@@ -181,8 +178,8 @@ + } + + int +-sync_ntp(int fd, const struct sockaddr *peer, double *offset, double *error, +- int verbose) ++sync_ntp(int fd, const struct sockaddr *peer, socklen_t addrlen, ++ double *offset, double *error, int verbose) + { + int attempts = 0, accepts = 0, rejects = 0; + int delay = MAX_DELAY, ret; +@@ -195,7 +192,7 @@ + *offset = 0.0; + *error = NTP_INSANITY; + +- if (connect(fd, peer, SA_LEN(peer)) < 0) { ++ if (connect(fd, peer, addrlen) < 0) { + warn("Failed to connect to server"); + return (-1); + } --- rdate-1.2.orig/debian/patches/06-491540-add-progress.patch +++ rdate-1.2/debian/patches/06-491540-add-progress.patch @@ -0,0 +1,89 @@ +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=491540 + +When "-vv" is specified, rdate now displays a dot each time it tries +to send a packet to the NTP server. This is needed to implement +cancelation of time synchronisation in the debian-installer. + +The attached patch will allow rdate to display a line with a single dot +('.') on stderr each time an attempt to contact the NTP server is made. +This is only made when "-vv" has been given on the command-line. + +This patch would allow us to implement cancelable progress during the +clock-setup step of the debian-installer. + +Jérémy Bobbio Sun, 20 Jul 2008 11:47:41 +0200 + +diff -up a/src/rdate.c b/src/rdate.c +--- a/src/rdate.c 2009-05-27 11:44:11.000000000 +1000 ++++ b/src/rdate.c 2009-05-27 11:53:47.000000000 +1000 +@@ -70,7 +70,7 @@ static const char rcsid[] = "$OpenBSD: r + #endif + + void rfc868time_client (const char *, int, struct timeval *, struct timeval *, int, int, int); +-void ntp_client (const char *, int, struct timeval *, struct timeval *, int, int); ++void ntp_client (const char *, int, struct timeval *, struct timeval *, int, int, int); + + extern char *__progname; + +@@ -157,7 +157,7 @@ main(int argc, char **argv) + hname = argv[optind]; + + if (ntp) +- ntp_client(hname, family, &new, &adjust, corrleaps, port); ++ ntp_client(hname, family, &new, &adjust, corrleaps, port, verbose); + else + rfc868time_client(hname, family, &new, &adjust, corrleaps, useudp, port); + +diff -up a/src/ntp.c b/src/ntp.c +--- a/src/ntp.c 2009-05-27 11:44:11.000000000 +1000 ++++ b/src/ntp.c 2009-05-27 11:53:47.000000000 +1000 +@@ -110,8 +110,8 @@ struct ntp_data { + u_int64_t xmitck; + }; + +-void ntp_client(const char *, int, struct timeval *, struct timeval *, int, int); +-int sync_ntp(int, const struct sockaddr *, double *, double *); ++void ntp_client(const char *, int, struct timeval *, struct timeval *, int, int, int); ++int sync_ntp(int, const struct sockaddr *, double *, double *, int); + int write_packet(int, struct ntp_data *); + int read_packet(int, struct ntp_data *, double *, double *); + void unpack_ntp(struct ntp_data *, u_char *); +@@ -126,7 +126,7 @@ int corrleaps; + + void + ntp_client(const char *hostname, int family, struct timeval *new, +- struct timeval *adjust, int leapflag, int port) ++ struct timeval *adjust, int leapflag, int port, int verbose) + { + struct addrinfo hints, *res0, *res; + double offset, error; +@@ -155,7 +155,7 @@ ntp_client(const char *hostname, int fam + ((struct sockaddr_in*)res->ai_addr)->sin_port = htons(port); + } + +- ret = sync_ntp(s, res->ai_addr, &offset, &error); ++ ret = sync_ntp(s, res->ai_addr, &offset, &error, verbose); + if (ret < 0) { + #ifdef DEBUG + fprintf(stderr, "try the next address\n"); +@@ -181,7 +181,8 @@ ntp_client(const char *hostname, int fam + } + + int +-sync_ntp(int fd, const struct sockaddr *peer, double *offset, double *error) ++sync_ntp(int fd, const struct sockaddr *peer, double *offset, double *error, ++ int verbose) + { + int attempts = 0, accepts = 0, rejects = 0; + int delay = MAX_DELAY, ret; +@@ -200,6 +201,10 @@ sync_ntp(int fd, const struct sockaddr * + } + + while (accepts < MAX_QUERIES && attempts < 2 * MAX_QUERIES) { ++ if (verbose >= 2) { ++ fprintf(stderr, ".\n"); ++ fflush(stderr); ++ } + memset(&data, 0, sizeof(data)); + + if (current_time(JAN_1970) > deadline) { --- rdate-1.2.orig/debian/patches/04-434452-avoid-libnss-files-library.patch +++ rdate-1.2/debian/patches/04-434452-avoid-libnss-files-library.patch @@ -0,0 +1,263 @@ +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=434452 + +Should be able to use rdate -o 123 -n w/o needing libnss_files and +/etc/services + +rdate currently uses /etc/services to determine ntp ports. For the udeb +in d-i, I'd rather avoid that, since the libnss_files library needed to +read /etc/services is not currently included in d-i, and would use +significant space (33k). Currently if these files are omitted, it fails: + +rdate: pool.ntp.org: Servname not supported for ai_socktype. + +It seemed to me that if rdate is run with the -o option, it knows the +port to use, and so shouldn't need to look in /etc/services at all. +However the current use of getaddrinfo makes it look in /etc/services +every time. Also, it currently doesn't support -o at all for NTP. + +PS: As I was reading the code, I noticed several innacuracies on the +man page: + +* -u is not supported for NTP. Probably obvious, to those who know how + NTP works, but wasn't to me. :-) +* -4 and -6 only select the preferred address family. Ie, with -6, it + will first try any ipv6 addresses, but if none are found, or + connecting fails, it will then fall back to ipv4 addresses. + +PPS: The package description should mention that it can also use NTP. + +Joey Hess Mon, 23 Jul 2007 18:29:43 -0400 + +diff -up a/src/rfc868time.c b/src/rfc868time.c +--- a/src/rfc868time.c 2006-09-29 12:12:55.000000000 +1000 ++++ b/src/rfc868time.c 2009-05-27 11:44:11.000000000 +1000 +@@ -69,7 +69,7 @@ static const char rcsid[] = "$OpenBSD: r + + void + rfc868time_client (const char *hostname, int family, struct timeval *new, +- struct timeval *adjust, int leapflag) ++ struct timeval *adjust, int leapflag, int useudp, int port) + { + struct addrinfo hints, *res0, *res; + struct timeval old; +@@ -80,10 +80,10 @@ rfc868time_client (const char *hostname, + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = family; +- hints.ai_socktype = SOCK_STREAM; ++ hints.ai_socktype = useudp ? SOCK_DGRAM : SOCK_STREAM; + /* XXX what about rfc868 UDP + * probably not due to the Y2038 issue -mirabile */ +- error = getaddrinfo(hostname, "time", &hints, &res0); ++ error = getaddrinfo(hostname, port ? NULL : "time", &hints, &res0); + if (error) { + errx(1, "%s: %s", hostname, gai_strerror(error)); + /*NOTREACHED*/ +@@ -95,6 +95,10 @@ rfc868time_client (const char *hostname, + if (s < 0) + continue; + ++ if (port) { ++ ((struct sockaddr_in*)res->ai_addr)->sin_port = htons(port); ++ } ++ + if (connect(s, res->ai_addr, res->ai_addrlen) < 0) { + close(s); + s = -1; +@@ -107,6 +111,10 @@ rfc868time_client (const char *hostname, + err(1, "Could not connect socket"); + freeaddrinfo(res0); + ++ /* UDP requires us to send an empty datagram first */ ++ if (useudp) ++ send(s, NULL, 0, 0); ++ + if (read(s, &tim, sizeof(tim)) != sizeof(tim)) + err(1, "Could not read data"); + +diff -up a/src/rdate.c b/src/rdate.c +--- a/src/rdate.c 2006-09-29 12:12:55.000000000 +1000 ++++ b/src/rdate.c 2009-05-27 11:44:11.000000000 +1000 +@@ -55,6 +55,7 @@ static const char rcsid[] = "$OpenBSD: r + #include + + #include ++#include + #include + #include + #include +@@ -68,22 +69,24 @@ static const char rcsid[] = "$OpenBSD: r + #define logwtmp(a,b,c) + #endif + +-void rfc868time_client (const char *, int, struct timeval *, struct timeval *, int); +-void ntp_client (const char *, int, struct timeval *, struct timeval *, int); ++void rfc868time_client (const char *, int, struct timeval *, struct timeval *, int, int, int); ++void ntp_client (const char *, int, struct timeval *, struct timeval *, int, int); + + extern char *__progname; + + void + usage(void) + { +- (void) fprintf(stderr, "Usage: %s [-46acnpsv] host\n", __progname); ++ (void) fprintf(stderr, "Usage: %s [-46acnpsv] [-o port] host\n", __progname); + (void) fprintf(stderr, " -4: use IPv4 only\n"); + (void) fprintf(stderr, " -6: use IPv6 only\n"); + (void) fprintf(stderr, " -a: use adjtime instead of instant change\n"); + (void) fprintf(stderr, " -c: correct leap second count\n"); + (void) fprintf(stderr, " -n: use SNTP instead of RFC868 time protocol\n"); ++ (void) fprintf(stderr, " -o num: override time port with num\n"); + (void) fprintf(stderr, " -p: just print, don't set\n"); + (void) fprintf(stderr, " -s: just set, don't print\n"); ++ (void) fprintf(stderr, " -u: use UDP instead of TCP as transport\n"); + (void) fprintf(stderr, " -v: verbose output\n"); + } + +@@ -91,15 +94,16 @@ int + main(int argc, char **argv) + { + int pr = 0, silent = 0, ntp = 0, verbose = 0; +- int slidetime = 0, corrleaps = 0; ++ int slidetime = 0, corrleaps = 0, useudp = 0; + char *hname; + extern int optind; + int c; + int family = PF_UNSPEC; ++ int port = 0; + + struct timeval new, adjust; + +- while ((c = getopt(argc, argv, "46psancv")) != -1) ++ while ((c = getopt(argc, argv, "46psancvuo:")) != -1) + switch (c) { + case '4': + family = PF_INET; +@@ -133,6 +137,14 @@ main(int argc, char **argv) + verbose++; + break; + ++ case 'u': ++ useudp++; ++ break; ++ ++ case 'o': ++ port = atoi(optarg); ++ break; ++ + default: + usage(); + return 1; +@@ -145,9 +157,9 @@ main(int argc, char **argv) + hname = argv[optind]; + + if (ntp) +- ntp_client(hname, family, &new, &adjust, corrleaps); ++ ntp_client(hname, family, &new, &adjust, corrleaps, port); + else +- rfc868time_client(hname, family, &new, &adjust, corrleaps); ++ rfc868time_client(hname, family, &new, &adjust, corrleaps, useudp, port); + + if (!pr) { + if (!slidetime) { +diff -up a/src/ntp.c b/src/ntp.c +--- a/src/ntp.c 2007-11-11 17:04:33.000000000 +1100 ++++ b/src/ntp.c 2009-05-27 11:44:11.000000000 +1000 +@@ -110,7 +110,7 @@ struct ntp_data { + u_int64_t xmitck; + }; + +-void ntp_client(const char *, int, struct timeval *, struct timeval *, int); ++void ntp_client(const char *, int, struct timeval *, struct timeval *, int, int); + int sync_ntp(int, const struct sockaddr *, double *, double *); + int write_packet(int, struct ntp_data *); + int read_packet(int, struct ntp_data *, double *, double *); +@@ -126,7 +126,7 @@ int corrleaps; + + void + ntp_client(const char *hostname, int family, struct timeval *new, +- struct timeval *adjust, int leapflag) ++ struct timeval *adjust, int leapflag, int port) + { + struct addrinfo hints, *res0, *res; + double offset, error; +@@ -135,7 +135,7 @@ ntp_client(const char *hostname, int fam + memset(&hints, 0, sizeof(hints)); + hints.ai_family = family; + hints.ai_socktype = SOCK_DGRAM; +- ierror = getaddrinfo(hostname, "ntp", &hints, &res0); ++ ierror = getaddrinfo(hostname, port ? NULL : "ntp", &hints, &res0); + if (ierror) { + errx(1, "%s: %s", hostname, gai_strerror(ierror)); + /*NOTREACHED*/ +@@ -150,6 +150,10 @@ ntp_client(const char *hostname, int fam + s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + if (s < 0) + continue; ++ ++ if (port) { ++ ((struct sockaddr_in*)res->ai_addr)->sin_port = htons(port); ++ } + + ret = sync_ntp(s, res->ai_addr, &offset, &error); + if (ret < 0) { +--- a/docs/rdate.8 2007-11-11 17:04:33.000000000 +1100 ++++ b/docs/rdate.8 2009-05-27 11:44:11.000000000 +1000 +@@ -3,6 +3,7 @@ + .\" + .\" Copyright (c) 1994 Christos Zoulas + .\" All rights reserved. ++.\" Copyright (c) 2007 Anibal Monsalve Salazar + .\" + .\" Redistribution and use in source and binary forms, with or without + .\" modification, are permitted provided that the following conditions +@@ -37,7 +38,8 @@ + .Nd set the system's date from a remote host + .Sh SYNOPSIS + .Nm rdate +-.Op Fl 46acnpsv ++.Op Fl 46acnpsuv ++.Op Fl o Ar port + .Ar host + .Sh DESCRIPTION + .Nm +@@ -76,10 +78,16 @@ server (with this parameter) or (recomme + controlled watch or phone service. + .It Fl n + Use SNTP (RFC 2030) instead of the RFC 868 time protocol. ++.It Fl o Ar port ++Use port ++.Ar port ++instead of port 37. + .It Fl p + Do not set, just print the remote time. + .It Fl s + Do not print the time. ++.It Fl u ++Use UDP instead of TCP as transport. + .It Fl v + Verbose output. + Always show the adjustment. +@@ -108,9 +116,22 @@ To gradually adjust time once an hour af + adjustment, put the following line into root's crontab: + .Pp + .D1 Li "58 * * * * rdate -ncav ptbtime1.ptb.de | logger -t NTP" ++.Pp ++To to set the time through an ssh tunnel, use something like so: ++.Pp ++.D1 Li ssh -f -L 10037:time.example.com:37 tyr.example.com sleep 10 ++.D1 Li rdate -a -o 10037 locahost ++.Pp + .Sh SEE ALSO + .Xr date 1 , + .Xr adjtime 2 , + .Xr inetd 8 , + .Xr ntpd 8 , + .Xr timed 8 ++.Sh AUTHORS ++This ++manual page was written by ++.An Christos Zoulas. ++It was changed by ++.An Anibal Monsalve Salazar ++for the Debian Project.