aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-05-02 12:28:23 +0200
committerLudovic Courtès <ludo@gnu.org>2017-05-02 12:32:52 +0200
commit8a2105078b5845e31768da06b360676352b1f3e9 (patch)
tree07c0ec70926042fab5bef4442d66f52a19b58b54
parent49f9d7f697d19870f01104cdb6a90a32aea87679 (diff)
downloadpatches-8a2105078b5845e31768da06b360676352b1f3e9.tar
patches-8a2105078b5845e31768da06b360676352b1f3e9.tar.gz
substitute: Validate substitute URLs.
Reported by Maxim Cournoyer <maxim.cournoyer@gmail.com> at <https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00548.html>. * guix/scripts/substitute.scm (validate-uri): New procedure. (guix-substitute): Use it.
-rwxr-xr-xguix/scripts/substitute.scm7
1 files changed, 7 insertions, 0 deletions
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index 748c334e3c..b4e913a880 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -980,6 +980,10 @@ default value."
(and number (max 20 (- number 1))))))
80))
+(define (validate-uri uri)
+ (unless (string->uri uri)
+ (leave (_ "~a: invalid URI~%") uri)))
+
(define (guix-substitute . args)
"Implement the build daemon's substituter protocol."
(mkdir-p %narinfo-cache-directory)
@@ -1001,6 +1005,9 @@ default value."
(newline)
(force-output (current-output-port))
+ ;; Sanity-check %CACHE-URLS so we can provide a meaningful error message.
+ (for-each validate-uri %cache-urls)
+
;; Attempt to install the client's locale, mostly so that messages are
;; suitably translated.
(match (or (find-daemon-option "untrusted-locale")