Some changes from start-web-server

This commit is contained in:
mainzelm 2004-05-24 11:59:56 +00:00
parent 1bd77d4b10
commit 1374c26247
1 changed files with 10 additions and 7 deletions

View File

@ -111,6 +111,11 @@ exec scsh -lel SSAX-4.9/load.scm -lel sunet-2.1/load.scm -dm -o http-test -e mai
(else (else
(error "Internal error, option not found" option alist)))) (error "Internal error, option not found" option alist))))
(define (become-nobody-if-root)
(cond ((zero? (user-uid))
(set-gid (->gid "nobody"))
(set-uid (->uid "nobody")))))
(define (main args) (define (main args)
(with-cwd (with-cwd
(file-name-directory (car args)) (file-name-directory (car args))
@ -121,9 +126,6 @@ exec scsh -lel SSAX-4.9/load.scm -lel sunet-2.1/load.scm -dm -o http-test -e mai
(log-file-name . "/tmp/httpd.log") (log-file-name . "/tmp/httpd.log")
(requests . 5))) (requests . 5)))
(options (make-options-from-args (cdr args) default-options))) (options (make-options-from-args (cdr args) default-options)))
(cond ((zero? (user-uid))
(set-gid (->gid "nobody"))
(set-uid (->uid "nobody"))))
(format #t "Going to run Webserver with: (format #t "Going to run Webserver with:
htdocs-dir: ~a htdocs-dir: ~a
@ -145,10 +147,10 @@ exec scsh -lel SSAX-4.9/load.scm -lel sunet-2.1/load.scm -dm -o http-test -e mai
with-simultaneous-requests (lookup-option options 'requests) with-simultaneous-requests (lookup-option options 'requests)
with-syslog? #t with-syslog? #t
with-log-file (lookup-option options 'log-file-name) with-log-file (lookup-option options 'log-file-name)
with-post-bind-thunk become-nobody-if-root
with-request-handler with-request-handler
(alist-path-dispatcher (alist-path-dispatcher
(list (cons "h" (home-dir-handler "public_html")) (list (cons "seval" seval-handler)
(cons "seval" seval-handler)
;; You may want to adapt this to your site. ;; You may want to adapt this to your site.
;; call like http://localhost:8080/man/man?ssh(1) ;; call like http://localhost:8080/man/man?ssh(1)
(cons "man" (rman-handler 'man (cons "man" (rman-handler 'man
@ -163,8 +165,9 @@ exec scsh -lel SSAX-4.9/load.scm -lel sunet-2.1/load.scm -dm -o http-test -e mai
"Generated by info-gateway")) "Generated by info-gateway"))
(cons "cgi-bin" (cgi-handler (cons "cgi-bin" (cgi-handler
(lookup-option options 'cgi-bin-dir)))) (lookup-option options 'cgi-bin-dir))))
(rooted-file-or-directory-handler (tilde-home-dir-handler "public_html"
(lookup-option options 'htdocs-dir)))))))) (rooted-file-or-directory-handler
(lookup-option options htdocs-dir)))))))))
)) ))
;; EOF ;; EOF