2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

96_allowed.pm: change default for empty validFor (Forum #46380)

git-svn-id: https://svn.fhem.de/fhem/trunk@10398 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2016-01-07 09:05:47 +00:00
parent 8560e4e74a
commit 4163083bba
5 changed files with 14 additions and 14 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- bugfix: allowed without a validFor is invalid.
- feature: 98_weekprofile: detect profile changes in master device
- feature: 49_SSCam: Function "Get" for retrieval Camera-Readings added,
Attributs pollcaminfoall, pollnologging added,

View File

@ -70,7 +70,7 @@ FBAHA_Notify($$)
my ($ntfy, $dev) = @_;
return if($dev->{NAME} ne "global" ||
!grep(m/^INITIALIZED$/, @{$dev->{CHANGED}}));
delete $modules{telnet}{NotifyFn};
delete $modules{FBAHA}{NotifyFn};
FBAHA_reassign($ntfy);
return;
}

View File

@ -227,7 +227,7 @@ FW_SecurityCheck($$)
for my $a (@list2) {
next if(!$defs{$a});
my $vf = AttrVal($a, "validFor","");
$fnd = 1 if((!$vf || $vf =~ m/\b$l\b/) && AttrVal($a, "basicAuth",""));
$fnd = 1 if($vf && ($vf =~ m/\b$l\b/) && AttrVal($a, "basicAuth",""));
}
push @list3, $l if(!$fnd);
}

View File

@ -56,7 +56,7 @@ allowed_Authorize($$$$)
my ($me, $cl, $type, $arg) = @_;
return 0 if($me->{disabled});
return 0 if($me->{validFor} && $me->{validFor} !~ m/\b$cl->{SNAME}\b/);
return 0 if(!$me->{validFor} || $me->{validFor} !~ m/\b$cl->{SNAME}\b/);
if($type eq "cmd") {
return 0 if(!$me->{allowedCommands});
@ -80,7 +80,7 @@ allowed_Authenticate($$$$)
my ($me, $cl, $param) = @_;
return 0 if($me->{disabled});
return 0 if($me->{validFor} && $me->{validFor} !~ m/\b$cl->{SNAME}\b/);
return 0 if(!$me->{validFor} || $me->{validFor} !~ m/\b$cl->{SNAME}\b/);
my $aName = $me->{NAME};
if($cl->{TYPE} eq "FHEMWEB") {
@ -339,9 +339,8 @@ allowed_Attr(@)
<li>validFor<br>
A comma separated list of frontend names. Currently supported frontends
are all devices connected through the FHEM TCP/IP library, e.g. telnet
and FHEMWEB. If set, the rules specified via the other attributes will
only apply to the frontends in the list. If not set, the rules apply to
all frontends.
and FHEMWEB. <b>Note: changed behaviour:</b>The allowed instance is
only active, if this attribute is set.
</li>
</ul>
@ -487,11 +486,10 @@ allowed_Attr(@)
<a name="validFor"></a>
<li>validFor<br>
Komma separierte Liste von Forntend-Instanznamen. Aktuell werden nur
Frontends unterst&uuml;tzt, die das FHEM TCP/IP Bibliothek verwenden.
Falls gesetzt, dann gelten die mit den anderen Attributen
spezifizierten Regeln nur f&uuml;r diese Instanzen. Falls nicht
gesetzt, dann sind alle Frontends betroffen.
Komma separierte Liste von Frontend-Instanznamen. Aktuell werden nur
Frontends unterst&uuml;tzt, die das FHEM TCP/IP Bibliothek verwenden,
z.Bsp. telnet und FHEMWEB. <b>Achtung, &Auml;nderung:</b> falls nicht
gesetzt, ist die allowed Instanz nicht aktiv.
</li>
</ul>

View File

@ -28,7 +28,8 @@ telnet_Initialize($)
my %lhash = ( Fn=>"CommandTelnetEncoding",
ClientFilter => "telnet",
Hlp=>"[utf8|latin1],query and set the character encoding for the current telnet session" );
Hlp=>"[utf8|latin1],query and set the character encoding ".
"for the current telnet session" );
$cmds{encoding} = \%lhash;
}
@ -70,7 +71,7 @@ telnet_SecurityCheck($$)
for my $a (@list2) {
next if(!$defs{$a});
my $vf = AttrVal($a, "validFor","");
$fnd = 1 if((!$vf || $vf =~ m/\b$l\b/) &&
$fnd = 1 if(($vf && $vf =~ m/\b$l\b/) &&
(AttrVal($a, "password","") ||
AttrVal($a, "globalpassword","")));
}