From: Dave Hart Date: Sun, 26 Apr 2009 14:17:47 +0000 (+0000) Subject: Remove truncation of position (blanking) code in refclock_nmea.c X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab55e8586d7b60dc6bab776cac6b289121f3611a;p=thirdparty%2Fntp.git Remove truncation of position (blanking) code in refclock_nmea.c bk: 49f46d0blqCDgtCGwBOYEJvy4jTHgw --- diff --git a/ChangeLog b/ChangeLog index f29d8999fb..5f1979d616 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* Remove truncation of position (blanking) code in refclock_nmea.c (4.2.5p167) 2009/04/26 Released by Harlan Stenn * Crypto cleanup from Dave Mills. (4.2.5p166) 2009/04/25 Released by Harlan Stenn diff --git a/ntpd/refclock_nmea.c b/ntpd/refclock_nmea.c index ebf35ca1e7..67e9e77d87 100644 --- a/ntpd/refclock_nmea.c +++ b/ntpd/refclock_nmea.c @@ -491,10 +491,9 @@ nmea_receive( struct refclockproc *pp; struct peer *peer; int month, day; - char *cp, *dp, *bp, *msg; + char *cp, *dp, *msg; int cmdtype; int cmdtypezdg = 0; - int blanking; /* Use these variables to hold data until we decide its worth keeping */ char rd_lastcode[BMAX]; l_fp rd_timestamp; @@ -792,75 +791,6 @@ nmea_receive( } pp->day = day; - /* - * ntpq -c clockvar clients don't really need to know our - * position with perfect accuracy, so for privacy blank - * out least significant digits. To avoid leaking the - * omitted info indirectly, also blank checksum. - * - * Start by pointing cp and dp at the fields with - * longitude and latitude in the last timecode. - */ - switch (cmdtype) { - - case GPGLL: - cp = field_parse(pp->a_lastcode, 1); - dp = field_parse(cp, 2); - break; - - case GPGGA: - cp = field_parse(pp->a_lastcode, 2); - dp = field_parse(cp, 2); - break; - - case GPRMC: - cp = field_parse(pp->a_lastcode, 3); - dp = field_parse(cp, 2); - break; - - case GPZDG_ZDA: - default: - cp = dp = NULL; - } - - /* - * Blanking everything after the decimal point '.' is easy and - * gives enough error for at least a few neighbors to be as - * likely as you to be the one with the reflock. We're keeping - * degrees and minutes but tossing the seconds (expressed as - * decimal fractions of a minute). Degrees minutes seconds, - * not hours minutes seconds. :) - */ - bp = cp; - while (bp) { - blanking = 0; - while (',' != *bp) { - if (blanking) - *bp = '_'; - else if ('.' == *bp) - blanking = 1; - bp++; - } - - /* - * blank the longitude at cp then the latitude at dp - * then we're done. - */ - if (bp < dp) - bp = dp; - else - bp = NULL; - } - - /* - * blank the checksum, last two characters on the line - */ - if (cp) { - bp = pp->a_lastcode + pp->lencode - 2; - if (0 == bp[2]) - bp[0] = bp[1] = '_'; - } - #ifdef HAVE_PPSAPI /* * If the PPSAPI is working, rather use its timestamps.