SOURCES: mon-ftp.patch (NEW) - properly handle multiline replies a...

arekm arekm at pld-linux.org
Sun Jan 29 15:20:25 CET 2006


Author: arekm                        Date: Sun Jan 29 14:20:25 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- properly handle multiline replies after quit command

---- Files affected:
SOURCES:
   mon-ftp.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/mon-ftp.patch
diff -u /dev/null SOURCES/mon-ftp.patch:1.1
--- /dev/null	Sun Jan 29 15:20:25 2006
+++ SOURCES/mon-ftp.patch	Sun Jan 29 15:20:20 2006
@@ -0,0 +1,28 @@
+diff -urN mon-1.1.0pre1.org/mon.d/ftp.monitor mon-1.1.0pre1/mon.d/ftp.monitor
+--- mon-1.1.0pre1.org/mon.d/ftp.monitor	2004-06-09 07:18:05.000000000 +0200
++++ mon-1.1.0pre1/mon.d/ftp.monitor	2006-01-29 15:19:39.406145500 +0100
+@@ -171,14 +171,16 @@
+ 	print S "quit\r\n";
+ 	$result->{"detail"} .= "    > quit\n";
+ 
+-	$in = <S>;
+-	$result->{"detail"} .= "    < $in";
+-	if ($in !~ /^221 /) {
+-	    alarm 0;
+-	    $result->{"ok"} = 0;
+-	    $result->{"error"} = "FTP server error after quit";
+-	    close(S);
+-	    return undef;
++	while ($in = <S>) {
++		$result->{"detail"} .= "    < $in";
++		next if ($in =~ /^[0-9]{3}\-/);
++		if ($in !~ /^221 /) {
++			alarm 0;
++			$result->{"ok"} = 0;
++			$result->{"error"} = "FTP server error after quit";
++			close(S);
++			return undef;
++		}
+ 	}
+ 
+ 	close(S);
================================================================


More information about the pld-cvs-commit mailing list