Commit Graph

284 Commits (master)

Author SHA1 Message Date
Tor Lillqvist 01953730f2 Do build also the browser dir in the (quick-and-dirty) Emscripten case
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Ibe7782c8dadd232b4ee4f2f9585e0649d4eb71f1
2023-01-16 18:43:21 +02:00
Tor Lillqvist 1889fe2016 When we are building WASM we don't build the browser subdirectory
This is how I imagine that this stuff should work:

- In one tree you build with --host=wasm32-local-emscripten. This
  results in only the WASM binary being built, containing C++ code
  from Collabora Office core and C++ code from Online (to a similar
  extent as in the iOS, Android, and gtk apps). No HTML and JS for the
  client's browser is produced in this tree. The embedded filesystem
  from the corresponding WASM core build could be copied into this
  tree for use as below. (Or, alternatively the build in the other
  tree could look into the config.status file in this tree to figure
  out where to pick up the embedded fs data file.)

- In another tree you build with --with-wasm-fallback=<path to the
  above WASM tree>. Note that the C++ code will be built normally in
  this case, for Linux. This build results in an otherwise normal COOL
  build, with the added feature that the COOL server sends the whole
  document file also to the COOL client whenever it is saved. The HTML
  and JS browser code will have code that enables receiving the
  document in this case, plus incremental updates to the document (if
  possible), and code to detect that the connection to the COOL server
  is broken and then fall back to using the local WASM in the
  browser. Obviously the WASM binary and related JS and other data
  (like the embedded file system from core) will have to be downloaded
  into the client right at the start, to be present if the connection
  breaks, but the WASM will likely not need to be started until
  needed.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I945c93451d3f5f0b1bc6ad8550da64e8e6453b6b
2023-01-15 19:46:37 +01:00
Michael Stahl 901ad84339 WASM add simple automake file and dummy cpp file
Copy the list of .cpp files from the Android project, assuming this will
be similar in scope.

Signed-off-by: Michael Stahl <michael.stahl@allotropia.de>
Change-Id: I57c7ad2f10d1867307ff4fcea3d0c650726d18d8
2023-01-09 15:21:37 +02:00
Andras Timar a077c4288b Put all Zotero logic to browser
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ib1b071b96322511b7f319ff6b851e902b3556fbb
2022-12-12 13:35:29 +01:00
Pranam Lashkari 2cfae369af initial zotero skeleton
add zotero UI only if user is logged in
when zotero citation edit button is clicked,
fetch the library with zotero API.
Let user select what to insert

at this stage its not a complete solution but just first stage

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: Id67d8409bcd6416994713acd9ace495b24823fb0
2022-11-30 20:37:48 +01:00
Andras Timar d17fb50487 enable link to non-system libpng and openssl
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I109242bde268e63e9918af0f44fcb456e2b8f6c5
2022-11-28 12:41:59 +01:00
Ashod Nakashian 5892bcba1e wsd: test: refactor client connection management
The client connection management had nothing to
do with the WopiTestServer and it was there
for convenience. The issue was that it was
not available to tests that do not need
the custom WopiTestServer and depending
on it would make them unnecessarily
complicated.

This adds a new intermediary class to manage
client connections in tests. The reason
this logic didn't move to UnitWSD or even
UnitBase is simply because the client
connection logic depends on the helpers
namespace and other test-specific code
that isn't available in COOLWSD. In short,
UnitBase and UnitWSD are primarily an
interface that COOLWSD and co depend on
and cannot contain test-specific logic
that isn't linked to coolwsd.

We also move the UnitWebSocket helper class.

Change-Id: I79567774164e137349dc162482529578f150353c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-11-14 18:15:39 -05:00
Michael Meeks 2def6dc3d5 Switch to zstd image compression.
zstd provides for much faster compression server-side, as well
as better decompression.

zstd allows us to de-compress a keyframe and several deltas in a
single call in JS, so it is necessar to add a terminator to the
delta stream so that we can detect when to flush the buffer we
are working on - so the next delta applies to the correct data.

