The limiter for repository count under a TA only makes sense for
repositories referenced from certs but less so for the actual TA. So
remove the logic from ta_lookup() and friends and make the code simpler.
There is no risk in doing so since there is only one TA and one
ta_lookup() done per TAL and the MAX_REPO_PER_TAL check can never trigger.

-- 
:wq Claudio

Index: repo.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/repo.c,v
retrieving revision 1.15
diff -u -p -r1.15 repo.c
--- repo.c      7 Dec 2021 12:46:47 -0000       1.15
+++ repo.c      21 Dec 2021 15:20:26 -0000
@@ -381,7 +381,7 @@ ta_fetch(struct tarepo *tr)
 }
 
 static struct tarepo *
-ta_get(struct tal *tal, int nofetch)
+ta_get(struct tal *tal)
 {
        struct tarepo *tr;
 
@@ -405,7 +405,7 @@ ta_get(struct tal *tal, int nofetch)
        tal->urisz = 0;
        tal->uri = NULL;
 
-       if (noop || nofetch) {
+       if (noop) {
                tr->state = REPO_DONE;
                logx("ta/%s: using cache", tr->descr);
                /* there is nothing in the queue so no need to flush */
@@ -1087,7 +1087,6 @@ struct repo *
 ta_lookup(int id, struct tal *tal)
 {
        struct repo     *rp;
-       int              nofetch = 0;
 
        /* Look up in repository table. (Lookup should actually fail here) */
        SLIST_FOREACH(rp, &repos, entry) {
@@ -1099,13 +1098,7 @@ ta_lookup(int id, struct tal *tal)
        if ((rp->repouri = strdup(tal->descr)) == NULL)
                err(1, NULL);
 
-       if (++talrepocnt[id] >= MAX_REPO_PER_TAL) {
-               if (talrepocnt[id] == MAX_REPO_PER_TAL)
-                       warnx("too many repositories under %s", tals[id]);
-               nofetch = 1;
-       }
-
-       rp->ta = ta_get(tal, nofetch);
+       rp->ta = ta_get(tal);
 
        return rp;
 }

Reply via email to