Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
paho.mqtt.c
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eclipse
paho.mqtt.c
Commits
d1d6496d
Commit
d1d6496d
authored
Feb 26, 2018
by
Ian Craggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for bad protocol name #294
parent
adf15a38
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
1 deletion
+38
-1
MQTTAsync.c
src/MQTTAsync.c
+14
-0
MQTTAsync.h
src/MQTTAsync.h
+5
-0
MQTTClient.c
src/MQTTClient.c
+14
-0
MQTTClient.h
src/MQTTClient.h
+5
-1
No files found.
src/MQTTAsync.c
View file @
d1d6496d
...
...
@@ -465,6 +465,20 @@ int MQTTAsync_createWithOptions(MQTTAsync* handle, const char* serverURI, const
goto
exit
;
}
if
(
strstr
(
serverURI
,
"://"
)
!=
NULL
)
{
if
(
strncmp
(
URI_TCP
,
serverURI
,
strlen
(
URI_TCP
))
!=
0
#if defined(OPENSSL)
&&
strncmp
(
URI_SSL
,
serverURI
,
strlen
(
URI_SSL
))
!=
0
#endif
)
{
rc
=
MQTTASYNC_BAD_PROTOCOL
;
goto
exit
;
}
}
if
(
options
&&
(
strncmp
(
options
->
struct_id
,
"MQCO"
,
4
)
!=
0
||
options
->
struct_version
!=
0
))
{
rc
=
MQTTASYNC_BAD_STRUCTURE
;
...
...
src/MQTTAsync.h
View file @
d1d6496d
...
...
@@ -172,6 +172,11 @@
* Return code: Attempting SSL connection using non-SSL version of library
*/
#define MQTTASYNC_SSL_NOT_SUPPORTED -13
/**
* Return code: protocol prefix in serverURI should be tcp:// or ssl://
*/
#define MQTTASYNC_BAD_PROTOCOL -14
/**
* Default MQTT version to connect with. Use 3.1.1 then fall back to 3.1
...
...
src/MQTTClient.c
View file @
d1d6496d
...
...
@@ -320,6 +320,20 @@ int MQTTClient_create(MQTTClient* handle, const char* serverURI, const char* cli
goto
exit
;
}
if
(
strstr
(
serverURI
,
"://"
)
!=
NULL
)
{
if
(
strncmp
(
URI_TCP
,
serverURI
,
strlen
(
URI_TCP
))
!=
0
#if defined(OPENSSL)
&&
strncmp
(
URI_SSL
,
serverURI
,
strlen
(
URI_SSL
))
!=
0
#endif
)
{
rc
=
MQTTCLIENT_BAD_PROTOCOL
;
goto
exit
;
}
}
if
(
!
initialized
)
{
#if defined(HEAP_H)
...
...
src/MQTTClient.h
View file @
d1d6496d
/*******************************************************************************
* Copyright (c) 2009, 201
7
IBM Corp.
* Copyright (c) 2009, 201
8
IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
...
...
@@ -175,6 +175,10 @@
* Return code: Attempting SSL connection using non-SSL version of library
*/
#define MQTTCLIENT_SSL_NOT_SUPPORTED -10
/**
* Return code: protocol prefix in serverURI should be tcp:// or ssl://
*/
#define MQTTCLIENT_BAD_PROTOCOL -14
/**
* Default MQTT version to connect with. Use 3.1.1 then fall back to 3.1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment