Commit graph

227 commits

Author SHA1 Message Date
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
Miklos Vajna
8e2829fee7 tools: fix -Werror,-Wfortify-source
'sscanf' may overflow; destination buffer in 'smap_key' has size 20, but
the corresponding specifier in tools/map.cpp:570 may require size 21.

Change-Id: Ie7356db924193777869a39b882512a864c0e10c5
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
2022-01-24 12:33:23 +01:00
Aron Budea
2faa5459ce coolconfig: migrate missing entries in special cases
Also fix ssl.hpkp.pins.pin handling.

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: I48ffe3db9ec0ff2db53f5e8cac5ec3d7aa55e66c
2022-01-17 10:16:06 +01:00
Andras Timar
e543581887 coolconfig: allow set command to create new config settings
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I1efcca7a773df366a2cca1d56f1d6fb967402deb
2022-01-17 07:00:58 +01:00
Aron Budea
3ec29a474e coolconfig: Updated "host" entry handling in migration tool
- new method for migrating "host" entries:
  only done if there are new entries in the old config,
  and then replace the list in the new config with the old one

- other small changes, eg.
  don't migrate special default values if they match target value

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: Idf43db4068c163077109825486855a259666181c
2022-01-12 09:49:43 +01:00
Aron Budea
c6155a3513 coolconfig: Add config migration tool
Usage:
coolconfig migrateconfig [--old-config-file=<path>]
  [--config-file=<path>] [--write]

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: I44e16bd07588887e01732b430e4c6e368a034cd1
2022-01-10 20:11:26 +01:00
Gleb Popov
a169580d53 Actually pass freebsd_flags variable to nmount() call.
Signed-off-by: Gleb Popov <6yearold@gmail.com>
Change-Id: I5149b30e8dc6c2ed13c964f8bcf44399565c4f66
2021-12-09 15:24:47 +01:00
Miklos Vajna
dcfe16eec1 coolconvert: fix stack-use-after-scope
The vector is allocated on the stack in a for loop, so it's not valid to
refer to its address in the lambda that is executed on a thread. Rather
copy it.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ie1f85d6efb27a4aa44b181f8d9f134e9fa41d508
2021-11-19 12:41:28 +01:00
Andras Timar
f07ff8c7e0 rename: remaining lool->cool changes
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ib7d4e804bebe52dead8d53b0e0bbaed0f08bf3d0
2021-11-18 14:14:11 +01:00
Andras Timar
504c05df3b rename: loolwsd-systemplate-setup -> coolwsd-systemplate-setup
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I699db87f94f9080909c2ca783e04ad8b4dd98025
2021-11-17 22:10:58 +01:00
Mert Tumer
b59fbe8d4c rename: loolmap -> coolmap
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: I3136305d5733c5c7a886baa230fd4c1e1401b734
2021-11-17 21:51:05 +01:00