do security-guard check in ssl-load...

This commit is contained in:
Ryan Culpepper 2012-11-17 02:33:55 -05:00
parent d6cb2ecee6
commit 1c0e08f0a6

View File

@ -18,6 +18,7 @@
(require ffi/unsafe (require ffi/unsafe
ffi/unsafe/define ffi/unsafe/define
ffi/unsafe/atomic ffi/unsafe/atomic
ffi/file
racket/port racket/port
racket/tcp racket/tcp
racket/string racket/string
@ -425,15 +426,17 @@
(raise-argument-error 'ssl-load-certificate-chain! (raise-argument-error 'ssl-load-certificate-chain!
"path-string?" "path-string?"
pathname)) pathname))
(let ([path (path->bytes (let ([path
(path->complete-path (cleanse-path pathname) (path->complete-path (cleanse-path pathname)
(current-directory)))]) (current-directory))])
(security-guard-check-file who path '(read))
(let ([path (path->bytes path)])
(atomically ;; for to connect ERR_get_error to `load-it' (atomically ;; for to connect ERR_get_error to `load-it'
(let ([n (load-it ctx path)]) (let ([n (load-it ctx path)])
(unless (= n 1) (unless (= n 1)
(error who "load failed from: ~e ~a" (error who "load failed from: ~e ~a"
pathname pathname
(get-error-message (ERR_get_error))))))))) (get-error-message (ERR_get_error))))))))))
(define (ssl-load-certificate-chain! ssl-context-or-listener pathname) (define (ssl-load-certificate-chain! ssl-context-or-listener pathname)
(ssl-load-... 'ssl-load-certificate-chain! (ssl-load-... 'ssl-load-certificate-chain!