Don't pass NULL to printf %s.
This is undefined behaviour, and some platforms don't like it. Issue #2355. Thanks to CJ Lee.
This commit is contained in:
parent
68504da4a6
commit
f3590f3020
@ -36,7 +36,7 @@ int handle__auth(struct mosquitto *mosq)
|
|||||||
mosquitto_property *properties = NULL;
|
mosquitto_property *properties = NULL;
|
||||||
|
|
||||||
if(!mosq) return MOSQ_ERR_INVAL;
|
if(!mosq) return MOSQ_ERR_INVAL;
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received AUTH", mosq->id);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received AUTH", SAFE_PRINT(mosq->id));
|
||||||
|
|
||||||
if(mosq->protocol != mosq_p_mqtt5){
|
if(mosq->protocol != mosq_p_mqtt5){
|
||||||
return MOSQ_ERR_PROTOCOL;
|
return MOSQ_ERR_PROTOCOL;
|
||||||
|
@ -32,7 +32,7 @@ Contributors:
|
|||||||
|
|
||||||
static void connack_callback(struct mosquitto *mosq, uint8_t reason_code, uint8_t connect_flags, const mosquitto_property *properties)
|
static void connack_callback(struct mosquitto *mosq, uint8_t reason_code, uint8_t connect_flags, const mosquitto_property *properties)
|
||||||
{
|
{
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received CONNACK (%d)", mosq->id, reason_code);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received CONNACK (%d)", SAFE_PRINT(mosq->id), reason_code);
|
||||||
if(reason_code == MQTT_RC_SUCCESS){
|
if(reason_code == MQTT_RC_SUCCESS){
|
||||||
mosq->reconnects = 0;
|
mosq->reconnects = 0;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ int handle__pingreq(struct mosquitto *mosq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_BROKER
|
#ifdef WITH_BROKER
|
||||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received PINGREQ from %s", mosq->id);
|
log__printf(NULL, MOSQ_LOG_DEBUG, "Received PINGREQ from %s", SAFE_PRINT(mosq->id));
|
||||||
#else
|
#else
|
||||||
return MOSQ_ERR_PROTOCOL;
|
return MOSQ_ERR_PROTOCOL;
|
||||||
#endif
|
#endif
|
||||||
@ -69,9 +69,9 @@ int handle__pingresp(struct mosquitto *mosq)
|
|||||||
if(mosq->bridge == NULL){
|
if(mosq->bridge == NULL){
|
||||||
return MOSQ_ERR_PROTOCOL;
|
return MOSQ_ERR_PROTOCOL;
|
||||||
}
|
}
|
||||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received PINGRESP from %s", mosq->id);
|
log__printf(NULL, MOSQ_LOG_DEBUG, "Received PINGRESP from %s", SAFE_PRINT(mosq->id));
|
||||||
#else
|
#else
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received PINGRESP", mosq->id);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received PINGRESP", SAFE_PRINT(mosq->id));
|
||||||
#endif
|
#endif
|
||||||
return MOSQ_ERR_SUCCESS;
|
return MOSQ_ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -119,20 +119,20 @@ int handle__pubackcomp(struct mosquitto *mosq, const char *type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_BROKER
|
#ifdef WITH_BROKER
|
||||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received %s from %s (Mid: %d, RC:%d)", type, mosq->id, mid, reason_code);
|
log__printf(NULL, MOSQ_LOG_DEBUG, "Received %s from %s (Mid: %d, RC:%d)", type, SAFE_PRINT(mosq->id), mid, reason_code);
|
||||||
|
|
||||||
/* Immediately free, we don't do anything with Reason String or User Property at the moment */
|
/* Immediately free, we don't do anything with Reason String or User Property at the moment */
|
||||||
mosquitto_property_free_all(&properties);
|
mosquitto_property_free_all(&properties);
|
||||||
|
|
||||||
rc = db__message_delete_outgoing(mosq, mid, mosq_ms_wait_for_pubcomp, qos);
|
rc = db__message_delete_outgoing(mosq, mid, mosq_ms_wait_for_pubcomp, qos);
|
||||||
if(rc == MOSQ_ERR_NOT_FOUND){
|
if(rc == MOSQ_ERR_NOT_FOUND){
|
||||||
log__printf(mosq, MOSQ_LOG_WARNING, "Warning: Received %s from %s for an unknown packet identifier %d.", type, mosq->id, mid);
|
log__printf(mosq, MOSQ_LOG_WARNING, "Warning: Received %s from %s for an unknown packet identifier %d.", type, SAFE_PRINT(mosq->id), mid);
|
||||||
return MOSQ_ERR_SUCCESS;
|
return MOSQ_ERR_SUCCESS;
|
||||||
}else{
|
}else{
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received %s (Mid: %d, RC:%d)", mosq->id, type, mid, reason_code);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received %s (Mid: %d, RC:%d)", SAFE_PRINT(mosq->id), type, mid, reason_code);
|
||||||
|
|
||||||
rc = message__delete(mosq, mid, mosq_md_out, qos);
|
rc = message__delete(mosq, mid, mosq_md_out, qos);
|
||||||
if(rc == MOSQ_ERR_SUCCESS){
|
if(rc == MOSQ_ERR_SUCCESS){
|
||||||
|
@ -115,7 +115,7 @@ int handle__publish(struct mosquitto *mosq)
|
|||||||
}
|
}
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG,
|
log__printf(mosq, MOSQ_LOG_DEBUG,
|
||||||
"Client %s received PUBLISH (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))",
|
"Client %s received PUBLISH (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))",
|
||||||
mosq->id, message->dup, message->msg.qos, message->msg.retain,
|
SAFE_PRINT(mosq->id), message->dup, message->msg.qos, message->msg.retain,
|
||||||
message->msg.mid, message->msg.topic,
|
message->msg.mid, message->msg.topic,
|
||||||
(long)message->msg.payloadlen);
|
(long)message->msg.payloadlen);
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ int handle__pubrec(struct mosquitto *mosq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_BROKER
|
#ifdef WITH_BROKER
|
||||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received PUBREC from %s (Mid: %d)", mosq->id, mid);
|
log__printf(NULL, MOSQ_LOG_DEBUG, "Received PUBREC from %s (Mid: %d)", SAFE_PRINT(mosq->id), mid);
|
||||||
|
|
||||||
if(reason_code < 0x80){
|
if(reason_code < 0x80){
|
||||||
rc = db__message_update_outgoing(mosq, mid, mosq_ms_wait_for_pubcomp, 2);
|
rc = db__message_update_outgoing(mosq, mid, mosq_ms_wait_for_pubcomp, 2);
|
||||||
@ -99,7 +99,7 @@ int handle__pubrec(struct mosquitto *mosq)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received PUBREC (Mid: %d)", mosq->id, mid);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received PUBREC (Mid: %d)", SAFE_PRINT(mosq->id), mid);
|
||||||
|
|
||||||
if(reason_code < 0x80 || mosq->protocol != mosq_p_mqtt5){
|
if(reason_code < 0x80 || mosq->protocol != mosq_p_mqtt5){
|
||||||
rc = message__out_update(mosq, mid, mosq_ms_wait_for_pubcomp, 2);
|
rc = message__out_update(mosq, mid, mosq_ms_wait_for_pubcomp, 2);
|
||||||
@ -122,7 +122,7 @@ int handle__pubrec(struct mosquitto *mosq)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if(rc == MOSQ_ERR_NOT_FOUND){
|
if(rc == MOSQ_ERR_NOT_FOUND){
|
||||||
log__printf(mosq, MOSQ_LOG_WARNING, "Warning: Received PUBREC from %s for an unknown packet identifier %d.", mosq->id, mid);
|
log__printf(mosq, MOSQ_LOG_WARNING, "Warning: Received PUBREC from %s for an unknown packet identifier %d.", SAFE_PRINT(mosq->id), mid);
|
||||||
}else if(rc != MOSQ_ERR_SUCCESS){
|
}else if(rc != MOSQ_ERR_SUCCESS){
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ int handle__pubrel(struct mosquitto *mosq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_BROKER
|
#ifdef WITH_BROKER
|
||||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received PUBREL from %s (Mid: %d)", mosq->id, mid);
|
log__printf(NULL, MOSQ_LOG_DEBUG, "Received PUBREL from %s (Mid: %d)", SAFE_PRINT(mosq->id), mid);
|
||||||
|
|
||||||
/* Immediately free, we don't do anything with Reason String or User Property at the moment */
|
/* Immediately free, we don't do anything with Reason String or User Property at the moment */
|
||||||
mosquitto_property_free_all(&properties);
|
mosquitto_property_free_all(&properties);
|
||||||
@ -104,7 +104,7 @@ int handle__pubrel(struct mosquitto *mosq)
|
|||||||
rc = send__pubcomp(mosq, mid, NULL);
|
rc = send__pubcomp(mosq, mid, NULL);
|
||||||
if(rc) return rc;
|
if(rc) return rc;
|
||||||
#else
|
#else
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received PUBREL (Mid: %d)", mosq->id, mid);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received PUBREL (Mid: %d)", SAFE_PRINT(mosq->id), mid);
|
||||||
|
|
||||||
rc = send__pubcomp(mosq, mid, NULL);
|
rc = send__pubcomp(mosq, mid, NULL);
|
||||||
if(rc){
|
if(rc){
|
||||||
|
@ -59,9 +59,9 @@ int handle__suback(struct mosquitto *mosq)
|
|||||||
/* Client is not a bridge, so shouldn't be sending SUBACK */
|
/* Client is not a bridge, so shouldn't be sending SUBACK */
|
||||||
return MOSQ_ERR_PROTOCOL;
|
return MOSQ_ERR_PROTOCOL;
|
||||||
}
|
}
|
||||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received SUBACK from %s", mosq->id);
|
log__printf(NULL, MOSQ_LOG_DEBUG, "Received SUBACK from %s", SAFE_PRINT(mosq->id));
|
||||||
#else
|
#else
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received SUBACK", mosq->id);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received SUBACK", SAFE_PRINT(mosq->id));
|
||||||
#endif
|
#endif
|
||||||
rc = packet__read_uint16(&mosq->in_packet, &mid);
|
rc = packet__read_uint16(&mosq->in_packet, &mid);
|
||||||
if(rc) return rc;
|
if(rc) return rc;
|
||||||
|
@ -59,9 +59,9 @@ int handle__unsuback(struct mosquitto *mosq)
|
|||||||
/* Client is not a bridge, so shouldn't be sending SUBACK */
|
/* Client is not a bridge, so shouldn't be sending SUBACK */
|
||||||
return MOSQ_ERR_PROTOCOL;
|
return MOSQ_ERR_PROTOCOL;
|
||||||
}
|
}
|
||||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received UNSUBACK from %s", mosq->id);
|
log__printf(NULL, MOSQ_LOG_DEBUG, "Received UNSUBACK from %s", SAFE_PRINT(mosq->id));
|
||||||
#else
|
#else
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received UNSUBACK", mosq->id);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received UNSUBACK", SAFE_PRINT(mosq->id));
|
||||||
#endif
|
#endif
|
||||||
rc = packet__read_uint16(&mosq->in_packet, &mid);
|
rc = packet__read_uint16(&mosq->in_packet, &mid);
|
||||||
if(rc) return rc;
|
if(rc) return rc;
|
||||||
|
@ -72,6 +72,8 @@ typedef SOCKET mosq_sock_t;
|
|||||||
typedef int mosq_sock_t;
|
typedef int mosq_sock_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define SAFE_PRINT(A) (A)?(A):"null"
|
||||||
|
|
||||||
enum mosquitto_msg_direction {
|
enum mosquitto_msg_direction {
|
||||||
mosq_md_in = 0,
|
mosq_md_in = 0,
|
||||||
mosq_md_out = 1
|
mosq_md_out = 1
|
||||||
|
@ -204,10 +204,10 @@ int send__connect(struct mosquitto *mosq, uint16_t keepalive, bool clean_session
|
|||||||
mosq->keepalive = keepalive;
|
mosq->keepalive = keepalive;
|
||||||
#ifdef WITH_BROKER
|
#ifdef WITH_BROKER
|
||||||
# ifdef WITH_BRIDGE
|
# ifdef WITH_BRIDGE
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Bridge %s sending CONNECT", clientid);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Bridge %s sending CONNECT", SAFE_PRINT(clientid));
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending CONNECT", clientid);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending CONNECT", SAFE_PRINT(clientid));
|
||||||
#endif
|
#endif
|
||||||
return packet__queue(mosq, packet);
|
return packet__queue(mosq, packet);
|
||||||
}
|
}
|
||||||
|
@ -43,15 +43,15 @@ int send__disconnect(struct mosquitto *mosq, uint8_t reason_code, const mosquitt
|
|||||||
#ifdef WITH_BROKER
|
#ifdef WITH_BROKER
|
||||||
# ifdef WITH_BRIDGE
|
# ifdef WITH_BRIDGE
|
||||||
if(mosq->bridge){
|
if(mosq->bridge){
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Bridge %s sending DISCONNECT", mosq->id);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Bridge %s sending DISCONNECT", SAFE_PRINT(mosq->id));
|
||||||
}else
|
}else
|
||||||
# else
|
# else
|
||||||
{
|
{
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Sending DISCONNECT to %s (rc%d)", mosq->id, reason_code);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Sending DISCONNECT to %s (rc%d)", SAFE_PRINT(mosq->id), reason_code);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending DISCONNECT", mosq->id);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending DISCONNECT", SAFE_PRINT(mosq->id));
|
||||||
#endif
|
#endif
|
||||||
assert(mosq);
|
assert(mosq);
|
||||||
packet = mosquitto__calloc(1, sizeof(struct mosquitto__packet));
|
packet = mosquitto__calloc(1, sizeof(struct mosquitto__packet));
|
||||||
|
@ -46,9 +46,9 @@ int send__pingreq(struct mosquitto *mosq)
|
|||||||
int rc;
|
int rc;
|
||||||
assert(mosq);
|
assert(mosq);
|
||||||
#ifdef WITH_BROKER
|
#ifdef WITH_BROKER
|
||||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PINGREQ to %s", mosq->id);
|
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PINGREQ to %s", SAFE_PRINT(mosq->id));
|
||||||
#else
|
#else
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PINGREQ", mosq->id);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PINGREQ", SAFE_PRINT(mosq->id));
|
||||||
#endif
|
#endif
|
||||||
rc = send__simple_command(mosq, CMD_PINGREQ);
|
rc = send__simple_command(mosq, CMD_PINGREQ);
|
||||||
if(rc == MOSQ_ERR_SUCCESS){
|
if(rc == MOSQ_ERR_SUCCESS){
|
||||||
@ -60,9 +60,9 @@ int send__pingreq(struct mosquitto *mosq)
|
|||||||
int send__pingresp(struct mosquitto *mosq)
|
int send__pingresp(struct mosquitto *mosq)
|
||||||
{
|
{
|
||||||
#ifdef WITH_BROKER
|
#ifdef WITH_BROKER
|
||||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PINGRESP to %s", mosq->id);
|
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PINGRESP to %s", SAFE_PRINT(mosq->id));
|
||||||
#else
|
#else
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PINGRESP", mosq->id);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PINGRESP", SAFE_PRINT(mosq->id));
|
||||||
#endif
|
#endif
|
||||||
return send__simple_command(mosq, CMD_PINGRESP);
|
return send__simple_command(mosq, CMD_PINGRESP);
|
||||||
}
|
}
|
||||||
@ -70,9 +70,9 @@ int send__pingresp(struct mosquitto *mosq)
|
|||||||
int send__puback(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code, const mosquitto_property *properties)
|
int send__puback(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code, const mosquitto_property *properties)
|
||||||
{
|
{
|
||||||
#ifdef WITH_BROKER
|
#ifdef WITH_BROKER
|
||||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBACK to %s (m%d, rc%d)", mosq->id, mid, reason_code);
|
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBACK to %s (m%d, rc%d)", SAFE_PRINT(mosq->id), mid, reason_code);
|
||||||
#else
|
#else
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBACK (m%d, rc%d)", mosq->id, mid, reason_code);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBACK (m%d, rc%d)", SAFE_PRINT(mosq->id), mid, reason_code);
|
||||||
#endif
|
#endif
|
||||||
util__increment_receive_quota(mosq);
|
util__increment_receive_quota(mosq);
|
||||||
/* We don't use Reason String or User Property yet. */
|
/* We don't use Reason String or User Property yet. */
|
||||||
@ -82,9 +82,9 @@ int send__puback(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code, cons
|
|||||||
int send__pubcomp(struct mosquitto *mosq, uint16_t mid, const mosquitto_property *properties)
|
int send__pubcomp(struct mosquitto *mosq, uint16_t mid, const mosquitto_property *properties)
|
||||||
{
|
{
|
||||||
#ifdef WITH_BROKER
|
#ifdef WITH_BROKER
|
||||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBCOMP to %s (m%d)", mosq->id, mid);
|
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBCOMP to %s (m%d)", SAFE_PRINT(mosq->id), mid);
|
||||||
#else
|
#else
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBCOMP (m%d)", mosq->id, mid);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBCOMP (m%d)", SAFE_PRINT(mosq->id), mid);
|
||||||
#endif
|
#endif
|
||||||
util__increment_receive_quota(mosq);
|
util__increment_receive_quota(mosq);
|
||||||
/* We don't use Reason String or User Property yet. */
|
/* We don't use Reason String or User Property yet. */
|
||||||
@ -95,9 +95,9 @@ int send__pubcomp(struct mosquitto *mosq, uint16_t mid, const mosquitto_property
|
|||||||
int send__pubrec(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code, const mosquitto_property *properties)
|
int send__pubrec(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code, const mosquitto_property *properties)
|
||||||
{
|
{
|
||||||
#ifdef WITH_BROKER
|
#ifdef WITH_BROKER
|
||||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBREC to %s (m%d, rc%d)", mosq->id, mid, reason_code);
|
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBREC to %s (m%d, rc%d)", SAFE_PRINT(mosq->id), mid, reason_code);
|
||||||
#else
|
#else
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBREC (m%d, rc%d)", mosq->id, mid, reason_code);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBREC (m%d, rc%d)", SAFE_PRINT(mosq->id), mid, reason_code);
|
||||||
#endif
|
#endif
|
||||||
if(reason_code >= 0x80 && mosq->protocol == mosq_p_mqtt5){
|
if(reason_code >= 0x80 && mosq->protocol == mosq_p_mqtt5){
|
||||||
util__increment_receive_quota(mosq);
|
util__increment_receive_quota(mosq);
|
||||||
@ -109,9 +109,9 @@ int send__pubrec(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code, cons
|
|||||||
int send__pubrel(struct mosquitto *mosq, uint16_t mid, const mosquitto_property *properties)
|
int send__pubrel(struct mosquitto *mosq, uint16_t mid, const mosquitto_property *properties)
|
||||||
{
|
{
|
||||||
#ifdef WITH_BROKER
|
#ifdef WITH_BROKER
|
||||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBREL to %s (m%d)", mosq->id, mid);
|
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBREL to %s (m%d)", SAFE_PRINT(mosq->id), mid);
|
||||||
#else
|
#else
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBREL (m%d)", mosq->id, mid);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBREL (m%d)", SAFE_PRINT(mosq->id), mid);
|
||||||
#endif
|
#endif
|
||||||
/* We don't use Reason String or User Property yet. */
|
/* We don't use Reason String or User Property yet. */
|
||||||
return send__command_with_mid(mosq, CMD_PUBREL|2, mid, false, 0, properties);
|
return send__command_with_mid(mosq, CMD_PUBREL|2, mid, false, 0, properties);
|
||||||
|
@ -114,7 +114,7 @@ int send__publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint3
|
|||||||
mosquitto__free(mapped_topic);
|
mosquitto__free(mapped_topic);
|
||||||
mapped_topic = topic_temp;
|
mapped_topic = topic_temp;
|
||||||
}
|
}
|
||||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBLISH to %s (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))", mosq->id, dup, qos, retain, mid, mapped_topic, (long)payloadlen);
|
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBLISH to %s (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))", SAFE_PRINT(mosq->id), dup, qos, retain, mid, mapped_topic, (long)payloadlen);
|
||||||
G_PUB_BYTES_SENT_INC(payloadlen);
|
G_PUB_BYTES_SENT_INC(payloadlen);
|
||||||
rc = send__real_publish(mosq, mid, mapped_topic, payloadlen, payload, qos, retain, dup, cmsg_props, store_props, expiry_interval);
|
rc = send__real_publish(mosq, mid, mapped_topic, payloadlen, payload, qos, retain, dup, cmsg_props, store_props, expiry_interval);
|
||||||
mosquitto__free(mapped_topic);
|
mosquitto__free(mapped_topic);
|
||||||
@ -124,10 +124,10 @@ int send__publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint3
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBLISH to %s (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))", mosq->id, dup, qos, retain, mid, topic, (long)payloadlen);
|
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBLISH to %s (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))", SAFE_PRINT(mosq->id), dup, qos, retain, mid, topic, (long)payloadlen);
|
||||||
G_PUB_BYTES_SENT_INC(payloadlen);
|
G_PUB_BYTES_SENT_INC(payloadlen);
|
||||||
#else
|
#else
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBLISH (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))", mosq->id, dup, qos, retain, mid, topic, (long)payloadlen);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBLISH (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))", SAFE_PRINT(mosq->id), dup, qos, retain, mid, topic, (long)payloadlen);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return send__real_publish(mosq, mid, topic, payloadlen, payload, qos, retain, dup, cmsg_props, store_props, expiry_interval);
|
return send__real_publish(mosq, mid, topic, payloadlen, payload, qos, retain, dup, cmsg_props, store_props, expiry_interval);
|
||||||
@ -175,7 +175,7 @@ int send__real_publish(struct mosquitto *mosq, uint16_t mid, const char *topic,
|
|||||||
}
|
}
|
||||||
if(packet__check_oversize(mosq, packetlen)){
|
if(packet__check_oversize(mosq, packetlen)){
|
||||||
#ifdef WITH_BROKER
|
#ifdef WITH_BROKER
|
||||||
log__printf(NULL, MOSQ_LOG_NOTICE, "Dropping too large outgoing PUBLISH for %s (%d bytes)", mosq->id, packetlen);
|
log__printf(NULL, MOSQ_LOG_NOTICE, "Dropping too large outgoing PUBLISH for %s (%d bytes)", SAFE_PRINT(mosq->id), packetlen);
|
||||||
#else
|
#else
|
||||||
log__printf(NULL, MOSQ_LOG_NOTICE, "Dropping too large outgoing PUBLISH (%d bytes)", packetlen);
|
log__printf(NULL, MOSQ_LOG_NOTICE, "Dropping too large outgoing PUBLISH (%d bytes)", packetlen);
|
||||||
#endif
|
#endif
|
||||||
|
@ -89,11 +89,11 @@ int send__subscribe(struct mosquitto *mosq, int *mid, int topic_count, char *con
|
|||||||
|
|
||||||
#ifdef WITH_BROKER
|
#ifdef WITH_BROKER
|
||||||
# ifdef WITH_BRIDGE
|
# ifdef WITH_BRIDGE
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Bridge %s sending SUBSCRIBE (Mid: %d, Topic: %s, QoS: %d, Options: 0x%02x)", mosq->id, local_mid, topic[0], topic_qos&0x03, topic_qos&0xFC);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Bridge %s sending SUBSCRIBE (Mid: %d, Topic: %s, QoS: %d, Options: 0x%02x)", SAFE_PRINT(mosq->id), local_mid, topic[0], topic_qos&0x03, topic_qos&0xFC);
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
for(i=0; i<topic_count; i++){
|
for(i=0; i<topic_count; i++){
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending SUBSCRIBE (Mid: %d, Topic: %s, QoS: %d, Options: 0x%02x)", mosq->id, local_mid, topic[i], topic_qos&0x03, topic_qos&0xFC);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending SUBSCRIBE (Mid: %d, Topic: %s, QoS: %d, Options: 0x%02x)", SAFE_PRINT(mosq->id), local_mid, topic[i], topic_qos&0x03, topic_qos&0xFC);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -89,12 +89,12 @@ int send__unsubscribe(struct mosquitto *mosq, int *mid, int topic_count, char *c
|
|||||||
#ifdef WITH_BROKER
|
#ifdef WITH_BROKER
|
||||||
# ifdef WITH_BRIDGE
|
# ifdef WITH_BRIDGE
|
||||||
for(i=0; i<topic_count; i++){
|
for(i=0; i<topic_count; i++){
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Bridge %s sending UNSUBSCRIBE (Mid: %d, Topic: %s)", mosq->id, local_mid, topic[i]);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Bridge %s sending UNSUBSCRIBE (Mid: %d, Topic: %s)", SAFE_PRINT(mosq->id), local_mid, topic[i]);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
for(i=0; i<topic_count; i++){
|
for(i=0; i<topic_count; i++){
|
||||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending UNSUBSCRIBE (Mid: %d, Topic: %s)", mosq->id, local_mid, topic[i]);
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending UNSUBSCRIBE (Mid: %d, Topic: %s)", SAFE_PRINT(mosq->id), local_mid, topic[i]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return packet__queue(mosq, packet);
|
return packet__queue(mosq, packet);
|
||||||
|
Loading…
Reference in New Issue
Block a user