using WITH-SYSLOG-DESTINATION
This commit is contained in:
parent
1e164e08b2
commit
5b666fb2e4
32
ftpd.scm
32
ftpd.scm
|
@ -72,10 +72,7 @@
|
|||
(define log
|
||||
(lambda (level format-message . args)
|
||||
(syslog level
|
||||
(apply format #f format-message args)
|
||||
(format "ftpd[~D]" (thread-uid (current-thread)))
|
||||
#f
|
||||
(syslog-facility daemon))))
|
||||
(apply format #f format-message args))))
|
||||
|
||||
(define (protocol-family->string protocol-family)
|
||||
(cond ((= protocol-family protocol-family/unspecified)
|
||||
|
@ -104,6 +101,13 @@
|
|||
|
||||
(define (ftpd anonymous-home . maybe-port)
|
||||
(let ((port (optional maybe-port 21)))
|
||||
(with-syslog-destination
|
||||
"ftpd"
|
||||
(syslog-options log-pid)
|
||||
(syslog-facility daemon)
|
||||
syslog-mask-all
|
||||
(lambda ()
|
||||
|
||||
(log (syslog-level notice)
|
||||
"starting on port ~D with ~S as anonymous home"
|
||||
port (expand-file-name anonymous-home (cwd)))
|
||||
|
@ -113,7 +117,7 @@
|
|||
|
||||
(log (syslog-level info)
|
||||
"new connection with ~S"
|
||||
(socket-address->string address)
|
||||
(socket-address->string address))
|
||||
|
||||
(log (syslog-level debug)
|
||||
"got connection with socket ~S and address ~S"
|
||||
|
@ -137,7 +141,8 @@
|
|||
((= errno errno/notconn)
|
||||
(log (syslog-level warning)
|
||||
"socket not connected any more - exiting thread")
|
||||
(log (syslog-level debug) "socket ~S not connected any more"
|
||||
(log (syslog-level debug)
|
||||
"socket ~S not connected any more"
|
||||
(socket->string socket))
|
||||
(exit 'fick-dich-ins-knie))))
|
||||
(lambda ()
|
||||
|
@ -148,11 +153,16 @@
|
|||
(log (syslog-level info)
|
||||
"closing socket")
|
||||
(close-socket socket))
|
||||
(socket-address->string address)))) ; use remote address as thread-name
|
||||
|
||||
port)))
|
||||
(socket-address->string address))) ; use remote address as thread-name
|
||||
port)))))
|
||||
|
||||
(define (ftpd-inetd anonymous-home)
|
||||
(with-syslog-destination
|
||||
"ftpd"
|
||||
(syslog-option log-pid)
|
||||
(syslog-facility daemon)
|
||||
#f
|
||||
(lambda ()
|
||||
(log (syslog-level info)
|
||||
"new connection on current input- and output-port with ~S as anonymous home"
|
||||
(expand-file-name anonymous-home (cwd)))
|
||||
|
@ -165,7 +175,7 @@
|
|||
|
||||
(handle-connection (current-input-port)
|
||||
(current-output-port)
|
||||
(file-name-as-directory anonymous-home)))
|
||||
(file-name-as-directory anonymous-home)))))
|
||||
|
||||
(define (set-ftp-socket-options! socket)
|
||||
;; If the client closes the connection, we won't lose when we try to
|
||||
|
@ -876,7 +886,7 @@
|
|||
|
||||
; Version
|
||||
|
||||
(define *ftpd-version* "$Revision: 1.17 $")
|
||||
(define *ftpd-version* "$Revision: 1.18 $")
|
||||
|
||||
(define (copy-port->port-binary input-port output-port)
|
||||
(let ((buffer (make-string *window-size*)))
|
||||
|
|
Loading…
Reference in New Issue