ports/163339: rc script not supports pure-authd

Gabor HALASZ halasz.g at freemail.hu
Fri Dec 16 16:00:29 UTC 2011


>Number:         163339
>Category:       ports
>Synopsis:       rc script not supports pure-authd
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 16 16:00:24 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Gabor HALASZ
>Release:        RELENG_9
>Organization:
>Environment:
FreeBSD server.hamito.eu 9.0-PRERELEASE FreeBSD 9.0-PRERELEASE #2: Sat Dec  3 13:38:27 CET 2011     root at server.hamito.eu:/usr/obj/usr/src/sys/CUSTOM  amd64
>Description:
The /usr/local/etc/rc.d/pure-ftpd not contains any support for pure-authd, the external authentication agent of pure-ftpd. 
>How-To-Repeat:
Install the package. My version is pure-ftpd-1.0.34.
>Fix:
I added few lines to rc.d/pure-ftpd, see the attached diff file. 

Patch attached with submission follows:

--- /usr/local/etc/rc.d/pure-ftpd.orig	2011-12-09 02:23:44.725543156 +0100
+++ /usr/local/etc/rc.d/pure-ftpd	2011-12-16 16:47:53.974676979 +0100
@@ -14,6 +14,10 @@
 # pureftpd_upload_enable="YES"
 # pureftpd_uploadscript="/full/path/to/launch_script"
 #
+# For launch pure-authd daemon define
+# pureftpd_authd_enable="YES"
+# pureftpd_authdscript="/full/path/to/auth_script"
+#
 
 . /etc/rc.subr
 
@@ -24,30 +28,56 @@
 
 command=/usr/local/sbin/pure-config.pl
 command_upload=/usr/local/sbin/pure-uploadscript
+command_authd=/usr/local/sbin/pure-authd
 pureftpd_uploadscript=${pureftpd_uploadscript:-"/usr/bin/touch"}
+pureftpd_authdscript=${pureftpd_authdscript:-"/usr/local/sbin/pure-alwaysfail"}
 pureftpd_config=${pureftpd_config:-"/usr/local/etc/pure-ftpd.conf"}
 required_files=${pureftpd_config}
 pidfile=/var/run/pure-ftpd.pid
 pidfile2=/var/run/pure-uploadscript.pid
+pidfile3=/var/run/pure-authd.pid
 procname=pure-ftpd
+pureftpd_authsocket=`grep ^ExtAuth /usr/local/etc/pure-ftpd.conf | sed s/^ExtAuth[\ \t]*//`
 
 pureftpd_enable=${pureftpd_enable:-"NO"}
 command_args="${pureftpd_config} -g${pidfile}"
 command_upload_args="-B -r ${pureftpd_uploadscript}"
+command_authd_args=" -s ${pureftpd_authsocket} -B -r ${pureftpd_authdscript}"
 
+start_precmd=start_precmd
 start_postcmd=start_postcmd
 stop_postcmd=stop_postcmd
 
+start_precmd()
+{
+        if test -n ${pureftpd_authd_enable:-""} && checkyesno pureftpd_authd_enable && test -x ${pureftpd_authdscript}; then
+        echo "Starting ${command_authd}."
+        ${command_authd} ${command_authd_args}  
+        fi
+}
+
 start_postcmd()
 {
-       if test -n ${pureftpd_upload_enable:-""} && checkyesno pureftpd_upload_enable; then
-       echo "Starting ${command_upload}."
-       ${command_upload} ${command_upload_args}  
-       fi
+        if test -n ${pureftpd_upload_enable:-""} && checkyesno pureftpd_upload_enable; then
+        echo "Starting ${command_upload}."
+        ${command_upload} ${command_upload_args}  
+        fi
 }
 
 stop_postcmd()
 {
+        if test -n ${pureftpd_authd_enable:-""} && checkyesno pureftpd_authd_enable; then
+        pid=$(check_pidfile ${pidfile3} ${command_authd})
+        if [ -z ${pid} ]; then
+        echo "pure-authd not running? (check ${pidfile3})."
+        return 1
+        fi
+        echo "Stopping ${command_authd}."
+        kill -${sig_stop:-TERM} ${pid}
+        [ $? -ne 0 ] && [ -z "$rc_force" ] && return 1
+        wait_for_pids ${pid}
+        fi
+
         if test -n ${pureftpd_upload_enable:-""} && checkyesno pureftpd_upload_enable; then
         pid=$(check_pidfile ${pidfile2} ${command_upload})
         if [ -z ${pid} ]; then
--- /dev/null	2011-12-16 16:50:15.000000000 +0100
+++ /usr/local/sbin/pure-alwaysfail	2011-12-09 02:50:02.926545142 +0100
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+echo auth_ok:0
+echo end


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list