Commit graph

197 commits

Author SHA1 Message Date
Rene Engelhard
623b45a533 fix build with poco 1.8.0(.1) 2017-11-13 20:21:22 +01:00
Miklos Vajna
bb7ac21d44 Make sure that loop index type is never narrower than the length type
Change-Id: I19aac80850c0371085ca6364412d5ac9207220d0
2017-11-06 09:14:38 +01:00
Miklos Vajna
a3d6dee503 Remove unused strings
Change-Id: I621c462bca38222dcf26dfa1e414cf27e1a3e088
2017-11-03 15:25:09 +01:00
Jan Holesovsky
343c5bc690 tdf#99744 SaveAs: Extend test to check that the Save As result was sent.
Change-Id: I3788b87d2599c01000af97f496ee2b840c0cae3e
2017-10-26 11:11:38 +02:00
Tor Lillqvist
73d77a9f67 More -Werror=implicit-fallthrough=
Change-Id: I62164eef3a4f95bfe505b3b1a866495bde6c19b1
2017-10-26 11:51:53 +03:00
Pranav Kant
e9e162b35e lokdialog: Mouse/key events, canvas use & child window impl.
Change-Id: If8ae5c284e7166d4a01bd664644134f11197f988
2017-10-25 00:39:03 -07:00
Pranav Kant
de780f8253 lokdialog: wsd: first cut at lok dialog rendering api
Change-Id: Id522e0796428ed0a15ea3496e6726f51ed232e75
2017-10-25 00:37:41 -07:00
Miklos Vajna
7ab856b196 common, wsd: clean up redundant casts
Change-Id: Iad7e2417c6b1a154f6ad21839b841ca452e835c5
2017-10-24 09:23:54 +02:00
Jan Holesovsky
262916363d rlimits: The fsize and nofile need more tweaking...
Change-Id: Ifdb4d24f103f54fd286b8ffa715c0a61c2cff94f
2017-10-06 15:42:53 +02:00
Jan Holesovsky
92aca7f2dd Compile the support key in (when configured to use one).
Change-Id: Iffff0b95b245b91d9732a774a6026a3cec2b2222
Reviewed-on: https://gerrit.libreoffice.org/43185
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2017-10-06 11:39:29 +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
Michael Meeks
79053911fc Support key logic and verification.
Change-Id: Ie55150b99df3e80239236571af185502196ad3e9
Reviewed-on: https://gerrit.libreoffice.org/43097
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
(cherry picked from commit 56385cb8ac2a57af4eb70bc8bc7313a9299533c3)
Reviewed-on: https://gerrit.libreoffice.org/43099
2017-10-03 21:52:45 +02:00
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
Marco Cecchetti
e015c83957 fixed wrong logging text
Change-Id: Ife3bdf05e15a9f11227c37eec6af0719cd8b2e5a
Reviewed-on: https://gerrit.libreoffice.org/43033
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Tested-by: Marco Cecchetti <mrcekets@gmail.com>
(cherry picked from commit 8f9cff124763285e0bb7cc98d96770b98367eafb)
Reviewed-on: https://gerrit.libreoffice.org/43034
2017-10-02 10:55:27 +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
Michael Meeks
be228a160d Allow unit tests to avoid handleInput.
Change-Id: Ib4accd6bbfdc1fc55c45365df275edfa8a68bc59
2017-09-19 21:13:58 +01: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
057fd10881 No need to scare people too much.
Change-Id: I2b598b3363a73c352bda2cb6bbf0c0d208456456
Reviewed-on: https://gerrit.libreoffice.org/41291
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-08-18 15:39:16 +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
Pranav Kant
af13e5927d Open the log channel explicitly to avoid file creation inside jail
Change-Id: Ida66861e0e1c5925dbbf53d564a829eaf0fd15c7
2017-07-12 15:14:58 +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
Andras Timar
ad8bffa04a configure option to disable SECCOMP
Change-Id: I8120674b60d388a3f85190631469a112c4af9266
Reviewed-on: https://gerrit.libreoffice.org/39408
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2017-07-03 11:43:01 +02:00
Michael Meeks
73a87493f0 Use WireIds instead of long hashes to identify tiles efficiently.
Changes protocol to use 'wid' instead of 'hash' everywhere. Wire-ids
are monotonically increasing integers that can be mapped to hash
values for all of the hash values and tiles we cache internally.

