download: Protect against dangling symlinks in $SSL_CERT_DIR.

Reported by Christopher Baines <mail@cbaines.net>
in <https://bugs.gnu.org/25213>.

* guix/build/download.scm (make-credendials-with-ca-trust-files): Check
whether FILE exists before calling
'set-certificate-credentials-x509-trust-file!'.
master
Ludovic Courtès 2016-12-16 18:00:01 +01:00
parent 99ec0cb397
commit 580deec5b4
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 6 additions and 3 deletions

View File

@ -289,9 +289,12 @@ DIRECTORY. Those authority certificates are checked when
(string-suffix? ".pem" file))) (string-suffix? ".pem" file)))
'()))) '())))
(for-each (lambda (file) (for-each (lambda (file)
(set-certificate-credentials-x509-trust-file! (let ((file (string-append directory "/" file)))
cred (string-append directory "/" file) ;; Protect against dangling symlinks.
x509-certificate-format/pem)) (when (file-exists? file)
(set-certificate-credentials-x509-trust-file!
cred file
x509-certificate-format/pem))))
(or files '())) (or files '()))
cred)) cred))