OpenBSD CVS

CVS log for src/usr.sbin/rdate/ntp.c


[BACK] Up to [local] / src / usr.sbin / rdate

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.37 / (download) - annotate - [select for diffs], Sun Nov 12 18:53:22 2023 UTC (6 months, 2 weeks ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.36: +29 -6 lines
Diff to previous 1.36 (colored)

Bump NTP era if the offset we receive is small, in a similar manner
as ntpd.  ok deraadt@

Revision 1.36 / (download) - annotate - [select for diffs], Thu Jan 9 19:37:56 2020 UTC (4 years, 4 months ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.35: +3 -3 lines
Diff to previous 1.35 (colored)

Remove unused attempts variable whose probable intended use would have
been redundant anyway. No object change.

From Artturi Alm

Revision 1.35 / (download) - annotate - [select for diffs], Fri Jun 28 13:32:50 2019 UTC (4 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.34: +5 -5 lines
Diff to previous 1.34 (colored)

When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.

Revision 1.34 / (download) - annotate - [select for diffs], Sat Aug 18 15:25:20 2018 UTC (5 years, 9 months ago) by mestre
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.33: +4 -1 lines
Diff to previous 1.33 (colored)

After calling getaddrinfo(3) both on rfc868 and ntp cases we can drop the "dns"
promise and only pledge("stdio inet") since from here until the end of the
program we will only exchange packets through sockets.

After a discussion with deraadt@ about adding privdrop to it we came to the
conclusion that the easiest and sane solution is just to reduce pledge(2)
instead of adding a ton of code to chroot the child that is already forbidden
to access the filesystem anyway.

Revision 1.33 / (download) - annotate - [select for diffs], Fri Jan 16 06:40:20 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9, OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.32: +1 -2 lines
Diff to previous 1.32 (colored)

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible.  Annotate <sys/param.h> lines with their current reasons.  Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc.  Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution.  These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)

Revision 1.32 / (download) - annotate - [select for diffs], Wed Oct 29 04:00:44 2014 UTC (9 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.31: +11 -24 lines
Diff to previous 1.31 (colored)

use poll() instead of select(), thereby removing the fd_set malloc/free
dance which was used to avoid fd_set overflow with high file descriptor
values.
ok doug

Revision 1.31 / (download) - annotate - [select for diffs], Wed Dec 28 21:39:30 2011 UTC (12 years, 5 months ago) by sthen
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (colored)

s/minum/minimum/ in comment

Revision 1.30 / (download) - annotate - [select for diffs], Mon Aug 16 11:09:26 2010 UTC (13 years, 9 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.29: +3 -3 lines
Diff to previous 1.29 (colored)

Fix another gcc4 mis-alignment, by using bcopy() rather than
(u_int64_t *)charptr = value.

Problem reported by Daniel Ouellet, first diff from matthieu@,
another from naddy@ equivalent to this one.

ok millert@ dlg@ (for naddy's) deraadt@

Revision 1.29 / (download) - annotate - [select for diffs], Sun Sep 17 17:03:56 2006 UTC (17 years, 8 months ago) by ckuethe
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.28: +6 -1 lines
Diff to previous 1.28 (colored)

Make rdate ignore ntp responses with ALARM status.
"yeah..." henning@

Revision 1.28 / (download) - annotate - [select for diffs], Tue Mar 14 22:56:20 2006 UTC (18 years, 2 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.27: +2 -2 lines
Diff to previous 1.27 (colored)

#ifdef DEBUG not #if DEBUG

Revision 1.27 / (download) - annotate - [select for diffs], Tue Oct 26 09:48:59 2004 UTC (19 years, 7 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.26: +3 -2 lines
Diff to previous 1.26 (colored)

make the ntp version check even better, use NTP_VERSION_MIN and _MAX

Revision 1.26 / (download) - annotate - [select for diffs], Sun Oct 24 18:47:43 2004 UTC (19 years, 7 months ago) by henning
Branch: MAIN
Changes since 1.25: +4 -4 lines
Diff to previous 1.25 (colored)

accept replies with a NTP version number of 4 or lower, instead of only 4
as before, we can handle all versions

Revision 1.25 / (download) - annotate - [select for diffs], Wed Sep 15 01:11:12 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.24: +30 -33 lines
Diff to previous 1.24 (colored)

KNF

Revision 1.24 / (download) - annotate - [select for diffs], Wed Sep 15 01:05:09 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.23: +2 -4 lines
Diff to previous 1.23 (colored)

don't refuse packets with stratum=0, they are fine

Revision 1.23 / (download) - annotate - [select for diffs], Wed Jul 14 20:11:16 2004 UTC (19 years, 10 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.22: +1 -6 lines
Diff to previous 1.22 (colored)

do not bail out if the server says its clock is unsynchronized.
rdate is a simple client and doesn't have another server to query,
and a server's idea of the time is better than the local clock's
one in basically any case.

Revision 1.22 / (download) - annotate - [select for diffs], Thu Jun 17 18:09:33 2004 UTC (19 years, 11 months ago) by alexander
Branch: MAIN
Changes since 1.21: +4 -5 lines
Diff to previous 1.21 (colored)

err on calloc failure; ok henning@

Revision 1.21 / (download) - annotate - [select for diffs], Wed Jun 9 07:15:56 2004 UTC (19 years, 11 months ago) by alexander
Branch: MAIN
Changes since 1.20: +135 -169 lines
Diff to previous 1.20 (colored)

  * Bring rdate's SNTP support into compliance with SNTPv4 (RFC 2030).
  * More robust handling of NTP error conditions (e.g. host or
    service unreachable).
  * Improve the detection of stale and/or spoofed NTP responses
    from servers.
  * Add support for getaddrinfo(3)'s multiple host support if
    error conditions occur (e.g. round-robin DNS, and the first
    NTP server isn't responding, try the next host in line).
  * Minor formatting/code cleanup.

ok henning@

Revision 1.20 / (download) - annotate - [select for diffs], Sat Jun 5 19:18:56 2004 UTC (20 years ago) by alexander
Branch: MAIN
Changes since 1.19: +4 -4 lines
Diff to previous 1.19 (colored)

Typo correction, and consistency changes.

ok jakob@, henning@

Revision 1.19 / (download) - annotate - [select for diffs], Sun May 30 22:57:42 2004 UTC (20 years ago) by deraadt
Branch: MAIN
Changes since 1.18: +24 -24 lines
Diff to previous 1.18 (colored)

insane spacing

Revision 1.18 / (download) - annotate - [select for diffs], Sun May 30 22:41:15 2004 UTC (20 years ago) by jakob
Branch: MAIN
Changes since 1.17: +12 -2 lines
Diff to previous 1.17 (colored)

verify that the server is confident in the result it is sending us; from Alexander Guy

Revision 1.17 / (download) - annotate - [select for diffs], Wed May 26 16:38:44 2004 UTC (20 years ago) by jakob
Branch: MAIN
Changes since 1.16: +44 -26 lines
Diff to previous 1.16 (colored)

Send out a random 64-bit number as our transmit time.  The NTP
server will copy said number into the originate field on the
response that it sends us.  This is totally legal per the SNTP spec.

The impact of this is two fold: we no longer send out the current
system time for the world to see (which may aid an attacker), and
it gives us a (not very secure) way of knowing that we're not
getting spoofed by an attacker that can't capture our traffic
but can spoof packets from the NTP server we're communicating with.

code by Alexander Guy. ok deraadt@

Revision 1.16 / (download) - annotate - [select for diffs], Tue May 18 17:25:18 2004 UTC (20 years ago) by jakob
Branch: MAIN
Changes since 1.15: +3 -3 lines
Diff to previous 1.15 (colored)

sendto() return code fixes; from andreq matveev
ok deraadt@

Revision 1.15 / (download) - annotate - [select for diffs], Mon Feb 16 21:25:41 2004 UTC (20 years, 3 months ago) by jakob
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.14: +4 -4 lines
Diff to previous 1.14 (colored)

add IPv4/IPv6 transport selection. ok millert@ deraadt@

Revision 1.14 / (download) - annotate - [select for diffs], Wed May 14 18:06:21 2003 UTC (21 years ago) by itojun
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.13: +5 -5 lines
Diff to previous 1.13 (colored)

"error" was typed double, which is not suitable for getaddrinfo(3).
from tobias

Revision 1.13 / (download) - annotate - [select for diffs], Sun Sep 8 12:33:42 2002 UTC (21 years, 8 months ago) by jakob
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.12: +6 -4 lines
Diff to previous 1.12 (colored)

add leap second support for rfc868, from thorsten glaser

Revision 1.12 / (download) - annotate - [select for diffs], Sat Aug 10 21:37:28 2002 UTC (21 years, 9 months ago) by jakob
Branch: MAIN
Changes since 1.11: +4 -4 lines
Diff to previous 1.11 (colored)

style; from thorsten

Revision 1.11 / (download) - annotate - [select for diffs], Wed Jul 31 12:48:46 2002 UTC (21 years, 10 months ago) by jakob
Branch: MAIN
Changes since 1.10: +5 -4 lines
Diff to previous 1.10 (colored)

minor changes and knf from thorsten glaser

Revision 1.10 / (download) - annotate - [select for diffs], Sun Jul 28 07:48:29 2002 UTC (21 years, 10 months ago) by jakob
Branch: MAIN
Changes since 1.9: +4 -1 lines
Diff to previous 1.9 (colored)

call ntpleaps before trying to sync if needed

Revision 1.9 / (download) - annotate - [select for diffs], Sat Jul 27 20:11:34 2002 UTC (21 years, 10 months ago) by jakob
Branch: MAIN
Changes since 1.8: +5 -4 lines
Diff to previous 1.8 (colored)

move leap seconds correction to -N option for now

Revision 1.8 / (download) - annotate - [select for diffs], Sat Jul 27 08:47:19 2002 UTC (21 years, 10 months ago) by jakob
Branch: MAIN
Changes since 1.7: +14 -2 lines
Diff to previous 1.7 (colored)

enable leapsecond supprt

Revision 1.7 / (download) - annotate - [select for diffs], Fri Jun 14 21:35:01 2002 UTC (21 years, 11 months ago) by todd
Branch: MAIN
Changes since 1.6: +2 -2 lines
Diff to previous 1.6 (colored)

spelling; from Brian Poole <raj@cerias.purdue.edu>

Revision 1.6 / (download) - annotate - [select for diffs], Thu May 16 22:00:37 2002 UTC (22 years ago) by ho
Branch: MAIN
Changes since 1.5: +24 -12 lines
Diff to previous 1.5 (colored)

More careful with select(). deraadt@ ok.

Revision 1.5 / (download) - annotate - [select for diffs], Thu May 16 21:05:24 2002 UTC (22 years ago) by jakob
Branch: MAIN
Changes since 1.4: +31 -41 lines
Diff to previous 1.4 (colored)

IPv6 support; itojun@

Revision 1.4 / (download) - annotate - [select for diffs], Thu May 16 15:01:32 2002 UTC (22 years ago) by jakob
Branch: MAIN
Changes since 1.3: +7 -1 lines
Diff to previous 1.3 (colored)

#ifdef DEBUG some verbose output, may be moved to a -v flag later perhaps

Revision 1.3 / (download) - annotate - [select for diffs], Thu May 16 11:00:53 2002 UTC (22 years ago) by deraadt
Branch: MAIN
Changes since 1.2: +30 -23 lines
Diff to previous 1.2 (colored)

bit more KNF

Revision 1.2 / (download) - annotate - [select for diffs], Thu May 16 10:52:38 2002 UTC (22 years ago) by deraadt
Branch: MAIN
Changes since 1.1: +41 -37 lines
Diff to previous 1.1 (colored)

various KNF, and mark some issues

Revision 1.1 / (download) - annotate - [select for diffs], Thu May 16 10:46:34 2002 UTC (22 years ago) by jakob
Branch: MAIN

add support for SNTP & split out RFC868 time support. ok deraadt@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.