Commit graph

1725 commits

Author SHA1 Message Date
Tamás Zolnai
d0deb5eaa0 wsd: filter-out redundant 'formfieldbutton' messages.
Signed-off-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Change-Id: I37834c63631fa44c9d37c9e1a4d448c1fef68c9e
2021-02-10 16:51:30 +01:00
Ashod Nakashian
bafcc98285 wsd: support FileUrl
Change-Id: I433b5f79956be9d8557df1a1f433a99d6ae10f65
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-09 10:45:37 -05:00
Ashod Nakashian
ec58e833e8 wsd: refactor downloadStorageFileToLocal
Prepare to support FileUrl.

Change-Id: I0ac4eccb937653ba86e74c2e6cecb7ddd5dd4ffe
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-09 10:45:37 -05:00
Ashod Nakashian
f7d61ae0d3 wsd: remove single-use member
And a couple of const cases.
The removed const is to allow move on return.

Change-Id: I7a81b531e75c39379871f5ffeb82d49ba1110ab1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-09 10:45:37 -05:00
Aron Budea
c4faeb049b wsd: tweak SSL logging
Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: I4e1e4f99cd2ac3d21b9426602de11e10bdd47a61
2021-02-06 21:43:03 +01:00
Ashod Nakashian
2304b52587 wsd: correct assertion on storage and not tilecache
We already access _storage before the assertion,
so it must move before the first use.

Also, we have no use for _tileCache when uploading,
so no point in asserting its validity here.

Change-Id: I4196d0719e6750cfd2dba8d5f449a1b76286bde9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-31 22:20:59 -05:00
Ashod Nakashian
8a37738fdb wsd: documentation of DocumentBroker states
This details the design of the DocumentBroker
states and state-machines as they are to be
eventually implemented. Not everything described
is current, but the goal is to document what
the design ought to be, not what it is.

Change-Id: I938177812777af058b46c41a396407d0a083cbc4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-31 22:20:59 -05:00
Ashod Nakashian
aba6d5b6c5 wsd: log at info level when we force uploading
Change-Id: Ic6da7e2c0f29ddbf5884b75866794609f69f8a8f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-31 22:20:59 -05:00
Ashod Nakashian
523cfec790 wsd: save -> upload
Change-Id: I08445bd9f726225809c443f4bdfc611bbfc03bf6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-31 22:20:59 -05:00
Ashod Nakashian
30f7ea2e9a wsd: remove default arguments of uploadToStorageInternal
Only the last argument (force) was implicit, and only
in one call (of total two calls). Explicit is better.

Change-Id: Ic26f4dd265f48156d1730f1b95bb70145ca47873
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-31 22:20:59 -05:00
Ashod Nakashian
2b96bf3fd6 wsd: move the loaded flag into DocumentStatus
The loaded flag is used to track whether or not
the document was ever loaded. It does *not* reflect
whether or not the document is currently loaded,
rather it is used to save the document, if necessary,
before unloaded.

This is why we need to track it as a separate boolean,
rather than implicitly tracking this state via the
DocumentState enum, which would not be able to
differentiate between a failed-to-load state and
one of a normal end-of-life, after loading.

Change-Id: I1fc3fb09c31cadf7ebb6b0123e462e78dd0af356
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-29 09:22:36 -05:00
Ashod Nakashian
048c468caa wsd: move the markToDestroy flag into DocumentStatus
The markToDestroy flag tracks whether or not the
document is in the process of being unloaded.

Change-Id: I8f2339f75ed6d7c5d318eb1d467d6a9cbc1d61c2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-29 09:22:36 -05:00
Ashod Nakashian
1041346928 wsd: move the closeRequested flag into DocumentStatus
The closeRequested flag tracks owner termination.

Change-Id: I91d7491396cd8db6ca493ba8015a5310c361a2f3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-29 09:22:36 -05:00
Ashod Nakashian
ca0c2a24cc wsd: introduce DocumentState class
DocumentState is responsible for tracking
the state of the document, properly documenting
the different stages of the document lifetime
and encapsulating all the relevant members.

DocumentState is still unused in this commit.

