71_YAMAHA_NP: More secure FM frequency input.

git-svn-id: https://svn.fhem.de/fhem/trunk@10227 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
ra666ack 2015-12-21 21:53:13 +00:00
parent 3186414bd3
commit f1fb1fb0f1
2 changed files with 55 additions and 41 deletions

View File

@ -706,10 +706,10 @@ sub YAMAHA_NP_Set
if(length($a[2]) <= 6 and length($a[2]) >= 5) # Check the string length (x)xx.xx
{
if ( $a[2] =~ /^[0-9,.E]+$/ ) # Check if value is numeric
{
if( $a[2] >= 87.50 and $a[2] <= 108.00) # Check if within the value range
{
if(substr($a[2], -3, 1) eq '.') # Check for decimal point
{
if( $a[2] >= 87.50 and $a[2] <= 108.00) # Check if within the value range
{
my $lastDigit = substr($a[2], -1, 1);
if(($lastDigit eq "0") or ($lastDigit eq "5"))
@ -725,12 +725,12 @@ sub YAMAHA_NP_Set
}
else
{
return "Missing decimal point. Accepted format (x)xx.xx"
return "Frequency value must be in the range 87.50 ... 108.00 of the format (x)xx.xx";
}
}
else
{
return "Frequency value must be in the range 87.50 ... 108.00 of the format (x)xx.xx";
return "Missing decimal point. Accepted format (x)xx.xx";
}
}
else

View File

@ -1,12 +1,23 @@
attr global userattr cmdIcon devStateIcon devStateStyle icon sortby webCmd widgetOverride
attr global autoload_undefined_devices 1
attr global logfile ./log/fhem-%Y-%m.log
attr global modpath .
attr global motd SecurityCheck:\
\
WEB,WEBphone,WEBtablet has no basicAuth attribute.\
telnetPort has no password/globalpassword attribute.\
Running with root privileges.\
Restart FHEM for a new check if the problem is fixed,\
or set the global attribute motd to none to supress this message.\
attr global statefile ./log/fhem.save
attr global updateInBackground 1
attr global verbose 3
attr global updateInBackground
define telnetPort telnet 7072 global
define WEB FHEMWEB 8083 global
attr WEB editConfig 1
define WEBphone FHEMWEB 8084 global
attr WEBphone stylesheetPrefix smallscreen
@ -17,6 +28,7 @@ attr WEBtablet stylesheetPrefix touchpad
# Fake FileLog entry, to access the fhem log from FHEMWEB
define Logfile FileLog ./log/fhem-%Y-%m.log fakelog
define autocreate autocreate
attr autocreate filelog ./log/%NAME-%Y.log
@ -24,3 +36,5 @@ define eventTypes eventTypes ./log/eventTypes.txt
# Disable this to avoid looking for new USB devices on startup
define initialUsbCheck notify global:INITIALIZED usb create
define NP_test YAMAHA_NP 192.168.1.15 30 10