diff options
author | Rob Austein <sra@hactrn.net> | 2009-08-28 23:16:33 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2009-08-28 23:16:33 +0000 |
commit | fbefdadd323dd72652edad04e784efd6e53a2407 (patch) | |
tree | 8884ab261b64915c70af03a2002f85894918bddf | |
parent | c9bab7513d390073ec9fcf70397fc7f0b66b4814 (diff) |
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
-rw-r--r-- | rpkid/rpki/publication.py | 9 |
1 files 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): |