Commit graph

710 commits

Author SHA1 Message Date
Miklos Vajna
7ab856b196 common, wsd: clean up redundant casts
Change-Id: Iad7e2417c6b1a154f6ad21839b841ca452e835c5
2017-10-24 09:23:54 +02:00
Jan Holesovsky
557479e288 More information about the support key state.
Change-Id: I0fb7792df3c0ba97497b7d9f5281640c40eb49a4
Reviewed-on: https://gerrit.libreoffice.org/43112
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2017-10-06 11:38:14 +02:00
Jan Holesovsky
783e3552c0 Support key logic in loolws + improvements in loolconfig.
To be able to set the support key directly from the command line, and to show
the option, etc.

Change-Id: Iac93bc47a6f4b9d5a5ad0ac8b06bda978e01b760
Reviewed-on: https://gerrit.libreoffice.org/43098
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2017-10-06 11:37:18 +02:00
Jan Holesovsky
c0fcd071d7 rlimits: Let's default to 0 when there's nothing in the config file too.
Change-Id: Ib99939a11d1e7cef112bf352b7c1dc6ac2d045c4
Reviewed-on: https://gerrit.libreoffice.org/43170
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit 2d2398aa06c66d0a79178becf90b28fdcc20bdfd)
Reviewed-on: https://gerrit.libreoffice.org/43171
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-10-05 16:21:14 +02:00
Pranav Kant
6a73c19d16 Show save-as option based on CheckFileInfo params
If UserCanNotWriteRelative is mentioned in the CheckFileInfo response.

Change-Id: I33d2e21159b3e18ae88fd72f404f2d1d1d9b64e5
2017-10-03 20:58:36 +05:30
Jan Holesovsky
7f49b1eba6 PutFile ext: X-LOOL-WOPI-IsAutosave header to indicate autosave + unit test.
Change-Id: I65ed711dae5100467fe6ed9902bd7bad8c7f8d68
Reviewed-on: https://gerrit.libreoffice.org/43074
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-10-03 12:04:18 +02:00
Pranav Kant
3008342c57 Don't kill the process when debugging
Assume that when SLEEPFORDEBUGGER or SLEEPKITFORDEBUGGER is mentioned,
loolwsd is being debugged. In that case, don't set any timeout to exit
before first child is forked.

Change-Id: I2527f02187d8452ef6bebb70e1d750b5e796c4b6
2017-10-03 13:47:39 +05:30
Jan Holesovsky
f658067eaa Don't crash when the parameters are missing.
Change-Id: I96ace7ad7757e7e0c74dd9f361c78ecff6171a96
Reviewed-on: https://gerrit.libreoffice.org/42854
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-09-27 16:36:13 +02:00
Jan Holesovsky
5c604e9f78 PutFile ext: X-LOOL-WOPI-IsModifiedByUser header to indicate modifications.
Change-Id: I5d69903211045969d678df695717eae7452e7f04
Reviewed-on: https://gerrit.libreoffice.org/42852
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-09-27 16:36:02 +02:00
Marco Cecchetti
ee6e64528d wsd: support for FSIZE and NOFILE system limits
The routine for handling the configuration for the max file size
limit, was wrongly using NOFILE. Now we handle both limits correctly.

Change-Id: Ie8b63617286f66af6d4eb1b35b9e4f4b28f3c2a6
Reviewed-on: https://gerrit.libreoffice.org/42803
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/42811
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Tested-by: Marco Cecchetti <mrcekets@gmail.com>
2017-09-26 17:40:31 +02:00
Jan Holesovsky
b57e38766a Document the 'access_header' WOPI extension.
Change-Id: Ie77501144344fc0503faf100b614e181cf722685
2017-09-20 14:17:33 +02:00
Michael Meeks
2c1508c309 Implement more reliable in-process short-cuts.
Change-Id: Icdfa71affad147c29df175ae687cbecc3f1f171b
2017-09-19 21:17:13 +01:00
Pranav Kant
7b4f734b32 Broadcast closing documents in same thread
... instead of handing it over the Document broker polling thread which
can lead to race conditions, and hence not giving desired behavior when
document is changed externally.

Change-Id: Ib0821d4ae931c357bc4d4c526865eefc090ddc23
2017-09-18 23:02:07 +05:30
Henry Castro
bccdd8d4d7 wsd: notify when the document is disconnected
Change-Id: I36e6df3c576ff0f02d3b059c2f1db4226d527b49
2017-09-17 10:37:48 -04:00
Henry Castro
2556c2b441 wsd: debug: log when the wsd is ready to accept connections
Change-Id: I56ea17af47bc85f30e74f5e93b94e0f3f3d95be4
2017-09-13 17:02:26 -04:00
Miklos Vajna
bcb5b744b8 net, wsd: fix -Werror,-Wdelete-non-virtual-dtor warnings
Two problem types:

- non-final class has virtual functions but no virtual dtor -> mark the
  class final
- abstract class has no virtual dtor -> add a virtual dtor

