mirror of
https://github.com/curl/curl.git
synced 2026-08-25 15:33:39 +03:00
mqtt: add support for username and password
Minor-edits-by: Daniel Stenberg Added test 2200 to 2205 Closes #7243
This commit is contained in:
parent
53c26dedf4
commit
791937b881
10 changed files with 579 additions and 36 deletions
|
|
@ -228,8 +228,11 @@ test2064 test2065 test2066 test2067 test2068 test2069 test2070 \
|
|||
test2071 test2072 test2073 test2074 test2075 test2076 test2077 \
|
||||
test2078 \
|
||||
test2080 test2081 \
|
||||
\
|
||||
test2100 \
|
||||
\
|
||||
test2200 test2201 test2202 test2203 test2204 test2205 \
|
||||
\
|
||||
test3000 test3001 test3002 test3003 test3004 test3005 test3006 test3007 \
|
||||
test3008 test3009 test3010 test3011 test3012 test3013 test3014 test3015 \
|
||||
test3016 test3017 test3018 test3019 test3020
|
||||
|
|
|
|||
62
tests/data/test2200
Normal file
62
tests/data/test2200
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
MQTT
|
||||
MQTT SUBSCRIBE
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data nocheck="yes">
|
||||
hello
|
||||
</data>
|
||||
<datacheck hex="yes">
|
||||
00 04 31 31 39 30 68 65 6c 6c 6f 5b 4c 46 5d 0a
|
||||
</datacheck>
|
||||
|
||||
# error 5 - "Connection Refused, not authorized. Wrong data supplied"
|
||||
<servercmd>
|
||||
error-CONNACK 5
|
||||
</servercmd>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<features>
|
||||
mqtt
|
||||
</features>
|
||||
<server>
|
||||
mqtt
|
||||
</server>
|
||||
<name>
|
||||
MQTT SUBSCRIBE with user and password
|
||||
</name>
|
||||
<command option="binary-trace">
|
||||
mqtt://%HOSTIP:%MQTTPORT/%TESTNUMBER -u fakeuser:fakepasswd
|
||||
</command>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
# These are hexadecimal protocol dumps from the client
|
||||
#
|
||||
# Strip out the random part of the client id from the CONNECT message
|
||||
# before comparison
|
||||
<strippart>
|
||||
s/^(.* 00044d51545404c2003c000c6375726c).*/$1/
|
||||
</strippart>
|
||||
<protocol>
|
||||
client CONNECT 2e 00044d51545404c2003c000c6375726c
|
||||
server CONNACK 2 20020005
|
||||
</protocol>
|
||||
|
||||
# 8 is CURLE_WEIRD_SERVER_REPLY
|
||||
<errorcode>
|
||||
8
|
||||
</errorcode>
|
||||
</verify>
|
||||
</testcase>
|
||||
50
tests/data/test2201
Normal file
50
tests/data/test2201
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
MQTT
|
||||
MQTT PUBLISH
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<features>
|
||||
mqtt
|
||||
</features>
|
||||
<server>
|
||||
mqtt
|
||||
</server>
|
||||
<name>
|
||||
MQTT PUBLISH with user and password valid
|
||||
</name>
|
||||
<command option="binary-trace">
|
||||
mqtt://%HOSTIP:%MQTTPORT/%TESTNUMBER -d something -u testuser:testpasswd
|
||||
</command>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
# These are hexadecimal protocol dumps from the client
|
||||
#
|
||||
# Strip out the random part of the client id from the CONNECT message
|
||||
# before comparison
|
||||
<strippart>
|
||||
s/^(.* 00044d51545404c2003c000c6375726c).*/$1/
|
||||
</strippart>
|
||||
<protocol>
|
||||
client CONNECT 2e 00044d51545404c2003c000c6375726c
|
||||
server CONNACK 2 20020000
|
||||
client PUBLISH f 000432323031736f6d657468696e67
|
||||
client DISCONNECT 0 e000
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
||||
59
tests/data/test2202
Normal file
59
tests/data/test2202
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
MQTT
|
||||
MQTT PUBLISH
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
</data>
|
||||
|
||||
# error 5 - "Connection Refused, not authorized. Wrong data supplied"
|
||||
<servercmd>
|
||||
error-CONNACK 5
|
||||
</servercmd>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<features>
|
||||
mqtt
|
||||
</features>
|
||||
<server>
|
||||
mqtt
|
||||
</server>
|
||||
<name>
|
||||
MQTT PUBLISH with invalid user and password
|
||||
</name>
|
||||
<command option="binary-trace">
|
||||
mqtt://%HOSTIP:%MQTTPORT/%TESTNUMBER -d something -u fakeuser:fakepasswd
|
||||
</command>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
# These are hexadecimal protocol dumps from the client
|
||||
#
|
||||
# Strip out the random part of the client id from the CONNECT message
|
||||
# before comparison
|
||||
<strippart>
|
||||
s/^(.* 00044d51545404c2003c000c6375726c).*/$1/
|
||||
</strippart>
|
||||
<protocol>
|
||||
client CONNECT 2e 00044d51545404c2003c000c6375726c
|
||||
server CONNACK 2 20020005
|
||||
</protocol>
|
||||
|
||||
|
||||
# 8 is CURLE_WEIRD_SERVER_REPLY
|
||||
<errorcode>
|
||||
8
|
||||
</errorcode>
|
||||
</verify>
|
||||
</testcase>
|
||||
62
tests/data/test2203
Normal file
62
tests/data/test2203
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
MQTT
|
||||
MQTT SUBSCRIBE
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data nocheck="yes">
|
||||
hello
|
||||
</data>
|
||||
<datacheck hex="yes">
|
||||
00 04 31 31 39 30 68 65 6c 6c 6f 5b 4c 46 5d 0a
|
||||
</datacheck>
|
||||
|
||||
# error 5 - "Connection Refused, not authorized. No user or password supplied"
|
||||
<servercmd>
|
||||
error-CONNACK 5
|
||||
</servercmd>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<features>
|
||||
mqtt
|
||||
</features>
|
||||
<server>
|
||||
mqtt
|
||||
</server>
|
||||
<name>
|
||||
MQTT with error in CONNACK
|
||||
</name>
|
||||
<command option="binary-trace">
|
||||
mqtt://%HOSTIP:%MQTTPORT/%TESTNUMBER
|
||||
</command>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
# These are hexadecimal protocol dumps from the client
|
||||
#
|
||||
# Strip out the random part of the client id from the CONNECT message
|
||||
# before comparison
|
||||
<strippart>
|
||||
s/^(.* 00044d5154540402003c000c6375726c).*/$1/
|
||||
</strippart>
|
||||
<protocol>
|
||||
client CONNECT 18 00044d5154540402003c000c6375726c
|
||||
server CONNACK 2 20020005
|
||||
</protocol>
|
||||
|
||||
# 8 is CURLE_WEIRD_SERVER_REPLY
|
||||
<errorcode>
|
||||
8
|
||||
</errorcode>
|
||||
</verify>
|
||||
</testcase>
|
||||
56
tests/data/test2204
Normal file
56
tests/data/test2204
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
MQTT
|
||||
MQTT SUBSCRIBE
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data nocheck="yes">
|
||||
hello
|
||||
</data>
|
||||
<datacheck hex="yes">
|
||||
00 04 31 31 39 30 68 65 6c 6c 6f 5b 4c 46 5d 0a
|
||||
</datacheck>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<features>
|
||||
mqtt
|
||||
</features>
|
||||
<server>
|
||||
mqtt
|
||||
</server>
|
||||
<name>
|
||||
MQTT SUBSCRIBE with user and password
|
||||
</name>
|
||||
<command option="binary-trace">
|
||||
mqtt://%HOSTIP:%MQTTPORT/%TESTNUMBER -u testuser:testpasswd
|
||||
</command>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
# These are hexadecimal protocol dumps from the client
|
||||
#
|
||||
# Strip out the random part of the client id from the CONNECT message
|
||||
# before comparison
|
||||
<strippart>
|
||||
s/^(.* 00044d51545404c2003c000c6375726c).*/$1/
|
||||
</strippart>
|
||||
<protocol>
|
||||
client CONNECT 2e 00044d51545404c2003c000c6375726c
|
||||
server CONNACK 2 20020000
|
||||
client SUBSCRIBE 9 000100043232303400
|
||||
server SUBACK 3 9003000100
|
||||
server PUBLISH c 300c00043232303468656c6c6f0a
|
||||
server DISCONNECT 0 e000
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
||||
51
tests/data/test2205
Normal file
51
tests/data/test2205
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
MQTT
|
||||
MQTT SUBSCRIBE
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<features>
|
||||
mqtt
|
||||
</features>
|
||||
<server>
|
||||
mqtt
|
||||
</server>
|
||||
<name>
|
||||
MQTT with very long user name
|
||||
</name>
|
||||
<file name="log/input%TESTNUMBER">
|
||||
user = %repeat[65536 x a]%:fakepasswd
|
||||
</file>
|
||||
<command option="binary-trace">
|
||||
mqtt://%HOSTIP:%MQTTPORT/%TESTNUMBER -K log/input%TESTNUMBER
|
||||
</command>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
# These are hexadecimal protocol dumps from the client
|
||||
#
|
||||
# Strip out the random part of the client id from the CONNECT message
|
||||
# before comparison
|
||||
<strippart>
|
||||
s/^(.* 00044d51545404c2003c000c6375726c).*/$1/
|
||||
</strippart>
|
||||
# 8 is CURLE_WEIRD_SERVER_REPLY
|
||||
<errorcode>
|
||||
8
|
||||
</errorcode>
|
||||
</verify>
|
||||
</testcase>
|
||||
Loading…
Add table
Add a link
Reference in a new issue