1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00
Commit graph

3778 commits

Author SHA1 Message Date
Andy Green
3709d80f3d ss-deserialize: add pointless h NULL check
h cannot be NULL since it's set by address offset earlier.
Help coverity understand that.
2021-11-09 07:45:58 +00:00
Andy Green
f8d74d058e adopt: coverity: add pointless vh NULL check
The wsi is always created on a valid vhost.  Add a needless NULL check on
it to satisfy coverity.
2021-11-09 07:45:48 +00:00
Andy Green
a53eb4d4fe ss-h1: coverity: add needless header NULL check
Coverity does not understand that once we checked that  the header has
a non-zero length, the associated pointer can never be NULL.  Add a
pointless check to make it happy.
2021-11-08 13:44:45 +00:00
Andy Green
7b34626a22 mbedtls-x509: coverity: remove needless check
ip can't be NULL, it's set to the address of another object.
2021-11-08 13:44:45 +00:00
Andy Green
d1f6101bad unix-sockets: NOP for coverity
continue here makes no difference than using break, but continue gets us a
pointless complaint "statement continue does not have any effect" and break
does not.
2021-11-08 13:44:45 +00:00
Andy Green
d3783f0c71 client: connect: confirm we have a protocol
Coverity gets antsy that we were checking wsi->a.protocol for NULL earlier
then start using it... explicitly bail if it's NULL before we start using
it.
2021-11-08 13:44:45 +00:00
Andy Green
f3a1263bc1 jit-trust: SAN_RFC822_NAME needs other_name union member
->san is a union, in this case we set the type to indicate we use
SAN_OTHER_NAME member, but set the unstructured_name union member, that is
smaller.

This doesn't cause any problem, since the union has space for it.  But
Coverity noticed, it is wrong, so fix it.
2021-11-08 13:44:45 +00:00
Andy Green
81a69d10e9 jit-trust: show coverity we handle NULL attribute source
Coverity doesn't understand that since we already handled
akid.keyIdentifier.MBEDTLS_PRIVATE(len) being zero, we don't need to
check for akid.keyIdentifier.MBEDTLS_PRIVATE(p) being NULL.

So explicitly check it, even though it is a NOP.
2021-11-08 13:44:45 +00:00
Andy Green
7de0d88ac3 jit-trust: clean after failed mbedtls_x509_get_name
mbedtls_x509_get_name() does not clean up properly after itself in the case
of OOM on multi-segment name.  We have to add extra handling and cleaning.
2021-11-08 13:44:45 +00:00
PW Hu
fe31dcd8ac docs: audit api return information
https://github.com/warmcat/libwebsockets/issues/2481
2021-11-07 10:08:00 +00:00
Andy Green
c19dc963c9 cgi: issue CGI_TERMINATED also on reap
We also need to report CGI_TERMINATED when reaping children that closed by
themselves.  Keep an extra copy of the pid outside of the lws_spawn object
so it's still around by then.
2021-11-07 07:04:09 +00:00
Andy Green
095798d5d9 sshd: plugin: work with _BUILTIN
The sshd example has gotten crufted a few different ways.

Adapt the test-sshd protocol and callbacks to not collide with the plugin
ssh-demo exports, for BUILTIN case.

Do not build a static copy of ssh-base for test-sshd if PLUGINS_BUILTIN is
going to provide it via lws import.

Add pvo for ssh-base to enable it on to the test-sshd vhost.

Banner staging in buf[] shared some of source and dest when it was copied
in, move it up a bit to avoid this.

Add note about rsa key disable workaround on Fedora.

test-sshd uses CGI (and requires it enabled to build) because it predates
lws_spawn... lws cgi was migrated to lws_spawn, really the test=sshd needs
rewriting to use lws_spawn directly instead of cgi.
2021-11-07 07:04:09 +00:00
Andy Green
7c9f1ca0a6 plugins: iterate builtin plugins as if loaded
For plugins that handle PROTOCOL_INIT, we have to iterate any PLUGINS_BUILTIN
plugins as if we had just discovered and loaded them from plugin files, so
they bind to vhosts appropriately.