Change-Id: Ic2c8de3a9f2d42c5550c5f4ad5f889040f697890
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-29 09:22:36 -05:00
Ashod Nakashian
b4dd9f82a3 wsd: saveToStorageInternal -> uploadToStorageInternal
Change-Id: I0273314d65ebee91092a883bebeb53ab31051194
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-26 21:40:59 -05:00
Ashod Nakashian
f14034584f wsd: saveAsToStroage -> uploadAsToStorage
Change-Id: I6edbff6da6b2c29000c0a66524266138aeb88b89
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-26 21:40:59 -05:00
Ashod Nakashian
ed1e08662a wsd: saveToStorage -> uploadToStorage
Change-Id: Ie00728ca81d481676ae3a3c44d8d79e80ee29278
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-26 21:40:59 -05:00
Ashod Nakashian
a176213750 wsd: lastStorageSaveSuccessful -> lastStorageUploadSuccessful
Change-Id: I71618e388f44ac7b74f295c8af5d0235b395fe87
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-26 21:40:59 -05:00
Ashod Nakashian
7a9dc03e46 wsd: DocumentBroker documentation
Change-Id: Iaacb2bb961719e23ef0e955587d70f38ef5ce464
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-26 21:40:59 -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
Tor Lillqvist
b92e13de96 Add an ERROR message from client to server that is logged with LOG_ERR()
Change-Id: If9f3316bb07f68b609c96135227a3e06a1112786
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-01-26 15:24:08 +02:00
Tor Lillqvist
e60f972b05 Correct description of handling of the DEBUG message from the client
Change-Id: I19fd4ed92315908af36362368ee2fdbc8558c2ae
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-01-26 14:38:46 +02:00
Tor Lillqvist
cb63bb6bed Log the DEBUG messages from client with LOG_DBG and not to stderr
Change-Id: I4fbb05b3b703ebcd1221faafd1ab3e33a1f8f144
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-01-25 14:24:43 +02:00
Ashod Nakashian
21b1a54d00 wsd: access _isLoaded member via getter
This prepares for moving this flag into
the upcoming state machine.

Change-Id: I0fa0e26f72a8f4da6813c3be6df5b16a94773591
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-23 23:55:43 +00:00
Ashod Nakashian
c12313676e wsd: cosmetic
Change-Id: Ie0df45003a0d4221c4e03ad093229cb703e6bf3a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-23 23:55:43 +00:00
Ashod Nakashian
f038204021 wsd: load -> download
To differentiate between the different stages
of document lifecycle, fetching documents
from the storage is now called 'download',
as opposed to the previous 'load', which is
reserved to loading document in Core.

This is a cosmetic renaming to avoid
confusing usage and intent going forward.

Change-Id: Ib9451e6f73bab19b877a3e6c8fb5b17ba82a06ab
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-23 23:55:43 +00:00
Michael Meeks
f4008cd979 clipboard: give a more explicit clustering error earlier.
Change-Id: I3050fd5f9e66174ece03620e956ee394684f369f
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-01-15 09:31:22 +00:00
Ashod Nakashian
18446d63cf wsd: test: don't report test timeout outside of tests
Change-Id: I6c5042578a3b718e2305139c0e4ea390b4a43ed3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-13 22:03:29 -05:00
Ashod Nakashian
307900ef9f wsd: misc and cosmetics
Change-Id: I407a20af9297278bdfd06ef3587cdb1d5fff0195
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-13 16:24:29 -05:00
Ashod Nakashian
6713c2a8d5 wsd: avoid reading the config entry more than once
This code is executed regularly, at every poll.
The config getter internally throws exceptions,
catches and handles, before returning. While
this isn't performance sensitive, it is noisy
to have such poor-behaving code executed
frequently and regularly.

But the real motivation is the pain this exception
causes when debugging an exception. GDB ends up
catching this rogue exception, which is hardly
useful or helpful.

At any rate, we don't need to get a config entry
more than once, as they can't change during the
lifetime of the process.

Change-Id: Ic69fb94674b74b298987131d44d9baa27e9fa4aa
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-13 16:24:29 -05:00
Ashod Nakashian
06c5c90dd5 wsd: test: support SSL in classic tests
Add support for configuring the SSL certificates
when running the test binary as well as setting
up the SSL context.

Also adds the SSL socket headers with proper
compile-time guards for when SSL is disabled.

Change-Id: I99992639a66a64871f8ff8a2b2105279ead63ca1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-13 08:07:06 -05:00
Ashod Nakashian
feac95ab77 wsd: test: shorter poll interval during tests
Technically, the poll interval should be
irrelevant because the tests should wakeupWorld
when they need to break the poll. However, it
turns out that many tests implicitly rely on
the poll interval to be large, and if for
any reason the poll wakes up, the tests either
advance their phase too soon, or assert, causing
random failures and reliability issues.

As the tests should now be more robust (at
least the ones that were non-deterministic
in this way), we can now lower the interval
to catch other cases (either extant or in the
future).

Change-Id: Id0d472e70875db8669bb21c6582b0d5052b19bfb
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-13 08:07:06 -05:00
Ashod Nakashian
1fb968ac08 wsd: test: remove redundant wakeupWorld and log the exit status
And introduce passTest and failTest to log a reason
and be more informative when reading logs.

Change-Id: I5090793b802a29135de8ea3783a457e189cc7df3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-13 08:07:06 -05:00
Ashod Nakashian
07cf0d52ef wsd: default UserFriendlyName if missing
While UserFriendlyName is an optional field
in the WOPI protocol, Core needs it for
the Author of the document. When it's blank
the Author is not set and the document fails
to load.