Change-Id: I0e292e3a697b4902d6488b7c04deaba2d1485e94
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-11-02 12:09:53 +01:00
Michael Meeks 1407aedf1f coolstress: add man-page, cleanup somewhat and document a little.
Change-Id: I57b6bb7bde6e0fa8ffd9a08cf5b9d8c8b4759bf2
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-09-01 13:33:20 +01:00
Ashod Nakashian 82a5c3173d wsd: fuzzer: fix build
Change-Id: Ib52e32de04e7af230ed21eed11e0855050e97c74
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-17 08:55:12 -04:00
Ashod Nakashian 9419b7ef0d make: minimize fuzzer dependency duplication
Change-Id: I6ff335ab6e4ddeb950cd03ddb08a793790327579
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-17 08:55:12 -04:00
Ashod Nakashian a87d1ae54f wsd: add HttpEcho fuzzer
This is a full round-trip http fuzzer.
It can achieve >1000 iterations per second
on a single 2 Ghz core, even while going
through the network loopback layer.
The advantage is that more networking code
is fuzzed this way, including not just
the http code, but also the sockets.

Change-Id: I75d21bd0e25221ee6621097a2605d62c4bb2ae4d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-17 08:55:12 -04:00
Ashod Nakashian 5c6516e4e4 wsd: support code-coverage report via --with-coverage
This adds support for code-coverage HTML reporting.
To achieve this, we must use file-linking in jails
so that we can update the coverage data (.gcda files)
from the jails. This means that creating jails is
slower than with bind-mounting and we need to
account for that in our timeouts.

We also can't kill child processes with SIGKILL,
which is un-catchable. Instead, we use SIGTERM
and dump the profile data before exiting.

Change-Id: I16fa534f6ed42f7133014d841bb024423315e0a4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-02 14:45:12 -04:00
Henry Castro 79bd9e42cb wsd: proxy: add ProxyRequestHandler files
Change-Id: Ic61f70316e921ba3cb988a3b0f8f8d2c7df89cc6
Signed-off-by: Henry Castro <hcastro@collabora.com>
2022-06-27 16:04:32 +01:00
Michael Meeks 47275c6f9e This should do something cooler.
Change-Id: I90d6028c91e88034b48ab91de7429ebde5ba5c25
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-10 11:48:33 +01:00
Ashod Nakashian 96adaa15d1 wsd: kill coolwsd_fuzzer
coolwsd_fuzzer predates actual fuzzing
with libfuzzer and is currently unsused.

Change-Id: Id095b165943ba14dbf525ddc607ad329f5d952d4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-20 07:12:03 -04:00
Ashod Nakashian 827d9518c0 wsd: make: build the fuzzer binaries only configured with fuzzing
This reduces the build time significantly while also
minimizing the disk-space requirements for builds.

When configured with --enable-fuzzers the fuzzing
target binaries are built.

Change-Id: Ia8560d876f548d04ac085503e55a3a5dca90f590
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-20 07:12:03 -04:00
Ashod Nakashian b34de7fad1 wsd: move STATE_ENUM to common/StateEnum.hpp
With some minor modifications.

Change-Id: I5bc06bd96bbf201ccaee87170d052b4ad2a6c778
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-06 18:33:45 -04:00
Rash419 31d8822758 wsd: cleanup: moved all parsing related static methods and containers to HostUtil.cpp
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I8555522c6216f893b90ba4c27747314830f7abd2
2022-03-29 12:18:31 +02:00
Ashod Nakashian 1022a7e78e Revert "wsd: exclude deprecated openssl API"
Apparently this breaks the build on at least
CentOS. Reverting for now.

This reverts commit 23f02b8929.

Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Change-Id: Ie8f00bbc53a63098b473d625846c0b6fd4e074bd
2022-03-22 08:41:59 +01:00
Ashod Nakashian 23f02b8929 wsd: exclude deprecated openssl API
There are no deprecated API currently in use,
but that is a moving target as we upgrade openssl.
This prevents any accidental use of deprecated API
and will reveal any deprecated API used in any
particular build.

Change-Id: I969f7f7c4efe163d4704dea9aab45c09550baa40
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-03-21 08:57:41 +00:00
Michael Meeks 42f565faf7 add $ make stress
Change-Id: I7da764b711f1a143ee67ef7a2f48fc34e3d17487
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-03-04 10:06:33 +00:00
Michael Meeks 96b15bd704 Count and report on various internal exceptions.
An initial set of seven of these, easy to add more as/when needed.