Change-Id: Ibcb25817bab0f453e93d52a6f99d3ff65059e47d
2017-06-20 21:49:44 +01:00
Michael Meeks
8fb48811ec Protocol - only match complete token names.
Change-Id: I027e29da8cc6c48a0d896fa41516934a3ff71b43
2017-06-20 21:49:44 +01:00
Michael Meeks
7ea5f71a7b Units: allow filtering of user alerts.
Catch things that kill tests like disk-full earlier.

Change-Id: Ib50b516063305f2fc93b662ec3ad9ab6c52c6c92
2017-06-16 20:25:23 +01:00
Pranav Kant
db13014e00 Update modifiedTime for local files unconditionally
Also teach logger to print timestamp object.

Change-Id: Ia13836814c195cef92f5dafd8245c9958600876d
2017-06-16 19:49:37 +05:30
Ashod Nakashian
44d8876f27 Remove data rlimit
Seems to have no effect, so gone in
favor of RLIMIT_AS (virtual memeory).

Change-Id: I210879ec9285f420c9f9839cdabf45c42d865fb3
Reviewed-on: https://gerrit.libreoffice.org/38720
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-06-13 06:27:12 +02:00
Ashod Nakashian
6de3adcf9c wsd: pass default rlimits to forkit from config
Change-Id: I84d271f460f0fb1d03a973107c32265d84bf2841
Reviewed-on: https://gerrit.libreoffice.org/38675
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-06-12 06:18:31 +02:00
Ashod Nakashian
92d29b1ce7 wsd: support setting process rlimits
Change-Id: I7117e6843d2ebc919d7d2303cc593de888cc54b1
Reviewed-on: https://gerrit.libreoffice.org/38672
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-06-12 06:17:21 +02:00
Aditya Dewan
9502741590 tdf#107278 admin console: adding graph to track CPU load
Change-Id: Idb07fe4139dd639a49ce1545cc15895f74876b06
Reviewed-on: https://gerrit.libreoffice.org/38425
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-06-08 12:58:12 +02:00
Michael Meeks
3101fa510d Accumulate I/O stats per document.
Change-Id: Ie2f5647e65070ddd828f048820efd38b600f9133
2017-06-02 20:41:25 +01:00
Ashod Nakashian
da2d3cbc92 wsd: support per-user links and commands
userextrainfo is a json array that contains
extra user-specific links.

Currently 'avatar' is assumed to hold the
image url for the user's avatar.

'mail' and other links can also be added.

Change-Id: I37c4c68bfa0b7ee659e017b4867dcb8cf5c2ca2f
Reviewed-on: https://gerrit.libreoffice.org/38120
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-29 06:45:18 +02:00
Pranav Kant
7a4bc5b95a admin-console: Check the password against hashed value in config
The new password hash property is called secure_password in the config
file. `loolconfig` tool should be used to set the password hash in
appropriate format with desired salt length, password length, number of
iterations in PBKDF2.

To be backward compatible, plain-text password for admin-console in
config file is still accepted in case secure_password property is
missing from the config file.

Change-Id: If229999dac62856e368555c0242c4aa6f8061fba
2017-05-25 01:18:31 +05:30
Ashod Nakashian
407c538f04 Correctly send termination reason to clients
Fixes the case when the client reconnects on idle
disconnection (because it never got the 'close: idle'
message).

Also, show informative message to users in this case
instead of grey screen.

Change-Id: Ia2e1f2ffefe6d35dd1552e7cc44e490aab86c600
Reviewed-on: https://gerrit.libreoffice.org/37891
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-22 07:05:28 +02:00
Pranav Kant
8a02e7a8fa wsd: Debugging environment vars to debug storages
Also, extend the LOOLProtocol::tokenize to accept a custom delimeter.