By default we are at least able to load the
document with a sensible placeholder for the
Author. Meanwhile, we log a warning to let
the integrators know of the issue.

Documentation updated.

Change-Id: I4dd2c9d164b4d889f85701a4a27ee8d395bff220
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-11 22:07:21 -05:00
Henry Castro
722a152caa wsd: disable setting "SAL_LOG" in "DEBUG" mode
The development environment is necessary analyse
the logs, so disable setting SAL_LOG instead to
add a parameter to already a long list of options

Change-Id: Id8e4a66e1dcb32c636806e47e1d69270af4c53f5
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-01-11 08:15:39 -04:00
Ashod Nakashian
e8a5b4843c wsd: UploadResult cleanup
A minor cleanup of UploadResult to make tidy
it up a little bit and make it less specific.

Single-argument constructors should be explicit
to avoid unexpected conversion and other surprises.

Change-Id: I57599805743dffddac620f501dc6ca79c2217f89
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-10 11:13:27 -05:00
Michael Meeks
234962dc79 Remind admins of the costs of high log levels.
Change-Id: Ie83ec794eb0962b6ecf3f1f7b201390d19fb0958
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-01-04 17:39:45 +00: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
01138d7ae0 wsd: save errno before invoking any other functions
Most C and Posix API clobber errno. By failing to save
it immediately after invoking an API we risk simply
reporting the result of an arbitrary subsequent API call.

This adds LOG_SYS_ERRNO to take errno explicitly.
This is necessary because sometimes logging is not done
immediately after calling the function for which we
want to report errno. Similarly, log macros that log
errno need to save errno before calling any functions.
This is necessary as the argements might contain calls
that clobber errno.

This also converts some LOG_SYS entries to LOG_ERR
because there can be no relevant errno in that context
(f.e. in a catch clause).

A couple of LOG_ macros have been folded into others,
reducing redundancy.

Finally, both of these log macros append errno to the
log message, so there is little point in ending the
messages with a period.

Change-Id: Iecc656f67115fec78b65cad4e7c17a17623ecf43
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-29 11:40:17 +00:00
Ashod Nakashian
0072a4080e wsd: test: log timeout better
Change-Id: I3643a2bad8611d1f6402615435295717eb2e93c1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-28 12:04:53 -04:00
Ashod Nakashian
693a2e19e3 wsd: SocketPoll::poll accepts chrono duration
Cleans up some of the conversions and implicity
unit in integral types.

Change-Id: I79f35b92f8f631894e55bdb39851b050870fce96
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-22 11:24:13 -05:00
Ashod Nakashian
13d7d23cbe wsd: use chrono for readability and conversion safety
Change-Id: If5d478605fef0199b331d91310673a460e70d48e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-22 11:24:13 -05:00
Ashod Nakashian
693ac2fa52 wsd: logs and const
Change-Id: Id7e4f81ab9709b62eddfa747479ab593a5ad45a2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-22 11:24:13 -05:00
Miklos Vajna
f77c8076a7 wsd: fix crash on renderfont when the doc broker has no tile cache
Happens when renderfont is called without first loading a document.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I1152d1f4b3f610364e22c406cda5494672f20aed
2020-12-21 10:23:56 +01:00
Michael Meeks
e5b2d3381f Check ENABLE_DEBUG conditional correctly.
Avoiding some debug code ending up in the product.

Change-Id: If37b2986f134986a33b9dd5b4729b50c56cbc248
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2020-12-10 11:53:02 +00:00
Miklos Vajna
8b0ab31864 WopiStorage: fix uninitialized reads
Change-Id: I603a5205f111b7c8f99baecd6ed482fc9502a6d5
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
2020-12-10 09:35:25 +01:00
Ashod Nakashian
583c627a66 wsd: avoid single-character strings
Change-Id: I709e8e797bc5e68984823d8c46c590e109d23f18
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-09 17:19:58 +01:00
Ashod Nakashian
a26d587760 killpoco: use standard data types where possible
Change-Id: I723797be18f6eba1e494639f5698c0d8d9a665bc
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-09 17:19:58 +01:00
Ashod Nakashian
8298fdb2d6 wsd: cosmetic and consts
Change-Id: Ibb4bb7c527f68786bd6288b407008a3e3a7b2e17
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-09 17:19:58 +01:00
Ashod Nakashian
a76375234d wsd: remove unsused return values
Saving documents to storage also logs and broadcasts
the result to the users. Return values from these
functions are ignored, and anyway not actionable.

Change-Id: Iaf0dab9c6ac8c593e4df292c71fcb30e8b6d7eeb
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-09 17:19:58 +01:00