Commit graph

2387 commits

Author SHA1 Message Date
Ashod Nakashian
7d65e30595 loolwsd: regex matching class against whitelist/blacklist
With unittests.

Change-Id: Ibb14c493cc6de61b6497ab84e34e105481afe464
Reviewed-on: https://gerrit.libreoffice.org/24231
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-19 01:40:37 +00:00
Henry Castro
c29944a386 loolwsd: fix close after close
The closing handshake.
Either peer can send a control frame with data containing
a specified control sequence to begin the closing handshake.

Upon receiving such a frame, the other peer sends a
Close frame in response, if it hasn't already sent one.
2016-04-18 20:27:27 -04:00
Tor Lillqvist
5c0788254b Add "exit" command and comment syntax to input files for the 'connect' program 2016-04-18 21:31:57 +03:00
Tor Lillqvist
bbcc70c69f Add debug hack to intentionally slow down tile rendering
When compiled with --enable-debug, when requesting a tile for part=42,
actually use part=0, and sleep five seconds before passing the
rendered tile back up. This makes it easier to debug handling of
simultaneous requests for the same tile from multiple clients.
2016-04-18 18:29:47 +03:00
Tor Lillqvist
d012075dc8 Sanity check 2016-04-18 16:40:28 +03:00
Andras Timar
59944636b0 allow="true" attribute has to be written out 2016-04-18 15:37:30 +02:00
Jan Holesovsky
5e96e32b56 bccu#1699: Use 256 pixels at 96dpi as the TWIPs size (3840 TWIPs). 2016-04-18 14:42:25 +02:00
Tor Lillqvist
f769474d25 The "unload" message is not implemented and likely won't be 2016-04-18 15:39:51 +03:00
Tor Lillqvist
a08b2a0e0b Just use "/" instead of Poco::Path::separator() 2016-04-18 15:34:34 +03:00
Tor Lillqvist
311a748d45 Clean up jails of exited loolkit processes sooner
In loolforkit, whenever we have forked a new loolkit, also check if
any previously forked children have exited. Remove the jails of
those. (The loolkit process itself does not even try to remove all of
its jail, see 3aadd910c6e32c0e557671effa5a4c606cd6e8bf.)

In order to be able to notice exited child processes in loolforkit, we
no longer can set the action for SIGCHLD to SIG_IGN. That means that
exiting loolkit processes will be in the zombie state until loolforkit
picks up their exit status. As loolforkit does this check only in
connection with forking a new child, zombie loolkit processes will
hang around for some time, until the next loolkit process is
forked. Not sure if this is a problem.

countLoolKitProcesses() in httpwstest now needs to skip zombies.

Loolwsd still takes care of removing whatever jails are left when it
finishes.
2016-04-18 14:30:09 +03:00
Tor Lillqvist
3aadd910c6 We can't remove jailPath when inside the chroot as it does not exist there
When inside the chroot, what we would need to do is remove everything
below / . But doing that is a bit too risky, in case some developer
screws up some detail and that code happens to run outside the chroot
after all, and the developer's machine gets trashed. So just remove
paths we can reasonably assume won't exist as global pathnames on a
developer machine: loSubPath and JAILED_DOCUMENT_ROOT.

Currently the actual complete cleanup of loolkit jails happens in
loolwsd when it is exiting. That is a bug and will have to be
fixed. It should be done in loolforkit as soon as possible after the
loolkit process has exited.
2016-04-18 13:18:39 +03:00
Andras Timar
6eaece12e1 package looltool 2016-04-18 10:31:31 +02:00
Andras Timar
4fd2354bc0 Add missing headers to dist tarball 2016-04-18 10:30:32 +02:00
Tor Lillqvist
996898f9ce The default number of preforked loolkit processes is actually just one
At least, that is the value of the num_prespawn_children element in
the loolwsd.xml as shipped. But maybe that is not what is meant with
"default"? It is unclear to me what the "default" attribute means.
2016-04-18 09:52:25 +03:00
Tor Lillqvist
70c7ca5a57 The --nocaps option does not take an argument 2016-04-18 09:49:21 +03:00
Tor Lillqvist
16e4ad5fc5 The 'loadtest' programs can surely die 2016-04-18 09:43:39 +03:00
Tor Lillqvist
c6941c71c6 Bin a few unneeded #includes and usings 2016-04-18 09:43:39 +03:00
Miklos Vajna
0f82a3a6ae loolwsd: fix -Werror,-Wshadow
Change-Id: I33095de03e5f3df3ed8919121f6a078f80c26ae9
2016-04-18 08:41:19 +02:00
Miklos Vajna
b1b947cfb3 loolwsd: fix -Werror,-Wlogical-not-parentheses
Change-Id: I035347339cf789e49994640b03f239a3e161f9b7
2016-04-18 08:40:03 +02:00
Ashod Nakashian
385359824a loolwsd: unittest to validate correct doc reloading while unloading
Change-Id: Id956fc9e243c44ecd3914b448ab92f87e011d3ee
Reviewed-on: https://gerrit.libreoffice.org/24185
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-18 03:37:54 +00:00
Ashod Nakashian
b933988a59 loolwsd: flag and wait if document is unloading before relaoding
When a new view is created on a document that is
in the process of unloading, all sorts of things
can go wrong. This is especially problematic when
the document needs to be saved before unloading,
which takes significantly longer than otherwise.

