mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
00_MQTT2_SERVER.pm: accept clients with empty clientId (Forum #90145)
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@17163 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
ee414f557b
commit
6bc45d6426
@ -221,11 +221,12 @@ MQTT2_SERVER_Read($@)
|
|||||||
my $cpt = $cptype{$cp};
|
my $cpt = $cptype{$cp};
|
||||||
$hash->{lastMsgTime} = gettimeofday();
|
$hash->{lastMsgTime} = gettimeofday();
|
||||||
|
|
||||||
|
# Lowlevel debugging
|
||||||
# my $pltxt = $pl;
|
# my $pltxt = $pl;
|
||||||
#$pltxt =~ s/[^ -~]/./g;
|
# $pltxt =~ s/([^ -~])/"(".ord($1).")"/ge;
|
||||||
# Log3 $sname, 5, "$pltxt";
|
# 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";
|
Log3 $sname, 2, "$cname $cpt before CONNECT, disconnecting";
|
||||||
CommandDelete(undef, $cname);
|
CommandDelete(undef, $cname);
|
||||||
return MQTT2_SERVER_Read($hash, 1);
|
return MQTT2_SERVER_Read($hash, 1);
|
||||||
@ -234,7 +235,7 @@ MQTT2_SERVER_Read($@)
|
|||||||
####################################
|
####################################
|
||||||
if($cpt eq "CONNECT") {
|
if($cpt eq "CONNECT") {
|
||||||
($hash->{protoTxt}, $off) = MQTT2_SERVER_getStr($pl, 0); # V3:MQIsdb V4:MQTT
|
($hash->{protoTxt}, $off) = MQTT2_SERVER_getStr($pl, 0); # V3:MQIsdb V4:MQTT
|
||||||
$hash->{protoNum} = 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->{cflags} = unpack('C*', substr($pl,$off++,1));
|
||||||
$hash->{keepalive} = unpack('n', substr($pl, $off, 2)); $off += 2;
|
$hash->{keepalive} = unpack('n', substr($pl, $off, 2)); $off += 2;
|
||||||
($hash->{cid}, $off) = MQTT2_SERVER_getStr($pl, $off);
|
($hash->{cid}, $off) = MQTT2_SERVER_getStr($pl, $off);
|
||||||
|
@ -126,7 +126,7 @@ MQTT2_DEVICE_Parse($$)
|
|||||||
|
|
||||||
# autocreate and expand readingList
|
# autocreate and expand readingList
|
||||||
if($autocreate && !%fnd) {
|
if($autocreate && !%fnd) {
|
||||||
return "" if($cid =~ m/mosqpub.*/);
|
return "" if($cid && $cid =~ m/mosqpub.*/);
|
||||||
my $cidHash = $modules{MQTT2_DEVICE}{defptr}{cid}{$cid};
|
my $cidHash = $modules{MQTT2_DEVICE}{defptr}{cid}{$cid};
|
||||||
my $nn = $cidHash ? $cidHash->{NAME} : "MQTT2_$cid";
|
my $nn = $cidHash ? $cidHash->{NAME} : "MQTT2_$cid";
|
||||||
PrioQueue_add(sub{
|
PrioQueue_add(sub{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user