Change-Id: Iae208b65c774e6da7a3dda5e725fe07d4d589e4f
2017-09-12 10:03:32 +02:00
Michael Meeks
5c879a17b2 Count key-strokes, and report per session.
Change-Id: Id661fc15d4a75e322024ce62d24b2d7dae8f256a
2017-09-11 19:00:10 +01:00
Marco Cecchetti
dee39a562c support for rendering a watermark on each tile
Change-Id: I3edccac49a3bcd3d2493d8d7ef3a1ae29307e727
Reviewed-on: https://gerrit.libreoffice.org/41898
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-09-07 17:28:44 +02:00
Jan Holesovsky
f7c199684c WOPI extension: DisableInactiveMessages to avoid showing message when dimmed.
Change-Id: I925602295dde95611ab1a6565dd7266460769a50
Reviewed-on: https://gerrit.libreoffice.org/41709
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-08-29 19:44:33 +02:00
Pranav Kant
29db4b447f admin protocol: 'total_mem' -> 'mem_consumed'
total_mem can be confused with total system memory or total memory
availabe to loolwsd process. Change the API to say what it actually
returns.

Change-Id: I55c246b8a1d0c5c52767520150e55616266a6d4f
2017-08-29 12:12:13 +05:30
Pranav Kant
65e3f7c7df admin: expose total available memory to admin clients
Take into reckoning the memproportion config value for total available
memory to us.

Change-Id: Ib93c88d746268f3e9f566beed7df77357d530eba
2017-08-29 12:12:08 +05:30
Pranav Kant
ad211ef51b wsd: Configurable autosave and idlesave durations
But these save conditions are checked every 30 seconds only, so setting
them to less than 30 seconds wouldn't mean that save will be triggered
anytime sooner.

Change-Id: Id473a79af6a3170c72e372040460f2b7c15f150e
2017-08-24 16:54:15 +05:30
Pranav Kant
da4fe86b82 wsd: Do not throw when cannot save local file out of jail
Change-Id: Ie155823536694facb8bfcfe49f6386a7fc845689
2017-08-22 19:50:19 +05:30
Pranav Kant
a9522f38aa wsd: Notify forkit conditionally about rlimits
No need to notify the forkit very early when loolwsd is initializing and
forkit pipes are not set. Forkit is notified of rlimits anyway
explicitly in the URL when it is initialized; no need to try to
initialize it again.

Change-Id: I9fde13e42f6e6393da7cf245ed979538d715319a
2017-08-21 20:06:11 +05:30
Pranav Kant
b0ad8874dc wsd: don't write until forkit write pipe is ready
Change-Id: I95439e8e77dc308d993b07ccbd273228f755ce14
2017-08-21 20:06:06 +05:30
Pranav Kant
769e41dfb2 Fix build
Mismerge. There is no session->getAccessToken now

Change-Id: I4d8f2cc612cbd39b3163bcdbba5df8ea5d732774
2017-08-18 07:14:33 +05:30
Aditya Dewan
c3711a4375 Extending WOPI implementaion to introduce 'Save As' feature
Change-Id: Ic4c80f4c4b54944143682c25a5878c1336787b27
Reviewed-on: https://gerrit.libreoffice.org/40946
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-08-17 19:25:44 +02:00
Pranav Kant
10bfd18e97 Decode the headers before creating Authorization object
Change-Id: I0da0b4112ac46d2407d2cd308b21ee1dee9d68de
Reviewed-on: https://gerrit.libreoffice.org/41258
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-08-17 17:15:12 +02:00
Jan Holesovsky
a3a3d0ad6c Fix various nitpicks.
Change-Id: I41fe795bc1ea7c73527c7e1183de7098517bad7a
2017-08-17 14:05:22 +02:00
Jan Holesovsky
f8ca17278f access_header: Pass the access_header around + unit test.
Change-Id: I5d6d93e289d8faceda59deae128e8124a0193d95
Reviewed-on: https://gerrit.libreoffice.org/41243
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-08-17 13:41:07 +02:00
Jan Holesovsky
afcfac4bef access_header: Infrastructure for providing custom headers for authentication.
Change-Id: I52e61dc01dbad0d501471e663aaf364d9bc23c52
Reviewed-on: https://gerrit.libreoffice.org/41223
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-08-17 13:40:57 +02:00
Tamas Bunth
a37d5789e0 Log missing cache on standard error too 2017-08-16 12:09:09 +02:00
Pranav Kant
ef54b6ea16 wsd: Ignore useractive, userinactive when doc is not loaded
Sometimes client sends a userinactive message while the document is
already being loaded, which leads to the kit process skipping sending
the result of LOK callbacks to the client.

Handling this in child session is futile in the case when userinactive
message is sent when the document is being loaded, since kit process
handles the 'userinactive' message only after document is loaded (i.e
isLoaded() returns true). Moving this handling to DocumentBroker will
take care of both the cases - when 'userinactive' is sent before load
starts, and during load of the document.

