⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 12

📁 Unix/Linux 网络时间协议版本3 Network Time Protocol Version 3 (NTP) distribution for Unix systems
💻
📖 第 1 页 / 共 4 页
字号:
Received: from mail.eecis.udel.edu by whimsy.udel.edu id aa06167;          10 Aug 1998 17:49 EDTReceived: from localhost (localhost [[UNIX: localhost]]) by hrothgar.gw.com (8.9.1/8.8.6.Beta0/2.1.kim) id RAA10454 for stenn@whimsy.udel.edu; Mon, 10 Aug 1998 17:49:39 -0400 (EDT)Message-Id: <199808102149.RAA10454@hrothgar.gw.com>From: Christos Zoulas <christos@zoulas.com>Date: Mon, 10 Aug 1998 17:49:39 -0400In-Reply-To: <4827.902780923@whimsy.udel.edu>       from stenn@whimsy.udel.edu (Aug 10,  4:28pm)Organization: Astron SoftwareX-Mailer: Mail User's Shell (7.2.6 beta(2)+dynamic 2/29/96)To: stenn@whimsy.udel.eduSubject: Re: xntp patchesOn Aug 10,  4:28pm, stenn@whimsy.udel.edu (stenn@whimsy.udel.edu) wrote:-- Subject: Re: xntp patches| Christos,| | Did you apply the 3 patches to 5.93 that are out there?| | If they don't fix the problems, please send me the patches again (sorry,| but I have  *ton* of email here and the patches you describe don't seem| to be "handy") and I'll wrap them up with the 3 existing patches and| cut a 5.94 release.| | HarlanHere it is again; most of the fixes, except the md5 stuff are non-controvercial.Note that the structure of the directories is a bit different than the standarddistribution. Also I have mandoc pages for the main programs re-written from thehtml pages; maybe we could automate their generation.christos- Use the latest version of the mdX routines if __NetBSD__- Add missing prototypes- Don't compare against EOF in ntp_getopt; the getopt functions are defined  to return -1.- NetBSD is broken with respect to clock_settime in that it does not  define CLOCK_REALTIME yet. Check for that.- Make functions in the function lists have consistant signatures and  widen prototypes where necessary.- Fix a printf argument.- make main declarations consistant; use int main instead of void always,  and add prototypes for the appropriate main function.diff -rc old/lib/libntp/a_md512crypt.c new/lib/libntp/a_md512crypt.c*** old/lib/libntp/a_md512crypt.c	Mon Aug 10 17:42:48 1998--- new/lib/libntp/a_md512crypt.c	Mon Aug 10 17:40:19 1998****************** 74,79 ****--- 74,82 ----      u_int32 *pkt;      int length;	/* total length of encrypted area */  {+ #ifdef __NetBSD__+     unsigned char hash[16];+ #endif      /*       *  Don't bother checking the keys.  The first stage would have       *  handled that.  Finish up the generation by also including the****************** 81,90 ****       */        MD5Update(&ctx, (unsigned const char *)(pkt) + length - 8, 8);      MD5Final(&ctx);        memmove((char *) &pkt[NOCRYPT_int32S + length/sizeof(u_int32)],! 	    (char *) ctx.digest,	      	    BLOCK_OCTETS);      return (4 + BLOCK_OCTETS);  }--- 84,101 ----       */        MD5Update(&ctx, (unsigned const char *)(pkt) + length - 8, 8);+ #ifdef __NetBSD__+     MD5Final(hash, &ctx);+ #else      MD5Final(&ctx);+ #endif        memmove((char *) &pkt[NOCRYPT_int32S + length/sizeof(u_int32)],! #ifdef __NetBSD__! 	    (char *) hash,! #else! 	    (char *) ctx.digest,! #endif  	    BLOCK_OCTETS);      return (4 + BLOCK_OCTETS);  }diff -rc old/lib/libntp/a_md5decrypt.c new/lib/libntp/a_md5decrypt.c*** old/lib/libntp/a_md5decrypt.c	Mon Aug 10 17:42:48 1998--- new/lib/libntp/a_md5decrypt.c	Mon Aug 10 17:39:56 1998****************** 39,44 ****--- 39,47 ----      int length;		/* length of variable data in octets */  {      MD5_CTX ctx;+ #ifdef __NetBSD__+     unsigned char hash[16];+ #endif        authdecryptions++;  ****************** 51,59 ****      MD5Init(&ctx);      MD5Update(&ctx, (unsigned const char *)cache_key, cache_keylen);      MD5Update(&ctx, (unsigned const char *)pkt, length);      MD5Final(&ctx);  !     return (!memcmp((const char *)ctx.digest,  		    (const char *)pkt + length + 4,  		    BLOCK_OCTETS));  }--- 54,71 ----      MD5Init(&ctx);      MD5Update(&ctx, (unsigned const char *)cache_key, cache_keylen);      MD5Update(&ctx, (unsigned const char *)pkt, length);+ #ifdef __NetBSD__+     MD5Final(hash, &ctx);+ #else      MD5Final(&ctx);+ #endif  !     return (!memcmp(! #ifdef __NetBSD__! 		    (const char *) hash,! #else! 		    (const char *) ctx.digest,! #endif  		    (const char *)pkt + length + 4,  		    BLOCK_OCTETS));  }diff -rc old/lib/libntp/a_md5encrypt.c new/lib/libntp/a_md5encrypt.c*** old/lib/libntp/a_md5encrypt.c	Mon Aug 10 17:42:48 1998--- new/lib/libntp/a_md5encrypt.c	Mon Aug 10 17:39:28 1998****************** 45,50 ****--- 45,53 ----  {      MD5_CTX ctx;      int len;		/* in 4 byte quantities */+ #ifdef __NetBSD__+     unsigned char hash[16];+ #endif        authencryptions++;  ****************** 64,73 ****      MD5Init(&ctx);      MD5Update(&ctx, (unsigned const char *)cache_key, cache_keylen);      MD5Update(&ctx, (unsigned const char *)pkt, length);      MD5Final(&ctx);        memmove((char *)&pkt[NOCRYPT_int32S + len],! 	    (char *)ctx.digest,  	    BLOCK_OCTETS);      return (4 + BLOCK_OCTETS);	/* return size of key and MAC  */  }--- 67,84 ----      MD5Init(&ctx);      MD5Update(&ctx, (unsigned const char *)cache_key, cache_keylen);      MD5Update(&ctx, (unsigned const char *)pkt, length);+ #ifdef __NetBSD__+     MD5Final(hash, &ctx);+ #else      MD5Final(&ctx);+ #endif        memmove((char *)&pkt[NOCRYPT_int32S + len],! #ifdef __NetBSD__! 	    (char *) hash,! #else! 	    (char *) ctx.digest,! #endif  	    BLOCK_OCTETS);      return (4 + BLOCK_OCTETS);	/* return size of key and MAC  */  }diff -rc old/lib/libntp/getopt.c new/lib/libntp/getopt.c*** old/lib/libntp/getopt.c	Mon Aug 10 17:42:49 1998--- new/lib/libntp/getopt.c	Mon Aug 10 17:38:40 1998****************** 30,35 ****--- 30,37 ----  static char	*scan = NULL;	/* Private scan pointer. */  static const char	*prog = "amnesia";  + static int badopt P((char *, int));+   /*   * Print message about a bad option.   */diff -rc old/lib/libntp/humandate.c new/lib/libntp/humandate.c*** old/lib/libntp/humandate.c	Mon Aug 10 17:42:49 1998--- new/lib/libntp/humandate.c	Mon Aug 10 17:38:05 1998****************** 20,25 ****--- 20,27 ----          "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"  };  + char *humanlogtime P((void));+   char *  humandate(ntptime)  	u_long ntptime;diff -rc old/lib/libntp/lib_strbuf.h new/lib/libntp/lib_strbuf.h*** old/lib/libntp/lib_strbuf.h	Mon Aug 10 17:42:50 1998--- new/lib/libntp/lib_strbuf.h	Mon Aug 10 17:37:23 1998****************** 25,27 ****--- 25,29 ----  extern char lib_stringbuf[LIB_NUMBUFS][LIB_BUFLENGTH];  extern int lib_nextbuf;  extern int lib_inited;+ + void init_lib P((void));diff -rc old/lib/libntp/machines.c new/lib/libntp/machines.c*** old/lib/libntp/machines.c	Mon Aug 10 17:42:50 1998--- new/lib/libntp/machines.c	Mon Aug 10 17:36:25 1998****************** 112,118 ****  }  #endif /* SYS_PTX */  ! #ifdef HAVE_CLOCK_SETTIME  const char *set_tod_using = "clock_settime";    /*#include <time.h>	*/--- 112,118 ----  }  #endif /* SYS_PTX */  ! #if defined(HAVE_CLOCK_SETTIME) && defined(CLOCK_REALTIME)  const char *set_tod_using = "clock_settime";    /*#include <time.h>	*/****************** 131,137 ****    return clock_settime(CLOCK_REALTIME, &ts);  }  ! #else /* not HAVE_CLOCK_SETTIME */  # ifdef HAVE_SETTIMEOFDAY  const char *set_tod_using = "settimeofday";  # else /* not (HAVE_SETTIMEOFDAY || HAVE_CLOCK_SETTIME) */--- 131,137 ----    return clock_settime(CLOCK_REALTIME, &ts);  }  ! #else /* not HAVE_CLOCK_SETTIME || not CLOCK_REALTIME */  # ifdef HAVE_SETTIMEOFDAY  const char *set_tod_using = "settimeofday";  # else /* not (HAVE_SETTIMEOFDAY || HAVE_CLOCK_SETTIME) */Only in new/lib/libntp: obj.i386diff -rc old/usr.sbin/xntp/Makefile.inc new/usr.sbin/xntp/Makefile.inc*** old/usr.sbin/xntp/Makefile.inc	Mon Aug 10 17:42:55 1998--- new/usr.sbin/xntp/Makefile.inc	Mon Aug 10 15:45:34 1998****************** 1,5 ****  #	$NetBSD: $! WARNS?=	0  CPPFLAGS += -I${.CURDIR}/../include -DHAVE_CONFIG_H  LDADD += -lntp  DPADD += ${LIBNTP}--- 1,5 ----  #	$NetBSD: $! WARNS?=	1  CPPFLAGS += -I${.CURDIR}/../include -DHAVE_CONFIG_H  LDADD += -lntp  DPADD += ${LIBNTP}diff -rc old/usr.sbin/xntp/include/parse.h new/usr.sbin/xntp/include/parse.h*** old/usr.sbin/xntp/include/parse.h	Mon Aug 10 17:42:52 1998--- new/usr.sbin/xntp/include/parse.h	Mon Aug 10 15:54:23 1998****************** 335,345 ****    struct clockformat  {!   u_long	(*input)();	/* special input protocol - implies fixed format */!   u_long        (*convert)();	/* conversion routine */!   void          (*syncevt)();	/* routine for handling RS232 sync events (time stamps) */!   u_long        (*syncpps)();	/* PPS input routine */!   u_long        (*synth)();	/* time code synthesizer */    void           *data;		/* local parameters */    char           *name;		/* clock format name */    unsigned short  length;	/* maximum length of data packet */--- 335,350 ----    struct clockformat  {!   u_long	(*input)	/* special input protocol - implies fixed format */! 	P((parse_t *, unsigned int, timestamp_t *));!   u_long        (*convert)	/* conversion routine */! 	P((char *, unsigned int, void *, clocktime_t *, void *));!   void          (*syncevt)	/* routine for handling RS232 sync events (time stamps) */! 	P((parse_t *, timestamp_t *, void *, u_long));!   u_long        (*syncpps)	/* PPS input routine */! 	P((parse_t *, int, timestamp_t *));!   u_long        (*synth)	/* time code synthesizer */! 	P((parse_t *, timestamp_t *));    void           *data;		/* local parameters */    char           *name;		/* clock format name */    unsigned short  length;	/* maximum length of data packet */****************** 371,377 ****    extern time_t parse_to_unixtime P((clocktime_t *, u_long *));  extern u_long updatetimeinfo P((parse_t *, time_t, u_long, u_long));! extern void syn_simple P((parse_t *, timestamp_t *, struct format *, u_long));  extern u_long pps_simple P((parse_t *, int, timestamp_t *));  #endif  --- 376,382 ----    extern time_t parse_to_unixtime P((clocktime_t *, u_long *));  extern u_long updatetimeinfo P((parse_t *, time_t, u_long, u_long));! extern void syn_simple P((parse_t *, timestamp_t *, void *, u_long));  extern u_long pps_simple P((parse_t *, int, timestamp_t *));  #endif  diff -rc old/usr.sbin/xntp/ntpdate/ntpdate.c new/usr.sbin/xntp/ntpdate/ntpdate.c*** old/usr.sbin/xntp/ntpdate/ntpdate.c	Mon Aug 10 17:42:54 1998--- new/usr.sbin/xntp/ntpdate/ntpdate.c	Mon Aug 10 15:49:57 1998****************** 69,80 ****  #define	NTPDATE_PRIO	(-12)  #else  #define	NTPDATE_PRIO	(100)- #endif-   #if defined(HAVE_TIMER_SETTIME) || defined (HAVE_TIMER_CREATE)  /* POSIX TIMERS - vxWorks doesn't have itimer - casey */  static timer_t ntpdate_timerid;  #endif    /*   * Compatibility stuff for Version 2--- 69,80 ----  #define	NTPDATE_PRIO	(-12)  #else  #define	NTPDATE_PRIO	(100)  #if defined(HAVE_TIMER_SETTIME) || defined (HAVE_TIMER_CREATE)  /* POSIX TIMERS - vxWorks doesn't have itimer - casey */  static timer_t ntpdate_timerid;  #endif+ #endif+     /*   * Compatibility stuff for Version 2****************** 220,225 ****--- 220,228 ----  #endif /* SYS_WINNT */    #ifdef NO_MAIN_ALLOWED+ void ntpdatemain P((int, char *[]));+ + void  CALL(ntpdate,"ntpdate",ntpdatemain);    void clear_globals()****************** 280,296 ****    always_step = 0;    never_step = 0;  }  #endif    /*   * Main program.  Initialize us and loop waiting for I/O and/or   * timer expiries.   */- void  #ifndef NO_MAIN_ALLOWED! main  #else! ntpdatemain  #endif /* NO_MAIN_ALLOWED */  (argc, argv)       int argc;--- 283,300 ----    always_step = 0;    never_step = 0;  }+ #else+ int main P((int, char *[]));  #endif    /*   * Main program.  Initialize us and loop waiting for I/O and/or   * timer expiries.   */  #ifndef NO_MAIN_ALLOWED! int main  #else! void ntpdatemain  #endif /* NO_MAIN_ALLOWED */  (argc, argv)       int argc;****************** 332,338 ****    /*     * Decode argument list     */!   while ((c = ntp_getopt(argc, argv, "a:bBde:k:o:p:qr:st:uv")) != EOF)      switch (c)        {        case 'a':--- 336,342 ----    /*     * Decode argument list     */!   while ((c = ntp_getopt(argc, argv, "a:bBde:k:o:p:qr:st:uv")) != -1)      switch (c)        {        case 'a':Only in new/usr.sbin/xntp/ntpdate: obj.i386diff -rc old/usr.sbin/xntp/ntpq/ntpq.c new/usr.sbin/xntp/ntpq/ntpq.c*** old/usr.sbin/xntp/ntpq/ntpq.c	Mon Aug 10 17:42:54 1998--- new/usr.sbin/xntp/ntpq/ntpq.c	Mon Aug 10 15:49:45 1998****************** 434,439 ****--- 434,440 ----  int debug;    #ifdef NO_MAIN_ALLOWED+ void ntpqmain P((int, char *[]));  CALL(ntpq,"ntpq",ntpqmain);    void clear_globals()****************** 449,465 ****      numcmds = 0;      numhosts = 0;      }  #endif  /*   * main - parse arguments and handle options   */- #if !defined(VMS)- void- #endif /* VMS */  #ifndef NO_MAIN_ALLOWED! main  #else! ntpqmain  #endif  (argc, argv)  int argc;--- 450,465 ----      numcmds = 0;      numhosts = 0;      }+ #else+ int main P((int, char *[]));  #endif  /*   * main - parse arguments and handle options   */  #ifndef NO_MAIN_ALLOWED! int main  #else! void ntpqmain  #endif  (argc, argv)  int argc;****************** 478,484 ****  	delay_time.l_uf = DEFDELAY;    	progname = argv[0];! 	while ((c = ntp_getopt(argc, argv, "c:dinp")) != EOF)  		switch (c) {  		case 'c':  			ADDCMD(ntp_optarg);--- 478,484 ----  	delay_time.l_uf = DEFDELAY;    	progname = argv[0];! 	while ((c = ntp_getopt(argc, argv, "c:dinp")) != -1)  		switch (c) {  		case 'c':

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -