Commit graph

237 commits

Author SHA1 Message Date
Caolán McNamara
94341f0390 cid#360697 Ignoring number of bytes read
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I24c1bf9f103f3bf1325246a0223919ff1dbf62b4
2024-04-23 08:53:55 +02:00
Caolán McNamara
c4a6b37460 cid#360694 silence Division or modulo by float zero
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ifac9d92f95e131f2888bef6a74435b3d6a8df829
2024-04-16 15:19:35 +02:00
Aron Budea
246e87fea2 wsd: Unconditionally compile support-key-enabled code paths
Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: Iec477c223f2dc75e0be8b472c8439ca9311d6aae
2024-04-14 01:23:00 +01:00
Ashod Nakashian
6ad2e59245 mount: smarter umount handling
We fall back to MNT_FORCE only when
MNT_DETACH fails. Also improves when
we log the error to stderr.

Change-Id: I8b8b2a863b0339ddd489f1d0150446e6bae82a8a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-10 18:49:27 +02:00
Ashod Nakashian
882350ed70 wsd: remove sendWithDateAndAgent
The explicit header entries were needed
with Poco, but since we always set them
in our http::Response constructor, these
are redundant.

Change-Id: Ifde48fd3048018747dae3e84560b31960e511a25
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian
21b0394828 wsd: better empty string operations
Change-Id: Ic14efcaa8a1c345b875c27446b16f51740c55efa
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-18 18:41:49 +00:00
Michael Meeks
04b74d5767 Initial RLE benchmark.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I00a7903fe9b10066881b1637f6ae9ad59ff6607b
2024-03-10 20:06:53 +00:00
Michael Meeks
7b9e11a382 coolmap: annotate hex dumps with memory map names for pointers.
Also dump a list of shared libraries by reference count in
unshared pages.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Iecc281b27059c2f051b07fea29ab27be7d5703c0
2024-02-29 15:26:34 +00:00
Noel Grandin
8a8e55c16e replace Poco in StreamSocket::send
Signed-off-by: Noel Grandin <noel.grandin@collabora.co.uk>
Change-Id: I987cc515e27fbaf4e778a5ac6f005a43ff88be71
2024-02-27 13:17:12 +00:00
Michael Meeks
7031c3b0ce cool#8328 - config header fixup.
config.h should be included as the 1st line in each source file.
It should not be included in headers.

config_version.h which changes on every commit should not be
included widely - so remove it from the HttpRequest heeader to
save tinderbox's ccache.

Fetch version info from helper methods rather than in-lining via
defines, to better encapsulate.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: If449a36f1ac61940f04d70d5f4180db389d9b4c4
2024-02-21 09:35:25 +00:00
Ashod Nakashian
61cf7b9601 wsd: clean up unused header includes
Clang-tidy recommendation driven header
include clean-up.

Change-Id: I30c32866b7798e70df0463ee6bc7a0bcc3de5049
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-08 08:38:48 +01:00
Michael Meeks
b45f4b8f93 spdx: improve machine and human readability of headers.
Change-Id: I71f1421debf31b8c6cd0fd75c0cb45e2563b8a5a
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-11-20 14:30:02 +00:00
Michael Meeks
08d9081280 net: don't try to set TCP_NODELAY on local Unix sockets.
Change-Id: Ic0f720554080a01b7a46abbffda023834016c0ea
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-11-01 08:06:53 +00:00
Ashod Nakashian
c3fb1d0dde wsd: helper to serialize pairs
Since we don't want to propagate Poco types
as well as our pair containers, it's best
to have these are named functions rather
than as operator<<.

Change-Id: I9772b8f314262147b6c445464bf3ce8cb598b56d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-10-24 21:33:02 -04:00
Ashod Nakashian
0c59eda780 wsd: http: use named HTTP status-code instead of naked int
Self-documenting, less error-prone, and searchable.

Change-Id: Ifc21d7cf5512d9a63c5d5bc10ebc003fcccc93c1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-10-24 21:33:02 -04:00
Caolán McNamara
d52dc848bb cid318968 Calling risky function
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I81717e28f64cfe70a598363ca4723b177209d99f
2023-10-18 08:31:41 +02:00
Ashod Nakashian
57a9cf053a wsd: support EnableExperimental in Log
Now that we depend on EnableExperimental in Log.cpp,
we must define it in the standalone binaries that
otherwise don't define it.