Add some private helpers to keep the guts from duplication in plat.
2021-11-07 07:04:09 +00:00
Andy Green
555503b202 lejp: allow leading wildcard
This lets us have path matches like "*[]"
2021-11-07 05:33:44 +00:00
Andy Green
c935df1e7e lejp: object indexes
This adds an optional feature LEJP_FLAG_FEAT_OBJECT_INDEXES that changes
lejp to treat { } items as indexable in ctx->i[] / ctx->ipos, since they
also can take commas.

This may break existing uses so it requires the default-off feature flag to
enable it.  The flags context field is zeroed by lejp_construct(), so any
flags should be set on ctx->flags after alling that.

There's also a flag LEJP_FLAG_LATEST available as an alias to enable any
desirable but not-backwards-compatible behaviour, including this.

Add the info to the README and adapt the unit test to do it both with and
without the FEAT_OBJECT_INDEXES flag.
2021-11-07 05:33:43 +00:00
Andy Green
a81c7cccd0 retry: handle empty retry table 2021-11-06 09:09:35 +00:00
Ron Frederick
b5b7e793d4 server: SO_REUSEPORT: enable with LWS_MAX_SMP > 1
Either explicit option selection, or multiple SMP service threads, should
enable SO_REUSEPORT

https://github.com/warmcat/libwebsockets/issues/2470
2021-10-30 06:19:37 +01:00
Andy Green
37b930a6ae openssl: remove lws_ssl_get_error_string as cruft
It's not exported, it seems nothing wants it any more
2021-10-29 20:10:55 +01:00
Andy Green
3f4800b88f log: cherrypick common errno to be strings
Pick some common errno constants for the platform and provide strings for
them.  Replace numeric errno logging with the new api for client.

Replace any usage of strerror() in network code with the new api.  For
constrained devices, this should give a small saving on .rodata.

Leave some usages in daemonize.c and unix plat where the size isn't going
to matter.
2021-10-29 20:10:52 +01:00
Andy Green
c2ac541f43 client: connect3: show what we are trying to connect to
Make it visible what we are currently attempting to connect to as a numeric
ipv4/ipv6 address.
2021-10-29 15:41:52 +01:00
Andy Green
0993543ac8 adopt: improve wsi tags for listen
async-dns has to keep a listener on udp:53, but its tag doesn't really give
a clue what it is

[1534033|wsisrv|0|adopted]

this patch improves it and moves the decision about putting the server wsi
in SERVER or MUX group to the caller instead of guessing from the desc
name.

[1549684|wsisrv|0|system|asyncdns]
2021-10-29 15:41:52 +01:00
Andy Green
67f532a8c6 cmake: bring tls include requirement out as PUBLIC
There's no problem for library build, also with LWS_WITH_MINIMAL_EXAMPLES,
but after install at least on OSX, there are problems finding the installed
lws include dir (concealed on most platforms by the path being in the
default search list for the toolchain), and the references in the lws
includes to the tls includes meaning that explicit paths for that must be
available at consuming cmakes.

This patch enhances the cmake config installed by lws to deal with adding
the lws include paths to CMAKE_REQUIRED_INCLUDES and include_directories,
so it can be found before the target is introduced.

The tls include is passed back up the CMakeLists layers and the lws targets
marked with target_include_directories(PUBLIC) with them, so they are
understood as needed by consumers.

More boilerplate is moved out of the example consuming cmakes.

After this, on machines with previous installs of older lws, you may have to
clean out the cmake install path, that is usually something like

