mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
FB_CALLMONITOR: fix url encoding of passwords via TR-064 and wrong authentication check (Forum: #78087)
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@15402 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d6d6941c5d
commit
f1394a3cd0
@ -1348,7 +1348,7 @@ sub FB_CALLMONITOR_requestTR064($$$$;$$)
|
|||||||
return "no password available to access FritzBox. Please set your FRITZ!Box password via 'set ".$hash->{NAME}." password <your password>'";
|
return "no password available to access FritzBox. Please set your FRITZ!Box password via 'set ".$hash->{NAME}." password <your password>'";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $tr064_base_url = "http://$fb_user:$fb_pw\@$fb_ip:49000";
|
my $tr064_base_url = "http://".urlEncode($fb_user).":".urlEncode($fb_pw)."\@$fb_ip:49000";
|
||||||
|
|
||||||
$param->{noshutdown} = 1;
|
$param->{noshutdown} = 1;
|
||||||
$param->{timeout} = AttrVal($name, "fritzbox-remote-timeout", 5);
|
$param->{timeout} = AttrVal($name, "fritzbox-remote-timeout", 5);
|
||||||
@ -1388,16 +1388,16 @@ sub FB_CALLMONITOR_requestTR064($$$$;$$)
|
|||||||
|
|
||||||
if($data =~ /<NewSecurityPort>(\d+)<\/NewSecurityPort>/)
|
if($data =~ /<NewSecurityPort>(\d+)<\/NewSecurityPort>/)
|
||||||
{
|
{
|
||||||
$tr064_base_url = "https://$fb_user:$fb_pw\@$fb_ip:$1";
|
$tr064_base_url = "https://".urlEncode($fb_user).":".urlEncode($fb_pw)."\@$fb_ip:$1";
|
||||||
$hash->{helper}{TR064}{SECURITY_PORT} = $1;
|
$hash->{helper}{TR064}{SECURITY_PORT} = $1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$tr064_base_url = "https://$fb_user:$fb_pw\@$fb_ip:".$hash->{helper}{TR064}{SECURITY_PORT};
|
$tr064_base_url = "https://".urlEncode($fb_user).":".urlEncode($fb_pw)."\@$fb_ip:".$hash->{helper}{TR064}{SECURITY_PORT};
|
||||||
}
|
}
|
||||||
|
|
||||||
# generate challenge XML
|
# éxecute the TR-064 request
|
||||||
my $soap_request = '<?xml version="1.0" encoding="utf-8"?>'.
|
my $soap_request = '<?xml version="1.0" encoding="utf-8"?>'.
|
||||||
'<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" >'.
|
'<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" >'.
|
||||||
'<s:Body>'.
|
'<s:Body>'.
|
||||||
@ -1414,10 +1414,19 @@ sub FB_CALLMONITOR_requestTR064($$$$;$$)
|
|||||||
($err, $data) = HttpUtils_BlockingGet($param);
|
($err, $data) = HttpUtils_BlockingGet($param);
|
||||||
|
|
||||||
if($err ne "")
|
if($err ne "")
|
||||||
|
{
|
||||||
|
if(exists($param->{code}) and $param->{code} eq "401")
|
||||||
|
{
|
||||||
|
$hash->{helper}{PWD_NEEDED} = 1;
|
||||||
|
Log3 $name, 3, "FB_CALLMONITOR ($name) - unable to login via TR-064, wrong user/password";
|
||||||
|
return "unable to login via TR-064, wrong user/password";
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
Log3 $name, 3, "FB_CALLMONITOR ($name) - error while requesting TR-064 method $command: $err";
|
Log3 $name, 3, "FB_CALLMONITOR ($name) - error while requesting TR-064 method $command: $err";
|
||||||
return "error while requesting TR-064 TR-064 method $command: $err";
|
return "error while requesting TR-064 TR-064 method $command: $err";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($data eq "" and exists($param->{code}))
|
if($data eq "" and exists($param->{code}))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user