Change-Id: Ib33a18cafa9d5a3a17f6bd8c6145f9331ae54044
Reviewed-on: https://gerrit.libreoffice.org/24184
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-18 03:36:45 +00:00
Ashod Nakashian
892358e5cb loolwsd: new Admin API to remove documents
Normally, when each client view closes, the
session count is decremented until the last
view is closed. However this doesn't work
when the kit child process terminates.

Due to a race condition between the last
client disconnecting, and the internal
structure destructing, and the next
client connecting (on the same doc),
the Admin loses track of the doc and pid.

This is an issue of assuming a document
and its pid are unique and will always
remain unchanged.

This patch adds a new API to remove a
doc and all its views unconditionally
to try to avoid the above issues.

Change-Id: I0c181260679875b0464dd9b6548b29b8d6a361f7
Reviewed-on: https://gerrit.libreoffice.org/24183
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-18 03:35:29 +00:00
Ashod Nakashian
52959b7289 loolwsd: admin cleanups
Change-Id: Ib8a488ef08d345f768323e1303f7a053e54464d5
Reviewed-on: https://gerrit.libreoffice.org/24182
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-18 03:34:54 +00:00
Ashod Nakashian
53a2e3ba42 loolwsd: save on disconnection test enabled and functional
Change-Id: I604b0826674e981136ca7f8a9169a20eed9597d3
Reviewed-on: https://gerrit.libreoffice.org/24181
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-18 03:34:10 +00:00
Ashod Nakashian
2ee7d35fb8 loolwsd: reload test now actually reloads same document
Change-Id: I2ff724d3a3566f5fcb010ce46a6749e517afccd2
Reviewed-on: https://gerrit.libreoffice.org/24180
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-18 03:33:41 +00:00
Ashod Nakashian
7399f82b4e loolwsd: std::exit -> std::_Exit in forkit
Change-Id: I68af331440d95811f1d50c95de470350c0b6a4a3
Reviewed-on: https://gerrit.libreoffice.org/24179
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-18 03:33:12 +00:00
Ashod Nakashian
8af52337a5 loolwsd: clean and quick shutdown
Change-Id: Idfac3a27d19dd0a1b141d95a62c9e3453bd399a1
Reviewed-on: https://gerrit.libreoffice.org/24166
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 16:13:18 +00:00
Ashod Nakashian
a000a1e274 loolwsd: forkit exits without cleanup to avoid LO Core assertions
Change-Id: Ic9033b7d33f2ef114615950f01eab5904faa2ca7
Reviewed-on: https://gerrit.libreoffice.org/24165
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 16:12:49 +00:00
Ashod Nakashian
882ffafb16 loolwsd: simplified ChildDispatcher
Change-Id: I5b61678a01f4491ca06a25dd969f7538b4c8445d
Reviewed-on: https://gerrit.libreoffice.org/24164
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 16:12:30 +00:00
Ashod Nakashian
b420b70154 loolwsd: gitignore loolforkit-nocaps
Change-Id: Ide73478726c0341d2679053650b3c89ec7c8dc94
Reviewed-on: https://gerrit.libreoffice.org/24163
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:27:13 +00:00
Ashod Nakashian
8b5d702acb loolwsd: testBadRequest actually provokes connection error
Change-Id: Ibf12b6b45d6eb34e031ab689983ab3599a58caef
Reviewed-on: https://gerrit.libreoffice.org/24162
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:27:00 +00:00
Ashod Nakashian
ea223f14d2 loolwsd: storage validation should throw BadRequest on failure
Change-Id: I8e9eca96e3e9cef7391a74d72db806e6d1085b01
Reviewed-on: https://gerrit.libreoffice.org/24161
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:26:38 +00:00
Ashod Nakashian
a70c5300b1 loolwsd: childConnected event added to UnitWSD
Change-Id: I3d19465229b434d07f50290f08462e9c9c66a6ca
Reviewed-on: https://gerrit.libreoffice.org/24160
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:26:09 +00:00
Ashod Nakashian
b50a7d507c loolwsd: wopi trusted hosts are stored in set to warn about conflicting config
Change-Id: If27e173ffee753e655057d8516f4f3b3ecda5d3b
Reviewed-on: https://gerrit.libreoffice.org/24159
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:24:58 +00:00
Ashod Nakashian
372baaf427 loolwsd: cleanup of DocumentBroker session management
Improved session add/remove API.
Reduced mutex count.
Renamed members and variables.
Added documentation.