Change-Id: I4ea3ac7b184d2ca373eb3ff4fb7b4ae394d454df
2017-08-11 23:27:17 +05:30
Jan Holesovsky
894c5f2cc2 Warn more about missing capabilities, and advise what to do on SLES11.
Change-Id: I93587db6fa32c1c505877c20857799be71ee162f
2017-08-10 11:12:24 +02:00
Jan Holesovsky
cef217ea24 wsd: Fix the OAuth unit test.
Trying to combine the Poco's http server together with our polling loop leads
only to problem; so instead let's introduce a hook where we can do the WOPI
serving directly in the unit test.

Change-Id: Id3fec6ff93c3ad652aa4e0fc6309c5b7639728cb
2017-08-09 22:27:49 +02:00
Jan Holesovsky
a59598050d convert-to: Set the mimetype in the responses.
Change-Id: Ib8dcad5f81499aec0ba147a3a4ef0b7a30995bcc
2017-08-07 11:33:08 +02:00
Jan Holesovsky
beffd4967a convert-to: New features in the convert-to functionality.
* Add possibility to omit the 'format' parameter
* Allow it even when the 'file' storage is disabled

Change-Id: Ib8dcad5f81499aec0ba147a3a4ef0b7a30995bcc
2017-08-07 11:32:10 +02:00
Henry Castro
a262b7d7ba wsd: OAuth token passing
MS-WOPI:
"The following HTTP header MUST be included in all WOPI requests."
"Authorization "Bearer" and <token>"

Change-Id: Ie5327286e93b86a49a0248ff5886bf3ea99df768
2017-08-03 17:11:00 -04:00
Andras Timar
945d74c237 wsd: fix compilation with old OpenSSL that does not have PKCS5_PBKDF2_HMAC()
Change-Id: If48641f6cbcc4d4ded78ea5cc9c9f66063a2ac0a
Reviewed-on: https://gerrit.libreoffice.org/39779
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2017-07-31 19:40:37 +02:00
Jan Holesovsky
92cdab8bf8 discovery: Make the unknown file extensions read-only.
Change-Id: Ie1467334868a7e4aa31aa69f67d0cd434ed18e7b
Reviewed-on: https://gerrit.libreoffice.org/40083
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-07-17 20:05:27 +02:00
Pranav Kant
160c1f555a Save unsaved documents when memory consumption is high
These saved documents are then removed to free some memory when next
memory cleanup is triggered in the admin loop.

Change-Id: Ia789a65dc204b546f1d3627a8006c4590bdca371
2017-07-11 17:51:47 +05:30
Pranav Kant
ccce64eeef This is percentage of total sys memory, not total consumed memory
Change-Id: I16b8b3d217cd0fabed83a9c63a5966cc6fe4d8fb
2017-07-11 17:51:47 +05:30
Pranav Kant
aa6b96aaed Skip memory cleanup when memproportion is not configured
Change-Id: I3799d914b5155c37f37bb497ac48e76c1a68761b
2017-07-10 20:41:49 +05:30
Pranav Kant
5ef7606316 Update the iterator too
Change-Id: Ia715fa11eb21a25935a2075d09c674bd45472e96
2017-07-08 01:52:46 +05:30
Pranav Kant
fde57adbbf Introduce hard mode when we are OOM
Start killing documents when memory usage goes above threshold.

Also make it possible to close documents from admin instance.
In DocumentBroker::closeDocument, just set the _stop flag and wake
up the polling thread which will terminate the children, instead of
manually terminating the children.

Change-Id: Ie70e05b3fb6ea816a87b6dcfaed92cdddb94aa90
2017-07-07 21:14:53 +05:30
Pranav Kant
13a541e4bb Lets do away with this
Consistency.

Change-Id: Iea670b77ab5f3f668183eac52f3ae8db92d79a40
2017-07-07 12:18:37 +05:30
Pranav Kant
3eaf31f81b Document missing protocol message
Change-Id: I79b2ceb1dafb884356b2b0a0b6fb59b493784fe4
2017-07-06 19:23:14 +05:30
Miklos Vajna
01bf6ab344 wsd: use the more effective overload accepting a character in Storage
I guess checking for "{" in parseJSON() happens for performance reasons,
but then it's a good idea to also avoid constructing a temporary string
for no reason.

Change-Id: I285ba0ed615054fc014796f7d8971a2b9783b075
2017-07-06 11:17:33 +02:00
Aditya Dewan
bc7fa9a812 admin: convert document list to drop down
Change-Id: I23635599b008fb0bfa694b4e73cb8f18f49c8ab7
Reviewed-on: https://gerrit.libreoffice.org/39170
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-07-06 09:18:09 +02:00
Aditya Dewan
c29815f42c Assign unique editorId to localhost users
Change-Id: I1c8949fa7acca1b11b35b48629cc20a1170d8caa
Reviewed-on: https://gerrit.libreoffice.org/39442
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-07-06 09:17:23 +02:00