summaryrefslogtreecommitdiffstats
path: root/usr.sbin/xntpd/patches/patch.6
blob: 220acad2ed1974c08922ea9567e8f0e39cb1539e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550

Received: from louie.udel.edu by huey.udel.edu id aa17107; 27 Jan 94 14:37 EST
Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa16998;
          27 Jan 94 14:34 EST
Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP;
	id AA29914 (5.65c-6/7.3v-FAU); Thu, 27 Jan 1994 20:34:08 +0100
Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP;
	id AA23509 (5.65c-6/7.3m-FAU); Thu, 27 Jan 1994 20:34:05 +0100
From: Frank Kardel <Frank.Kardel@informatik.uni-erlangen.de>
Message-Id: <199401271934.AA23509@faui43.informatik.uni-erlangen.de>
Subject: Re:  Solaribum
To: Mills@udel.edu
Date: Thu, 27 Jan 94 20:33:59 MET
Cc: Frank.Kardel@informatik.uni-erlangen.de, Piete.Brooks@cl.cam.ac.uk, 
    Paul_Vixie@corpmis.sjc.hw.sony.com
In-Reply-To:  <9401271111.aa16183@huey.udel.edu>; from "Mills@udel.edu" at Jan 27, 94 11:11 am
X-Mailer: ELM [version 2.3 PL11]


> Guys,

> Two masive patches collided in midair here, leaving broken parts scattered
> over three counties. The National Time Safety Board has investigated,
> but been unable, ...

Additional efforts of the european branch of the NTPSB have uncovered
that the collision was due to low visibility across the atlantic.

And I wanted to go on:
  All measures have been taken to limit the effects of the crash to a
  minimum and to resume normal aircraft operation as soon as possible.

  All crew members and passengers are required to apply following patch
  to xntp3.3y.tar.Z for increased comfort and safety. This patch should
  enable us to resume normal operation again.

  After applying the patches you may remove following debris:

     include/ntp_machine.h.rej
     xntpd/ntp_config.c.rej
     xntpd/ntp_control.c.rej

Unfortunately I did a test compile and the results of that will
extend the ground stay of the 3.3y aircraft considerably.
(You may start thinking about bringing up 3.3xx - see below)

SunOS 4.x.x does NOT have the new highly portable "memmove()"
routine. The lack of this will mean that we will have to
#define memmove(a, b, c) memcpy(a, b, c)
or find something else. I'd like to leave this to Paul.
Also on Sunos 4.x there are implicit declarations of bzero due
the the FDSET macro from the system header files. So I am not
so sure whether strictly using mem* is the best or whether we should
add b* prototypes to l_stdlib.h. I think Paul has now something
to work on. Anyhow, the patches below will rectify some problems
but the resulting code still needs much polishing (providing memmove
where it is missing e.g. SunOS4.x).

In order to get a flying version fast (3.3xx) Dave could apply my
patch he is holding to 3.3x - that should then make a workable
version. 3.3y can then be cleaned up slowly (starting with the 
patches below and then port it again to the rest of the systems).

Sorry about the bad news.

> I have one more patch from Frank which I will hold on to until the aircraft
> is recertified.

That one is still to be applied because without it, it is possible
to shoot down any plane around the NTP universe that is bearing
the 3.3x banner (but can be applied to 3.3x).


For the 3.3y construction crew:

diff -c -r ../yy/include/ntp_machine.h ./include/ntp_machine.h
*** ../yy/include/ntp_machine.h	Thu Jan 27 15:03:23 1994
--- ./include/ntp_machine.h	Thu Jan 27 19:13:35 1994
***************
*** 121,139 ****
  		      to the correct broadcast address - are these
  		      implementations broken or did the spec change ?
  
-   HAVE_UNISTD_H     - Maybe should be part of NTP_POSIX_SOURCE ?
- 
  DEFINITIONS FOR SYSTEM && PROCESSOR
    STR_SYSTEM        - value of system variable
    STR_PROCESSOR     - value of processor variable
  
  You could just put the defines on the DEFS line in machines/<os> file.
