Make it a hard error when an unknown repoistory id is passed to
authorclaudio <claudio@openbsd.org>
Tue, 19 Apr 2022 13:25:08 +0000 (13:25 +0000)
committerclaudio <claudio@openbsd.org>
Tue, 19 Apr 2022 13:25:08 +0000 (13:25 +0000)
parse_filepath(). If that happens something went very wrong and
it is better to fail hard then to limp along.
OK tb@

usr.sbin/rpki-client/parser.c

index 07b5bbd..abaa54c 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parser.c,v 1.68 2022/04/19 09:52:29 claudio Exp $ */
+/*     $OpenBSD: parser.c,v 1.69 2022/04/19 13:25:08 claudio Exp $ */
 /*
  * Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
  * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -108,7 +108,7 @@ parse_filepath(unsigned int repoid, const char *path, const char *file,
        /* build file path based on repoid, entity path and filename */
        rp = repo_get(repoid);
        if (rp == NULL)
-               return NULL;
+               errx(1, "build file path: repository %u missing", repoid);
 
        if (loc == DIR_VALID)
                repopath = rp->validpath;