Commit graph

727 commits

Author SHA1 Message Date
Tor Lillqvist
ed8c10dfb1 nftw() does not set errno on failure
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I7e768416b5113d71330148227aeceb941013c578
2022-03-25 21:29:53 +01:00
Ashod Nakashian
97a6d1cd98 wsd: support experimental features
This adds a new config option to enable/disable
experimental features and behavior. The default
value can be controlled at build time by
--enable-experimental.

Change-Id: Iffcb4c71d9e0933a646251b63033b6dadcd3b809
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-03-17 18:46:46 -04:00
Dennis Francis
f12a6dd370 kit: restore curly braces
Signed-off-by: Dennis Francis <dennis.francis@collabora.com>
Change-Id: I78b181dacc09dbfc47e3702db8ca9b0083d135e4
2022-03-17 18:31:41 +05:30
Dennis Francis
8af039251d kit: can't open password-protected files
Reproduction:
Opening a password protected document gives an error corresponding to
'faileddocloading' and then a blank file is displayed.

Fix:
Since 0b76383346, when Document::load()
fails without any exception, onLoad() sends

"error: cmd=load kind=faileddocloading"

to the client. This is a problem when load() fails just because the
client did not provide password for a password protected document.
Besides for all "exception free cases" load() already sends the correct
error message(s) to the client. So this patch also avoids sending
duplicate error messages.

Signed-off-by: Dennis Francis <dennis.francis@collabora.com>
Change-Id: I422740ab8855ed772461c23f42a5443afb729bb5
2022-03-14 12:56:20 +00:00
Ashod Nakashian
4322f87d92 wsd: improved forkit logs
And avoid pid of 0 in getKitPids().

Change-Id: I68743a55aed080ed54d7d8576f269974c644e1b2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-03-09 19:24:40 -05:00
Kristopher Maxwell
cb6a5fd4ad Remove unused parameters in ChildSession
The buffer and length parameters were unused in methods in ChildSession.

Signed-off-by: Kristopher Maxwell <kristophermaxwellc@gmail.com>
Change-Id: I6aff3c92a5d787db84bbe64aa13f2f0160340f7f
2022-02-28 07:13:11 -05:00
Ashod Nakashian
6c28ddb07c wsd: exit the kit when we fail to connect to wsd
This prevents the kit from becoming a zombie
when it has an early failure to connect to WSD.

Change-Id: I4e8203b2cc3d80822308236e5b47be0c0c96e9ae
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-02-24 07:38:13 -05:00
Ashod Nakashian
15e600ed9d wsd: exit forkit when WSD dies
This may happen due to various reasons and
is most commonly observed during heavy testing.

We now detect when our parent has exited and
we exit forkit as well, since otherwise it
would be a zombie consuming resources.

Change-Id: I71de0315fe7bee419a9e7d0b564630ff75ae15eb
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-02-24 07:38:13 -05:00
Michael Meeks
0b76383346 Send error on failed load and/or exception during document load
This avoids an endless spinner for the loading mobile app in this case.

Change-Id: I047797cbdb066a236afc40337d2eba08f9c0c84b
2022-02-19 22:15:46 +00:00
Ashod Nakashian
f8b05a0f83 wsd: support unattended runs
With --unattended, do not wait for a debugger
upon seg-faulting. This avoids the unnecessary wait
that prolongs failed unit-tests in automated runs.
Now run_unit.sh and Cypress Makefile set this flag.

Note that the wait only happens when in debug
builds, or when envar COOL_DEBUG is set. This
prevents us from waiting when running a debug
build where we can't see the output, or indeed
the run is on a CI build machine.

This flag can also be used by devs when reproducing
failures where there is no interest in attaching
a debugger. The logs are shorter and more
readable, too. At least in trace level.

Change-Id: Ice15482c6724abc47f5955402295198eb7f671ee
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-02-17 18:52:48 -05:00
Pranam Lashkari
7e22a01d4d refactored feature disabling bits
now it is known as feature locking

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: I2935edbfe1eb8dcc194641afa2461cf77b2b29d3
2022-02-11 17:00:11 +00:00
Ashod Nakashian
2444e28059 wsd: reduce noisy logs
This reduces some logs from debug to trace,
especially in Socket where the amount of
activity is high, but the logs in question
don't add value in debug level.

