From: Ben R. <ben...@gm...> - 2013-10-05 12:15:55
|
Hello, I use ProfTPD 1.3.4a on my Debian Wheezy (7 / stable) box. I am trying to use mod-exec with useStdin option in a simple test configuration. Here is my mod_exec configuration : ExecEngine on ExecBeforeCommand PASS /tmp/test.sh arg1 "%U" Execlog /var/log/proftpd/exec.log ExecOptions useStdin test.sh : #!/bin/bash read -r arg1=$REPLY read -r arg2=$REPLY echo "$arg1 / $arg2" >> /tmp/test.log exit 0 I then try to connect : # ftp 127.0.0.1 Connected to 127.0.0.1. 220 ProFTPD 1.3.4a Server (Debian) [127.0.0.1] Name (127.0.0.1:root): ftp 331 Password required for ftp Password: 421 Service not available, remote server has closed connection Login failed. No control connection for command: No such file or directory ftp> However, test.log contains expected values : arg1 / ftp /var/log/proftpd/exec.log : preparing to execute '/tmp/test.sh' with uid 104 (euid 104), gid 65534 (egid 65534) + '/tmp/test.sh': argv[1] = arg1 + '/tmp/test.sh': argv[2] = %U wrote argument 0 (arg1) to stdin (5) wrote argument 1 (ftp) to stdin (5) Note that the following 2 expected lines are not present : '/tmp/test.sh' terminated normally, with exit status 0 ExecBeforeCommand for /tmp/test.sh succeeded /var/log/proftpd/proftpd.log : (localhost.localdomain[127.0.0.1]): FTP session opened. (localhost.localdomain[127.0.0.1]): ProFTPD terminating (signal 11) (localhost.localdomain[127.0.0.1]): FTP session closed. I tried to use the Perl script provided here to read from stdin : http://www.castaglia.org/proftpd/modules/mod_exec.html Same issue. I tried to use last version of mod_exec.c file : 1.33 instead of 1.20, but reverting the two PR_ISSPACE modifications to compile correctly. Same issue. I tried to use ExecOnEvent core.chroot instead of ExecBeforeCommand PASS. Same issue. Am I missing something ? Thank you very much ! Best regards, Ben |