Change-Id: I6c65e052d00f9eaa10adee3c9464043e4c594848
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-02-18 13:51:41 +00:00
Ashod Nakashian 4fcd07b172 make: silence chmod failure on missing path
Change-Id: I38d302377a26f2ebe4a734b5f16286613e762891
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-02-17 18:52:48 -05:00
Ashod Nakashian 3d04a857bd wsd: test: improved and simplify test logging
Build-time unit-test output is now only
displayed when the test fails. This is to
reduce noise while building when not helpful.

Change-Id: I273d97dae192a24e9a1ae9f662b0fcd7ff555b75
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-02-17 18:52:48 -05:00
Ashod Nakashian 203a58f6d8 wsd: test: add SaveOnExit test
Refactor UnitWOPIDocumentConflict.cpp into
WOPIUploadConflictCommon.hpp and reuse for both
DocumentConflict and SaveOnExit tests.

Change-Id: I54ec1e37e5e9c6298b12a2b2e596363683fb2e34
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-02-08 20:46:01 -05: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
Jan Holesovsky dbe05b2d48 Cleanup the old binaries
Signed-off-by: Jan Holesovsky <kendy@collabora.com>
Change-Id: I16375c3d1c55cf7bda690a3c71dd5c996cd8be5a
2021-11-19 21:16:32 +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
Andras Timar bf5bce7669 rename: loolwsd-generate-proof-key -> coolwsd-generate-proof-key
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I3aa30ce4e5f6df2068fa2e0788034e83cb0ae26b
2021-11-17 22:06:34 +01:00
Andras Timar 26d71a293a rename: remove old man files, add coolwsd man file, and create compat loolwsd symlink
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I4171e2d2825924cf73da692e743f2041a546b1a9
2021-11-17 22:02:46 +01:00
Mert Tumer f32715a7bb rename: loolconvert -> coolconvert
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: I3283cb0d222fbdf1edb09b549ae7945d6370c289
2021-11-17 21:51:05 +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
Mert Tumer c9a4d2f6f3 rename: loolmount -> coolmount
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: Ic025c5a76c6f27cdf1a6267f24cf8052733f1f24
2021-11-17 21:51:05 +01:00
Mert Tumer 5ebabf9f58 rename: loolwsd -> coolwsd only binary
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: Ia44f7f96bcad7200031ad87f6a6fdd3e361f2808
2021-11-17 18:08:19 +03:00
Andras Timar 9a88a95097 --disable-lool-user-checking was renamed to --disable-cool-user-checking at some places, now replace it everywhere
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I881f8b7adfbb396da8beb07c4d0300a153ecd304
2021-11-17 09:56:09 +01:00
Mert Tumer 81f61c8073 rename: loolforkit -> coolforkit
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: I1de688dce4b068bff35451604486b72ecc8c91d4
2021-11-16 21:02:24 +01:00
Andras Timar cde4d9322e add compatibility symlink 'loolconfig' for 'coolconfig'
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I4715b4469d5f11f63eff4b76651eee549000c1c2
2021-11-15 22:07:53 +01:00
Mert Tumer 78ccaa845e rename: loolconfig -> coolconfig
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: Ied23cb46a668f754931fc125745b674b546a0195
2021-11-15 22:07:53 +01:00
Jan Holesovsky 74d601920e Remove even the loleaflet/ dir if it is around
Signed-off-by: Jan Holesovsky <kendy@collabora.com>
Change-Id: Ib264307672ea3fa351a1540fd3f4a6fafdd87d5a
2021-11-10 17:18:56 +01:00
Henry Castro e3ebcb8f09 makefile: rename loleaflet -> browser
Change-Id: Iaaa33e3da68995e3d20ade69e7c70eaf27b32500
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-11-10 17:18:56 +01:00
Henry Castro e0fe47be5f rename loleaflet.html -> cool.html
Change-Id: Iaa28f1269f8192755ec323396ae4ff054529f412
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-11-10 17:18:56 +01:00
Pranam Lashkari f84df1161c quarantine: create hard links for quarantining when file is saved
number of versions to maintain per file can be specified in loolwsd.xml
on exceeding specified quarantine size oldest file(s) is deleted

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: I3ca55b9ab29a82988f19fe0acd43e0fae2c2a423
2021-11-01 17:21:51 +02:00
Pranam Lashkari f02a0a1447 freemium: renamed Freemium namespace to CommandControl
also renamed freemium files accordingly

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: Id33b8a1d1a2a8725bfa6e7b7c562430ea126993c
2021-10-21 12:28:13 +03:00
Michael Meeks b043b6213d Move LOOLWebSocket into test/ - where it can be slowly removed.
Change-Id: I388690261d323377648a1502b927e73f862ad802
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-10-11 13:40:20 +01:00
Andras Timar ab2af84665 Fix Lintian warnings related to man pages
W: loolwsd: bad-whatis-entry usr/share/man/man1/loolforkit.1.gz
W: loolwsd: bad-whatis-entry usr/share/man/man1/loolwsd-generate-proof-key.1.gz
W: loolwsd: bad-whatis-entry usr/share/man/man1/loolwsd-systemplate-setup.1.gz
W: loolwsd: no-manual-page usr/bin/loolmount
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ieb7d2f92076d4d4b6b13bfc3ceb990ff3d8db78e
2021-09-29 21:34:41 +02:00
Andras Timar 30ef4a62d5 fix Lintian errors: binary-or-shlib-defines-rpath
E: loolwsd: binary-or-shlib-defines-rpath usr/bin/loolconvert /snap/loolwsd/current/usr/lib
E: loolwsd: binary-or-shlib-defines-rpath usr/bin/loolconvert /opt/poco/lib

