2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

fhem.pl: generate warning on : in reading or devicename

git-svn-id: https://svn.fhem.de/fhem/trunk@10346 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2016-01-03 12:34:27 +00:00
parent 7eaacd8dbd
commit d61dbc996b
2 changed files with 11 additions and 6 deletions

View File

@ -109,7 +109,7 @@ TcpServer_Accept($$)
}
}
my $cname = "$type:$caddr:$port";
my $cname = "${name}_${caddr}_${port}";
my %nhash;
$nhash{NR} = $devcount++;
$nhash{NAME} = $cname;

View File

@ -1705,7 +1705,7 @@ CommandDefine($$)
@a = split("[ \t][ \t]*", $def, 3);
$ignoreErr = 1;
}
if($a[0] && $a[0] eq "-temporary") { # Forum #39610
if($a[0] && $a[0] eq "-temporary") { # Forum #39610, 46640
$def =~ s/\s*-temporary\s*//;
@a = split("[ \t][ \t]*", $def, 3);
$temporary = 1;
@ -1715,8 +1715,13 @@ CommandDefine($$)
return "Usage: define <name> <type> <type dependent arguments>"
if(int(@a) < 2);
return "$name already defined, delete it first" if(defined($defs{$name}));
return "Invalid characters in name (not A-Za-z0-9.:_): $name"
return "Invalid characters in name (not A-Za-z0-9._): $name"
if($name !~ m/^[a-z0-9.:_]*$/i);
if($name =~ m/:/) { # Forum #45788
my $msg = "unsupported character (:) in devicename $name";
return $msg if($init_done);
Log 3, "WARNING: $msg";
}
my $m = $a[1];
if(!$modules{$m}) { # Perhaps just wrong case?
@ -2578,9 +2583,9 @@ CommandSetstate($$)
next;
}
# Log3 $d, 3, "WARNING: unsupported character in reading $sname ".
# "(not A-Za-z\\d_\\.-), notify the $d->{TYPE} module maintainer."
# if($sname !~ m/^[A-Za-z\d_\.-]+$/);
Log3 $d, 3, "WARNING: unsupported character in reading $sname ".
"(not A-Za-z\\d_\\.-), notify the $d->{TYPE} module maintainer."
if($sname !~ m/^[A-Za-z\d_\.-]+$/);
if(!defined($d->{READINGS}{$sname}) ||
!defined($d->{READINGS}{$sname}{TIME}) ||