8
0
forked from pool/paho-mqtt-c

Accepting request 1293490 from devel:libraries:c_c++

OBS-URL: https://build.opensuse.org/request/show/1293490
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/paho-mqtt-c?expand=0&rev=9
This commit is contained in:
2025-07-16 13:52:05 +00:00
committed by Git OBS Bridge
7 changed files with 226 additions and 6 deletions

93
fix-build-gcc15.patch Normal file
View File

@@ -0,0 +1,93 @@
From de9b43580aa1bb8703f256f994aa16e12d4b1d56 Mon Sep 17 00:00:00 2001
From: fpagliughi <fpagliughi@mindspring.com>
Date: Wed, 14 May 2025 17:56:02 -0400
Subject: [PATCH] #1576 Changed 'bool' typedef to 'bit'
---
src/MQTTPacket.h | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/MQTTPacket.h b/src/MQTTPacket.h
index fd384ae9b..04c217ef8 100644
--- a/src/MQTTPacket.h
+++ b/src/MQTTPacket.h
@@ -28,7 +28,7 @@
#include "LinkedList.h"
#include "Clients.h"
-typedef unsigned int bool;
+typedef unsigned int bit;
typedef void* (*pf)(int, unsigned char, char*, size_t);
#include "MQTTProperties.h"
@@ -67,16 +67,16 @@ typedef union
struct
{
unsigned int type : 4; /**< message type nibble */
- bool dup : 1; /**< DUP flag bit */
+ bit dup : 1; /**< DUP flag bit */
unsigned int qos : 2; /**< QoS value, 0, 1 or 2 */
- bool retain : 1; /**< retained flag bit */
+ bit retain : 1; /**< retained flag bit */
} bits;
#else
struct
{
- bool retain : 1; /**< retained flag bit */
+ bit retain : 1; /**< retained flag bit */
unsigned int qos : 2; /**< QoS value, 0, 1 or 2 */
- bool dup : 1; /**< DUP flag bit */
+ bit dup : 1; /**< DUP flag bit */
unsigned int type : 4; /**< message type nibble */
} bits;
#endif
@@ -95,24 +95,24 @@ typedef struct
#if defined(REVERSED)
struct
{
- bool username : 1; /**< 3.1 user name */
- bool password : 1; /**< 3.1 password */
- bool willRetain : 1; /**< will retain setting */
+ bit username : 1; /**< 3.1 user name */
+ bit password : 1; /**< 3.1 password */
+ bit willRetain : 1; /**< will retain setting */
unsigned int willQoS : 2; /**< will QoS value */
- bool will : 1; /**< will flag */
- bool cleanstart : 1; /**< cleansession flag */
+ bit will : 1; /**< will flag */
+ bit cleanstart : 1; /**< cleansession flag */
int : 1; /**< unused */
} bits;
#else
struct
{
int : 1; /**< unused */
- bool cleanstart : 1; /**< cleansession flag */
- bool will : 1; /**< will flag */
+ bit cleanstart : 1; /**< cleansession flag */
+ bit will : 1; /**< will flag */
unsigned int willQoS : 2; /**< will QoS value */
- bool willRetain : 1; /**< will retain setting */
- bool password : 1; /**< 3.1 password */
- bool username : 1; /**< 3.1 user name */
+ bit willRetain : 1; /**< will retain setting */
+ bit password : 1; /**< 3.1 password */
+ bit username : 1; /**< 3.1 user name */
} bits;
#endif
} flags; /**< connect flags byte */
@@ -140,12 +140,12 @@ typedef struct
struct
{
unsigned int reserved : 7; /**< message type nibble */
- bool sessionPresent : 1; /**< was a session found on the server? */
+ bit sessionPresent : 1; /**< was a session found on the server? */
} bits;
#else
struct
{
- bool sessionPresent : 1; /**< was a session found on the server? */
+ bit sessionPresent : 1; /**< was a session found on the server? */
unsigned int reserved : 7; /**< message type nibble */
} bits;
#endif

72
fix-char-range.patch Normal file
View File