These RPATHs are not needed when we statically link poco, as we do with production
packages.

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I5050fe1f1925937388793d443020fdc6a14ec97d
2021-09-25 19:04:59 +02:00
Andras Timar dad92dee25 remove EULA from source code
... in order to avoid confusion. Binaries that Collabora compile, and
distribute are under a EULA. Source code is not.

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I34c7e089a100b43e6b9c69ee566736a9ae0cb93c
2021-09-23 18:35:52 +02:00
Michael Meeks 860290df2a trace: add make run-trace and clean some duplication.
Change-Id: I912be9aa603125e6fe3a6de234bc4647f0ae2893
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-09-10 22:45:29 +01:00
Michael Meeks 9f4ee5d450 stress: start to implement based on SocketPoll.
Change-Id: I6fba41c826ab70b1f653f6511dac32f10f998259
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-08-17 19:19:46 +01:00
Pranam Lashkari e02e1df76d Introduce Freemium options
Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: Ib6b68ff74839cf84f2d8c8cfb7d380be9209f923
2021-07-20 14:41:18 +05:30
Michael Meeks 1c2bbced33 systemplate: ensure we have write access to directories before cleaning.
Some of the folders we setup from the system are:

dr-xr-xr-x 1 michael users 2824 Jun  9 21:05 systemplate/usr/share/fonts/

before adjustment, and resist removal.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I8e5a96264b98d8091b205f7469bc46c401f47ab1
2021-07-16 19:25:44 +01:00
Tor Lillqvist 64675d2926 Add ProfileZone to encodeSubBufferToPNG
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I7363ea929ba703ce34a5c2411687f120ac5ba59e
2021-06-22 16:43:40 +03:00
Tor Lillqvist d6569159b7 Output a Trace Event metadata event identifying each named thread
Move the generic dummy implementation of
TraceEvent::emitOneRecording() to a source file of its own. (That is
the one which is used in test and tool executables.)

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I81cab07e5a6852b42d278a5446c13c3825cf546e
2021-06-21 12:43:17 +03:00
Tor Lillqvist 8cef48a0fa Introduce a generic TraceEvent class and instant events here, too
Modelled on how it is done in core. ProfileZone is derived from
NamedEvent which is derived from TraceEvent. Here we don't keep any
separate ProfileZone.hpp, though.

