我一直在寻找pure-ftpd-1.0.42源代码:
https://github.com/jedisct1/pure-ftpd
试图找到它何时触发:
https://github.com/jedisct1/pure-ftpd/blob/master/src/pure-uploadscript.c
即。什么时候在上传文件后运行uploadscript。
如果您查看src/ftp_parser.c
,dostor
方法就是文件启动上传之旅的方式。然后它转到ul_send
然后ul_handle_data
,但此时我迷路了。我从来没有看到它说什么,好吧,这个文件现在已上传,是时候致电uploadscript
了。有人能告诉我这条线吗?
答案 0 :(得分:1)
In the pureftpd_start()
function in src/ftpd.c
, pure-ftpd
starts up and parses all of its command-line options. It also opens a pipe to the pure-uploadscript
, if configured; here. Rather than invoking the upload script on each upload (and incurring the fork()
and exec()
overhead per-upload), pure-ftpd
keeps the upload script process running separately, and sends it the uploaded file path via the pipe.
Knowing this, then, we look for where that pipe is written to, using the upload_pipe_push()
function. Interestingly, that function is called here, by the displayrate()
function, which is called by both dostor()
and doretr()
in the src/ftpd.c
file.
Hope this helps!