Also supressed an error when superfluous.

This makes debug-level logs much more readable
and relevant to the main events.

Change-Id: Ie2698b56f320d15a09060cf2877477d9da0e1582
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-02-04 10:26:49 -05:00
Pranam Lashkari
d4c7aaa4c4 fixed master slide previews not being updated
after switching to master view previews would remain unchanged
this patch will invalidate tiles for all the previews

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: Ie7320d625bd95fe80fc76a459b576d6148b39276
2022-02-04 01:16:13 +05:30
Dennis Francis
edee504da5 kit: prefer char literal instead of string
Signed-off-by: Dennis Francis <dennis.francis@collabora.com>
Change-Id: I636092327e5d656d2bf4df207c99e712bd773ac5
2022-01-12 12:05:10 +03:00
Dennis Francis
0f3850fb6c calcRTL: include sheet RTL info in status message
Also parse and use these in js side.

Signed-off-by: Dennis Francis <dennis.francis@collabora.com>
Change-Id: Iff86d994002ddf9f59a814eca77a288186f401d8
2022-01-11 21:21:27 +01:00
Ashod Nakashian
0a5df03387 wsd: improved logging around session add/remove
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit c8acc9d080b73099f8c51a554c0af22d7b8a6fe0)

Change-Id: Iea545095c1276ce5830a9af038322ecb2c78a9d2
2022-01-11 09:28:03 +01:00
Ashod Nakashian
c93d0688b3 wsd: handle the modified status for inactive views
The modified status is normally broadcast to all
views. This works fine, except with async disonnection.

With two views, one inactive, if we disconnect both,
we cannot know which disconnection will be processed
first. Depending on the order, the second one
will be used for saving. If it is the inactive user,
we will never see that the document has been saved
successfully, because we would have the modified
flag set to true and the message that updates
it to false (after saving) will be dropped.

This scenario was reproducible fairly reliably
in HTTPWSTest::testSaveOnDisconnect.

Here we make sure that we pass-through the
ModifiedStatus for inactive users as well,
since this flag is used for housekeeping.

Change-Id: Iac9ac5ee5f4bc4035587c8e34a756cddb5bddb9f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit ff32851738d4412e4a6e2de5380c17647b1a6fcc)
2022-01-11 09:28:03 +01:00
Michael Meeks
15dc307107 signal activity: add some more helpful call sites.
Based on previous crashes, it is useful to have more granularity
on what happened last.

Change-Id: If18a3a4d7817be23a6f8aadd301827a8e1bc007e
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-01-10 13:03:37 +00:00
Michael Meeks
9354fc829d signal activity dumping; overdue cleanup / re-factor.
Change-Id: I7cb3047488f6daffbb5de285dfc5631c4dd89c8e
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-01-10 13:03:37 +00:00
Gleb Popov
c2364222c2 Do not enter capabilities mode on FreeBSD in the forkit process.
This is too restrictive security measure, so turn it off for now.

Signed-off-by: Gleb Popov <6yearold@gmail.com>
Change-Id: I6f158ed4ed77f6508c9effbad5307d43e9e5461b
2022-01-03 15:59:39 +01:00
Tomaž Vajngerl
b9545f932c support for a custom path to NSS certdb files for sign/encrypt
The path of the NSS certdb is defined in the coolwsd.xml config
file and if the config file is set and contains the certdb files,
then the db files are copied to the jail into /tmp/certdb folder.
Also the /tmp/certdb path is set to LO_CERTIFICATE_DATABASE_PATH
env. var, which is then used as the default certdb in LibreOffice
when LOKit starts up.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: I72e8f28f27a0306fef9319bc6212cd99cb3f8212
2021-12-15 06:00:55 -05:00
Mert Tumer
5d7cfcd861 check if we save-as successfully before proceed with downloadas
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: I77c76f424a5767a19be812f35dfadf9e56cbfb20
2021-12-14 18:57:13 +03:00
Mert Tumer
a809df68b0 fix double encoding url on convert-to
Problem is, all save-as requests received urlencoded
but when it is a wopi request we change the url bit of the message
with correct path jail filename parts. At that stage it becomes decoded
already. saveAs in the core also decodes the url and thats why we should
re-encode it. But unless it is a wopi request it should be already
encoded and we should not re-encode it again.

Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: I08b3a1cff6c3aa9271222c255f4a35aa5b984819
2021-12-08 10:40:26 -05:00
Mert Tumer
688b65a390 fix saveAs for files with encoding characters
Appearently core expects encoded path for filenames on saveas
and decodes it at the end.

