diff --git a/usr.sbin/rpki-client/repo.c b/usr.sbin/rpki-client/repo.c index 4c5e6ee6e1d..a88ab01b14e 100644 --- a/usr.sbin/rpki-client/repo.c +++ b/usr.sbin/rpki-client/repo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: repo.c,v 1.70 2024/11/13 12:51:04 tb Exp $ */ +/* $OpenBSD: repo.c,v 1.71 2024/12/19 13:23:38 job Exp $ */ /* * Copyright (c) 2021 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -1264,6 +1264,20 @@ repo_byid(unsigned int id) return NULL; } +static struct repo * +repo_rsync_bypath(const char *path) +{ + struct repo *rp; + + SLIST_FOREACH(rp, &repos, entry) { + if (rp->rsync == NULL) + continue; + if (strcmp(rp->basedir, path) == 0) + return rp; + } + return NULL; +} + /* * Find repository by base path. */ @@ -1892,7 +1906,8 @@ repo_cleanup_entry(FTSENT *e, struct filepath_tree *tree, int cachefd) } if (e->fts_level == 3 && fts_state.type == RSYNC_DIR) { /* .rsync/rpki.example.org/repository */ - fts_state.rp = repo_bypath(path + strlen(".rsync/")); + fts_state.rp = repo_rsync_bypath(path + + strlen(".rsync/")); } break; case FTS_DP: