summaryrefslogtreecommitdiff
path: root/usr.sbin/rpki-client
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2021-04-12 17:23:31 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2021-04-12 17:23:31 +0000
commit04470dbf23f17b4c97427c92a7f81e0b8b2f41a5 (patch)
treed4552e76bfb7ec697dcf1e5e539823afd64bc64f /usr.sbin/rpki-client
parentb6b6955b76ad019e899c63595b595c7674d66e61 (diff)
Cast XML_GetCurrentLineNumber() to unsigned long long in warnx since
expat my either use unsigned long or unsigened long long as return value depending on compile options. This upcast is an easy way around this issue. OK deraadt@
Diffstat (limited to 'usr.sbin/rpki-client')
-rw-r--r--usr.sbin/rpki-client/rrdp.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/usr.sbin/rpki-client/rrdp.c b/usr.sbin/rpki-client/rrdp.c
index 4464e503368..7f8b2d0b356 100644
--- a/usr.sbin/rpki-client/rrdp.c
+++ b/usr.sbin/rpki-client/rrdp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rrdp.c,v 1.3 2021/04/07 16:29:14 claudio Exp $ */
+/* $OpenBSD: rrdp.c,v 1.4 2021/04/12 17:23:30 claudio Exp $ */
/*
* Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
@@ -303,18 +303,18 @@ rrdp_finished(struct rrdp *s)
}
if (s->res == HTTP_OK) {
+ XML_Parser p = s->parser;
+
/*
* Finalize parsing on success to be sure that
* all of the XML is correct. Needs to be done here
* since the call would most probably fail for non
* successful data fetches.
*/
- if (XML_Parse(s->parser, NULL, 0, 1) != XML_STATUS_OK) {
- warnx("%s: XML error at line %lu: %s",
- s->local,
- XML_GetCurrentLineNumber(s->parser),
- XML_ErrorString(XML_GetErrorCode(s->parser))
- );
+ if (XML_Parse(p, NULL, 0, 1) != XML_STATUS_OK) {
+ warnx("%s: XML error at line %llu: %s", s->local,
+ (unsigned long long)XML_GetCurrentLineNumber(p),
+ XML_ErrorString(XML_GetErrorCode(p)));
rrdp_failed(s);
return;
}
@@ -340,16 +340,14 @@ rrdp_finished(struct rrdp *s)
case SNAPSHOT:
warnx("%s: downloading snapshot",
s->local);
- s->sxml = new_snapshot_xml(s->parser,
- &s->current, s);
+ s->sxml = new_snapshot_xml(p, &s->current, s);
s->state = RRDP_STATE_REQ;
break;
case DELTA:
warnx("%s: downloading %lld deltas",
s->local, s->repository.serial -
s->current.serial);
- s->dxml = new_delta_xml(s->parser,
- &s->current, s);
+ s->dxml = new_delta_xml(p, &s->current, s);
s->state = RRDP_STATE_REQ;
break;
}
@@ -368,8 +366,7 @@ rrdp_finished(struct rrdp *s)
} else {
/* reset delta parser for next delta */
free_delta_xml(s->dxml);
- s->dxml = new_delta_xml(s->parser,
- &s->current, s);
+ s->dxml = new_delta_xml(p, &s->current, s);
s->state = RRDP_STATE_REQ;
}
break;
@@ -498,10 +495,10 @@ rrdp_data_handler(struct rrdp *s)
SHA256_Update(&s->ctx, buf, len);
if ((s->state & RRDP_STATE_PARSE_ERROR) == 0 &&
XML_Parse(p, buf, len, 0) != XML_STATUS_OK) {
- s->state |= RRDP_STATE_PARSE_ERROR;
- warnx("%s: parse error at line %lu: %s", s->local,
- XML_GetCurrentLineNumber(p),
+ warnx("%s: parse error at line %llu: %s", s->local,
+ (unsigned long long)XML_GetCurrentLineNumber(p),
XML_ErrorString(XML_GetErrorCode(p)));
+ s->state |= RRDP_STATE_PARSE_ERROR;
}
}