Change-Id: Ic56032eaf6df7d0d5d707a60eeddf2d75c9041ac
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-10-02 20:14:53 +01:00
Caolán McNamara
e3cfc935ff cid#318907 silence Uncaught exception
silence various of these in tests and utilities

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I4fcc95b1b5d5c95e5ac40782550f95c08a3467bd
2023-08-24 08:30:40 +02:00
Caolán McNamara
eaa2b0cf2f cid#318821 COPY_INSTEAD_OF_MOVE
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I91e2fe0bcbf9ebe68917b0326425ac73bfa544fe
2023-08-15 15:09:36 +02:00
Caolán McNamara
6682a2a527 cid#318900 Out-of-bounds write
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I18f30bbe7271a93a44ce798e358277add9876454
2023-08-14 12:31:55 +02:00
Caolán McNamara
5185b7bedf cid#318934 silence Untrusted loop bound
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Icd7a7d3394dda93045f97481b109498fca3c01c8
2023-08-10 08:47:25 +02:00
Caolán McNamara
d79d86ed91 cid#318844 Dereference before null check
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ie3b4da580b86f4f313825dabb6d73af1508432d9
2023-08-10 08:47:25 +02:00
Caolán McNamara
2a8910a941 addPollFor default arg is now always explicitly passed
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ic9a822835ace44a1dee0c3dc4c8eb64d8e929b4d
2023-08-10 08:47:25 +02:00
Caolán McNamara
c593a0bde5 replaySync is unused
since:

commit 96adaa15d1
Date:   Thu Apr 14 19:05:26 2022 -0400

    wsd: kill coolwsd_fuzzer

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Id4b2275fbb0680a82ae29848a182de06a2de0d04
2023-08-10 08:47:25 +02:00
Aron Budea
f84835b0c6 config: Fix 'warn_unused_result' during build
tools/Config.cpp: In member function 'virtual int Config::main(const std::vector<std::basic_string<char> >&)':
tools/Config.cpp:480:18: error: ignoring return value of 'int chown(const char*, __uid_t, __gid_t)' declared with attribute 'warn_unused_result' [-Werror=unused-result]
  480 |             chown(proofKeyPath.c_str(), pwd->pw_uid, -1);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From fc946198d3

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: Iaa4db6fb4dc6f742779754d4e05708aa8f41ebd6
2023-07-23 13:18:42 +02:00
Andras Timar
fc946198d3 Rewrite coolwsd-generate-proof-key in C++
* simplified the tooling a bit: use coolconfig for creating
  RSA key pairs for WOPI Proof headers.
* got rid of a dependency: ssh-keygen, towards leaner docker images

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Iaf468b5c8585d45027f512bb0a287ab77afb1ea9
2023-07-22 00:14:48 +02:00
Caolán McNamara
d078354eb7 cid#318955 Uninitialized scalar field
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I2df245ffa6bf45536ebe4383033dcdd87f280bc2
2023-07-05 14:49:59 +02:00
Caolán McNamara
08f28aa8af cid#318956 AUTO_CAUSES_COPY
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Id2902a510e61c9ecf00f416908aa2a66f76547c0
2023-06-26 07:08:46 -04:00
Ashod Nakashian
9efc81a51b wsd: random device mounting
We now warn when we fail to use mknod
to create the random devices and have
stricter requirements to mounting
character-devices. Specifically,
we explicitly only allow mounting
the random devices.

Change-Id: Ib0dc300dedc40942ea52426af2b267f6a81fbeb8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-23 18:13:59 +02:00
Caolán McNamara
c617e14d67 cid#318956 AUTO_CAUSES_COPY
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ifcd6984042b50999a24f65479bc81428f710d38a
2023-06-21 08:40:21 +02:00
Ashod Nakashian
67c5dbb5de mount: support mounting from character device
And improve error reporting.

