2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

bugfix: 70_Jabber.pm: hardening XML::Stream Process() call and fix of ssl_verify

git-svn-id: https://svn.fhem.de/fhem/trunk@7480 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
bios01 2015-01-09 12:20:50 +00:00
parent e2248578a3
commit 0a4b0acb99
2 changed files with 34 additions and 3 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: 70_Jabber.pm: hardening XML::Stream Process() call and fix of ssl_verify
- feature: readingsGroup: allow devspec :FILTER= expressions in device selection
- added: 73_km200.pm for the Buderus KM200 heating controller (Sailor)
- feature: 70_XBMC: added command 'connect' to connect instantly

View File

@ -25,6 +25,7 @@
# Version: 1.1 - 2014-07-28
#
# Changelog:
# v1.2 2015-01-09 hardening XML::Stream Process() call and fix of ssl_verify
# v1.1 2014-07-28 Added UTF8 encoding / decoding to Messages
# v1.0 2014-04-10 Stable Release - Housekeeping & Add to SVN
# v0.3 2014-03-19 Fixed SetPresence() & Added extensive debugging capabilities by setting $debug to 1
@ -221,6 +222,7 @@ Jabber_PollMessages($)
{
my ($hash) = @_;
my $name = $hash->{NAME};
my $connectiondied = 0;
RemoveInternalTimer($hash);
if(!$init_done) {
@ -281,10 +283,33 @@ Jabber_PollMessages($)
}
}
#We do Process() and if the connection died we reconnect.
#We do Process() - if the connection has died we reconnect.
if ($doProcess == 1) {
Log 0, "$hash->{NAME} DoProcess Call" if $debug;
#Check for previous errors in process(), before XMPP::Connection will break down FHEM
$connectiondied = 0;
if (defined($hash->{JabberDevice})) {
if (exists($hash->{JabberDevice}->{PROCESSERROR}) && ($hash->{JabberDevice}->{PROCESSERROR} == 1)) {
#XMPP::Connection would kill FHEM now.. But we try to handle it.
$hash->{STATE} = "Disconnected";
$hash->{CONNINFO} = "Jabber connection error (Previous XMPP Process() error!)";
Log 0, "$hash->{NAME} Jabber connection error (Previous XMPP Process() error!)" if $debug;
$connectiondied = 1;
} else {
#Do Process(), if it is undef, connection is gone or some other problem...
if (!defined($hash->{JabberDevice}->Process(1))) {
$hash->{STATE} = "Disconnected";
$hash->{CONNINFO} = "Jabber connection died";
Log 0, "$hash->{NAME} Jabber connection error (Process() is undef!)" if $debug;
$connectiondied = 1;
}
}
} else {
$connectiondied = 1;
}
if ($connectiondied == 1) {
#connection died
Log 0, "$hash->{NAME} Connection died" if $debug;
$hash->{JabberDevice} = undef;
@ -318,6 +343,11 @@ sub Jabber_CheckConnection($)
}
$hash->{JabberDevice} = $dev;
#Default to SSL = nonverify (0x00) - this has been changed in XML::Stream 1.23_04 and cause problems because you need a CA verify list.
if (defined($hash->{JabberDevice}->{STREAM}->{SIDS}->{default}->{ssl_verify})) {
$hash->{JabberDevice}->{STREAM}->{SIDS}->{default}->{ssl_verify} = 0x00;
}
#Needed for Message handling:
$hash->{JabberDevice}->SetMessageCallBacks(normal => sub { \&Jabber_INC_Message($hash,@_) }, chat => sub { \&Jabber_INC_Message($hash,@_) } );
#Needed if someone wants to subscribe to us and is on the WhiteList