/usr/local/lib/cmake/libwebsockets/*

before make installing lws and putting the latest content in there.
2021-10-28 08:12:48 +01:00
Chunho Lee
8e4336838a mqtt: allow indicating username and password are not on heap
Fix minimal-mqtt-client and minimal-mqtt-client-multi from crashes
by allowing indicating username and password are not on heap.
2021-10-27 16:52:38 +01:00
Chunho Lee
41c88959d2 plat: freertos: selectively use old service looping 2021-10-26 09:55:09 +01:00
Andy Green
2761badd0f minimal: ss: embedded: RT595S ACM transport
Adds an example for NXP RT595S eval board, using serialized SS over CDC /
ACM USB composite device, one ttyACM for logs and the other for the SSS
link.
2021-10-24 16:50:39 +01:00
Andy Green
99f7e572ca raw-file: clear POLLOUT before handling 2021-10-24 16:48:03 +01:00
Jin Wang
312bb56385 ss: policy: adaptations for dynamic policy 2021-10-21 14:51:21 +01:00
Jin Wang
2670a971b9 metrics: ss: skip tagging if no ss streamtypename 2021-10-19 15:40:00 +01:00
Andy Green
9127bcde7f client: connect_check fail just log once 2021-10-19 06:32:19 +01:00
Andy Green
a3592cbe4f adns: api-test: add synthetic result parsing
Add some exports so the api test can inject results into the parser for
live queries, suppressing asking the server but otherwise following the
flow.

Provide two new suspect responses for injection and parsing in ctest.

Add a --cos option to minimal-http-client to force a close after the
connection has started the async dns.
2021-10-18 09:58:16 +01:00
Andy Green
a51def06a1 coverity: adns: check length against 1500 2021-10-17 12:03:07 +01:00
Andy Green
66afd3da78 coverity: client_reset: no longer any way to get NULL *pwsi
Coverity belatedly noticed that client_reset no longer changes *pwsi
2021-10-17 12:03:07 +01:00
Andy Green
d730351fa3 adns: fix label limit check 2021-10-17 12:02:26 +01:00
Andy Green
28e5d41d9e http: sse: check POLLIN during DOING_TRANSACTION
When the client goes away, on some platforms all we get is POLLIN revent
stuck on... we have to read it to find out a zero length result and
understand it's gone.

Add SSE mode's DOING_TRANSACTION to the list of states we will read for.
2021-10-16 08:23:21 +01:00
Andy Green
cb7dd8c765 bind: use vhost log ctx since wsi optional 2021-10-16 08:23:18 +01:00
Felipe Gasper
9c718e47e2 logs: log context: async_dns
Of note: A single use of lwsl_debug() remains because the function in
question is documented as a public API, but the passed-in parameter
doesn’t offer a path to a logging context.
2021-10-16 08:23:09 +01:00
Andy Green
7e09e42472 freertos: no need to freak out if service_adjust_to is 0
If lws_s_a_t() is zero, there's a path where n stays -1 from its
declaration and we return -1.
2021-10-15 19:07:33 +01:00
Felipe Gasper
81830a3979 logs: migrate more to log context 2021-10-15 14:11:41 +01:00
Felipe Gasper
80b0c59ad6 client: fix nxdomain CCE 2021-10-15 14:11:41 +01:00
Orefkov Aleksander
abef9ba252 http: spa: fetch any params
Added the ability to get additional form parameters with unknown names in the form parameters parser lws_spa. The example of using the form parameters parser has been updated. Fixed bug of double freeing memory in the example.
2021-10-15 08:47:52 +01:00
Yichen Gu
43c4b79960 ss: static policy generator: fix filepath detection 2021-10-13 15:56:29 +01:00
Yichen Gu
c3515cd6d9 mqtt: protect printing debug only vars 2021-10-13 15:56:22 +01:00
Felipe Gasper
a2ff2ba4eb logs: migrate ws extension code to contextual logging 2021-10-13 11:10:52 +01:00
Felipe Gasper
5a9ede36db logs: migrate client-parser-ws.c to contextual logging 2021-10-13 09:53:14 +01:00
Orefkov Aleksander
1274ea03c0 mbedtls: windows: add define to be compatible with the latest versions of mbedtls 2021-10-12 15:37:23 +01:00
Orefkov Aleksander
15513d1ee4 mbedtls: set length even when LWS_HAVE_mbedtls_ssl_get_alpn_protocol 2021-10-12 10:17:39 +01:00
Orefkov Aleksander
f0e4eac10b cmake: wrong miniz include dir + mbed link on windows 2021-10-12 09:16:26 +01:00
Andy Green
028deaeaa5 smd: take message lock earlier 2021-10-12 09:14:47 +01:00
Felipe Gasper
f9d9cb3bb7 Teach client-ws.c about log contexts. 2021-10-12 07:33:19 +01:00
Andy Green
3ae573cf9b remove: ss plugins
These have been disabled via a preprocessor symbol with no UI to enable it
for a year or so, it looks like they are not going to be needed.

The model of in-tree auth selectable from cmake looks like it will do for
everything, or if not, the solution will probably look different to this.
2021-10-12 07:33:18 +01:00