! I don't since there are lost of different types compiler that a systemm might
! have, some that can do proto typing and others that cannot on the saem system.
! I get a chanse to twiddle some of the configuration paramasters at compile
! time based on compler/machine combinatsions by using this include file.
! See convex, aix and sun configurations see how complex it gets.
! 
  */
    
  
--- 121,141 ----
  		      to the correct broadcast address - are these
  		      implementations broken or did the spec change ?
  
  DEFINITIONS FOR SYSTEM && PROCESSOR
    STR_SYSTEM        - value of system variable
    STR_PROCESSOR     - value of processor variable
  
  You could just put the defines on the DEFS line in machines/<os> file.
! I don't since there are lots of different types of compilers that a system might
! have, some that can do proto typing and others that cannot on the same system.
! I get a chance to twiddle some of the configuration parameters at compile
! time based on compiler/machine combinations by using this include file.
! See convex, aix and sun configurations see how complex it get.
!   
! Note that it _is_ considered reasonable to add some system-specific defines
! to the machine/<os> file if it would be too inconvenient to puzzle them out
! in this file.
!   
  */
    
  
diff -c -r ../yy/parse/parse.c ./parse/parse.c
*** ../yy/parse/parse.c	Thu Jan 27 00:25:18 1994
--- ./parse/parse.c	Thu Jan 27 20:18:58 1994
***************
*** 29,40 ****
  #include "sys/time.h"
  #include "sys/errno.h"
  
- #include "ntp_fp.h"
- #include "ntp_unixtime.h"
- #include "ntp_calendar.h"
- 
- #include "parse.h"
- 
  #if defined(PARSESTREAM) && (defined(SYS_SUNOS4) || defined(SYS_SOLARIS)) && defined(STREAM)
  /*
   * Sorry, but in SunOS 4.x kernels there are no
--- 29,34 ----
***************
*** 44,51 ****
--- 38,54 ----
  #define _ntp_string_h
  extern void bcopy();
  extern void bzero();
+ #else
+ #define bzero(_X_, _Y_) memset(_X_, 0, _Y_)
+ #define bcopy(_X_, _Y_, _Z_) memmove(_Y_, _X_, _Z_)
  #endif
  
+ #include "ntp_fp.h"
+ #include "ntp_unixtime.h"
+ #include "ntp_calendar.h"
+ 
+ #include "parse.h"
+ 
  #include "ntp_stdlib.h"
  
  #ifdef PARSESTREAM
diff -c -r ../yy/xntpd/ntp_config.c ./xntpd/ntp_config.c
*** ../yy/xntpd/ntp_config.c	Thu Jan 27 15:03:47 1994
--- ./xntpd/ntp_config.c	Thu Jan 27 19:18:40 1994
***************
*** 1,4 ****
! /* ntp_config.c,v 3.1 1993/07/06 01:11:12 jbj Exp
   * ntp_config.c - read and apply configuration information
   */
  #define RESOLVE_INTERNAL	/* gdt */
--- 1,4 ----
! /*
   * ntp_config.c - read and apply configuration information
   */
  #define RESOLVE_INTERNAL	/* gdt */
***************
*** 375,388 ****
  			break;
  		}
  	
! 	if (errflg || optind != argc) {
  		(void) fprintf(stderr, "usage: %s [ -abd ] [ -c config_file ] [ -e encryption delay ]\n", progname);
  		(void) fprintf(stderr, "\t\t[ -f frequency file ] [ -k key file ] [ -l log file ]\n");
  		(void) fprintf(stderr, "\t\t[ -p pid file ] [ -r broadcast delay ] [ -s status directory ]\n");
  		(void) fprintf(stderr, "\t\t[ -t trusted key ] [ -v sys variable ] [ -V default sys variable ]\n");
  		exit(2);
  	}
! 	optind = 0;		/* reset optind to restart getopt_l */
  
  	if (debug) {
  #ifdef NTP_POSIX_SOURCE
--- 375,388 ----
  			break;
  		}
  	
