2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-25 15:59:21 +00:00

00_MQTT2_SERVER.pm: accept clients with empty clientId (Forum #90145)

git-svn-id: https://svn.fhem.de/fhem/trunk@17163 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2018-08-18 14:54:09 +00:00
parent ee6ab7fc37
commit d4f0bf54e5
2 changed files with 8 additions and 7 deletions

View File

@ -221,11 +221,12 @@ MQTT2_SERVER_Read($@)
my $cpt = $cptype{$cp};
$hash->{lastMsgTime} = gettimeofday();
#my $pltxt = $pl;
#$pltxt =~ s/[^ -~]/./g;
#Log3 $sname, 5, "$pltxt";
# Lowlevel debugging
# my $pltxt = $pl;
# $pltxt =~ s/([^ -~])/"(".ord($1).")"/ge;
# Log3 $sname, 5, "$pltxt";
if(!$hash->{cid} && $cpt ne "CONNECT") {
if(!defined($hash->{cid}) && $cpt ne "CONNECT") {
Log3 $sname, 2, "$cname $cpt before CONNECT, disconnecting";
CommandDelete(undef, $cname);
return MQTT2_SERVER_Read($hash, 1);
@ -234,8 +235,8 @@ MQTT2_SERVER_Read($@)
####################################
if($cpt eq "CONNECT") {
($hash->{protoTxt}, $off) = MQTT2_SERVER_getStr($pl, 0); # V3:MQIsdb V4:MQTT
$hash->{protoNum} = unpack('C*', substr($pl, $off++, 1));
$hash->{cflags} = unpack('C*', substr($pl, $off++, 1));
$hash->{protoNum} = unpack('C*', substr($pl,$off++,1)); # 3 or 4
$hash->{cflags} = unpack('C*', substr($pl,$off++,1));
$hash->{keepalive} = unpack('n', substr($pl, $off, 2)); $off += 2;
($hash->{cid}, $off) = MQTT2_SERVER_getStr($pl, $off);

View File

@ -126,7 +126,7 @@ MQTT2_DEVICE_Parse($$)
# autocreate and expand readingList
if($autocreate && !%fnd) {
return "" if($cid =~ m/mosqpub.*/);
return "" if($cid && $cid =~ m/mosqpub.*/);
my $cidHash = $modules{MQTT2_DEVICE}{defptr}{cid}{$cid};
my $nn = $cidHash ? $cidHash->{NAME} : "MQTT2_$cid";
PrioQueue_add(sub{