slave.c (299707) | slave.c (299709) |
---|---|
1/*- 2 * Copyright (c) 1985, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * SUCH DAMAGE. 28 */ 29 30#ifndef lint 31#if 0 32static char sccsid[] = "@(#)slave.c 8.1 (Berkeley) 6/6/93"; 33#endif 34static const char rcsid[] = | 1/*- 2 * Copyright (c) 1985, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * SUCH DAMAGE. 28 */ 29 30#ifndef lint 31#if 0 32static char sccsid[] = "@(#)slave.c 8.1 (Berkeley) 6/6/93"; 33#endif 34static const char rcsid[] = |
35 "$FreeBSD: head/usr.sbin/timed/timed/slave.c 299707 2016-05-14 00:46:38Z pfg $"; | 35 "$FreeBSD: head/usr.sbin/timed/timed/slave.c 299709 2016-05-14 02:42:09Z pfg $"; |
36#endif /* not lint */ 37 38#include "globals.h" 39#include <setjmp.h> 40#include <utmpx.h> 41#include "pathnames.h" 42 43extern jmp_buf jmpenv; --- 205 unchanged lines hidden (view full) --- 249 250 /* adjust time for residence on the queue */ 251 (void)gettimeofday(&otime, NULL); 252 adj_msg_time(msg,&otime); 253 /* 254 * the following line is necessary due to syslog 255 * calling ctime() which clobbers the static buffer 256 */ | 36#endif /* not lint */ 37 38#include "globals.h" 39#include <setjmp.h> 40#include <utmpx.h> 41#include "pathnames.h" 42 43extern jmp_buf jmpenv; --- 205 unchanged lines hidden (view full) --- 249 250 /* adjust time for residence on the queue */ 251 (void)gettimeofday(&otime, NULL); 252 adj_msg_time(msg,&otime); 253 /* 254 * the following line is necessary due to syslog 255 * calling ctime() which clobbers the static buffer 256 */ |
257 (void)strcpy(olddate, date()); | 257 (void)strlcpy(olddate, date(), sizeof(olddate)); |
258 tsp_time_sec = msg->tsp_time.tv_sec; | 258 tsp_time_sec = msg->tsp_time.tv_sec; |
259 (void)strcpy(newdate, ctime(&tsp_time_sec)); | 259 (void)strlcpy(newdate, ctime(&tsp_time_sec), 260 sizeof(newdate)); |
260 261 if (!good_host_name(msg->tsp_name)) { 262 syslog(LOG_NOTICE, 263 "attempted time setting by untrusted %s to %s", 264 msg->tsp_name, newdate); 265 suppress(&from, msg->tsp_name, fromnet); 266 break; 267 } --- 69 unchanged lines hidden (view full) --- 337 if (fromnet->status != SLAVE) 338 break; 339 (void)gettimeofday(&ntime, NULL); 340 electiontime = ntime.tv_sec + delay2; 341 break; 342 343 case TSP_SETDATE: 344 tsp_time_sec = msg->tsp_time.tv_sec; | 261 262 if (!good_host_name(msg->tsp_name)) { 263 syslog(LOG_NOTICE, 264 "attempted time setting by untrusted %s to %s", 265 msg->tsp_name, newdate); 266 suppress(&from, msg->tsp_name, fromnet); 267 break; 268 } --- 69 unchanged lines hidden (view full) --- 338 if (fromnet->status != SLAVE) 339 break; 340 (void)gettimeofday(&ntime, NULL); 341 electiontime = ntime.tv_sec + delay2; 342 break; 343 344 case TSP_SETDATE: 345 tsp_time_sec = msg->tsp_time.tv_sec; |
345 (void)strcpy(newdate, ctime(&tsp_time_sec)); | 346 (void)strlcpy(newdate, ctime(&tsp_time_sec), 347 sizeof(newdate)); |
346 schgdate(msg, newdate); 347 break; 348 349 case TSP_SETDATEREQ: 350 if (fromnet->status != MASTER) 351 break; 352 tsp_time_sec = msg->tsp_time.tv_sec; | 348 schgdate(msg, newdate); 349 break; 350 351 case TSP_SETDATEREQ: 352 if (fromnet->status != MASTER) 353 break; 354 tsp_time_sec = msg->tsp_time.tv_sec; |
353 (void)strcpy(newdate, ctime(&tsp_time_sec)); | 355 (void)strlcpy(newdate, ctime(&tsp_time_sec), 356 sizeof(newdate)); |
354 htp = findhost(msg->tsp_name); 355 if (htp == NULL) { 356 syslog(LOG_WARNING, 357 "DATEREQ from uncontrolled machine"); 358 break; 359 } 360 if (!htp->good) { 361 syslog(LOG_WARNING, --- 329 unchanged lines hidden --- | 357 htp = findhost(msg->tsp_name); 358 if (htp == NULL) { 359 syslog(LOG_WARNING, 360 "DATEREQ from uncontrolled machine"); 361 break; 362 } 363 if (!htp->good) { 364 syslog(LOG_WARNING, --- 329 unchanged lines hidden --- |