Permalink
Browse files

* Bug #2006 Invalid ping arguments for RH9

   Patch by Craig Constantine (cconstantine)


git-svn-id: http://svn.php.net/repository/pear/packages/Net_Ping/trunk@237049 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent a8ff6ba commit 498750fb685e95db52e4efcd97073d40d7a8d498 @helgi helgi committed Jun 5, 2007
Showing with 67 additions and 10 deletions.
  1. +52 −6 Ping.php
  2. +15 −4 package.xml
View
@@ -167,10 +167,26 @@ function _setSystemName()
$OS_Guess = new OS_Guess;
$sysname = $OS_Guess->getSysname();
- /* Nasty hack for Debian, as it uses a custom ping version */
+ // Refine the sysname for different Linux bundles/vendors. (This
+ // should go away if OS_Guess was ever extended to give vendor
+ // and vendor-version guesses.)
+ //
+ // Bear in mind that $sysname is eventually used to craft a
+ // method name to figure out which backend gets used to parse
+ // the ping output. Elsewhere, we'll set $sysname back before
+ // that.
if ('linux' == $sysname) {
if (file_exists('/etc/debian_version')) {
- $sysname = 'debian';
+ $sysname = 'linuxdebian';
+ }else if (file_exists('/etc/redhat-release')
+ && false !== ($release= @file_get_contents('/etc/redhat-release'))
+ )
+ {
+ if (preg_match('/release 8/i', $release)) {
+ $sysname = 'linuxredhat8';
+ }elseif (preg_match('/release 9/i', $release)) {
+ $sysname = 'linuxredhat9';
+ }
}
}
@@ -299,12 +315,22 @@ function _createArgList()
$retval['post'] = "";
break;
- case "debian":
+ case "linuxdebian":
$retval['pre'] = $quiet.$count.$ttl.$size.$timeout;
$retval['post'] = "";
+ $this->_sysname = 'linux'; // undo linux vendor refinement hack
+ break;
- /* undo nasty debian hack*/
- $this->_sysname = 'linux';
+ case "linuxredhat8":
+ $retval['pre'] = $iface.$ttl.$count.$quiet.$size.$deadline;
+ $retval['post'] = "";
+ $this->_sysname = 'linux'; // undo linux vendor refinement hack
+ break;
+
+ case "linuxredhat9":
+ $retval['pre'] = $timeout.$iface.$ttl.$count.$quiet.$size.$deadline;
+ $retval['post'] = "";
+ $this->_sysname = 'linux'; // undo linux vendor refinement hack
break;
case "windows":
@@ -489,7 +515,7 @@ function _initArgRelation()
"deadline" => "-w"
);
- $this->_argRelation["debian"] = array (
+ $this->_argRelation["linuxdebian"] = array (
"timeout" => "-t",
"iface" => NULL,
"ttl" => "-m",
@@ -498,6 +524,26 @@ function _initArgRelation()
"size" => "-s",
);
+ $this->_argRelation["linuxredhat8"] = array (
+ "timeout" => NULL,
+ "iface" => "-I",
+ "ttl" => "-t",
+ "count" => "-c",
+ "quiet" => "-q",
+ "size" => "-s",
+ "deadline" => "-w"
+ );
+
+ $this->_argRelation["linuxredhat9"] = array (
+ "timeout" => "-W",
+ "iface" => "-I",
+ "ttl" => "-t",
+ "count" => "-c",
+ "quiet" => "-q",
+ "size" => "-s",
+ "deadline" => "-w"
+ );
+
$this->_argRelation["windows"] = array (
"timeout" => "-w",
"iface" => NULL,
View
@@ -27,12 +27,15 @@
<role>lead</role>
</maintainer>
</maintainers>
- <release>
- <version>2.4.1</version>
- <date>2005-12-19</date>
+ <release>
+ <version>2.4.2</version>
+ <date>2007-06-05</date>
<state>stable</state>
<notes>
- * Fixed #2314
+* Bug #10788 Net_Ping::ping() multiple calls pile up output in results buffer
+ Patch by Craig Constantine (cconstantine)
+* Bug #2006 Invalid ping arguments for RH9
+ Patch by Craig Constantine (cconstantine)
</notes>
<filelist>
<dir name="/" baseinstalldir="Net">
@@ -49,6 +52,14 @@
</filelist>
</release>
<changelog>
+ <release>
+ <version>2.4.1</version>
+ <date>2005-12-19</date>
+ <state>stable</state>
+ <notes>
+ * Fixed #2314
+ </notes>
+ </release>
<release>
<version>2.4</version>
<date>2004-02-10</date>

0 comments on commit 498750f

Please sign in to comment.