2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

98_telnet.pm/01_FHEMWEB.pm: revert NotifyFn optimizations from r13334, as it doe not sets motd.

git-svn-id: https://svn.fhem.de/fhem/trunk@13443 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-02-19 12:51:22 +00:00
parent 62ee837319
commit 196a8a1eba
2 changed files with 15 additions and 4 deletions

View File

@ -130,6 +130,7 @@ FHEMWEB_Initialize($)
$hash->{DefFn} = "FW_Define";
$hash->{UndefFn} = "FW_Undef";
$hash->{NotifyFn}= "FW_Notify";
$hash->{NotifyFn}= ($init_done ? "FW_Notify" : "FW_SecurityCheck");
$hash->{AsyncOutputFn} = "FW_AsyncOutput";
$hash->{ActivateInformFn} = "FW_ActivateInform";
no warnings 'qw';
@ -217,13 +218,15 @@ FHEMWEB_Initialize($)
FW_readIcons($pe);
}
}
InternalTimer(1, "FW_SecurityCheck", $hash);
}
#####################################
sub
FW_SecurityCheck($$)
{
my ($ntfy, $dev) = @_;
return if($dev->{NAME} ne "global" ||
!grep(m/^INITIALIZED$/, @{$dev->{CHANGED}}));
my $motd = AttrVal("global", "motd", "");
if($motd =~ "^SecurityCheck") {
my @list1 = devspec2array("TYPE=FHEMWEB");
@ -244,6 +247,8 @@ FW_SecurityCheck($$)
if(@list3);
$attr{global}{motd} = $motd;
}
$modules{FHEMWEB}{NotifyFn}= "FW_Notify";
return;
}
#####################################
@ -801,7 +806,8 @@ FW_answerCall($)
my $supplied = $FW_webArgs{fwcsrf} ? $FW_webArgs{fwcsrf} : "";
my $want = $defs{$FW_wname}{CSRFTOKEN};
if($supplied ne $want) {
Log3 $FW_wname, 3, "FHEMWEB $FW_wname CSRF error: $supplied ne $want";
Log3 $FW_wname, 3, "FHEMWEB $FW_wname CSRF error: $supplied ne $want. ".
"For detals see the csrfToken FHEMWEB attribute";
return 0;
}
}

View File

@ -20,6 +20,7 @@ telnet_Initialize($)
$hash->{AsyncOutputFn} = "telnet_Output";
$hash->{UndefFn} = "telnet_Undef";
$hash->{AttrFn} = "telnet_Attr";
$hash->{NotifyFn}= "telnet_SecurityCheck";
$hash->{AttrList} = "globalpassword password prompt allowedCommands ".
"allowfrom SSL connectTimeout connectInterval ".
"encoding:utf8,latin1 sslVersion";
@ -33,7 +34,6 @@ telnet_Initialize($)
$cmds{inform} = { Fn=>"CommandTelnetInform",
ClientFilter => "telnet",
Hlp=>"{on|off|log|raw|timer|status},echo all events to this client" };
InternalTimer(1, "telnet_SecurityCheck", $hash);
}
sub
@ -58,8 +58,11 @@ CommandTelnetEncoding($$)
#####################################
sub
telnet_SecurityCheck()
telnet_SecurityCheck($$)
{
my ($ntfy, $dev) = @_;
return if($dev->{NAME} ne "global" ||
!grep(m/^INITIALIZED$/, @{$dev->{CHANGED}}));
my $motd = AttrVal("global", "motd", "");
if($motd =~ "^SecurityCheck") {
my @list1 = devspec2array("TYPE=telnet");
@ -82,6 +85,8 @@ telnet_SecurityCheck()
if(@list3);
$attr{global}{motd} = $motd;
}
delete $modules{telnet}{NotifyFn};
return;
}
##########################