diff --git a/lib/mosquitto.h b/lib/mosquitto.h index b7cc749fba..4ac6dccb86 100644 --- a/lib/mosquitto.h +++ b/lib/mosquitto.h @@ -334,8 +334,8 @@ libmosq_EXPORT int mosquitto_username_pw_set(struct mosquitto *mosq, const char * mosq - a valid mosquitto instance. * host - the hostname or ip address of the broker to connect to. * port - the network port to connect to. Usually 1883. - * keepalive - the number of seconds after which the broker should send a PING - * message to the client if no other messages have been exchanged + * keepalive - the number of seconds after which the client should send a PING + * message to the broker if no other messages have been exchanged * in that time. * * Returns: @@ -362,8 +362,8 @@ libmosq_EXPORT int mosquitto_connect(struct mosquitto *mosq, const char *host, i * mosq - a valid mosquitto instance. * host - the hostname or ip address of the broker to connect to. * port - the network port to connect to. Usually 1883. - * keepalive - the number of seconds after which the broker should send a PING - * message to the client if no other messages have been exchanged + * keepalive - the number of seconds after which the client should send a PING + * message to the broker if no other messages have been exchanged * in that time. * bind_address - the hostname or ip address of the local network interface to * bind to. @@ -395,8 +395,8 @@ libmosq_EXPORT int mosquitto_connect_bind(struct mosquitto *mosq, const char *ho * mosq - a valid mosquitto instance. * host - the hostname or ip address of the broker to connect to. * port - the network port to connect to. Usually 1883. - * keepalive - the number of seconds after which the broker should send a PING - * message to the client if no other messages have been exchanged + * keepalive - the number of seconds after which the client should send a PING + * message to the broker if no other messages have been exchanged * in that time. * * Returns: @@ -430,8 +430,8 @@ libmosq_EXPORT int mosquitto_connect_async(struct mosquitto *mosq, const char *h * mosq - a valid mosquitto instance. * host - the hostname or ip address of the broker to connect to. * port - the network port to connect to. Usually 1883. - * keepalive - the number of seconds after which the broker should send a PING - * message to the client if no other messages have been exchanged + * keepalive - the number of seconds after which the client should send a PING + * message to the broker if no other messages have been exchanged * in that time. * bind_address - the hostname or ip address of the local network interface to * bind to. @@ -466,8 +466,8 @@ libmosq_EXPORT int mosquitto_connect_bind_async(struct mosquitto *mosq, const ch * Parameters: * mosq - a valid mosquitto instance. * host - the hostname or ip address of the broker to connect to. - * keepalive - the number of seconds after which the broker should send a PING - * message to the client if no other messages have been exchanged + * keepalive - the number of seconds after which the client should send a PING + * message to the broker if no other messages have been exchanged * in that time. * bind_address - the hostname or ip address of the local network interface to * bind to. diff --git a/man/mosquitto.conf.5.xml b/man/mosquitto.conf.5.xml index 37614dd4d6..50c274922a 100644 --- a/man/mosquitto.conf.5.xml +++ b/man/mosquitto.conf.5.xml @@ -116,7 +116,7 @@ user <username> The username referred to here is the same as in - e. It is not the + . It is not the clientid. It is also possible to define ACLs based on pattern @@ -189,7 +189,7 @@ value Options to be passed to the auth plugin. See the - specific plugin instructions. + specific plugin instructions. @@ -698,7 +698,7 @@ client connected to a listener with mount point example can only see messages that are published in the topic hierarchy - example and above. + example and below. Not reloaded on reload signal. diff --git a/readme.md b/readme.md index 0ae7587f70..6474fc2831 100644 --- a/readme.md +++ b/readme.md @@ -61,7 +61,7 @@ to build. For Windows, see also `readme-windows.md`. If you are building from the git repository then the documentation will not already be built. Use `make binary` to skip building the man pages, or install -`docbook-xsl` on Debian/Ubuntu systems. +`docbook-xsl` and `xsltproc` on Debian/Ubuntu systems. ### Build Dependencies diff --git a/src/loop.c b/src/loop.c index bf4876bc94..215be5e5f6 100644 --- a/src/loop.c +++ b/src/loop.c @@ -323,12 +323,14 @@ int mosquitto_main_loop(struct mosquitto_db *db, mosq_sock_t *listensock, int li * expire it and clean up. */ if(now_time > context->disconnect_t+db->config->persistent_client_expiration){ - if(context->id){ - id = context->id; - }else{ - id = ""; + if(db->config->connection_messages == true){ + if(context->id){ + id = context->id; + }else{ + id = ""; + } + _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "Expiring persistent client %s due to timeout.", id); } - _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "Expiring persistent client %s due to timeout.", id); #ifdef WITH_SYS_TREE g_clients_expired++; #endif diff --git a/src/net.c b/src/net.c index b8a03dc0fd..a0136d6c01 100644 --- a/src/net.c +++ b/src/net.c @@ -4,12 +4,12 @@ Copyright (c) 2009-2014 Roger Light All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 and Eclipse Distribution License v1.0 which accompany this distribution. - + The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. - + Contributors: Roger Light - initial implementation and documentation. */ @@ -118,7 +118,9 @@ int mqtt3_socket_accept(struct mosquitto_db *db, mosq_sock_t listensock) if(!hosts_access(&wrap_req)){ /* Access is denied */ if(!_mosquitto_socket_get_address(new_sock, address, 1024)){ - _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "Client connection from %s denied access by tcpd.", address); + if(db->config->connection_messages == true){ + _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "Client connection from %s denied access by tcpd.", address); + } } COMPAT_CLOSE(new_sock); return -1; @@ -144,7 +146,9 @@ int mqtt3_socket_accept(struct mosquitto_db *db, mosq_sock_t listensock) } if(new_context->listener->max_connections > 0 && new_context->listener->client_count > new_context->listener->max_connections){ - _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "Client connection from %s denied: max_connections exceeded.", new_context->address); + if(db->config->connection_messages == true){ + _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "Client connection from %s denied: max_connections exceeded.", new_context->address); + } mqtt3_context_cleanup(db, new_context, true); return -1; } @@ -174,12 +178,14 @@ int mqtt3_socket_accept(struct mosquitto_db *db, mosq_sock_t listensock) }else if(rc == SSL_ERROR_WANT_WRITE){ new_context->want_write = true; }else{ - e = ERR_get_error(); - while(e){ - _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, - "Client connection from %s failed: %s.", - new_context->address, ERR_error_string(e, ebuf)); + if(db->config->connection_messages == true){ e = ERR_get_error(); + while(e){ + _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, + "Client connection from %s failed: %s.", + new_context->address, ERR_error_string(e, ebuf)); + e = ERR_get_error(); + } } mqtt3_context_cleanup(db, new_context, true); return -1; @@ -191,7 +197,9 @@ int mqtt3_socket_accept(struct mosquitto_db *db, mosq_sock_t listensock) } #endif - _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "New connection from %s on port %d.", new_context->address, new_context->listener->port); + if(db->config->connection_messages == true){ + _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "New connection from %s on port %d.", new_context->address, new_context->listener->port); + } return new_sock; } diff --git a/src/security.c b/src/security.c index 67a4f791d5..40eaab20ef 100644 --- a/src/security.c +++ b/src/security.c @@ -242,11 +242,15 @@ int mosquitto_acl_check(struct mosquitto_db *db, struct mosquitto *context, cons * plugins against possible pattern based attacks. */ if(username && strpbrk(username, "+#")){ - _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "ACL denying access to client with dangerous username \"%s\"", username); + if(db->config->connection_messages == true){ + _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "ACL denying access to client with dangerous username \"%s\"", username); + } return MOSQ_ERR_ACL_DENIED; } if(context->id && strpbrk(context->id, "+#")){ - _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "ACL denying access to client with dangerous client id \"%s\"", context->id); + if(db->config->connection_messages == true){ + _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "ACL denying access to client with dangerous client id \"%s\"", context->id); + } return MOSQ_ERR_ACL_DENIED; } } diff --git a/src/security_default.c b/src/security_default.c index c408582815..a7a6e23f7f 100644 --- a/src/security_default.c +++ b/src/security_default.c @@ -274,12 +274,16 @@ int mosquitto_acl_check_default(struct mosquitto_db *db, struct mosquitto *conte * publish or receive messages to its own place in the hierarchy). */ if(context->username && strpbrk(context->username, "+#")){ - _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "ACL denying access to client with dangerous username \"%s\"", context->username); + if(db->config->connection_messages == true){ + _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "ACL denying access to client with dangerous username \"%s\"", context->username); + } return MOSQ_ERR_ACL_DENIED; } if(context->id && strpbrk(context->id, "+#")){ - _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "ACL denying access to client with dangerous client id \"%s\"", context->id); + if(db->config->connection_messages == true){ + _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "ACL denying access to client with dangerous client id \"%s\"", context->id); + } return MOSQ_ERR_ACL_DENIED; } } diff --git a/src/websockets.c b/src/websockets.c index 5fdf12b30c..05c0dcea3b 100644 --- a/src/websockets.c +++ b/src/websockets.c @@ -219,7 +219,9 @@ static int callback_mqtt(struct libwebsocket_context *context, return -1; } if(mosq->listener->max_connections > 0 && mosq->listener->client_count > mosq->listener->max_connections){ - _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "Client connection from %s denied: max_connections exceeded.", mosq->address); + if(db->config->connection_messages == true){ + _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "Client connection from %s denied: max_connections exceeded.", mosq->address); + } _mosquitto_free(mosq); u->mosq = NULL; return -1; @@ -535,7 +537,7 @@ static int callback_http(struct libwebsocket_context *context, "Server: mosquitto\r\n" "Content-Length: %u\r\n\r\n", (unsigned int)filestat.st_size); - if(libwebsocket_write(wsi, buf, buflen, LWS_WRITE_HTTP) < 0){ + if(libwebsocket_write(wsi, buf, buflen, LWS_WRITE_HTTP) < 0){ fclose(u->fptr); u->fptr = NULL; return -1;