summaryrefslogtreecommitdiff
path: root/usr.sbin/rpki-client/main.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2022-01-04 18:41:33 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2022-01-04 18:41:33 +0000
commitec872e93d8654a71a57f6820def614ee5f68e0ae (patch)
treec09bed351e5ff3f17c0375d7f7c80ffae59a0ae3 /usr.sbin/rpki-client/main.c
parent81fe4c2bcccf420d8841a62e08987b4bcf7e56ba (diff)
Pass the filename back from the parser to the parent.
The parent will then add the filename to the filepath tree instead of doing that in entity_write_req(). In the parser pass the filename instead of the full entity object to various proc_parser functions. With this it will be possible to check more then one file in the parser. OK tb@, earlyer version OK benno@
Diffstat (limited to 'usr.sbin/rpki-client/main.c')
-rw-r--r--usr.sbin/rpki-client/main.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/usr.sbin/rpki-client/main.c b/usr.sbin/rpki-client/main.c
index 7d67de30084..0160877e96b 100644
--- a/usr.sbin/rpki-client/main.c
+++ b/usr.sbin/rpki-client/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.170 2021/12/29 11:37:57 claudio Exp $ */
+/* $OpenBSD: main.c,v 1.171 2022/01/04 18:41:32 claudio Exp $ */
/*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -132,12 +132,6 @@ entity_write_req(const struct entity *ent)
{
struct ibuf *b;
- if (filepath_add(&fpt, ent->file) == 0) {
- warnx("%s: File already visited", ent->file);
- entity_queue--;
- return;
- }
-
b = io_new_buffer();
io_simple_buffer(b, &ent->type, sizeof(ent->type));
io_simple_buffer(b, &ent->talid, sizeof(ent->talid));
@@ -467,6 +461,7 @@ entity_process(struct ibuf *b, struct stats *st, struct vrp_tree *tree,
struct cert *cert;
struct mft *mft;
struct roa *roa;
+ char *file;
int c;
/*
@@ -476,6 +471,14 @@ entity_process(struct ibuf *b, struct stats *st, struct vrp_tree *tree,
* We follow that up with whether the resources didn't parse.
*/
io_read_buf(b, &type, sizeof(type));
+ io_read_str(b, &file);
+
+ if (filepath_add(&fpt, file) == 0) {
+ warnx("%s: File already visited", file);
+ free(file);
+ entity_queue--;
+ return;
+ }
switch (type) {
case RTYPE_TAL:
@@ -544,6 +547,7 @@ entity_process(struct ibuf *b, struct stats *st, struct vrp_tree *tree,
errx(1, "unknown entity type %d", type);
}
+ free(file);
entity_queue--;
}