mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-28 23:14:10 +00:00
Allowedfrom added
git-svn-id: https://svn.fhem.de/fhem/trunk@145 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
f693a6b452
commit
5833bc1e61
@ -378,6 +378,7 @@
|
|||||||
- bugfix: 99_SUNRISE_EL.pm: may schedule double events
|
- bugfix: 99_SUNRISE_EL.pm: may schedule double events
|
||||||
- bugfix: 62_EMEM.pl, contrib/em1010.pl: correct readings for energy_kWh
|
- bugfix: 62_EMEM.pl, contrib/em1010.pl: correct readings for energy_kWh
|
||||||
and energy_kWh_w (Boris, 06.01.08)
|
and energy_kWh_w (Boris, 06.01.08)
|
||||||
|
- feature: gloabl attr allowfrom, as wished by Holger (8.1.2008)
|
||||||
|
|
||||||
- TODO
|
- TODO
|
||||||
emem -2.5kW / getDevData for emwz -1
|
emem -2.5kW / getDevData for emwz -1
|
||||||
|
10
fhem/HISTORY
10
fhem/HISTORY
@ -189,7 +189,11 @@
|
|||||||
- Boris Sun Jan 06 13:35:00 CET 2008
|
- Boris Sun Jan 06 13:35:00 CET 2008
|
||||||
- bugfix: 62_EMEM.pm: changed reading energy_total_kWh to energy_kWh_w,
|
- bugfix: 62_EMEM.pm: changed reading energy_total_kWh to energy_kWh_w,
|
||||||
added energy_kWh (formerly energy_total_kWh)
|
added energy_kWh (formerly energy_total_kWh)
|
||||||
- changed em1010.pl accordingly, added em1000em doc for getDevStatus reply from
|
- changed em1010.pl accordingly, added em1000em doc for getDevStatus reply
|
||||||
device
|
from device
|
||||||
- minor changes in fhem.html
|
- minor changes in fhem.html
|
||||||
|
|
||||||
|
- Rudi Tue Jan 8 21:13:08 MET 2008
|
||||||
|
- feature: attr global allowfrom <ip-adresses/hostnames>
|
||||||
|
If set, only connects from these addresses are allowed. This is to
|
||||||
|
"simulate" a little bit of security.
|
||||||
|
@ -193,6 +193,13 @@ split in multiple lines<br><br>
|
|||||||
non-localhost connections too.
|
non-localhost connections too.
|
||||||
</li><br>
|
</li><br>
|
||||||
|
|
||||||
|
<a name="allowfrom"></a>
|
||||||
|
<li>allowfrom<br>
|
||||||
|
Comma (,) separated list of ip-addresses or hostnames. If set,
|
||||||
|
only connections from these addresses are allowed.
|
||||||
|
</li><br>
|
||||||
|
|
||||||
|
<a name="statefile"></a>
|
||||||
<a name="statefile"></a>
|
<a name="statefile"></a>
|
||||||
<li>statefile<br>
|
<li>statefile<br>
|
||||||
Set the filename where the state and certain <a href="#at">at</a>
|
Set the filename where the state and certain <a href="#at">at</a>
|
||||||
|
27
fhem/fhem.pl
27
fhem/fhem.pl
@ -138,15 +138,15 @@ my %intAt; # Internal at timer hash.
|
|||||||
my $intAtCnt=0;
|
my $intAtCnt=0;
|
||||||
my $reread_active = 0;
|
my $reread_active = 0;
|
||||||
my $AttrList = "room comment";
|
my $AttrList = "room comment";
|
||||||
my $cvsid = '$Id: fhem.pl,v 1.36 2007-12-31 14:43:02 rudolfkoenig Exp $';
|
my $cvsid = '$Id: fhem.pl,v 1.37 2008-01-08 20:15:58 rudolfkoenig Exp $';
|
||||||
|
|
||||||
$init_done = 0;
|
$init_done = 0;
|
||||||
|
|
||||||
$modules{_internal_}{ORDER} = -1;
|
$modules{_internal_}{ORDER} = -1;
|
||||||
$modules{_internal_}{AttrList} = "configfile logfile lastinclude modpath " .
|
$modules{_internal_}{AttrList} =
|
||||||
"pidfilename port statefile title userattr " .
|
"archivecmd allowfrom archivedir configfile lastinclude logfile " .
|
||||||
"nrarchive archivedir archivecmd " .
|
"modpath nrarchive pidfilename port statefile title userattr " .
|
||||||
"verbose:1,2,3,4,5 version";
|
"verbose:1,2,3,4,5 version";
|
||||||
|
|
||||||
|
|
||||||
my %cmds = (
|
my %cmds = (
|
||||||
@ -295,10 +295,23 @@ while (1) {
|
|||||||
Log 1, "Accept failed: $!";
|
Log 1, "Accept failed: $!";
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
my @clientsock = sockaddr_in($clientinfo[1]);
|
my ($port, $iaddr) = sockaddr_in($clientinfo[1]);
|
||||||
|
my $caddr = inet_ntoa($iaddr);
|
||||||
|
my $af = $attr{global}{allowfrom};
|
||||||
|
if($af) {
|
||||||
|
if(",$af," !~ m/,$caddr,/) {
|
||||||
|
my $hostname = gethostbyaddr($iaddr, AF_INET);
|
||||||
|
if(!$hostname || ",$af," !~ m/,$hostname,/) {
|
||||||
|
Log 1, "Connection refused from $caddr:$port";
|
||||||
|
close($clientinfo[0]);
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
my $fd = $clientinfo[0];
|
my $fd = $clientinfo[0];
|
||||||
$client{$fd}{fd} = $fd;
|
$client{$fd}{fd} = $fd;
|
||||||
$client{$fd}{addr} = inet_ntoa($clientsock[1]) . ":" . $clientsock[0];
|
$client{$fd}{addr} = "$caddr:$port";
|
||||||
$client{$fd}{buffer} = "";
|
$client{$fd}{buffer} = "";
|
||||||
Log 4, "Connection accepted from $client{$fd}{addr}";
|
Log 4, "Connection accepted from $client{$fd}{addr}";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user