Change-Id: If15991971484d4d508714c9436a51b291f42079f
Reviewed-on: https://gerrit.libreoffice.org/24158
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:23:53 +00:00
Ashod Nakashian
0cf179ba57 loolwsd: run_unit.sh now finds abs_top_builddir and executes using bash
Change-Id: I3a341f5508ecf4cda51cc526d38d09cdbcaf09ff
Reviewed-on: https://gerrit.libreoffice.org/24157
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:20:43 +00:00
Ashod Nakashian
ea83ed2374 loolwsd: configuration manipulation UT hook added
Change-Id: If5ab75ee3630e629179dfc8d3c3374795bd2a221
Reviewed-on: https://gerrit.libreoffice.org/24156
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:20:14 +00:00
Henry Castro
e50495811f loleaflet: update to WebSocketErrorMessageException 2016-04-17 09:05:34 -04:00
Henry Castro
0a92e02339 loolwsd: test: update changes to WebSocketErrorMessageException 2016-04-17 08:42:07 -04:00
Michael Meeks
6388298a04 Attempt at a --nocaps argument to run with no caps, ie. under valgrind. 2016-04-16 20:47:55 +01:00
Ashod Nakashian
a76e9a2b21 loolwsd: check WOPI host against configured whitelist and cleanup factory
Change-Id: I1dd45a9b1332754a33b2f190b7f6244e8e3b1dff
Reviewed-on: https://gerrit.libreoffice.org/24136
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-16 17:58:18 +00:00
Ashod Nakashian
115e654d63 bccu#1648: Limit trusted WOPI hosts
Control allowed/trusted wopi hosts from config.

Change-Id: I730b4be8ef0d47bdb5e490926486184777de4eb0
Reviewed-on: https://gerrit.libreoffice.org/24135
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-16 17:58:01 +00:00
Ashod Nakashian
a9f58e2657 loolwsd: log Storage construction to identify concrete backend
Change-Id: I0bcb0d08bccd1551abc7c2ffdf79d8f6154dc880
Reviewed-on: https://gerrit.libreoffice.org/24134
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-16 17:57:14 +00:00
Ashod Nakashian
33854ec4ac loolwsd: cleanup and improve WSD request handlers
Standardized error handling in request-handlers.

There is a new family of internal exeptions designed
to signify the type of error and how to handle it.
All handlers must throw one of those errors
and they will be translated to the correct HTTP
response when caught.

Since some requests send a response as part of their
handling (convert-to, for example) those handlers
must return a flag signlaning whether or not they
sent a response. If not, HTTP OK response is sent
at the end of the handler.

To complicate things, some requests upgrade the
connection to WebSocket. In those cases errors
must be sent via the WebSocket and not as an
HTTP response. The error message sent can (and
in most cases should) be displayed to the end-user.

A new file, UserMessages.hpp, has been added to
hold user-visible messages that can be
reviewed and translated.

Change-Id: Icc725f3313446d4514cf6d092635158ee7171f5d
Reviewed-on: https://gerrit.libreoffice.org/24133
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-16 17:56:55 +00:00
Henry Castro
a66e73aeb0 loolwsd: fail when document broker cannot get a child 2016-04-16 13:32:44 -04:00
Ashod Nakashian
4254ddad77 loolwsd: consistently set HTTP status and reason everywhere
Change-Id: Ie538e4907e3a3a514918000bb585d2aaf182e468
Reviewed-on: https://gerrit.libreoffice.org/24132
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-16 17:29:35 +00:00
Ashod Nakashian
fe952794f0 loolwsd: don't expose private members
Change-Id: I049c92d0ddb296058fad283fffc291348b4608b1
Reviewed-on: https://gerrit.libreoffice.org/24131
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-16 17:29:11 +00:00
Ashod Nakashian
93d3f806e1 loolwsd: logging and cosmetics
Change-Id: I413a2e40f480ba41e37c7442724c3f037528f89b
Reviewed-on: https://gerrit.libreoffice.org/24130
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-16 17:28:45 +00:00
Ashod Nakashian
c2560725db loolwsd: admin uses config for ssl key
Change-Id: I38b0f59c158698a6eb89d4b671001e1d8cb61673
Reviewed-on: https://gerrit.libreoffice.org/24129
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-16 17:27:43 +00:00
Ashod Nakashian
8eedd9dfd3 loleaflet: gitignore branding files
Change-Id: I78df82004999938e2c9b7aa9935896fd8c195318
Reviewed-on: https://gerrit.libreoffice.org/24128
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-16 17:24:50 +00:00