This was needed to introduce generation of "instant" events here, too.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I6583134e96001641c50339deb4197fca6ab7d5d5
2021-06-02 09:04:21 +03:00
Henry Castro adbe58bded parallel npm installation
npm installation is taking too long,
it is preferable to process in parallel
while compiling some c++ source files.

Change-Id: Ie04726805723d94227806fb8b30c39909b84cb0f
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-05-27 16:27:14 -04:00
Tor Lillqvist 9c6b74ad08 Use a loolwsd.xml setting instead of --enable-trace-event-logging
That is our convention, and this also avoids a global variable in the
kit process.

Change-Id: I37d2d53aa7eb24f9848fa8ef98bc57d75db90d13
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-19 13:33:26 +03:00
Michael Meeks ded537eed5 make run should log to the console in product mode.
We don't have permission for /var/log/loolwsd.log typically.

Change-Id: I37c04bfba25c4c8241b2d92d77d93e5a3b662d82
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-05-15 17:40:09 +01:00
Tor Lillqvist 9da0145280 Add an --enable-trace-event-logging option to loolwsd
It enables turning Trace Event recording on (and off again). The
option is passed down to the client through loleaflet.html, and to the
KIT processes. If the option is not used, the new JS functions that
send trace events to the server turn into no-ops to avoid wasting
bandwidth.

It is always on in a "make run".

