From fbefdadd323dd72652edad04e784efd6e53a2407 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Fri, 28 Aug 2009 23:16:33 +0000 Subject: Fix uri_to_filename(). Old algorithm was just stripping rsync:// off the head of the URI; new algorithm also strips hostname[:port] and module, which removes gratuitous hostname/module settings in config files and is a better match for normal rsyncd usage. NB: Existing installations will require a config file update. svn path=/rpkid/rpki/publication.py; revision=2716 --- rpkid/rpki/publication.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rpkid/rpki/publication.py b/rpkid/rpki/publication.py index bd320278..d4e77de6 100644 --- a/rpkid/rpki/publication.py +++ b/rpkid/rpki/publication.py @@ -236,10 +236,13 @@ class publication_object_elt(rpki.xml_utils.base_elt, publication_namespace): Convert a URI to a local filename. """ if not self.uri.startswith("rsync://"): - raise rpki.exceptions.BadURISyntax - filename = self.gctx.publication_base + self.uri[len("rsync://"):] + raise rpki.exceptions.BadURISyntax, self.uri + u = 0 + for i in xrange(4): + u = self.uri.index("/", u + 1) + filename = self.gctx.publication_base.rstrip("/") + self.uri[u:] if filename.find("//") >= 0 or filename.find("/../") >= 0 or filename.endswith("/.."): - raise rpki.exceptions.BadURISyntax + raise rpki.exceptions.BadURISyntax, filename return filename class certificate_elt(publication_object_elt): -- cgit v1.2.3