2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

00_FBAHAHTTP.pm: Possible fix for execution denial (Forum #95913)

git-svn-id: https://svn.fhem.de/fhem/trunk@18400 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2019-01-24 13:57:31 +00:00
parent 62899b14d6
commit 90017e622f

View File

@ -70,9 +70,9 @@ FBAHAHTTP_Delete($)
}
sub
FBAHAHTTP_connect($)
FBAHAHTTP_connect($$)
{
my ($hash) = @_;
my ($hash, $doProcess) = @_;
my $name = $hash->{NAME};
my $dev = $hash->{DEF};
@ -103,6 +103,7 @@ FBAHAHTTP_connect($)
$hash->{".SID"} = $sid;
$hash->{STATE} = "connected";
Log3 $name, 4, "FBAHAHTTP_connect $name: got SID $sid";
FBAHAHTTP_ProcessStack($hash) if($doProcess && int(@{$hash->{CmdStack}}));
return undef;
}
@ -129,7 +130,7 @@ FBAHAHTTP_Poll($)
return if(IsDisabled($name));
if(!$hash->{".SID"}) {
my $ret = FBAHAHTTP_connect($hash);
my $ret = FBAHAHTTP_connect($hash, 0);
return $ret if($ret);
}
my $sid = $hash->{".SID"};
@ -242,14 +243,16 @@ FBAHAHTTP_ProcessStack($)
return;
}
Log3 $name, 5, "FBAHAHTTP_Write reply for $name: $_[2]";
if(!defined($_[2]) || $_[2] eq "") {
my $ret = (defined($_[2]) ? $_[2] : "") ;
$ret =~ s/[\r\n]//g;
Log3 $name, 5, "FBAHAHTTP_Write reply for $name: $ret";
if($ret eq "") {
if($hash->{RetriedCmd}) {
Log3 $name, 1, "No sensible respone after reconnect, giving up";
$hash->{CmdStack} = ();
return;
}
return if(FBAHAHTTP_connect($hash));
return if(FBAHAHTTP_connect($hash, 0));
$hash->{RetriedCmd} = $msg;
FBAHAHTTP_ProcessStack($hash);
return;
@ -278,7 +281,7 @@ FBAHAHTTP_Write($$$)
my $sid = $hash->{".SID"};
if(!$sid) {
my $ret = FBAHAHTTP_connect($hash); # try to reconnect
my $ret = FBAHAHTTP_connect($hash, 1); # try to reconnect
return $ret if($ret);
$sid = $hash->{".SID"};
}