Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • selsky/ntpsec
  • armbiant/gnome-ntpsec
  • smallm/ntpsec
  • devicenull/ntpsec
  • paelzer/ntpsec
  • mvangund/ntpsec
  • fe051/ntpsec
  • ollie314/ntpsec
  • rlaager/ntpsec
  • fhgwright/ntpsec
  • phirephly/ntpsec
  • Omnifarious/ntpsec
  • ghane/ntpsec
  • antranigv/ntpsec
  • pakarsolusitelematika/ntpsec
  • ianbruene/ntpsec
  • wingel/ntpsec
  • katyaBeck/ntpsec
  • akumiszcza/ntpsec
  • rouing/ntpsec
  • NTPsec/ntpsec
  • mlichvar/ntpsec
  • ktims/ntpsec
  • fararano.kevin/ntpsec
  • phillipcharleshart/ntpsec
  • SPACE001/ntpsec
  • thomasdstewart/ntpsec
  • testsleeek/ntpsec
  • NeatNerdPrime/ntpsec
  • marcinbrodowski35/ntpsec
  • AbbasDev/ntpsec
  • jurgen.xhelo/ntpsec
  • Wan10/ntpsec
  • BrnoPCmaniak/ntpsec
  • anastrophe/ntpsec
  • georgyo/ntpsec
  • mikie.simpson/ntpsec
  • OptimalRanging/ntpsec
  • toofishes/ntpsec
  • Jandrusk/ntpsec
  • sdwalker/ntpsec
  • mnordhoff/ntpsec
  • cjmayo/ntpsec
  • micromax/ntpsec
  • tychotithonus/ntpsec
  • ddrown/ntpsec
  • brendanbank/ntpsec
  • jh23453/ntpsec
  • samifarin/ntpsec
  • miller24joseph/ntpsec
  • AZDNice/ntpsec
  • lnceballos/ntpsec
  • gabriel-ku/ntpsec
  • psreport/ntpsec
  • thesamesam/ntpsec
  • alexk7/ntpsec
  • RRZEFox/ntpsec
  • m_by/ntpsec
  • jameshilliard/ntpsec
  • daemoneye/ntpsec
  • xgerault/ntpsec
  • permanent-vacations/ntpsec
  • o.zeynalpour/ntpsec
  • ravi.love.nippy/ntpsec
  • jhamlin96/ntpsec
  • abaehr/ntpsec
  • accidentallythecable-public/forks/ntpsec
  • james.jstroud/ntpsec
  • youwt19821020/ntpsec-no-root
  • jamesb_fe80/ntpsec
  • demsjf8/ntpsec
  • yegorich/ntpsec
  • 1963bib/ntpsec
  • armbiant/gnome-ntp
  • chucalu/ntpsec
  • folkertvanheusden/ntpsec
  • mktyler/ntpsec
  • 19bcs2794/ntpsec
  • LOCNNIL/ntpsec
  • lifeofguenter/ntpsec
  • trv-n/ntpsec-trimble-3
  • szepeviktor/ntpsec
  • lightswitch05/ntpsec
  • m_msft/ntpsec