So if the file name is something like a%20b
and it becomes a b in the storage.

Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: Ib200c92859b4ab3f262cfe88747563c42e2c6a5c
2021-12-03 09:26:36 +03:00
Pranam Lashkari
63608ba358 kit: removed back compatibility of textinput message
removed support for parameter "type" which is no longer sent with textinput

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: I97bb7e80fe9cc3bb0768fd37b0c15983310a538c
2021-11-30 19:44:25 +05:30
Szymon Kłos
41122e0e5f notebookbar: activate in core when default ui mode
Core needs "notebookbar" ui mode string to activate
notebookbar widgets. If we pass "default" notebookbar
is not activated and style previews widget doesn't work.

followup for b4f588ea3c

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I758dee279c6da8b3fd41e5121f2eb2336539f327
2021-11-23 19:47:25 +01:00
Ashod Nakashian
242e226a5f wsd: fix 'potentially uninitialized' variables
With --with-sanitizer=address, a number of variables
get flagged as 'potentially uninitialized.

There are only a handful of these, so fixed.

Change-Id: I7ffc78b8cfd152a56ed81d97b5cd3660ce5b16b6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-11-23 09:31:46 +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
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
Henry Castro
23afa3843c kit: rename 'lool' -> 'cool'
Change-Id: I4198570d9940a028f1b4d84666a80516174c2f7a
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-11-17 09:18:38 +01:00
Henry Castro
c07928bf40 misc: more renames 'lool' -> 'cool'
Change-Id: I2d392eef3dff23f2f8737e57bb977fa060ab8ea5
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-11-17 09:17:50 +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
Henry Castro
d399b46dc1 kit: update comments
Change-Id: Iad4844effdb6b984fe33a08d15dc837d6ff3f364
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-11-10 17:18:56 +01:00
Pranam Lashkari
fac6e261fd jails: kit: name temporary directory with jail is instead random name
jail-id is already used a sub-directory of each tmp dir,
so there is no more "information leak" in making the tmp directory name itself match the jail-id

further naming it with jail id helps in referencing that directory for hard linking when quarantining a file

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: Iaa635f44d1cd99571a9571113ce1cc92e203fddb
2021-10-22 09:00:04 -04:00
Hugo Peixoto
b2abb5e4aa Use tokens.equals() instead of tokens[] ==
This prevents additional strings from being allocated.

Signed-off-by: Hugo Peixoto <hugo.peixoto@gmail.com>
Change-Id: I84b1e5cf4d11bf8512febe068b3097770b63dc5c
2021-10-21 13:36:57 +02:00
Pranam Lashkari
f88a38a4e7 LOK: unifying the Freemium and uno command hiding APIs part 2
* replace vector with unordered_set
* avoid sending multiple blocking messages

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: I2f714e4f2797ade4ac9d5b4f824855bba31031c4
2021-10-21 12:28:13 +03:00
Pranam Lashkari
0afaefc85c LOK: unifying the Freemium and uno command hiding APIs
Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: I39637abef246ffdc02ef653a0de9001cc03cdaa0
2021-10-21 12:28:13 +03:00
Pranam Lashkari
88601440d0 introduce way to hide/restrict uno commands
Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: I1225190a67f726832e5b38a7c3f690b51c1385f3
2021-10-21 12:28:13 +03: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
Hugo Peixoto
7bf0ead625 Optimize startsWith calls on StringVector elements
There was a pattern of calling Util::startsWith on StringVector
elements:

- Util::startsWith(tokens[0], "boo")
- Util::startsWith(tokens.getParam(token), "boo")

These two expressions would cause a new string to be allocated and
immediately released. To optimize this, a StringVector::startsWith
method is introduced.