Change-Id: Iafe1919ccba7c376137d3e0568b857e20780bbc8
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-10 12:39:07 +03:00
Ashod Nakashian 3e500107c4 wsd: make: add new files
Change-Id: If0ad0c841658c7ab035f267ab8f0b031c6b71da9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-05-06 22:14:51 -04:00
Tor Lillqvist e7ed4e11cf Add a ProfileZone implementation here, too
Compiled but not yet used.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I3b85696ca6076e42d16e710b49bfd37bac342ec8
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-03 16:09:35 +03:00
Miklos Vajna c66f1d181c make dist: add missing test/HttpTestServer.hpp
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ib5bc2be18421e02e9c00bb1c61e41c4c93f2deb5
2021-04-30 10:38:09 +02:00
Yunusemre Şentürk d6d7b90abe Add net/WebSocketSession.hpp into packaging tarball
Signed-off-by: Yunusemre Şentürk <yunusemre@collabora.com>
Change-Id: Iefeb034022a9cff7537c5d254c211bd4a0622ad9
2021-04-29 14:00:27 +03:00
Miklos Vajna f4759515be fuzzers: HttpResponse is a superset of HttpStatus
HttpResponse covers http::Response::readData(), HttpStatus covered
http::StatusLine::parse(). The first calls the second, so remove the
second.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I163819ca470b766a7bc4694a9c6cfe4919e17963
2021-04-28 09:02:08 +02:00
Miklos Vajna 9afe974848 Add a fuzzer for http::Response::readData()
And remove the httpheader one, which is not useful, since it uses Poco
for the actual parsing, it did not find anything. (If we switch away
from Poco there in the future, it's easy enough to restore it.)

Also fix some problems found by the fuzzer.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I254247c46ecc78c9c3e75aac4f10c441b0e10fb3
2021-04-23 17:54:36 +02:00
Miklos Vajna 80c6562e59 Add a fuzzer for http::StatusLine::parse()
And fix an unhandled std::length_error it found.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I571cdd71caeda84820f2c64088966936637ce2bf
2021-04-23 09:02:21 +02:00
Miklos Vajna f720e280bf Add an initial libfuzzer based fuzzer for http::Header::parse()
Run the actual fuzzer like this:

./httpheader_fuzzer -max_len=16384 fuzzer/httpheader-data/

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I91afe44a632826cc15bd1c338bcc5234582e9674
2021-04-22 15:56:58 +02:00
Ashod Nakashian 935448424f make: build test after JS and WSD
Change-Id: Ifb073e31fedf67f96a877e9d3284bd4fae80c255
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-11 01:05:20 -04:00
Ashod Nakashian 08eab4bc15 wsd: more config features
Change-Id: I2fb33a2d89ab886bc454ae961dbff7b6c2c1b0ef
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 12:43:39 -04:00
Andras Timar 41c5cddc3d forward port packaging bits to master branch
The next version of Collabora Online will be version 2021.
Development of version 2021 will be carried on master branch
for the time being.
The corresponding core branch is distro/collabora/co-2021

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I9c97aaac711c9e1f1e48ed25066b169ea7e26e84
2021-03-31 18:29:49 +02:00
Ashod Nakashian da2309f147 make: delete loolwsd binary if it fails to cleanup
A broken loolwsd may be lurking around, which will
then get used during the next `make` invocation to
cleanup the jails. If it fails, it will break the
build altogether. This is not ideal. In this case,
we delete the loolwsd binary so that we force
building it anew. And in any case it was useless
for make, if it failed to do the only thing that
make needs it for: cleaning up the jails.

The new loolwsd will subsequently get used to
clean any left over jails before running the
tests, so that should be fine.

Change-Id: I76c16b5fc7c6f08308c9fb2e619228f8e0266b74
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-03-13 16:44:09 -05:00
Andras Timar 92f44a4695 On-disk cache was removed long ago, clean-up in packaging
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I2eeaed12af6ac8789151b95a9c2a2aa1fd72573b
2021-01-26 21:10:50 +01:00
Ashod Nakashian 72e9f3d2d6 wsd: asynchronous HTTP/1.1 implementation
This implements HTTP/1.1 per RFC 7230, partially.

Unit-tests are provided with documentation on usage.

This is desgined to serve as the http implementation
throughout loolwsd, for both synchronous and
asynchronous requests.

Change-Id: Iaf1b8c5fcb8cec032445e27c9f70d2fb807aa4dc
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-21 12:36:41 +01:00
Miklos Vajna 78f192399d Revert "wsd: disable ssl by default, enable ssl termination by default"
This reverts commit f6bf6f49ed. I did not
consider that this makes it harder to do a local developer setup with
reverse proxy + make run; also that if you don't read the doc to set up
a reverse proxy, then the default now serves http content and advertises
https, which is not helping sysadmins.

This needs more thinking how to improve one scenario without hurting
others.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ic789faa2dc5bb19a79d651dc81d4eaaf0b48607a
2021-01-14 13:59:44 +01:00
Ashod Nakashian ce3dd02ef3 wsd: new NetUtil file for network utilities
Move the connect function into the NetUtil
translation unit to aid using it for the
upcoming async socket logic.

The NetUtil should also come in handy for
the miscellaneous network helpers we have.

Change-Id: I2ee0c6e3e1769fd87572d7407d3b4979b59ffe6a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-13 22:05:18 -05:00
Miklos Vajna f6bf6f49ed wsd: disable ssl by default, enable ssl termination by default
The intention is to have defaults which are close to how people
typically use Online in production.

However, keep using ssl for 'make run', so that the https environment in
the browser is unchanged.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I7fd725a83b0e9ca1012f2c0e0c3bf038e5fa0059
2021-01-13 13:33:44 +01:00
Michael Meeks 317dffb817 Optimize copy of jails to hard-linking with new capability.
In some cases we cannot do a fast bind-mount of the files we want
in our jail since we don't have cap_sys_admin for loolmount inside
eg. docker.

Thus we need to fallback to hard-linking, however various security
systems namespace parts of our tree, such that link() fails with
EXDEV even across the (apparently) same file-system.

As such we need to assemble a copy of what we want to hard-link
close to our jails. However, this needs to be owned by root / the
system to avoid having writable files shared between jails. Hence
we need cap_chown in addition to cap_fowner, to get ownership right
and then hard-link.

Change-Id: Iba0ef46ddbc1c03f3dc7177bc1ec1755624135db
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-01-04 15:05:36 +00:00
Ashod Nakashian 9bbd273e91 wsd: test: leverage the log system in TST_LOG
This moves the test log macros into a new home,
test/testlog.hpp, to avoid cycling dependencies.

Change-Id: Iacb80e813a64ff830fa18f63ec4de2535ee702b7
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-28 12:04:53 -04:00
Michael Meeks e00392647b pure re-factor, creating Buffer class to wrap vector.
For large transfers eg. image previews, particularly with SSL's
protocol limit of 16k byte blocks, we see lots of inefficiency
repeatedly copying a 20Mb image and shuffling it down a
std::vector as we write data out.

Change-Id: I620568cad2e6f41684c35289b0ee77cf7f59c077
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2020-11-29 19:27:23 -05:00
Jan Dageförde c543e44150 Provide methods that output error headers into the socket
Signed-off-by: Jan Dageförde <jan.dagefoerde@googlemail.com>
Change-Id: Ia354248b824662fa4b47acee61ac444832eeb302
2020-10-28 13:12:27 +03:00
Jan Holesovsky d26248b666 Fix build with ./configure --disable-setcap.
Change-Id: I1bb1b898f990b2353ff5956af4db9d25c46521f4
2020-10-07 17:58:24 +03:00
Miklos Vajna 9619517a10 git hooks: enable them automatically during 'make'
So one can't forget enabling them.

Change-Id: Icb595e9d0711227eaa6f11c1a9ff87f2c361e0bb
2020-10-07 12:54:47 +02:00
Jan Holesovsky 4ad8773821 Make various bits of the UI configurable.
This adds the infrastructure to be able to pass the info which elements
like the statusbar / ruler / sidebar are supposed to be shown or hidden
on startup of the editor.

Change-Id: I188264dec6961074444934ff5fd7088e23b170d4
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/103169
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Mert Tumer <mert.tumer@collabora.com>
2020-09-28 11:53:16 +02:00
Ashod Nakashian 29a5a1f1e9 wsd: move jail setup to the script to support readonly systemplate
We now gracefully fallback to copying when/if systemplate
is readonly.

The bulk of the change is to support proper cleanup in
both cases.

First, we had to move as much of the jail bootstrapping
into the loolwsd-systemplate-setup script, so systemplate
will be as complete as possible before it is locked down.
Next, we needed to update the jail with graceful fallback
to linking/copying upon failure. For that, the jail setup
logic in Kit.cpp has been reworked to support not just
update failures, but also more comprehensive mounting
failures as well.

Finally, jail cleanup now is seamless. To support proper
cleanup when we had mounting enabled but had to fallback,
we mark jails that aren't mounted so we can 'rm -rf' the
contents safely and without fear or causing undue damage
(as unlikely as that is, technically we wouldn't want to
rm systemplate files, if mounting read-only had failed).

There are a few minor refactorings of JailUtil to make
it cleaner and more robust.

Change-Id: Iac34869cb84f45acf64fbbc46d46898367b496d2
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/101260
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
2020-08-25 07:58:30 +02:00
Miklos Vajna 9b620cb40b libfuzzer: fix build
libfuzzer only produces fuzzer binaries, not a loolwsd binary, so don't
expect it in the libfuzzer case.

Change-Id: Ib818667031665aa60a447ddd5edd3a09bca76e18
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98910
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-07-16 16:34:35 +02:00
Tor Lillqvist 63620b1823 Re-factoring to make re-use in a next-gen iOS app easier
Change-Id: I1656d38fb8ad4213417b8c00c0c84540e0eacdbe
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98499
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-07-11 06:14:46 +02:00
Ashod Nakashian 71a9d21d3e make: don't clean compile_commands.json
Since this file is only created manually,
it shouldn't be removed automatically.

Change-Id: I8d26b7bfc7f7cd899318b2edd3e5ef9bd462cc99
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98184
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-07-06 13:47:27 +02:00
Yunusemre Şentürk 187aefb626 Fix lool user control issue on packaging
Change-Id: I1e75279f955a74da5f167dff4648d142af51ab1b
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98192
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
2020-07-06 10:41:14 +02:00
Tor Lillqvist 3edc4d2201 Move the setupKitEnvironment() function into a file of its own
A small re-factoring to help planned re-plumbing of the iOS app.

Change-Id: I21f09216a7c5adf965179765a75f5a0d521cd7f3
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97771
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-07-03 08:40:49 +02:00
Ashod Nakashian 9041f14f00 make: cleanup before removing loolwsd binary
Change-Id: I28dbb165a716646ce5e423e28980ba41ca81d18f
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97782
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-07-03 02:03:39 +02:00
Ashod Nakashian a062581be6 make: improve cleanup dependency graph
Change-Id: I8a7edd3b49a272cb7bd8bff4d91b189a5856c5c8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97647
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-07-02 02:32:43 +02:00
Ashod Nakashian 9a427524d1 wsd: support --cleanup in loolwsd
Leaving behind jails with bind-mount
entries makes build-workspace removal
complicated, and jenkins builds start failing.

The cleanup stage is integrated in Makefiles
and should be transparent.

In the event that manual cleanup is necessary,
'loolwsd --cleanup' can be invoked.

Change-Id: Ia4b99b0c66e56dfa2d50e79b0ba98f714cf32886
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97470
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-07-01 06:14:39 +02:00
Ashod Nakashian 5c9988f2e3 wsd: faster jail setup via bind-mount
loolmount now works and supports mounting and
unmounting, plus numerous improvements,
refactoring, logging, etc..  When enabled,
binding improves the jail setup time by anywhere
from 2x to orders of magnitude (in docker, f.e.).

A new config entry mount_jail_tree controls
whether mounting is used or the old method of
linking/copying of jail contents. It is set to
true by default and falls back to linking/copying.
A test mount is done when the setting is enabled,
and if mounting fails, it's disabled to avoid noise.

Temporarily disabled for unit-tests until we can
cleanup lingering mounts after Jenkins aborts our
build job. In a future patch we will have mount/jail
cleanup as part of make.

The network/system files in /etc that need frequent
refreshing are now updated in systemplate to make
their most recent version available in the jails.
These files can change during the course of loolwsd
lifetime, and are unlikely to be updated in
systemplate after installation at all. We link to
them in the systemplate/etc directory, and if that
fails, we copy them before forking each kit
instance to have the latest.

This reworks the approach used to bind-mount the
jails and the templates such that the total is
now down to only three mounts: systemplate, lo, tmp.

As now systemplate and lotemplate are shared, they
must be mounted as readonly, this means that user/
must now be moved into tmp/user/ which is writable.

The mount-points must be recursive, because we mount
lo/ within the mount-point of systemplate (which is
the root of the jail). But because we (re)bind
recursively, and because both systemplate and
lotemplate are mounted for each jails, we need to
make them unbindable, so they wouldn't multiply the
mount-points for each jails (an explosive growth!)
Contrarywise, we don't want the mount-points to
be shared, because we don't expect to add/remove
mounts after a jail is created.

The random temp directory is now created and set
correctly, plus many logging and other improvements.

Change-Id: Iae3fda5e876cf47d2cae6669a87b5b826a8748df
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92829
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-07-01 05:42:43 +02:00
Tor Lillqvist 7f25109f72 tdf#128502: Chunk of work to enable "multi-tasking" in the iOS app
Seems to not cause any serious regressions in the iOS app or in "make
run", but of course I am not able to run a comprehensive check of all
functionality.

Change-Id: I44a0e8d60bdbc0a885db88475961575c5e95ce88
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93037
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-06-26 13:09:51 +02:00
Ashod Nakashian 68bdbcf798 wsd: remove unused QueueHandler
Change-Id: Iec80d2afb1762175088b92a6e7140b0ca863a483
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95339
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-06-02 17:26:08 +02:00
Michael Meeks dec683218a Proxy: move RequestDetails to its own header.
Share it with various other places requiring similar data.

Change-Id: I873f56798f5a34dcf7440456bd649b68f6d3df98
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94069
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-05-12 20:30:17 +02:00
Michael Meeks 18c4301a1f Proxy: re-factor proxy handling into ServerURL and cleanup copy/paste.
Also adds ServiceRoot handling for clipboard.

Change-Id: I7bc6591130fcc7d693e59ab8561fb9e99f4e93d5
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93578
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-05-06 23:12:12 +02:00
Michael Meeks bf0662bda1 Proxy websocket prototype.
Try to read/write avoiding a websocket.

Change-Id: I382039fa88f1030a63df1e47f687df2ee5a6055b
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92805
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2020-04-24 13:09:09 +02:00
Andras Timar 25bc0a1088 Proof: add loolwsd-generate-proof-key helper script
Change-Id: Ibbd99b6431b1a2992c520d3fad5f52d0770905f6
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92788
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
2020-04-23 19:36:06 +02:00