commit
c03c6b765e
@ -0,0 +1,61 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from mosq_test_helper import *
|
||||||
|
|
||||||
|
def write_config(filename, port):
|
||||||
|
with open(filename, 'w') as f:
|
||||||
|
f.write("listener %d\n" % (port))
|
||||||
|
f.write("allow_anonymous true\n")
|
||||||
|
f.write("max_inflight_messages 20\n")
|
||||||
|
f.write("max_inflight_bytes 1000000\n")
|
||||||
|
f.write("max_queued_messages 20\n")
|
||||||
|
f.write("max_queued_bytes 1000000\n")
|
||||||
|
|
||||||
|
def do_test(proto_ver):
|
||||||
|
rc = 1
|
||||||
|
keepalive = 60
|
||||||
|
connect_packet = mosq_test.gen_connect("subpub-qos0-bytes", keepalive=keepalive, proto_ver=proto_ver)
|
||||||
|
connack_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver)
|
||||||
|
|
||||||
|
connect_packet_helper = mosq_test.gen_connect("qos0-bytes-helper", keepalive=keepalive, proto_ver=proto_ver)
|
||||||
|
|
||||||
|
mid = 1
|
||||||
|
subscribe_packet = mosq_test.gen_subscribe(mid, "subpub/qos0/queued/bytes", 1, proto_ver=proto_ver)
|
||||||
|
suback_packet = mosq_test.gen_suback(mid, 1, proto_ver=proto_ver)
|
||||||
|
|
||||||
|
publish_packet0 = mosq_test.gen_publish("subpub/qos0/queued/bytes", qos=0, payload="message", proto_ver=proto_ver)
|
||||||
|
|
||||||
|
|
||||||
|
port = mosq_test.get_port()
|
||||||
|
conf_file = os.path.basename(__file__).replace('.py', '.conf')
|
||||||
|
write_config(conf_file, port)
|
||||||
|
broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port)
|
||||||
|
|
||||||
|
try:
|
||||||
|
sock = mosq_test.do_client_connect(connect_packet, connack_packet, timeout=4, port=port, connack_error="connack 1")
|
||||||
|
|
||||||
|
mosq_test.do_send_receive(sock, subscribe_packet, suback_packet, "suback")
|
||||||
|
|
||||||
|
helper = mosq_test.do_client_connect(connect_packet_helper, connack_packet, timeout=4, port=port, connack_error="connack helper")
|
||||||
|
|
||||||
|
helper.send(publish_packet0)
|
||||||
|
mosq_test.expect_packet(sock, "publish0", publish_packet0)
|
||||||
|
rc = 0
|
||||||
|
|
||||||
|
sock.close()
|
||||||
|
except mosq_test.TestError:
|
||||||
|
pass
|
||||||
|
finally:
|
||||||
|
os.remove(conf_file)
|
||||||
|
broker.terminate()
|
||||||
|
broker.wait()
|
||||||
|
(stdo, stde) = broker.communicate()
|
||||||
|
if rc:
|
||||||
|
print(stde.decode('utf-8'))
|
||||||
|
print("proto_ver=%d" % (proto_ver))
|
||||||
|
exit(rc)
|
||||||
|
|
||||||
|
|
||||||
|
do_test(proto_ver=4)
|
||||||
|
do_test(proto_ver=5)
|
||||||
|
exit(0)
|
@ -1,71 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
# Test whether a SUBSCRIBE to a topic with QoS 2 results in the correct SUBACK packet.
|
|
||||||
|
|
||||||
from mosq_test_helper import *
|
|
||||||
|
|
||||||
|
|
||||||
def helper(port):
|
|
||||||
connect_packet = mosq_test.gen_connect("test-helper", keepalive=60)
|
|
||||||
connack_packet = mosq_test.gen_connack(rc=0)
|
|
||||||
|
|
||||||
mid = 128
|
|
||||||
publish_packet = mosq_test.gen_publish("qos1/timeout/test", qos=1, mid=mid, payload="timeout-message")
|
|
||||||
puback_packet = mosq_test.gen_puback(mid)
|
|
||||||
|
|
||||||
sock = mosq_test.do_client_connect(connect_packet, connack_packet, connack_error="helper connack")
|
|
||||||
mosq_test.do_send_receive(sock, publish_packet, puback_packet, "helper puback")
|
|
||||||
sock.close()
|
|
||||||
|
|
||||||
|
|
||||||
def do_test(proto_ver):
|
|
||||||
rc = 1
|
|
||||||
mid = 3265
|
|
||||||
keepalive = 60
|
|
||||||
connect_packet = mosq_test.gen_connect("pub-qos1-timeout-test", keepalive=keepalive, proto_ver=proto_ver)
|
|
||||||
connack_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver)
|
|
||||||
|
|
||||||
subscribe_packet = mosq_test.gen_subscribe(mid, "qos1/timeout/test", 1, proto_ver=proto_ver)
|
|
||||||
suback_packet = mosq_test.gen_suback(mid, 1, proto_ver=proto_ver)
|
|
||||||
|
|
||||||
mid = 1
|
|
||||||
publish_packet = mosq_test.gen_publish("qos1/timeout/test", qos=1, mid=mid, payload="timeout-message", proto_ver=proto_ver)
|
|
||||||
publish_dup_packet = mosq_test.gen_publish("qos1/timeout/test", qos=1, mid=mid, payload="timeout-message", dup=True, proto_ver=proto_ver)
|
|
||||||
puback_packet = mosq_test.gen_puback(mid, proto_ver=proto_ver)
|
|
||||||
|
|
||||||
port = mosq_test.get_port()
|
|
||||||
broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port)
|
|
||||||
|
|
||||||
try:
|
|
||||||
sock = mosq_test.do_client_connect(connect_packet, connack_packet)
|
|
||||||
mosq_test.do_send_receive(sock, subscribe_packet, suback_packet, "suback")
|
|
||||||
|
|
||||||
helper(port)
|
|
||||||
# Should have now received a publish command
|
|
||||||
|
|
||||||
mosq_test.expect_packet(sock, "publish", publish_packet)
|
|
||||||
# Wait for longer than 5 seconds to get republish with dup set
|
|
||||||
# This is covered by the 8 second timeout
|
|
||||||
|
|
||||||
mosq_test.expect_packet(sock, "dup publish", publish_dup_packet)
|
|
||||||
sock.send(puback_packet)
|
|
||||||
rc = 0
|
|
||||||
|
|
||||||
sock.close()
|
|
||||||
except mosq_test.TestError:
|
|
||||||
pass
|
|
||||||
finally:
|
|
||||||
broker.terminate()
|
|
||||||
broker.wait()
|
|
||||||
(stdo, stde) = broker.communicate()
|
|
||||||
if rc:
|
|
||||||
print(stde.decode('utf-8'))
|
|
||||||
print("proto_ver=%d" % (proto_ver))
|
|
||||||
exit(rc)
|
|
||||||
|
|
||||||
|
|
||||||
do_test(proto_ver=4)
|
|
||||||
do_test(proto_ver=5)
|
|
||||||
|
|
||||||
exit(0)
|
|
||||||
|
|
@ -1,81 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
# Test whether a SUBSCRIBE to a topic with QoS 2 results in the correct SUBACK packet.
|
|
||||||
|
|
||||||
from mosq_test_helper import *
|
|
||||||
|
|
||||||
|
|
||||||
def helper(port):
|
|
||||||
connect_packet = mosq_test.gen_connect("test-helper", keepalive=60)
|
|
||||||
connack_packet = mosq_test.gen_connack(rc=0)
|
|
||||||
|
|
||||||
mid = 312
|
|
||||||
publish_packet = mosq_test.gen_publish("qos2/timeout/test", qos=2, mid=mid, payload="timeout-message")
|
|
||||||
pubrec_packet = mosq_test.gen_pubrec(mid)
|
|
||||||
pubrel_packet = mosq_test.gen_pubrel(mid)
|
|
||||||
pubcomp_packet = mosq_test.gen_pubcomp(mid)
|
|
||||||
|
|
||||||
sock = mosq_test.do_client_connect(connect_packet, connack_packet, connack_error="helper connack")
|
|
||||||
mosq_test.do_send_receive(sock, publish_packet, pubrec_packet, "helper pubrec")
|
|
||||||
mosq_test.do_send_receive(sock, pubrel_packet, pubcomp_packet, "helper pubcomp")
|
|
||||||
sock.close()
|
|
||||||
|
|
||||||
|
|
||||||
def do_test(proto_ver):
|
|
||||||
rc = 1
|
|
||||||
mid = 3265
|
|
||||||
keepalive = 60
|
|
||||||
connect_packet = mosq_test.gen_connect("pub-qo2-timeout-test", keepalive=keepalive, proto_ver=proto_ver)
|
|
||||||
connack_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver)
|
|
||||||
|
|
||||||
subscribe_packet = mosq_test.gen_subscribe(mid, "qos2/timeout/test", 2, proto_ver=proto_ver)
|
|
||||||
suback_packet = mosq_test.gen_suback(mid, 2, proto_ver=proto_ver)
|
|
||||||
|
|
||||||
mid = 1
|
|
||||||
publish_packet = mosq_test.gen_publish("qos2/timeout/test", qos=2, mid=mid, payload="timeout-message", proto_ver=proto_ver)
|
|
||||||
publish_dup_packet = mosq_test.gen_publish("qos2/timeout/test", qos=2, mid=mid, payload="timeout-message", dup=True, proto_ver=proto_ver)
|
|
||||||
pubrec_packet = mosq_test.gen_pubrec(mid, proto_ver=proto_ver)
|
|
||||||
pubrel_packet = mosq_test.gen_pubrel(mid, proto_ver=proto_ver)
|
|
||||||
pubcomp_packet = mosq_test.gen_pubcomp(mid, proto_ver=proto_ver)
|
|
||||||
|
|
||||||
port = mosq_test.get_port()
|
|
||||||
broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port)
|
|
||||||
|
|
||||||
try:
|
|
||||||
sock = mosq_test.do_client_connect(connect_packet, connack_packet)
|
|
||||||
mosq_test.do_send_receive(sock, subscribe_packet, suback_packet, "suback")
|
|
||||||
|
|
||||||
helper(port)
|
|
||||||
# Should have now received a publish command
|
|
||||||
|
|
||||||
mosq_test.expect_packet(sock, "publish", publish_packet)
|
|
||||||
# Wait for longer than 5 seconds to get republish with dup set
|
|
||||||
# This is covered by the 8 second timeout
|
|
||||||
|
|
||||||
mosq_test.expect_packet(sock, "dup publish", publish_dup_packet)
|
|
||||||
mosq_test.do_send_receive(sock, pubrec_packet, pubrel_packet, "pubrel")
|
|
||||||
|
|
||||||
# Wait for longer than 5 seconds to get republish with dup set
|
|
||||||
# This is covered by the 8 second timeout
|
|
||||||
|
|
||||||
mosq_test.expect_packet(sock, "dup pubrel", pubrel_packet)
|
|
||||||
sock.send(pubcomp_packet)
|
|
||||||
rc = 0
|
|
||||||
|
|
||||||
sock.close()
|
|
||||||
except mosq_test.TestError:
|
|
||||||
pass
|
|
||||||
finally:
|
|
||||||
broker.terminate()
|
|
||||||
broker.wait()
|
|
||||||
(stdo, stde) = broker.communicate()
|
|
||||||
if rc:
|
|
||||||
print(stde.decode('utf-8'))
|
|
||||||
print("proto_ver=%d" % (proto_ver))
|
|
||||||
exit(rc)
|
|
||||||
|
|
||||||
|
|
||||||
do_test(proto_ver=4)
|
|
||||||
do_test(proto_ver=5)
|
|
||||||
exit(0)
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
# Test whether a PUBLISH to a topic with QoS 2 results in the correct packet
|
|
||||||
# flow. This test introduces delays into the flow in order to force the broker
|
|
||||||
# to send duplicate PUBREC and PUBCOMP messages.
|
|
||||||
|
|
||||||
from mosq_test_helper import *
|
|
||||||
|
|
||||||
|
|
||||||
def do_test(port):
|
|
||||||
rc = 1
|
|
||||||
keepalive = 600
|
|
||||||
connect_packet = mosq_test.gen_connect("pub-qos2-timeout-test", keepalive=keepalive, proto_ver=proto_ver)
|
|
||||||
connack_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver)
|
|
||||||
|
|
||||||
mid = 1926
|
|
||||||
publish_packet = mosq_test.gen_publish("pub/qos2/test", qos=2, mid=mid, payload="timeout-message", proto_ver=proto_ver)
|
|
||||||
pubrec_packet = mosq_test.gen_pubrec(mid, proto_ver=proto_ver)
|
|
||||||
pubrel_packet = mosq_test.gen_pubrel(mid, proto_ver=proto_ver)
|
|
||||||
pubcomp_packet = mosq_test.gen_pubcomp(mid, proto_ver=proto_ver)
|
|
||||||
|
|
||||||
port = mosq_test.get_port()
|
|
||||||
broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port)
|
|
||||||
|
|
||||||
try:
|
|
||||||
sock = mosq_test.do_client_connect(connect_packet, connack_packet)
|
|
||||||
mosq_test.do_send_receive(sock, publish_packet, pubrec_packet, "pubrec")
|
|
||||||
|
|
||||||
# Timeout is 8 seconds which means the broker should repeat the PUBREC.
|
|
||||||
|
|
||||||
mosq_test.expect_packet(sock, "pubrec", pubrec_packet)
|
|
||||||
mosq_test.do_send_receive(sock, pubrel_packet, pubcomp_packet, "pubcomp")
|
|
||||||
|
|
||||||
rc = 0
|
|
||||||
|
|
||||||
sock.close()
|
|
||||||
except mosq_test.TestError:
|
|
||||||
pass
|
|
||||||
finally:
|
|
||||||
broker.terminate()
|
|
||||||
broker.wait()
|
|
||||||
(stdo, stde) = broker.communicate()
|
|
||||||
if rc:
|
|
||||||
print(stde.decode('utf-8'))
|
|
||||||
print("proto_ver=%d" % (proto_ver))
|
|
||||||
exit(rc)
|
|
||||||
|
|
||||||
|
|
||||||
do_test(proto_ver=4)
|
|
||||||
do_test(proto_ver=5)
|
|
||||||
exit(0)
|
|
||||||
|
|
@ -0,0 +1,101 @@
|
|||||||
|
<!--
|
||||||
|
.. title: Version 2.0.9 released.
|
||||||
|
.. slug: version-2-0-9-released
|
||||||
|
.. date: 2021-03-11 22:19:38 UTC
|
||||||
|
.. tags: Releases
|
||||||
|
.. category:
|
||||||
|
.. link:
|
||||||
|
.. description:
|
||||||
|
.. type: text
|
||||||
|
-->
|
||||||
|
|
||||||
|
Versions 2.0.9, 1.6.14, and 1.5.11 of Mosquitto have been released. These are
|
||||||
|
bugfix releases and include a minor security fix.
|
||||||
|
|
||||||
|
# 2.0.9
|
||||||
|
|
||||||
|
## Security
|
||||||
|
- If an empty or invalid CA file was provided to the client library for
|
||||||
|
verifying the remote broker, then the initial connection would fail but
|
||||||
|
subsequent connections would succeed without verifying the remote broker
|
||||||
|
certificate. Closes [#2130].
|
||||||
|
- If an empty or invalid CA file was provided to the broker for verifying the
|
||||||
|
remote broker for an outgoing bridge connection then the initial connection
|
||||||
|
would fail but subsequent connections would succeed without verifying the
|
||||||
|
remote broker certificate. Closes [#2130].
|
||||||
|
|
||||||
|
## Broker
|
||||||
|
- Fix encrypted bridge connections incorrectly connecting when `bridge_cafile`
|
||||||
|
is empty or invalid. Closes [#2130].
|
||||||
|
- Fix `tls_version` behaviour not matching documentation. It was setting the
|
||||||
|
exact TLS version to use, not the minimium TLS version to use. Closes [#2110].
|
||||||
|
- Fix messages to `$` prefixed topics being rejected. Closes [#2111].
|
||||||
|
- Fix QoS 0 messages not being delivered when max_queued_bytes was configured.
|
||||||
|
Closes [#2123].
|
||||||
|
- Fix bridge increasing backoff calculation.
|
||||||
|
- Improve handling of invalid combinations of listener address and bind
|
||||||
|
interface configurations. Closes [#2081].
|
||||||
|
- Fix `max_keepalive` option not applying to clients connecting with keepalive
|
||||||
|
set to 0. Closes [#2117].
|
||||||
|
|
||||||
|
## Client library
|
||||||
|
- Fix encrypted connections incorrectly connecting when the CA file passed to
|
||||||
|
`mosquitto_tls_set()` is empty or invalid. Closes [#2130].
|
||||||
|
- Fix connections retrying very rapidly in some situations.
|
||||||
|
|
||||||
|
## Build
|
||||||
|
- Fix cmake epoll detection.
|
||||||
|
|
||||||
|
# 1.6.14
|
||||||
|
|
||||||
|
## Security
|
||||||
|
- If an empty or invalid CA file was provided to the client library for
|
||||||
|
verifying the remote broker, then the initial connection would fail but
|
||||||
|
subsequent connections would succeed without verifying the remote broker
|
||||||
|
certificate. Closes [#2130].
|
||||||
|
- If an empty or invalid CA file was provided to the broker for verifying the
|
||||||
|
remote broker for an outgoing bridge connection then the initial connection
|
||||||
|
would fail but subsequent connections would succeed without verifying the
|
||||||
|
remote broker certificate. Closes [#2130].
|
||||||
|
|
||||||
|
## Broker
|
||||||
|
- Fix encrypted bridge connections incorrectly connecting when `bridge_cafile`
|
||||||
|
is empty or invalid. Closes [#2130].
|
||||||
|
|
||||||
|
## Client library
|
||||||
|
- Fix encrypted connections incorrectly connecting when the CA file passed to
|
||||||
|
`mosquitto_tls_set()` is empty or invalid. Closes [#2130].
|
||||||
|
- Fix connections retrying very rapidly in some situations.
|
||||||
|
|
||||||
|
## Clients
|
||||||
|
- Fix possible loss of data in `mosquitto_pub -l` when sending multiple long
|
||||||
|
lines. Closes [#2078].
|
||||||
|
|
||||||
|
# 1.5.11
|
||||||
|
|
||||||
|
## Security
|
||||||
|
- If an empty or invalid CA file was provided to the client library for
|
||||||
|
verifying the remote broker, then the initial connection would fail but
|
||||||
|
subsequent connections would succeed without verifying the remote broker
|
||||||
|
certificate. Closes [#2130].
|
||||||
|
- If an empty or invalid CA file was provided to the broker for verifying the
|
||||||
|
remote broker for an outgoing bridge connection then the initial connection
|
||||||
|
would fail but subsequent connections would succeed without verifying the
|
||||||
|
remote broker certificate. Closes [#2130].
|
||||||
|
|
||||||
|
## Broker
|
||||||
|
- Fix encrypted bridge connections incorrectly connecting when `bridge_cafile`
|
||||||
|
is empty or invalid. Closes [#2130].
|
||||||
|
|
||||||
|
## Client library
|
||||||
|
- Fix encrypted connections incorrectly connecting when the CA file passed to
|
||||||
|
`mosquitto_tls_set()` is empty or invalid. Closes [#2130].
|
||||||
|
|
||||||
|
[#2040]: https://github.com/eclipse/mosquitto/issues/2040
|
||||||
|
[#2078]: https://github.com/eclipse/mosquitto/issues/2078
|
||||||
|
[#2081]: https://github.com/eclipse/mosquitto/issues/2081
|
||||||
|
[#2110]: https://github.com/eclipse/mosquitto/issues/2110
|
||||||
|
[#2111]: https://github.com/eclipse/mosquitto/issues/2111
|
||||||
|
[#2117]: https://github.com/eclipse/mosquitto/issues/2117
|
||||||
|
[#2123]: https://github.com/eclipse/mosquitto/issues/2123
|
||||||
|
[#2130]: https://github.com/eclipse/mosquitto/issues/2130
|
Loading…
Reference in New Issue