This method works by calling compare directly on the underlying
StringVector string, avoiding creating a temporary string.

Signed-off-by: Hugo Peixoto <hugo.peixoto@gmail.com>
Change-Id: I6f27d5bb13783f39c7d4ce0644a11e57b0071244
2021-10-15 13:58:26 +02:00
Mike Kaganski
d1bc6911b5 Escape strings in JSON
This should take care e.g. for SharePoint user IDs, which have the
form of "domain\username", and the backslash must be escaped.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I75936070ad1661dc9b03e05a19b64159b0758018
2021-10-13 16:29:50 +01:00
Henry Castro
8b87f63325 kit: fix status indicator finish
Unfortunately the sequence message sent
from LO core is important, and the status
indicator finish should arrive to client side
before any dialog interactivity (i.e. Macros Warning Dialog).

However the LO core sends like 3 times status
finish for now we cannot duplicate them.

Change-Id: Ieee2ee93555b50b0e67507aae36096e10728a038
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-10-04 10:08:58 +02:00
Ashod Nakashian
ff1ff12663 wsd: each view handles its own url params
Change-Id: I0c6b9b86c970b1f45e7fa34d030f08c6f256d082
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit d4aa0a0f73eef5a90a14a2297f3050c1dba95a2d)
2021-09-26 17:02:01 -04:00
Tomaž Vajngerl
b31eb2ab92 New POST service to render a search result + unit and integ. tests
This adds a new service render-search-result, which renders an
image of the position where, the search fund a hit. The search
result contains the information in which object or paragraph,
which is just the node id and node type from the document model.

The service takes the document and the search result (xml file)
as the input and returns a PNG image as the output.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>

Change-Id: Iffc158c5b0a3c9a63f8d05830314c9bc1616b3b1
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
2021-09-13 10:36:15 +02:00
Dennis Francis
5efa765a7c fix build: add missing break -Werror=implicit-fallthrough
Signed-off-by: Dennis Francis <dennis.francis@collabora.com>
Change-Id: I12660822829c874179ccffd84dcdd33f5dde27e3
(cherry picked from commit 5a1c42c4e610a9265dfe3527c964413f029060ae)
2021-09-07 10:40:15 +05:30
Dennis Francis
94cadbe033 calc: use document bg color from core to paint canvas bg
Conflicts:
	loleaflet/src/layer/tile/TileLayer.js

Signed-off-by: Dennis Francis <dennis.francis@collabora.com>
Change-Id: Ief814741df4818000cef7499a8b1c9c1ce1f4371
(cherry picked from commit bfed92dffecc3b574f24920733c74565fb1ae29c)
2021-09-07 10:40:15 +05:30
Miklos Vajna
8ba165d5e9 kit: fix build
When building against core.git master:

kit/ChildSession.cpp:2668:13: error: enumeration value 'LOK_CALLBACK_SC_FOLLOW_JUMP' not handled in switch [-Werror,-Wswitch]

It's not clear how we want to handle this in Online, so have a default
label in debug builds as well.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ia0b1cef33e8a5a7fbc1518586ea1e3bb13aa5f22
2021-09-06 09:15:08 +02:00
Tor Lillqvist
6d2a6e110c Remove leftover tiles in the iOS app already when the document is closed
Normally (ideally), tiles (.bmp files) are removed as soon as the JS
has displayed them. But occasionally something goes wrong and they are
left behind. (For instance, it seems to happen if the user closes the
document immediately when it shows up.)

Do not leave them on disk until the app starts the next time.

Change-Id: I0c764280a69a16ad3b7b67c329832fd5331c2e1e
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-09-01 13:32:23 +03:00
Tor Lillqvist
65b8001d73 Remove more leftover files taking space in the iOS app
Remove the app's copy of the document after core has saved it and we
have stored the edited version at its real location.

Remove possible leftover tile bitmaps when the app starts.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Ibc41be38c2cfb689c532640d148116bc06a248ab
2021-08-24 18:02:40 +03:00
Miklos Vajna
4cfbd6b65c kit: improve StringVector usage in ChildSession::getClipboard()
It returns a temporary.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I5a9df90a4e7dda05cc387e5dc11842ea8e237504
2021-08-04 17:02:16 +01:00