Change-Id: I28b5c21e1bc4f20fccd6d7f1dfca0240b91e71fd
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-20 09:42:49 +02:00
Caolán McNamara
a5c000fa35 cid#318941 AUTO_CAUSES_COPY
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I256c1f61ed997615e3277817ba60db4971783dab
2023-06-14 10:10:46 +02:00
Caolán McNamara
13ed88a547 cid#318930 Resource leak
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I12cdbe749b2f46422f329e9da39427ede7feb436
2023-06-14 10:10:46 +02:00
Ashod Nakashian
ff1657934a wsd: simplify log streaming
Change-Id: Id22de0bc06680f957e7475f142bcaf1131fdbdb9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-10 08:46:11 -04:00
Michael Meeks
7987af35c4 coolmap: accelerate handling large ascii strings without \0 termination.
Change-Id: I6831f455da038a20eb611fbbb0902dc495dc31d7
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-03-10 17:08:59 +00:00
Ashod Nakashian
9c39ebad1f wsd: string::empty() is clearer than size() == 0
Change-Id: If2e25d344b5718c35cb9ae7b7519010ee88f0f60
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-10 07:45:12 -05:00
Ashod Nakashian
0c6413bf87 wsd: fix multi-part logging
This was a regression introduced in
14d96957cd.

The result was that multi-part logs were
not flushed and therefore not written to
the output.

Change-Id: Ib22a1da83209b00872d91ca05a940226cbb4552d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-09-13 09:45:43 +02:00
Michael Meeks
0ff45bd461 coolstress: remove redundant load.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I2656fb58a0fb9ce566a47656b2080a07d980869d
2022-09-01 13:33:20 +01:00
Ashod Nakashian
4e9b836ea6 wsd: always use Util::forcedExit to properly cleanup
We need to flush and shutdown logging before exiting,
so we can't use _exit/_Exit directly.

In addition, with profiling (e.g. code-coverage) we
must flush the profile data, lest it's all for naught.

Change-Id: I726c5a2f4e699c17dd0d7d5b1c86d856e0118b3c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-02 07:51:52 -04:00
Ashod Nakashian
e3deda303b wsd: fix warnings on GCC 12
Change-Id: Ia61f45d83223a65d1f7c444250230006a4ac098f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-07-13 09:37:07 +01:00
Michael Meeks
a5aeac6eeb stress: dump connection count.
Change-Id: I3a1a4202d8f3cbabaf46794fa1c3452af1470016
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-06-10 10:10:05 +01:00
Michael Meeks
fe5100183c reply: record more statistics.
Count data sent as well as received, re-factor, and measure B/W
usage too.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I5d00f0568c774cc03d2b8e4f730bfe4a8fb5b06f
2022-06-08 09:18:05 +01:00
Michael Meeks
55a47214d1 stress: account for the size of each message.
Change-Id: Ie94add7197672106a2c0684405a1b15c307470e4
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-06-06 09:58:15 +01:00
Ashod Nakashian
14d96957cd wsd: log macro cleanup
* Simplify log macros.
* Reduce expanded lines (faster compilation).
* Avoid flushing (since we always use ostringstream).

Change-Id: Id10c1a75b5af5d8cdba62d768192ab0a6a9e0aca
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-26 11:13:44 +03:00
Ashod Nakashian
480fb7b931 wsd: move tokenizer helpers into StringVector
In an attempt to reduce the size of Util.{c,h}pp
which has grown to contain all sorts of unrelated
helpers, we move StringVector helpers into
the StringVector.{c,h}pp files.

This makes the code better organized.

Change-Id: I152f341606807ae66253415b951bc9f89b09df57
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-12 07:39:07 -04:00
Michael Meeks
6548759fde replay: re-connect after a timeout for various errors.
Change-Id: I06cb01a0ab826b5723e634bb03e1bca6d99c4db2
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-03-04 10:06:33 +00:00
Michael Meeks
019913666d Replay: log which client a message is from / for; and improve errors.
Change-Id: Id9e7d9680a0c33d79c8f691222829406754eaf94
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-03-03 09:04:06 +00:00
Michael Meeks
0678082db4 Detect trace replay errors & exit and cleanup traces.
Change-Id: I15c04eb9eef02f3f6002c35dc5701b7dbe9a1398
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-02-21 15:37:05 +00:00
Gleb Popov
34574724b4 Teach coolmount to mount devfs on FreeBSD.
Use it to create /dev/{u}random devices instead of calling mknod().

Signed-off-by: Gleb Popov <6yearold@gmail.com>
Change-Id: I6ae7842c89255f3f43a8ac7f082a275d5496690a
2022-02-21 10:20:01 +01:00
Michael Meeks
60b76efe82 Count bandwidth use during stress testing.
Change-Id: I48e1540795f0992833d4c4365d4a9d0da7a48442
2022-02-15 19:44:08 +00:00