! 	if (errflg || ntp_optind != argc) {
  		(void) fprintf(stderr, "usage: %s [ -abd ] [ -c config_file ] [ -e encryption delay ]\n", progname);
  		(void) fprintf(stderr, "\t\t[ -f frequency file ] [ -k key file ] [ -l log file ]\n");
  		(void) fprintf(stderr, "\t\t[ -p pid file ] [ -r broadcast delay ] [ -s status directory ]\n");
  		(void) fprintf(stderr, "\t\t[ -t trusted key ] [ -v sys variable ] [ -V default sys variable ]\n");
  		exit(2);
  	}
! 	ntp_optind = 0;		/* reset ntp_optind to restart ntp_getopt */
  
  	if (debug) {
  #ifdef NTP_POSIX_SOURCE
***************
*** 430,437 ****
  	char resolver_name[MAXFILENAME];
  	int have_keyfile;
  	char keyfile[MAXFILENAME];
! 	extern int optind;
! 	extern char *optarg;
  	extern char *Version;
  	extern U_LONG info_auth_keyid;
  	FILEGEN *filegen;
--- 430,437 ----
  	char resolver_name[MAXFILENAME];
  	int have_keyfile;
  	char keyfile[MAXFILENAME];
! 	extern int ntp_optind;
! 	extern char *ntp_optarg;
  	extern char *Version;
  	extern U_LONG info_auth_keyid;
  	FILEGEN *filegen;
***************
*** 461,467 ****
  	/*
  	 * Decode argument list
  	 */
! 	while ((c = getopt_l(argc, argv, xntp_options)) != EOF) {
  		switch (c) {
  		case 'a':
  			proto_config(PROTO_AUTHENTICATE, (LONG)1);
--- 461,467 ----
  	/*
  	 * Decode argument list
  	 */
! 	while ((c = ntp_getopt(argc, argv, xntp_options)) != EOF) {
  		switch (c) {
  		case 'a':
  			proto_config(PROTO_AUTHENTICATE, (LONG)1);
***************
*** 470,476 ****
  			proto_config(PROTO_BROADCLIENT, (LONG)1);
  			break;
  		case 'c':
! 			config_file = optarg;
  			break;
  		case 'd':
  #ifdef DEBUG
--- 470,476 ----
  			proto_config(PROTO_BROADCLIENT, (LONG)1);
  			break;
  		case 'c':
! 			config_file = ntp_optarg;
  			break;
  		case 'd':
  #ifdef DEBUG
***************
*** 484,498 ****
  			do {
  				l_fp tmp;
  				
! 				if (!atolfp(optarg, &tmp)) {
  					syslog(LOG_ERR,
  			"command line encryption delay value %s undecodable",
! 					    optarg);
  					errflg++;
  				} else if (tmp.l_ui != 0) {
  					syslog(LOG_ERR,
  			"command line encryption delay value %s is unlikely",
! 					    optarg);
  					errflg++;
  				} else {
  					proto_config(PROTO_AUTHDELAY, tmp.l_f);
--- 484,498 ----
  			do {
  				l_fp tmp;
  				
! 				if (!atolfp(ntp_optarg, &tmp)) {
  					syslog(LOG_ERR,
  			"command line encryption delay value %s undecodable",
! 					    ntp_optarg);
  					errflg++;
  				} else if (tmp.l_ui != 0) {
  					syslog(LOG_ERR,
  			"command line encryption delay value %s is unlikely",
! 					    ntp_optarg);
  					errflg++;
  				} else {
  					proto_config(PROTO_AUTHDELAY, tmp.l_f);
***************
*** 501,537 ****
  			break;
  			
  		case 'f':
! 			stats_config(STATS_FREQ_FILE, optarg);
  			break;
  
  		case 'k':
! 			getauthkeys(optarg);
! 			if ((int)strlen(optarg) >= MAXFILENAME) {
  				syslog(LOG_ERR,
  				    "key file name too LONG (>%d, sigh), no name resolution possible",
  				    MAXFILENAME);
  			} else {
  				have_keyfile = 1;
! 				(void)strcpy(keyfile, optarg);
  			}
  			break;
  
  		case 'p':
! 			stats_config(STATS_PID_FILE, optarg);
  			break;
  
  		case 'r':
  			do {
  				l_fp tmp;
  				
! 				if (!atolfp(optarg, &tmp)) {
  					syslog(LOG_ERR,
  			"command line broadcast delay value %s undecodable",
! 					    optarg);
  				} else if (tmp.l_ui != 0) {
  					syslog(LOG_ERR,
  			 "command line broadcast delay value %s is unlikely",
! 					    optarg);
  				} else {
  					proto_config(PROTO_BROADDELAY, tmp.l_f);
  				}
--- 501,537 ----
  			break;
  			
  		case 'f':
! 			stats_config(STATS_FREQ_FILE, ntp_optarg);
  			break;
  
  		case 'k':
! 			getauthkeys(ntp_optarg);
! 			if ((int)strlen(ntp_optarg) >= MAXFILENAME) {
  				syslog(LOG_ERR,
  				    "key file name too LONG (>%d, sigh), no name resolution possible",
  				    MAXFILENAME);
  			} else {
  				have_keyfile = 1;
! 				(void)strcpy(keyfile, ntp_optarg);
  			}
  			break;
  
  		case 'p':
! 			stats_config(STATS_PID_FILE, ntp_optarg);
  			break;
  
  		case 'r':
  			do {
  				l_fp tmp;
  				
! 				if (!atolfp(ntp_optarg, &tmp)) {
  					syslog(LOG_ERR,
  			"command line broadcast delay value %s undecodable",
! 					    ntp_optarg);
  				} else if (tmp.l_ui != 0) {
  					syslog(LOG_ERR,
  			 "command line broadcast delay value %s is unlikely",
! 					    ntp_optarg);
  				} else {
  					proto_config(PROTO_BROADDELAY, tmp.l_f);
  				}
***************
*** 539,556 ****
  			break;
  			
  		case 's':
! 			stats_config(STATS_STATSDIR, optarg);
  			break;
  			
  		case 't':
  			do {
  				int tkey;
  				
! 				tkey = atoi(optarg);
  				if (tkey <= 0 || tkey > NTP_MAXKEY) {
  					syslog(LOG_ERR,
  				"command line trusted key %s is unlikely",
! 					    optarg);
  				} else {
  					authtrust(tkey, (LONG)1);
  				}
--- 539,556 ----
  			break;
  			
  		case 's':
! 			stats_config(STATS_STATSDIR, ntp_optarg);
  			break;
  			
  		case 't':
  			do {
  				int tkey;
  				
! 				tkey = atoi(ntp_optarg);
  				if (tkey <= 0 || tkey > NTP_MAXKEY) {
  					syslog(LOG_ERR,
  				"command line trusted key %s is unlikely",
! 					    ntp_optarg);
  				} else {
  					authtrust(tkey, (LONG)1);
  				}
***************
*** 559,565 ****
  			
  		case 'v':
  		case 'V':
! 			set_sys_var(optarg, strlen(optarg)+1, RW | ((c == 'V') ? DEF : 0));
  			break;
  			
  		default:
--- 559,565 ----
  			
  		case 'v':
  		case 'V':
! 			set_sys_var(ntp_optarg, strlen(ntp_optarg)+1, RW | ((c == 'V') ? DEF : 0));
  			break;
  			
  		default:
diff -c -r ../yy/xntpd/ntp_control.c ./xntpd/ntp_control.c
*** ../yy/xntpd/ntp_control.c	Thu Jan 27 15:03:48 1994
--- ./xntpd/ntp_control.c	Thu Jan 27 19:29:06 1994
***************
*** 1848,1854 ****
  			ctl_sys_num_events = 0;
  		gotvar += count_var(ext_sys_var);
  		wants = (u_char *)emalloc(gotvar);
! 		bzero((char *)wants, gotvar);
  		gotvar = 0;
  		while ((v = ctl_getitem(sys_var, &valuep)) != 0) {
  			if (v->flags & EOV) {
--- 1848,1854 ----
  			ctl_sys_num_events = 0;
  		gotvar += count_var(ext_sys_var);
  		wants = (u_char *)emalloc(gotvar);
! 		memset((char *)wants, 0, gotvar);
  		gotvar = 0;
  		while ((v = ctl_getitem(sys_var, &valuep)) != 0) {
  			if (v->flags & EOV) {
***************
*** 1904,1910 ****
  		if (res_authokay)
  			peer->num_events = 0;
  		wants = (u_char *)emalloc(gotvar);
! 		bzero((char*)wants, gotvar);
  		gotvar = 0;
  		while ((v = ctl_getitem(peer_var, &valuep)) != 0) {
  			if (v->flags & EOV) {
--- 1904,1910 ----
  		if (res_authokay)
  			peer->num_events = 0;
  		wants = (u_char *)emalloc(gotvar);
! 		memset((char*)wants, 0, gotvar);
  		gotvar = 0;
  		while ((v = ctl_getitem(peer_var, &valuep)) != 0) {
  			if (v->flags & EOV) {
***************
*** 2106,2112 ****
  	rpkt.status = htons(ctlclkstatus(&clock));
  	gotvar = CC_MAXCODE+1+count_var(clock.kv_list);
  	wants = (u_char *)emalloc(gotvar);
! 	bzero((char*)wants, gotvar);
  	gotvar = 0;
  	while ((v = ctl_getitem(clock_var, &valuep)) != 0) {
  		if (v->flags & EOV) {
--- 2106,2112 ----
  	rpkt.status = htons(ctlclkstatus(&clock));
  	gotvar = CC_MAXCODE+1+count_var(clock.kv_list);
  	wants = (u_char *)emalloc(gotvar);
! 	memset((char*)wants, 0, gotvar);
  	gotvar = 0;
  	while ((v = ctl_getitem(clock_var, &valuep)) != 0) {
  		if (v->flags & EOV) {
***************
*** 2578,2584 ****
    *kv  = (struct ctl_var *)emalloc((c+2)*sizeof(struct ctl_var));
    if (k)
      {
!       bcopy((char *)k, (char *)*kv, sizeof(struct ctl_var)*c);
        free((char *)k);
      }
  
--- 2578,2584 ----
    *kv  = (struct ctl_var *)emalloc((c+2)*sizeof(struct ctl_var));
    if (k)
      {
!       memmove((char *)*kv, (char *)k, sizeof(struct ctl_var)*c);
        free((char *)k);
      }
  
***************
*** 2621,2627 ****
  		{
  		  free(k->text);
  		  k->text = (char *)emalloc(size);
! 		  bcopy(data, k->text, size);
  		  k->flags = def;
  		  return;
  		}
--- 2621,2627 ----
  		{
  		  free(k->text);
  		  k->text = (char *)emalloc(size);
! 		  memmove(k->text, data, size);
  		  k->flags = def;
  		  return;
  		}
***************
*** 2629,2635 ****
  	  else
  	    {
  	      k->text = (char *)emalloc(size);
! 	      bcopy(data, k->text, size);
  	      k->flags = def;
  	      return;
  	    }
--- 2629,2635 ----
  	  else
  	    {
  	      k->text = (char *)emalloc(size);
! 	      memmove(k->text, data, size);
  	      k->flags = def;
  	      return;
  	    }
***************
*** 2637,2643 ****
  	}
      }
    t = add_var(kv, size, def);
!   bcopy(data, t, size);
  }
  
  void
--- 2637,2643 ----
  	}
      }
    t = add_var(kv, size, def);
!   memmove(t, data, size);
  }
  
  void
-- 
	   Frank Kardel (kardel@informatik.uni-erlangen.de)
    All SCSI disks will from now on be required to send an email
         notice 24 hours prior to complete hardware failure!

OpenPOWER on IntegriCloud