I've been looking through pure-ftpd-1.0.42 source code:
https://github.com/jedisct1/pure-ftpd
Trying to find when it triggers:
https://github.com/jedisct1/pure-ftpd/blob/master/src/pure-uploadscript.c
i.e. when does it run the uploadscript after a file has been uploaded.
If you look in src/ftp_parser.c the dostor method is how a file starts the upload journey. Then it goes to ul_send then ul_handle_data but I get lost at this point. I never see when it says, okay, this file is now uploaded, time to call uploadscript. Can someone show me the line?
In the
pureftpd_start()function insrc/ftpd.c,pure-ftpdstarts up and parses all of its command-line options. It also opens a pipe to thepure-uploadscript, if configured; here. Rather than invoking the upload script on each upload (and incurring thefork()andexec()overhead per-upload),pure-ftpdkeeps 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 thedisplayrate()function, which is called by bothdostor()anddoretr()in thesrc/ftpd.cfile.Hope this helps!