84 results
Show changes
Commits on Source (25)
Showing with 70 additions and 45 deletions
......@@ -138,7 +138,7 @@ extern bool octtoint (const char *, unsigned long *);
extern unsigned long ranp2 (int);
extern const char *refid_str (uint32_t, int);
extern bool decodenetnum (const char *, sockaddr_u *);
extern int decodenetnum (const char *, sockaddr_u *);
extern void signal_no_reset (int, void (*func)(int));
......
......@@ -203,7 +203,9 @@ linux_if_inet6_current(isc_interfaceiter_t *iter) {
}
res = sscanf(iter->entry, "%32[a-f0-9] %x %x %x %x %16s\n",
address, &ifindex, &prefix, &scope, &flags, name);
address, &ifindex, (unsigned int *)&prefix,
(unsigned int *) &scope,
(unsigned int *)&flags, name);
if (res != 6) {
/* isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_INTERFACE, ISC_LOG_ERROR,
......
......@@ -127,7 +127,7 @@ msyslog(LOG_ERR, "authreadkeys: reading %s", file);
token = nexttok(&line);
if (token == NULL) {
msyslog(LOG_ERR,
"authreadkeys: no key type for key %d", keyno);
"authreadkeys: no key type for key %u", keyno);
continue;
}
/*
......@@ -153,12 +153,12 @@ msyslog(LOG_ERR, "authreadkeys: reading %s", file);
keytype = NID_md5;
if (keytype == 0) {
msyslog(LOG_ERR,
"authreadkeys: invalid type for key %d", keyno);
"authreadkeys: invalid type for key %u", keyno);
continue;
}
if (EVP_get_digestbynid(keytype) == NULL) {
msyslog(LOG_ERR,
"authreadkeys: no algorithm for key %d", keyno);
"authreadkeys: no algorithm for key %u", keyno);
continue;
}
......@@ -171,7 +171,7 @@ msyslog(LOG_ERR, "authreadkeys: reading %s", file);
token = nexttok(&line);
if (token == NULL) {
msyslog(LOG_ERR,
"authreadkeys: no key for key %d", keyno);
"authreadkeys: no key for key %u", keyno);
continue;
}
len = strlen(token);
......@@ -196,9 +196,10 @@ msyslog(LOG_ERR, "authreadkeys: reading %s", file);
keystr[j / 2] = temp << 4;
}
if (j < jlim) {
msyslog(LOG_ERR,
"authreadkeys: invalid hex digit for key %d", keyno);
continue;
msyslog(LOG_ERR,
"authreadkeys: invalid hex digit for key %u",
keyno);
continue;
}
mac_setkey(keyno, keytype, keystr, jlim / 2);
keys++;
......
......@@ -26,8 +26,11 @@
* [IPv6]:port
*
* The IP must be numeric but the port can be symbolic.
*
* return: 0 for success
* negative numbers for error codes
*/
bool
int
decodenetnum(
const char *num,
sockaddr_u *netnum
......@@ -35,17 +38,21 @@ decodenetnum(
{
struct addrinfo hints, *ai = NULL;
const char *ip_start, *ip_end, *port_start, *temp;
const size_t numlen = strlen(num);
size_t numlen;
bool have_brackets;
char ip[INET6_ADDRSTRLEN];
ZERO(*netnum); /* don't return random data on fail */
NTP_REQUIRE(num != NULL);
/* check num not NULL before using it */
if ( NULL == num) {
return -1;
}
numlen = strlen(num);
/* Quickly reject empty or impossibly long inputs. */
if(numlen == 0 ||
numlen > (sizeof ip - 1) + (NI_MAXSERV - 1) + (3 /* "[]:" */)) {
return false;
numlen > ((sizeof(ip) - 1) + (NI_MAXSERV - 1) + (3 /* "[]:" */))) {
return -2;
}
/* Is this a bracketed IPv6 address? */
......@@ -66,7 +73,7 @@ decodenetnum(
}
else {
/* Anything else must be invalid. */
return false;
return -3;
}
}
/* No brackets. Searching backward, see if there's at least one
......@@ -99,8 +106,8 @@ decodenetnum(
either NULL or pointing to the start of the port. Check
whether the IP is short enough to possibly be valid and
if so copy it into ip. */
if(ip_end - ip_start + 1 > (int)sizeof(ip)) {
return false;
if ((ip_end - ip_start + 1) > (int)sizeof(ip)) {
return -4;
} else {
memcpy(ip, ip_start, (size_t)(ip_end - ip_start));
ip[ip_end - ip_start] = '\0';
......@@ -120,7 +127,7 @@ decodenetnum(
Let getaddrinfo() perform all further validation. */
if(getaddrinfo(ip, port_start == NULL ? "ntp" : port_start,
&hints, &ai) != 0) {
return false;
return -5;
}
NTP_INSIST(ai->ai_addrlen <= sizeof(*netnum));
......@@ -128,5 +135,5 @@ decodenetnum(
memcpy(netnum, ai->ai_addr, ai->ai_addrlen);
}
freeaddrinfo(ai);
return true;
return 0;
}
......@@ -299,9 +299,10 @@ blocking_getaddrinfo(
resp = emalloc_zero(resp_octets);
gai_resp = (void *)(resp + 1);
TRACE(2, ("blocking_getaddrinfo given node %s serv %s fam %d flags %x\n",
node, service, gai_req->hints.ai_family,
gai_req->hints.ai_flags));
TRACE(2,
("blocking_getaddrinfo given node %s serv %s fam %d flags %x\n",
node, service, gai_req->hints.ai_family,
(unsigned)gai_req->hints.ai_flags));
#ifdef DEBUG
if (debug >= 2)
fflush(stdout);
......@@ -648,9 +649,10 @@ blocking_getnameinfo(
resp = emalloc_zero(resp_octets);
gni_resp = (void *)((char *)resp + sizeof(*resp));
TRACE(2, ("blocking_getnameinfo given addr %s flags 0x%x hostlen %lu servlen %lu\n",
socktoa(&gni_req->socku), gni_req->flags,
(u_long)gni_req->hostoctets, (u_long)gni_req->servoctets));
TRACE(2,
("blocking_getnameinfo addr %s flags 0x%x hostlen %lu servlen %lu\n",
socktoa(&gni_req->socku), (unsigned)gni_req->flags,
(u_long)gni_req->hostoctets, (u_long)gni_req->servoctets));
gni_resp->retcode = getnameinfo(&gni_req->socku.sa,
SOCKLEN(&gni_req->socku),
......
......@@ -225,7 +225,8 @@ blocking_child_common(
break;
default:
msyslog(LOG_ERR, "unknown req %d to blocking worker", req->rtype);
msyslog(LOG_ERR, "unknown req %u to blocking worker",
req->rtype);
say_bye = true;
}
......
......@@ -121,7 +121,7 @@ ntpc_adj_systime(PyObject *self, PyObject *args)
UNUSED_ARG(self);
if (!PyArg_ParseTuple(args, "d", &adjustment))
return NULL;
return Py_BuildValue("d", (int)adj_systime(adjustment, adjtime));
return Py_BuildValue("d", adj_systime(adjustment, adjtime) ? 1 : 0);
}
static PyObject *
......
......@@ -351,7 +351,7 @@ decode_bitflags(
:
#endif
"",
bits, (int)LIB_BUFLENGTH);
(unsigned)bits, (int)LIB_BUFLENGTH);
errno = saved_errno;
return buf;
......
......@@ -103,7 +103,7 @@ format_time_fraction(
/* finally format the data and return the result */
snprintf(cp, LIB_BUFLENGTH, "%s%llu.%0*ld",
notneg? "" : "-", secs_u, prec_u, frac);
notneg? "" : "-", secs_u, (int)prec_u, frac);
return cp;
}
......@@ -122,7 +122,8 @@ inp_dcf7000(
{
unsigned int rtc;
parseprintf(DD_PARSE, ("inp_dcf7000(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
parseprintf(DD_PARSE, ("inp_dcf7000(0x%lx, 0x%x, ...)\n",
(unsigned long)parseio, (unsigned)ch));
switch (ch)
{
......
......@@ -219,7 +219,8 @@ inp_hopf6021(
{
unsigned int rtc;
parseprintf(DD_PARSE, ("inp_hopf6021(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
parseprintf(DD_PARSE, ("inp_hopf6021(0x%lx, 0x%x, ...)\n",
(unsigned long)parseio, (unsigned)ch));
switch (ch)
{
......
......@@ -398,7 +398,8 @@ mbg_input(
{
unsigned int rtc;
parseprintf(DD_PARSE, ("mbg_input(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
parseprintf(DD_PARSE, ("mbg_input(0x%lx, 0x%x, ...)\n",
(unsigned long)parseio, (unsigned)ch));
switch (ch)
{
......@@ -566,7 +567,8 @@ gps_input(
msg_buf = (struct msg_buf *)parseio->parse_pdata;
parseprintf(DD_PARSE, ("gps_input(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
parseprintf(DD_PARSE, ("gps_input(0x%lx, 0x%x, ...)\n",
(unsigned long)parseio, (unsigned)ch));
if (!msg_buf)
return PARSE_INP_SKIP;
......
......@@ -364,7 +364,8 @@ cvt_rawdcf(
cutoff = 4; /* doesn't really matter - it'll fail anyway, but gives error output */
}
parseprintf(DD_RAWDCF,("parse: cvt_rawdcf: average bit count: %d\n", cutoff));
parseprintf(DD_RAWDCF,("parse: cvt_rawdcf: average bit count: %u\n",
cutoff));
lowmax = 0;
highmax = 0;
......@@ -426,7 +427,9 @@ cvt_rawdcf(
cutoff = (cutoff + span) / 2;
parseprintf(DD_RAWDCF,("parse: cvt_rawdcf: lower maximum %d, higher maximum %d, cutoff %d\n", lowmax, highmax, cutoff));
parseprintf(DD_RAWDCF, ("parse: cvt_rawdcf: "
"lower maximum %u, higher maximum %u, cutoff %u\n",
lowmax, highmax, cutoff));
s = (unsigned char *)buffer;
while (s < e)
......@@ -583,7 +586,7 @@ inp_rawdcf(
static struct timespec timeout = { 1, (NS_PER_S/2) };
parseprintf(DD_PARSE, ("inp_rawdcf(0x%lx, 0x%x, ...)\n",
(long)parseio, ch));
(unsigned long)parseio, (unsigned)ch));
parseio->parse_dtime.parse_stime = *tstamp; /* collect timestamp */
......
......@@ -133,7 +133,8 @@ inp_rcc8000(
{
unsigned int rtc;
parseprintf(DD_PARSE, ("inp_rcc8000(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
parseprintf(DD_PARSE, ("inp_rcc8000(0x%lx, 0x%x, ...)\n",
(unsigned long)parseio, (unsigned)ch));
switch (ch)
{
......
......@@ -175,7 +175,8 @@ inp_schmid(
UNUSED_ARG(tstamp);
parseprintf(DD_PARSE, ("inp_schmid(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
parseprintf(DD_PARSE, ("inp_schmid(0x%lx, 0x%x, ...)\n",
(unsigned long)parseio, (unsigned)ch));
switch ((uint8_t)ch)
{
......
......@@ -85,8 +85,8 @@ inp_sel240x( parse_t *parseio,
{
unsigned long rc;
parseprintf( DD_PARSE,
("inp_sel240x(0x%lx, 0x%x, ...)\n",(long)parseio, ch));
parseprintf(DD_PARSE, ("inp_sel240x(0x%lx, 0x%x, ...)\n",
(unsigned long)parseio, (unsigned)ch));
switch( ch )
{
......
......@@ -118,7 +118,8 @@ inp_trimtaip(
{
unsigned int rtc;
parseprintf(DD_PARSE, ("inp_trimtaip(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
parseprintf(DD_PARSE, ("inp_trimtaip(0x%lx, 0x%x, ...)\n",
(unsigned long)parseio, (unsigned)ch));
switch (ch)
{
......
......@@ -160,7 +160,8 @@ inp_varitext(
struct varitext *t = (struct varitext *)parseio->parse_pdata;
int rtc;
parseprintf(DD_PARSE, ("inp_varitext(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
parseprintf(DD_PARSE, ("inp_varitext(0x%lx, 0x%x, ...)\n",
(unsigned long)parseio, (unsigned)ch));
if (!t)
return PARSE_INP_SKIP; /* local data not allocated - sigh! */
......
......@@ -122,7 +122,8 @@ inp_wharton_400a(
{
unsigned int rtc;
parseprintf(DD_PARSE, ("inp_wharton_400a(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
parseprintf(DD_PARSE, ("inp_wharton_400a(0x%lx, 0x%x, ...)\n",
(unsigned long)parseio, (unsigned)ch));
switch (ch)
{
......
......@@ -152,7 +152,7 @@ fetch_ieee754(
maxexp = 2047;
characteristic <<= 4;
/* grab lower characteristic bits */
characteristic |= (val & 0xF0U) >> 4;
characteristic |= (val & 0xF0) >> 4;
mantissa = (val & 0x0FULL) << 48;
mantissa |= get_byte(bufp, offsets, &fieldindex) << 40;
......@@ -172,7 +172,7 @@ fetch_ieee754(
maxexp = 255;
characteristic <<= 1;
/* grab last characteristic bit from 2nd byte */
characteristic |= (val & 0x80) ? 1U : 0 ;
characteristic |= (val & 0x80) ? 1 : 0 ;
mantissa = (val & 0x7FU) << 16;
mantissa |= get_byte(bufp, offsets, &fieldindex) << 8;
......