@@ -0,0 +1,72 @@
From bba72469721fd3c7628fda61e3081f802fe73907 Mon Sep 17 00:00:00 2001
From: Ian Craggs <icraggs@gmail.com>
Date: Mon, 17 Feb 2025 18:51:13 +0000
Subject: [PATCH] Ensure argument for isprint and isxdigit is in the correct
range #1565
---
src/MQTTPacket.c | 4 ++--
src/MQTTVersion.c | 4 ++--
src/Proxy.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/MQTTPacket.c b/src/MQTTPacket.c
index 40cb4d415..a67c92041 100644
--- a/src/MQTTPacket.c
+++ b/src/MQTTPacket.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2024 IBM Corp. and Ian Craggs
+ * Copyright (c) 2009, 2025 IBM Corp. and Ian Craggs
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
@@ -860,7 +860,7 @@ int MQTTPacket_formatPayload(int buflen, char* buf, int payloadlen, char* payloa
for (i = 0; i < payloadlen; i++)
{
- if (isprint(payload[i]))
+ if (isprint((unsigned char)payload[i]))
{
if (pos >= buflen)
break;
diff --git a/src/MQTTVersion.c b/src/MQTTVersion.c
index 92cd020c1..bba9708de 100644
--- a/src/MQTTVersion.c
+++ b/src/MQTTVersion.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2020 IBM Corp.
+ * Copyright (c) 2012, 2025 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
@@ -96,7 +96,7 @@ char* FindString(char* filename, const char* eyecatcher_input)
char* ptr = value;
c = fgetc(infile); /* skip space */
c = fgetc(infile);
- while (isprint(c))
+ while (isprint((unsigned char)c))
{
*ptr++ = c;
c = fgetc(infile);
diff --git a/src/Proxy.c b/src/Proxy.c
index bb9ad6826..60769f59b 100644
--- a/src/Proxy.c
+++ b/src/Proxy.c
@@ -272,7 +272,7 @@ void Proxy_specialChars(char* p0, char* p1, b64_size_t *basic_auth_in_len)
{
*p0++ = *p1++;
}
- else if (isxdigit(*(p1 + 1)) && isxdigit(*(p1 + 2)))
+ else if (isxdigit((unsigned char)*(p1 + 1)) && isxdigit((unsigned char)*(p1 + 2)))
{
/* next 2 characters are hexa digits */
char hex[3];
@@ -350,4 +350,4 @@ int Proxy_setHTTPProxy(Clients* aClient, char* source, char** dest, char** auth_
}
exit:
return rc;
-}
\ No newline at end of file
+}

View File

@@ -0,0 +1,31 @@
From 9ef8f4d865657434ff36b24af2b8980c942bacaa Mon Sep 17 00:00:00 2001
From: Ian Craggs <icraggs@gmail.com>
Date: Tue, 6 May 2025 15:36:26 +0100
Subject: [PATCH] Put MQTT 5 reason code into the connect failure reason code
field #1596
---
src/MQTTAsyncUtils.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/MQTTAsyncUtils.c b/src/MQTTAsyncUtils.c
index c084a11e3..d8315514d 100644
--- a/src/MQTTAsyncUtils.c
+++ b/src/MQTTAsyncUtils.c
@@ -1703,7 +1703,15 @@ static void nextOrClose(MQTTAsyncs* m, int rc, char* message)
MQTTAsync_failureData5 data = MQTTAsync_failureData5_initializer;
data.token = 0;
- data.code = rc;
+ if (rc > 0) /* MQTT Reason Codes are > 0; C client return codes are < 0 */
+ {
+ /* MQTT 5 reason codes >= 0x00 and < 0x80 are successful,
+ * but in that case we should not get here but be calling
+ * onSuccess instead. */
+ data.reasonCode = rc;
+ data.code = MQTTASYNC_FAILURE;
+ } else
+ data.code = rc;
data.message = message;
Log(TRACE_MIN, -1, "Calling connect failure for client %s", m->c->clientID);
(*(m->connect.onFailure5))(m->connect.context, &data);

View File

@@ -1,3 +1,24 @@
-------------------------------------------------------------------
Thu Jul 10 15:20:58 UTC 2025 - Antonio Teixeira <antonio.teixeira@suse.com>
- Update to 1.3.14:
* Mainly a service release. Issues fixed:
https://github.com/eclipse-paho/paho.mqtt.c/milestone/21?closed=1
* Unix domain socket support
* HTTP proxy improvements
* the environment variable PAHO_C_CLIENT_USE_HTTP_PROXY must be
set to TRUE for http_proxy environment variable to be used
* the http_proxy environment variable to be read is lower case only
* the no_proxy environment variable can be set to exclude hosts from
using an environment set proxy
- Fix builds with GCC15 (gh#eclipse-paho/paho.mqtt.c#1576)
* fix-build-gcc15.patch
- Ensure argument for isprint and isxdigit is in the correct range
(gh#eclipse-paho/paho.mqtt.c#1565)
* fix-char-range.patch
- Fix handling of MQTT 5 reason codes (gh#eclipse-paho/paho.mqtt.c#1596)
* fix-reason-code-handling.patch
-------------------------------------------------------------------
Wed Apr 10 13:57:34 UTC 2024 - Danilo Spinella <danilo.spinella@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package paho-mqtt-c
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,12 +18,15 @@
%define sover 1
Name: paho-mqtt-c
Version: 1.3.13
Version: 1.3.14
Release: 0
Summary: MQTT C Client
License: BSD-3-Clause AND EPL-1.0
URL: https://eclipse.org/paho/clients/c/
Source: https://github.com/eclipse/paho.mqtt.c/archive/v%{version}.tar.gz#/paho.mqtt.c-%{version}.tar.gz
Patch1: fix-build-gcc15.patch
Patch2: fix-reason-code-handling.patch
Patch3: fix-char-range.patch
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: gcc
@@ -48,7 +51,7 @@ Requires: libpaho-mqtt%{sover} = %{version}
Development files for the the Paho MQTT C Client.
%prep
%setup -q -n paho.mqtt.c-%{version}
%autosetup -p1 -n paho.mqtt.c-%{version}
%build
%cmake -DPAHO_WITH_SSL=TRUE -DPAHO_BUILD_DOCUMENTATION=FALSE -DPAHO_BUILD_SAMPLES=FALSE -DPAHO_ENABLE_TESTING=FALSE -DPAHO_ENABLE_CPACK=FALSE ..

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:47c77e95609812da82feee30db435c3b7c720d4fd3147d466ead126e657b6d9c
size 3489004

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7af7d906e60a696a80f1b7c2bd7d6eb164aaad908ff4c40c3332ac2006d07346
size 1198035