Change-Id: I7f789e703c5c8d2ad325b3dd149ba888c722f5f3
2017-05-17 16:30:33 +05:30
Ashod Nakashian
47c01440ba wsd: logs
Change-Id: I286c4c7415b114f51f3258bd6d50f8e103ea6c75
Reviewed-on: https://gerrit.libreoffice.org/37611
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-15 05:14:55 +02:00
Ashod Nakashian
484fcd63a5 wsd: corrections to replace and unittests
Change-Id: I0e03deaa710ba722a97c9f857b514f8ecb0e1682
Reviewed-on: https://gerrit.libreoffice.org/37609
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-15 05:13:21 +02:00
Ashod Nakashian
d267b86bbd wsd: include version in http agent strings
And move the WOPI agent string to Common.hpp.

Change-Id: Ife679705bcd6914ddd45ad50446e690fb22dd317
Reviewed-on: https://gerrit.libreoffice.org/37607
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-15 05:10:06 +02:00
Ashod Nakashian
9798eafb8c wsd: random jail paths instead of pid
Jail paths are now generate from a PRNG
instead of using the PID of the kit process.

The PRN is converted to base-64 and used
as the directory name where a given
kit is jailed.

Change-Id: I8e4bc35d9ccdfdae0e542ab707c417cd29ad52f3
Reviewed-on: https://gerrit.libreoffice.org/37372
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-08 04:59:12 +02:00
Michael Meeks
9e45fb30d7 SocketDisposition: push it down the stack, and cleanup around that.
Dung out overlapping return enumerations. Move more work into 'move'
callbacks at a safer time, etc.

Change-Id: I62ba5a35f12073b7b9c8de4674be9dae519a8aca
2017-05-05 18:37:26 +01:00
Jan Holesovsky
2a2d863321 Fix build with older kernel versions.
Change-Id: I28fc6687a42ac428413d644e9fd55870cd5936fa
2017-05-02 17:24:44 +02:00
Michael Meeks
31818b7dd6 Trap rather than kill from seccomp and log invalid syscalls.
Change-Id: I319c10776476fea865dd7a95921f1b08b689e09f
2017-04-28 19:06:20 +01:00
Michael Meeks
08c70f1315 Signal safe number logging (lame but useful).
Change-Id: I0b6095fc08dcc237a224b5942ab5a09e6820e43f
2017-04-28 19:05:45 +01:00
Michael Meeks
a7eeacf9e0 SigUtil: split out dumpBacktrace.
Change-Id: I33121de341051bf40ae0d42d1d6d44843d6d1e97
2017-04-28 18:08:57 +01:00
Michael Meeks
bc31103a5d Seccomp: filter more syscalls.
Change-Id: I2cc203d48e4592c5f182e675383e96a13b87bc36
2017-04-28 17:55:14 +01:00
Michael Meeks
7f4f752667 Initial seccomp work.
Add a list of unhelpful looking system calls to improve containment.

Change-Id: I2e4bf3e0a6a752d427299728663d17120586bb10
2017-04-28 14:26:21 +01:00
Michael Meeks
c8d1c18cb5 Revert "wsd: correctly remove request from socket buffer"
This reverts commit c851c3e93b.
2017-04-25 22:49:08 +01:00
Ashod Nakashian
c851c3e93b wsd: correctly remove request from socket buffer
POST requests require the full request to be
left in the socket buffer to be parsed in full.
But GET requests, especially WS upgrade, must
have the request cleared from the socket, as
there is more data expected to be read after
the upgrade, which happens by the DocBroker
thread, so clearing the buffer must be done
before the upgrade.

This patch accomodates these two conflicting
cases and refactors the code slightly to
make it more structured and readable.

Change-Id: Ia7357a745a3900f986099ba14af2a0946023018b
Reviewed-on: https://gerrit.libreoffice.org/36873
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-24 06:49:33 +02:00
Michael Meeks
f72b7d2ba1 Don't set the buffer size to zero.
This slows things down terribly, particularly the setting on the websocket
made tiles appearing one by one. Let's keep the possibility to zero the buffer
sizes for debugging, but hide that behind an env. variable (and in debug
builds only anyway).

Change-Id: Ie4d2cdb3c0ec3c50f1a2b4f9941a462ac4f2d196
2017-04-19 10:58:18 +02:00