mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 22:08:16 -05:00
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.
This commit is contained in:
parent
49f9d7f697
commit
8a2105078b
1 changed files with 7 additions and 0 deletions
|
@ -980,6 +980,10 @@ (define (client-terminal-columns)
|
|||
(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 @@ (define (guix-substitute . args)
|
|||
(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")
|
||||
|
|
Loading…
Reference in a new issue