commit e5787db6462210d07f2981a549b624795baf24a1
Author: Elan Ruusamäe <g...@delfi.ee>
Date:   Fri Sep 25 17:27:35 2015 +0300

    fix fetch when cwd=/
    
    specify path where to download, otherwise it will download relative to 
execution path
    and from nagios execution path is "/", thus GET operation will fail
    
    also use more secure mktemp rather predictable filename from date

 get-path.patch                     | 35 +++++++++++++++++++++++++++++++++++
 nagios-plugin-check_ftp_fully.spec |  4 +++-
 2 files changed, 38 insertions(+), 1 deletion(-)
---
diff --git a/nagios-plugin-check_ftp_fully.spec 
b/nagios-plugin-check_ftp_fully.spec
index f518ee9..c52f623 100644
--- a/nagios-plugin-check_ftp_fully.spec
+++ b/nagios-plugin-check_ftp_fully.spec
@@ -3,7 +3,7 @@ Summary:        Nagios plugin to check FTP transfers
 Summary(pl.UTF-8):     Wtyczka Nagiosa sprawdzająca ...
 Name:          nagios-plugin-%{plugin}
 Version:       0.1
-Release:       1
+Release:       2
 License:       GPL v2+
 Group:         Networking
 Source0:       http://www.deathwing00.org/nagios/check_ftp_fully
@@ -11,6 +11,7 @@ Source0:      
http://www.deathwing00.org/nagios/check_ftp_fully
 Source1:       %{plugin}.cfg
 Patch0:                args.patch
 Patch1:                bashisms.patch
+Patch2:                get-path.patch
 URL:           
http://exchange.nagios.org/directory/Plugins/Network-Protocols/FTP/check_ftp_fully/details
 Requires:      lftp
 Requires:      nagios-common
@@ -33,6 +34,7 @@ be extended easily.
 cp -p %{SOURCE0} %{plugin}
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 %install
 rm -rf $RPM_BUILD_ROOT
diff --git a/get-path.patch b/get-path.patch
new file mode 100644
index 0000000..39dd226
--- /dev/null
+++ b/get-path.patch
@@ -0,0 +1,35 @@
+specify path where to download, otherwise it will download relative to 
execution path
+and from nagios execution path is "/", thus GET operation will fail
+
+also use more secure mktemp rather predictable filename from date
+--- nagios-plugin-check_ftp_fully-0.1/check_ftp_fully~ 2015-09-25 
17:22:08.216836469 +0300
++++ nagios-plugin-check_ftp_fully-0.1/check_ftp_fully  2015-09-25 
17:25:29.783974165 +0300
+@@ -32,15 +32,16 @@
+ 
+ # Name of the file to use for testing
+ FILEDIR="/tmp/"
+-FILENAME=".fspftpcheck."$(/bin/date +%s)
+-FILEPATH=${FILEDIR}${FILENAME}
++FILEPATH=$(mktemp -p $FILEDIR .fspftpcheck.XXXXX) || exit 1
++TEMPGET=$(mktemp -p $FILEDIR .fspftpcheck.XXXXX) || exit 1
++FILENAME=$(basename $FILEPATH)
+ 
+ setup() {
+     echo $(/bin/date) > ${FILEPATH}
+ }
+ 
+ teardown() {
+-    /bin/rm -f ${FILEPATH}
++    /bin/rm -f ${FILEPATH} ${TEMPGET}
+ }
+ 
+ f_ok() {
+@@ -102,7 +103,7 @@
+ fi
+ 
+ # Get test
+-${LFTP} -u ${USERNAME},${PASSWORD} -p${PORT} -e "GET ${FILENAME}; quit" 
${HOSTNAME} >/dev/null 2>&1
++${LFTP} -u ${USERNAME},${PASSWORD} -p${PORT} -e "GET ${FILENAME} -o 
${TEMPGET}; quit" ${HOSTNAME} >/dev/null 2>&1
+ result=$?
+ if [ ${result} != 0 ]; then
+     f_cri "FTP check failed when trying to get a file from a directory."
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/nagios-plugin-check_ftp_fully.git/commitdiff/b061976216b9147d74f0e6da6686891d983e6c6f

_______________________________________________
pld-cvs-commit mailing list
pld-cvs-commit@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to