diff options
author | dinoex <dinoex@FreeBSD.org> | 2010-08-07 15:49:17 +0800 |
---|---|---|
committer | dinoex <dinoex@FreeBSD.org> | 2010-08-07 15:49:17 +0800 |
commit | 1c37717372d7d98a258335b55427139ef2993a9b (patch) | |
tree | c6bd3f127f30d165ad9b66dd0757935c7f15928d /ftp/vsftpd/files | |
parent | 6fe8d10844fdf146972eda6de187c893e099a07d (diff) | |
download | freebsd-ports-gnome-1c37717372d7d98a258335b55427139ef2993a9b.tar.gz freebsd-ports-gnome-1c37717372d7d98a258335b55427139ef2993a9b.tar.zst freebsd-ports-gnome-1c37717372d7d98a258335b55427139ef2993a9b.zip |
- rc.d supports now vsftpd_config
PR: 146556
- new option WITH_PIDFILE
Submitted by: Eugen Zagorodniy
- update to 2.3.0
Diffstat (limited to 'ftp/vsftpd/files')
-rw-r--r-- | ftp/vsftpd/files/pidfile.patch | 87 | ||||
-rw-r--r-- | ftp/vsftpd/files/vsftpd.sh.in | 12 |
2 files changed, 94 insertions, 5 deletions
diff --git a/ftp/vsftpd/files/pidfile.patch b/ftp/vsftpd/files/pidfile.patch new file mode 100644 index 000000000000..da420ccf9c43 --- /dev/null +++ b/ftp/vsftpd/files/pidfile.patch @@ -0,0 +1,87 @@ +diff -ruN ../vsftpd-2.0.7.orig/parseconf.c ./parseconf.c +--- ../vsftpd-2.0.7.orig/parseconf.c 2008-08-01 18:35:33.000000000 +0300 ++++ ./parseconf.c 2008-08-01 18:35:30.000000000 +0300 +@@ -149,6 +149,7 @@ + { "secure_chroot_dir", &tunable_secure_chroot_dir }, + { "ftp_username", &tunable_ftp_username }, + { "chown_username", &tunable_chown_username }, ++ { "pid_file", &tunable_pid_file }, + { "xferlog_file", &tunable_xferlog_file }, + { "vsftpd_log_file", &tunable_vsftpd_log_file }, + { "message_file", &tunable_message_file }, +diff -ruN ../vsftpd-2.0.7.orig/standalone.c ./standalone.c +--- ../vsftpd-2.0.7.orig/standalone.c 2008-08-01 18:35:34.000000000 +0300 ++++ ./standalone.c 2008-08-01 18:46:36.000000000 +0300 +@@ -7,6 +7,8 @@ + * Code to listen on the network and launch children servants. + */ + ++#include <stdio.h> ++ + #include "standalone.h" + + #include "parseconf.h" +@@ -49,7 +51,23 @@ + int forkret = vsf_sysutil_fork(); + if (forkret > 0) + { +- /* Parent, just exit */ ++ /* Parent, write pidfile (if nessesary) and exit. */ ++ if (tunable_pid_file) ++ { ++ FILE* pidfile = fopen(tunable_pid_file, "w"); ++ if (NULL != pidfile) ++ { ++ if (0 > fprintf(pidfile, "%d\n", forkret)) ++ { ++ die2("failed write to pidfile:", tunable_pid_file); ++ } ++ fclose(pidfile); ++ } ++ else ++ { ++ die2("cannot open pidfile:", tunable_pid_file); ++ } ++ } + vsf_sysutil_exit(0); + } + /* Son, close standard FDs to avoid SSH hang-on-exit */ +diff -ruN ../vsftpd-2.0.7.orig/tunables.c ./tunables.c +--- ../vsftpd-2.0.7.orig/tunables.c 2008-08-01 18:35:33.000000000 +0300 ++++ ./tunables.c 2008-08-01 18:55:17.000000000 +0300 +@@ -107,6 +107,7 @@ + const char* tunable_secure_chroot_dir; + const char* tunable_ftp_username; + const char* tunable_chown_username; ++const char* tunable_pid_file = 0; + const char* tunable_xferlog_file; + const char* tunable_vsftpd_log_file; + const char* tunable_message_file; +diff -ruN ../vsftpd-2.0.7.orig/tunables.h ./tunables.h +--- ../vsftpd-2.0.7.orig/tunables.h 2008-08-01 18:35:34.000000000 +0300 ++++ ./tunables.h 2008-08-01 18:35:31.000000000 +0300 +@@ -101,6 +101,7 @@ + extern const char* tunable_secure_chroot_dir; + extern const char* tunable_ftp_username; + extern const char* tunable_chown_username; ++extern const char* tunable_pid_file; + extern const char* tunable_xferlog_file; + extern const char* tunable_vsftpd_log_file; + extern const char* tunable_message_file; +diff -ruN ../vsftpd-2.0.7.orig/vsftpd.conf.5 ./vsftpd.conf.5 +--- ../vsftpd-2.0.7.orig/vsftpd.conf.5 2008-08-01 18:35:34.000000000 +0300 ++++ ./vsftpd.conf.5 2008-08-01 18:35:31.000000000 +0300 +@@ -923,6 +923,13 @@ + + Default: (none - the address is taken from the incoming connected socket) + .TP ++.B pid_file ++This option has efect only if ++.BR background ++is set. It writes pid of running daemon to file at the specified path. ++ ++Default: (none) (no pidfile is created) ++.TP + .B rsa_cert_file + This option specifies the location of the RSA certificate to use for SSL + encrypted connections. diff --git a/ftp/vsftpd/files/vsftpd.sh.in b/ftp/vsftpd/files/vsftpd.sh.in index ece3a60d6c0d..6b26ed855ad1 100644 --- a/ftp/vsftpd/files/vsftpd.sh.in +++ b/ftp/vsftpd/files/vsftpd.sh.in @@ -10,7 +10,8 @@ # 1. add the following line(s) to /etc/rc.conf to enable `vsftpd': # # vsftpd_enable="YES" -# vsftpd_flags="/some/path/conf.file" # Not required +# vsftpd_flags="-ooption=value" # Not required +# vsftpd_config="/some/path/conf.file" # Not required # # 2. tell vsftpd about standalone mode # Edit %%PREFIX%%/etc/vsftpd.conf (or /some/path/conf.file) to contain @@ -27,23 +28,24 @@ rcvar=`set_rcvar` load_rc_config "$name" : ${vsftpd_enable:="NO"} +: ${vsftpd_config:="%%PREFIX%%/etc/$name.conf"} command="%%PREFIX%%/libexec/$name" -required_files="%%PREFIX%%/etc/$name.conf" +required_files="${vsftpd_config}" start_precmd="vsftpd_check" extra_commands="reload" vsftpd_check() { - if grep -q "^ftp[ ]" /etc/inetd.conf ${required_files} + if grep -q "^ftp[ ]" /etc/inetd.conf then err 1 "ftp is already activated in /etc/inetd.conf" fi - if ! egrep -q -i -E "^listen.*=.*YES$" ${required_files} + if ! egrep -q -i -E "^listen.*=.*YES$" ${vsftpd_config} then err 1 'vsftpd script need "listen=YES" in config file' fi - if ! egrep -q -i -E "^background.*=.*YES$" ${required_files} + if ! egrep -q -i -E "^background.*=.*YES$" ${vsftpd_config} then err 1 'vsftpd script need "background=YES" in config file' fi |