As the behavior for calling fopen() on a NULL pointer is undefined in
ISO C99, a check is added before passing the file name to fopen().
This fixes CID 1495723.
In coap_io_do_epoll(), read() is called after timeout to clear the
file descriptor associated with the firing timer. As this function is
only called for its side effect, the result is ignored. Coverity scan
reports this as check_return event. A cast to void has been added to
document that the result is ignored on purpose.
This fixes CID 1495728.
coap_session_release() decrements a reference counter and releases
session resources when zero is reached. In certain function call
chains this leads to false positives with Coverity code analysis.
This change adds specific primitives to avoid these false positives.
This behavior is controlled by pre-processor conditionals.
Fix possible null pointer dereference in coap_get_context_server_hint()
and coap_get_context_server_psk().
These issues have been detected by Coverity scan as CIDs 1495725 and
1495729.
The symbol LIBCOAP_VERSION is set to a decimal 9-digit sequence of
form MMMmmmuuu where MMM is the major version number, mmm the minor
version number and uuu the micro version number.
RIOT defines a subset of the syslog levels in log.h with different
numeric values. The remaining levels are defined here. Note that
output granularity differs from what would be expected when adhering
to the syslog levels.
RIOT supports fd_set only for BOARD=native. For now,
coap_io_process_with_fds() is completely disabled on RIOT as it is not
yet implemented in coap_io_riot.c, anyway.
Calling coap_free_context() does not free off any async entries, and so
raises assertion errors when coming to freeing off sessions if any async
entries exist.
async_data_t is a union, but the size of val and ptr are not the same - so
usage can have uninitialized data - hence bad timeout values.
Makefile.am:
Do not expose coap_delete_all*() functions.
examples/coap-server.c:
Fix async_data_t issue.
examples/etsi_iot_01.c:
Fix 32 bit compiler warnings using same logic as coap-server for holding the
async timeout value.
examples/lwip/Makefile:
Include async.c for the LwIP build.
include/coap2/async.h
Define coap_delete_all_async() function.
include/coap2/net.h
include/coap2/resource.h
Document coap_delete_all*() functions as internal.
libcoap-2.map
libcoap-2.sym
Remove non-exposed coap_delete_all*() functions.
src/async.c
Provide coap_delete_all_async() function.
src/net.c
Call coap_delete_all_async() from within coap_free_context().
To build shared libraries, either the BUILD_SHARED_LIBS=ON option can be
defined globally for building, otherwise defining BUILD_SHARED_LIBS as an
OPTION in CMakeLists.txt works providing the OPTION is defined before the
add_library() call.
This fix is to move the OPTION BUILD_SHARED_LIBS to before the
add_library() call.
NOTE: Shared Library support is not currently available for Windows as the
appropriate functions are not currently exported.
BUILDING:
Document the Windows limitation and tidy up a bit.
src/coap_session.c:
src/net.c:
Wrap more code with #if !COAP_DISABLE_TCP
include/coap2/coap_tcp_internal.h:
Wrap function definitions with #if !COAP_DISABLE_TCP to force compiler
warnings if there still is reference to TCP functions and COAP_DISABLE_TCP
is set.
man/coap_attribute.txt.in:
man/coap_context.txt.in:
man/coap_encryption.txt.in:
man/coap_handler.txt.in:
man/coap_io.txt.in:
man/coap_keepalive.txt.in:
man/coap_logging.txt.in:
man/coap_observe.txt.in:
man/coap_pdu_setup.txt.in:
man/coap_recovery.txt.in:
man/coap_resource.txt.in:
man/coap_session.txt.in:
man/coap_tls_library.txt.in:
Make sure the full list is defined in the NAME section
[Gives a2x warnings that there are more than 10 entries, but this is OK]
Update where BUGS can be reported to.
man/Makefile.am:
Remove EXTRA_PAGES as all the names are now defined A2X_EXTRA_PAGES.
Commit 8faa8c28f has moved the inclusion of assert.h to
coap_internal.h. This change therefore removes the definition of
assert to avoid warnings due to multiple definitions.
As per RFC7641:
However, in the event that the state of a resource changes in
a way that would cause a normal GET request at that time to return a
non-2.xx response (for example, when the resource is deleted), the
server SHOULD notify the client by sending a notification with an
appropriate response code (such as 4.04 Not Found) and subsequently
MUST remove the associated entry from the list of observers of the
resource.
src/resource.c:
Send out a 4.04 response to all observers of a resource when deleting it.
There needs to be an easy way to validate that the examples provided in the
man pages compile without errors.
This PR provides a new executable examples-code-check that can be run against
the .txt.in files that are in the man directory. It abstracts the code for
each example and then runs the compiler against that stub code reporting errors
and warnings as appropriate for subsequent fixing in the man page.
.gitignore:
Ignore the new executable and the files it generates.
Makefile.am:
configure.ac:
Remove MAN_DIR and hard code in the man directory so that examples-code-check
is always built.
autogen.sh:
Make sure that all the temporary stub code files are cleaned up.
man/Makefile.am:
Support building and clean-up of the new examples-code-check.
man/examples-code-check.c: (new)
The code that parses the man pages, looking for examples and the gets
the examples compiled, testing for errors.
The function definitions in the SYNOPSIS section are also included in the
compilation of the examples.
scripts/build.sh:
If WITH_TESTS is set, check that the man page examples compile.
man/coap_encryption.txt.in:
man/coap_io.txt.in:
man/coap_observe.txt.in:
man/coap_pdu_setup.txt.in:
man/coap_resource.txt.in:
man/coap_session.txt.in:
Correct the SYNOPSIS function definitions.