2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-07 16:59:18 +00:00

FB_CALLMONITOR: fix not working telnet login, when user based authentication is configured in FritzBox

git-svn-id: https://svn.fhem.de/fhem/trunk@7599 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markusbloch 2015-01-17 16:50:38 +00:00
parent 00d12bc7cb
commit cb47d62734
2 changed files with 11 additions and 6 deletions

View File

@ -1,5 +1,7 @@
# 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: FB_CALLMONITOR: fix not working telnet login, when user based
authentication is configured in FritzBox
- feature: 02_RSS.pm: improved frontpage for RSS
- bugfix: FB_CALLMONITOR regognize "user:" as login prompt for
remote telnet connection (phonebook)

View File

@ -847,10 +847,10 @@ sub FB_CALLMONITOR_readRemotePhonebook($;$)
return "no password available to access FritzBox" unless(defined($fb_pw));
my $telnet = new Net::Telnet ( Timeout=>5, Errmode=>'return');
my $telnet = new Net::Telnet ( Timeout=>10, Errmode=>'return');
$telnet->errmode("return");
delete($hash->{helper}{READ_PWD}) if(exists($hash->{helper}{READ_PWD}));
unless($telnet->open($fb_ip))
{
return "Error Connecting to FritzBox: ".$telnet->errmsg;
@ -866,7 +866,7 @@ sub FB_CALLMONITOR_readRemotePhonebook($;$)
return "Couldn't recognize login prompt: ".$telnet->errmsg;
}
if($match =~ /(login|user):/ and defined($fb_user))
if($match =~ /(login|user):/i and defined($fb_user))
{
Log3 $name, 4, "FB_CALLMONITOR ($name) - setting user to FritzBox: $fb_user";
$telnet->print($fb_user);
@ -875,19 +875,22 @@ sub FB_CALLMONITOR_readRemotePhonebook($;$)
$telnet->close;
return "Error giving password to FritzBox: ".$telnet->errmsg;
}
Log3 $name, 4, "FB_CALLMONITOR ($name) - giving password to FritzBox";
$telnet->print($fb_pw);
}
elsif($match =~ /(login|user):/ and not defined($fb_user))
elsif($match =~ /(login|user):/i and not defined($fb_user))
{
$telnet->close;
return "FritzBox needs a username to login via telnet. Please provide a valid username/password combination";
}
elsif($match =~ /password:/)
elsif($match =~ /password:/i)
{
Log3 $name, 4, "FB_CALLMONITOR ($name) - giving password to FritzBox";
$telnet->print($fb_pw);
}
unless($telnet->waitfor('/#\s*$/i'))
unless($telnet->waitfor('/#\s*$/'))
{
$telnet->close;
my $err = $telnet->errmsg;