Commit graph

1853 commits

Author SHA1 Message Date
Henry Castro
e06cf8ac16 loolwsd: test: add testLOleaflet 2016-04-24 16:41:51 -04:00
Henry Castro
05d9e5ae0c loolwsd: test: update testInsertDelete 2016-04-24 15:00:21 -04:00
Ashod Nakashian
6b1a3115b2 loolwsd: request new session from child before storing session
Change-Id: Iadf8a4d30aaab276c55b3bb28c684df0004f8f3c
Reviewed-on: https://gerrit.libreoffice.org/24339
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-24 17:10:50 +00:00
Ashod Nakashian
74cb8d84d2 loolwsd: exception-safe session and document management
Sessions are referrenced in DocumentBroker instances,
which themselves are referrenced in a container.

When exceptions are thrown either while creating a new
session, or during the lifetime of one, these references
must be correctly cleaned up, otherwise we introduce
internal instability in addition to stalling the client.

Change-Id: I3177e45564860897528da6d7fbcbe346d3bd1c75
Reviewed-on: https://gerrit.libreoffice.org/24338
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-24 17:10:04 +00:00
Ashod Nakashian
56cf69c47f loolwsd: unittest to kill all children before loading
Change-Id: I90f28b792c56b9659c04bcc89042455a8a37b8fa
Reviewed-on: https://gerrit.libreoffice.org/24337
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-24 17:01:44 +00:00
Ashod Nakashian
bb8beee8e9 loolwsd: refactored killing of LoKit processes in unittests
Change-Id: Ia41adc977252049b1cd7d8936f0c4c8380516030
Reviewed-on: https://gerrit.libreoffice.org/24336
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-24 17:00:40 +00:00
Ashod Nakashian
2b5ecbd945 loolwsd: validate child and spawn new ones before using
Change-Id: Icf7c8a2c0fa6c455cea4a65207f1727638169a28
Reviewed-on: https://gerrit.libreoffice.org/24335
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-24 17:00:19 +00:00
Ashod Nakashian
08222c791f loolwsd: cosmetics
Change-Id: Ic5398c2ccacad24bef898ba502e5bd1bb0f26c00
Reviewed-on: https://gerrit.libreoffice.org/24334
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-24 16:57:10 +00:00
Ashod Nakashian
48bdc1e97a loolwsd: silence unused-result gcc error
Change-Id: Ide71b0b585a2b822cedc93e0b4aae11ab4aa1b34
Reviewed-on: https://gerrit.libreoffice.org/24333
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-24 16:55:29 +00:00
Ashod Nakashian
08b31ac3f5 loolwsd: simplified and improved synching re-activating clients
Change-Id: Idc07aecb33b350a0434c4310a0991a9b2ff1d738
Reviewed-on: https://gerrit.libreoffice.org/24323
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-23 18:12:58 +00:00
Michael Meeks
8f7eed639c Re-factor tile subscription logic.
Move the logic into the TileCache, simplify the API, and
internalize the lock. This should be a plain re-factor.
2016-04-23 18:03:42 +01:00
Michael Meeks
2c2504a073 Time stamp subscriptions to tile rendering. 2016-04-23 18:03:42 +01:00
Henry Castro
3d8285976d loolwsd: send part hash codes to the client 2016-04-23 11:42:12 -04:00
Henry Castro
415b265b6b loolwsd: update bundled headers 2016-04-23 11:38:49 -04:00
Ashod Nakashian
6789550cd9 No need to send invalidatetiles to the client on becoming active
The invalidatetiles is normally a notification coming from
LOK and it signifies that the tiles in quesion need
rendering anew. Issuing this internally from the Kit
removes TileCache images unnecessarily.

Furthermore, since this message is always sent in response
useractive message, there is no need in issuing it from
WSD when loleaflet is perfectly capable of issuing it
itself (internally).

Change-Id: Ia97de6d803745dca3f6e73100f2d921dbbdf76f6
Reviewed-on: https://gerrit.libreoffice.org/24316
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-23 13:29:07 +00:00
Tor Lillqvist
f46855eb25 It is not a cause for warning if we are removing a file
Use info() instead. Also, only log the info if the file actually
existed and was removed. We don't want misleading noise logging about
removing files that were not there. Use std::remove() directly to
avoid unnecessary layers that just make it harder to know whether the
removal worked or not.
2016-04-22 17:50:25 +03:00
Tor Lillqvist
c80b7388ed The JS client never sends any 'invalidatetiles' 2016-04-22 17:50:25 +03:00
Tor Lillqvist
7d2a1d9048 I always keep doing 'make cache-clean' 2016-04-22 17:50:25 +03:00
Tor Lillqvist
bff5748cd9 No need to have separate "editing" and "persistent" tile caches
All changes are supposed to be persistent. This simplifies the tile
caching code quite a lot.

The TileCache object no longer needs to keep any state whether the
document is being edited or whether it has been modified without
saving etc.

Update the modtime.txt file after saving the document. Otherwise the
tile cache would wrongly be considered invalid next time.

As a sanity check, we put a flag file 'unsaved.txt' into the cache
directory whenever we get a callback that indicates the document has
been modified, and remove it when the document is saved. If the flag
file is present when we take an existing tile cache into use, we can't
trust it.

Even after these changes, we still don't use an existing tile cache as
much (or at all?) as we could, though. The INVALIDATE_TILES EMPTY
callback that LO does early on in a conection causes us to remove all
cached tiles...
2016-04-22 17:49:39 +03:00
Tor Lillqvist
b0cfa35018 Remove accidental superfluous indentation 2016-04-22 13:26:32 +03:00
Tor Lillqvist
4aaf70bf8e The logging goes to stderr, not stdout
Check whether stderr goes to a terminal, not whether stdout does.
2016-04-22 13:24:35 +03:00
Michael Meeks
60ffc8aa6b Avoid tile subscription loop, and elide redundant tile subscriptions. 2016-04-22 07:58:31 +01:00
Miklos Vajna
0833a99b37 TileCache: avoid copying these for each invocation
Change-Id: Icaf84699d7f54f2f977162a040aed1f4090f680d
2016-04-22 08:39:16 +02:00
Ashod Nakashian
3a4c02b71d loolwsd: track important notifications not sent to inactive clients
These notifications are important to be sent once the user
becomes active again to sync their view with the latest.

Change-Id: Id8f9fff83eea888cdcc8d6ed1d4f12111de39a6e
Reviewed-on: https://gerrit.libreoffice.org/24288
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-22 04:36:51 +00:00
Ashod Nakashian
bde67c9934 loolwsd: track document modified state to avoid unnecessary auto-saving
This also avoids the feedback loop that results from the kit
thinking the previously inactive client is now active and
sending commands (.uno:Save).

Change-Id: I47074b35a922da15592d550032d494ba1efab83e
Reviewed-on: https://gerrit.libreoffice.org/24287
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-22 04:36:02 +00:00
Ashod Nakashian
f83cc22db9 Documentation update for 'useractive' and 'userinactive'.
Change-Id: I4e2f0923aa5d0f35c29c752b144e23b365e73bb0
Reviewed-on: https://gerrit.libreoffice.org/24279
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-21 13:03:06 +00:00
Tor Lillqvist
232499f542 Add test that simultaneously requested tiles indeed were rendered just once
This test requires the renderid parameter to be present in the 'tile:'
response messages, and that is the case only when ENABLE_DEBUG, so we
can run the test only in a debug build.
2016-04-21 12:50:24 +03:00
Tor Lillqvist
95278b8643 Don't just re-use the 'tile:' response as a 'tile' request
In a debug build it contains also the parameter renderid. (And in the
future, might be extended in other ways, too.) Construct a new request
message that has exactly and only the parameters we want.
2016-04-21 12:42:53 +03:00
Tor Lillqvist
d446822fb3 Add some more logging for tile cache management 2016-04-21 12:42:53 +03:00
Jan Holesovsky
06366c2e4c Fix build. 2016-04-21 11:36:47 +02:00
Andras Timar
a6969c8827 document --admincreds and --allowlocalstorage in loolwsd.service 2016-04-21 11:22:22 +02:00
Andras Timar
745edddbe8 spec file extended for Fedora/CentOS 2016-04-21 10:14:29 +02:00
Miklos Vajna
9059774e64 LOOLTool: fix potential memory leak
Change-Id: Ib1c9bb5cbbef709882580de40500c1a9c8f70e4a
2016-04-21 08:37:27 +02:00
Ashod Nakashian
5fbaa8f3d2 loolwsd: useractive and userinactive command support
loleaflet can now send userinactive when the user
has switched tabs or the browser window loses
focus. Similarly, it can send useractive when
focus is regained.

Change-Id: Id3186949b10a8263e29ada1a790d3123a79e8f08
Reviewed-on: https://gerrit.libreoffice.org/24272
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-21 05:31:18 +00:00
Henry Castro
40daf0185a loolwsd: test: discovery 2016-04-20 23:09:04 -04:00
Henry Castro
11fbb33b56 loolwsd: test: simulate lokit crash test 2016-04-20 21:14:51 -04:00
Michael Meeks
9d913f986b Use size_t for iterating tokens. 2016-04-20 20:47:00 +01:00
Tor Lillqvist
5a509f9211 In a debug build, say in the tile: reponse also whether it was found in cache
Also, do the construction of the response string in
MasterProcessSession::sendTile() only when it is actually going to be
used.
2016-04-20 18:54:18 +03:00
Tor Lillqvist
842525c25c Guard against mixing up cout output from separate threads 2016-04-20 18:54:18 +03:00
Tor Lillqvist
77a91c4b2e In debug builds append a renderid=<unique-id> token to tile: responses
Will be used in unit test to verify that several clients of the same
document asking for the same tile simultaneously indeed do cause just
one tile rendering to take place.
2016-04-20 18:54:17 +03:00
Tor Lillqvist
7b47548020 Add getToken* variants that iterate over a StringTokenizer
If any of the tokens in the string matches name=<value> for the name
in question, store that value and return true. Otherwise return false.
2016-04-20 18:54:17 +03:00
Tor Lillqvist
d423f7c2fd Add Util::UniqueId() to get a string id that is unique across processes and calls 2016-04-20 18:54:17 +03:00
Tor Lillqvist
e94e8344ad IIUC, the 'tile' and 'tile:' messages have an optional timestamp parameter 2016-04-20 18:54:17 +03:00
Tor Lillqvist
9499071707 Change comment to make sense 2016-04-20 18:54:17 +03:00
Andras Timar
028becc511 error: unused parameter ‘part’ [-Werror=unused-parameter] 2016-04-20 13:00:43 +02:00
Jan Holesovsky
97342a2817 bccu#1653: Make the .html's, .css's and .js's versioned.
It is still possible to access them directly via loleaflet/dist/<something>,
but such use can lead to unexpected behaviour due to various caching in the
browsers etc.
2016-04-20 12:58:10 +02:00
Michael Meeks
a47355db2f Expand use of the TileBeingRendered structure.
Implement this for tilecombine, and do tile writes in each client's
thread separately. Add env-var. to trigger sleep, and tune it to 1
second; easily long enough to exercise this code-path.
2016-04-20 11:14:18 +01:00
Andras Timar
14458095ad README: loolwsd's --test option was binned 2016-04-20 12:00:46 +02:00
Andras Timar
59aa99d08d typo: consistenly -> consistently 2016-04-20 11:51:28 +02:00
Andras Timar
f0549f8ba1 document --disable-ssl and related stuff 2016-04-20 11:48:12 +02:00
Tor Lillqvist
2d74d65578 Rant about the duplicate specification of document URI, GET and 'load' 2016-04-20 10:35:38 +03:00
Miklos Vajna
5e2937bf79 Log: strcpy -> strncpy
Change-Id: I2929ad46b422e6e55e198064c2930028df844630
2016-04-20 09:10:30 +02:00
Andras Timar
090c246be4 bccu#1696 - enable WOPI connection from the same host (by IP address) by default 2016-04-19 15:32:34 +02:00
Tor Lillqvist
f825fea9db operator '?:' has lower precedence than '+'; '+' will be evaluated first 2016-04-19 16:21:55 +03:00
Tor Lillqvist
bf6dd4e291 Typo 2016-04-19 16:17:58 +03:00
Pranav Kant
79b21598d5 admin console: Handle spaces in filenames
Change-Id: Id63189e5a58e023669304438784d30c6ec48a1c2
2016-04-19 16:38:08 +05:30
Tor Lillqvist
d5bb373447 Improve efficiency when multiple clients of same doc ask for same tile(s)
Keep track of tiles being rendered in TileCache, and when asked to
render the same tile as is already being rendered, just "subscribe" to
the existing ongoing rendering. When a tile has been rendered and is
being sent out to clients, check if there are "subscriptions" and send
it to them, too.

One problem is that if the client that caused a tile rendering to be
initiated goes away before the rendering has completed, it will never
complete, and the subscribers are left without the tile.

Change-Id: Icca237876a0f466c29eb5bf60ffd4da3d9d68600
Reviewed-on: https://gerrit.libreoffice.org/24228
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-19 10:51:45 +00:00
Andras Timar
fb7de5df8e we need key.pem for admin console in http-only case too 2016-04-19 12:11:37 +02:00
Andras Timar
4864fac25a enable default admin/admin optionally (e.g. for CODE VM) 2016-04-19 12:11:37 +02:00
Pranav Kant
3e93a212f0 loolwsd: Admin console unit tests
Change-Id: Id0baa51c2adb14b77080b5acd2abf0658ee54b2b
2016-04-19 14:40:03 +05:30
Pranav Kant
3111c5c6d1 loolwsd: Use common method to send websocket messages
Will help in placing unit test hooks to better test the admin
console

Change-Id: Ic4daae685a8fe493a0395d94e40112bf119c93e3
2016-04-19 14:39:50 +05:30
Pranav Kant
56d18909d5 loolwsd: Remove unused code
Change-Id: I7edf6b8d4f83f2cf9f85a2075d1dca216cda3d34
2016-04-19 14:39:50 +05:30
Andras Timar
69c156e6dd bccu#1696 enable WOPI connection from the same host by default 2016-04-19 10:17:50 +02:00
Miklos Vajna
55f18b4038 loolwsd: fix -Werror=shadow 2016-04-19 09:35:36 +02:00
Miklos Vajna
17de53981e Storage: fix missing underscore for non-static members
Change-Id: Ibde55358c9640344e8bb4e6e24b287b1e7d8c6b5
2016-04-19 09:10:28 +02:00
Ashod Nakashian
f62f336d5c loolwsd: fix typo in config
Change-Id: I27618137bb0b6a7162c1a03806942ee0033be74e
Reviewed-on: https://gerrit.libreoffice.org/24234
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-19 01:44:15 +00:00
Ashod Nakashian
23003c455c bccu#1696 - enable WOPI connection from the same host by default
Since auto-discovery is problematic, this patch implements
support for both regex patterned hostnames/IPs to allow,
and those to block/deny.

A hostname/IP must be both allowed, and not denied, to
be accepted.

By setting ranges of allowed hostnames/IPs, and others
to block/deny, an admin can configure Online with
great flexibility.

Defaults updated with same values, but not exhaustive.

Change-Id: Iedfcafe41d07d905b549fb450c3fe625ad44599e
Reviewed-on: https://gerrit.libreoffice.org/24233
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-19 01:41:51 +00:00
Ashod Nakashian
3878f3b515 loolwsd: initialization and resetting support in RegexListMatcher
Change-Id: Ic262cf9e4a21d30b6dfd9d9fc0d895f89d7d8e7b
Reviewed-on: https://gerrit.libreoffice.org/24232
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-19 01:41:00 +00:00
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
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
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
Michael Meeks
69816395d5 Re-enable verbose tracing during unit testing. 2016-04-15 22:04:15 +01:00
Michael Meeks
448e25f6d8 Make logging signal safe again. snprintf: simpler, safer, faster. 2016-04-15 21:53:10 +01:00
Michael Meeks
65ee749ce1 Move new unit tests to custom test driver.
Cleaner, and avoids bogus warnings during compile.
Merge run_test.sh.in into a mode of run_unit.sh - gives the
chance for nice debug output etc.
2016-04-15 21:52:39 +01:00
Michael Meeks
ebfa339da0 Cleanup symlinking and add realpath symlink if necessary. 2016-04-15 16:17:04 +01:00
Tor Lillqvist
b1aa059bc3 I don't have any ~/.fonts 2016-04-15 17:19:04 +03:00
Tor Lillqvist
947f8bcf13 Test number of loolkit processes also before and after the HTTPPostTest suite 2016-04-15 17:13:47 +03:00
Michael Meeks
a49f642801 Tolerate --version, and add git hash version, print on default start.
Should help diagnosing issues - to have this in our logs.
2016-04-15 15:07:24 +01:00
Michael Meeks
7376b7475e Font bits: create symlink in jail at OS instdir path, to point at /lo
This ensures that bundled fonts in instdir/share end up resolved to
the same path that they were in when the forkit font config was setup.

It may also help locate other pre-inited resources.

Also copy in ~/.fonts in debug mode - can't hurt.
2016-04-15 14:35:57 +01:00
Michael Meeks
ab6cc4135b Copy fonts into systemplate from libreoffice install. 2016-04-15 14:23:44 +01:00
Michael Meeks
b5e37448a8 looltool: get argument array copyies right. 2016-04-15 13:55:34 +01:00
Ashod Nakashian
7df929cb77 loolwsd: use SocketProcessor in kit
SocketProcessor doesn't need to take response
instance, since by the time it is called we
are already upgraded to WebSocket and it's
too late to set a request-level status.

Change-Id: Id95087e60354a50148c88427130613356679cf82
Reviewed-on: https://gerrit.libreoffice.org/24110
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-15 11:54:30 +00:00
Ashod Nakashian
df47ff1b2f loolwsd: .gitignore updated
Change-Id: Ica74b3f6f2fd9e3f9d75f41f2f780010b9b9bc55
Reviewed-on: https://gerrit.libreoffice.org/24109
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-15 11:53:57 +00:00
Ashod Nakashian
cf85f51850 loolwsd: tabs -> spaces
Change-Id: I581346970321446378ff135e0227e06a2092b39f
Reviewed-on: https://gerrit.libreoffice.org/24108
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-15 11:53:42 +00:00
Tor Lillqvist
5782e0b04c TileCache::lookupTile() already returns non-null only if the stream is open
No need to test at call sites. We can assert() as a sanity check
though.
2016-04-15 14:12:35 +03:00
Tor Lillqvist
ecaaab6e90 Default values for bool parameters make the code harder to read
In this case we always passed the parameter anyway.
2016-04-15 13:17:20 +03:00
Pranav Kant
cca858732a loolwsd: Allow admin console to kill documents (again)
Change-Id: I30405854e9ebdc56ab3477758e9008963d4b8efa
2016-04-15 15:25:01 +05:30
Tor Lillqvist
6ca6bf0da6 Rant about over-use of variables where literals would work 2016-04-15 12:26:56 +03:00
Pranav Kant
382da839e0 Add documentation about takeedit
Change-Id: I600046111d2478f1c02552d3caa60d2a50fa7c98
2016-04-15 14:48:58 +05:30
Pranav Kant
91c6154fc0 loolwsd: Use docKey as key for Admin instead of PID
Also change some variable names to be consistent with rest of the
coding style.

Change-Id: Icca9a9aec9bfb34c1edd5b6533d7646b05fe814f
2016-04-15 14:42:14 +05:30
Pranav Kant
7bf5e84a90 loolwsd: Make admin console work (again)
Change-Id: Ib51f33c60b5e42e154795357a7a787cb8691ad51
2016-04-15 13:28:42 +05:30
Pranav Kant
4f9eef9324 loolwsd: Be consistent, and use unique_lock
Change-Id: Idfc14bb7dd82827493865241f6d04cf9ae4a88fc
2016-04-15 13:28:42 +05:30
Pranav Kant
9669470d09 loolwsd: Admin doesn't need its own thread now
The timers are cancelled upon destruction of the static Admin
instance.

Change-Id: Ie43dc9d3ec96b002e12685ec997ad83c29b684d0
2016-04-15 13:28:42 +05:30
Tor Lillqvist
5c41d4c5ed -Werror=maybe-uninitialized 2016-04-15 10:53:06 +03:00
Miklos Vajna
0a92e811dc Storage: const auto -> const auto& where it would create a tmp copy
Change-Id: I0ec42200e19654ee2e1c9b0fc293668847a5b965
2016-04-15 08:49:35 +02:00
Henry Castro
39180a0e22 loolwsd: test: add connectLOKit
Connecting to a Kit process is managed by document broker, that it does several
jobs to establish the bridge connection between the Client and Kit process,
The result, it is mostly time outs to get messages in the unit test and it could fail.
connectLOKit ensures the websocket is connected to a kit process.
2016-04-14 21:54:36 -04:00
Ashod Nakashian
0b4b3c73d5 loolwsd: tile cache cleanup
Change-Id: Ib2abec83fd4866c09b30507c11a809d682c2f819
Reviewed-on: https://gerrit.libreoffice.org/24100
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-15 01:08:37 +00:00
Ashod Nakashian
322a3c1afe loolwsd: logging moved to own files
Change-Id: Idf1dd91cf37675e1bea8aeb5d9e8cf6d2ac9a725
Reviewed-on: https://gerrit.libreoffice.org/24099
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-15 01:07:13 +00:00
Ashod Nakashian
e5595509fd loolwsd: cosmetic cleanup
Change-Id: I02f3ab1778db462376b7563e7e8b0abeebd2e8a1
Reviewed-on: https://gerrit.libreoffice.org/24098
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-15 01:04:47 +00:00
Michael Meeks
fe684cc71d looltool: implement destdir, and fix parallelism. 2016-04-14 21:41:09 +01:00
Michael Meeks
444adc976d looltool cleanup add --no-check-certificate option too. 2016-04-14 20:44:02 +01:00
Michael Meeks
53c60b2842 Magic to cleanup autotools module linking of unit tests. 2016-04-14 18:58:18 +01:00
Michael Meeks
688d1ab6e6 Remove confusing ChildProcessSession include on LOOLWSD.
Move the ClientPortNumber into both Kit and WSD.
2016-04-14 18:58:18 +01:00
Michael Meeks
d817fc2c69 Simple command-line tool for file format conversion. 2016-04-14 18:58:18 +01:00
Andras Timar
1f7da1f5a2 loolwsd: install and package SSL key and certs if SSL is enabled 2016-04-14 18:47:50 +02:00
Henry Castro
bea5963aa7 loolwsd: avoid time out exception 2016-04-14 12:00:32 -04:00
Henry Castro
d11bd69c26 loolwsd: wait prison session until the peer is assigned
Some messages are not forwarded to the client session, this is caused
by the time the client session is assigned, the prison session,
it is already forwarding to not assigned peer session.
2016-04-14 11:41:15 -04:00
Andras Timar
8f93a5f526 merge loleaflet and loolwsd rpm packages 2016-04-14 17:08:52 +02:00
Tor Lillqvist
fe5f238c08 Exit when receiving an *unexpected* CLOSE frame
Otherwise we will just keep waiting for a line on input from stdin,
which is unhelpful.
2016-04-14 17:45:51 +03:00
Tor Lillqvist
066b48688a Use the 'expected' and 'actual' parameters of CPPUNIT_ASSERT_EQUAL() correctly 2016-04-14 17:07:55 +03:00
Tor Lillqvist
2edf15a18b Use CPPUNIT_ASSERT_EQUAL() to get expected and actual values into output 2016-04-14 17:05:09 +03:00
Andras Timar
2e0d895485 loolwsd: define sysconfdir for deb package 2016-04-14 15:26:51 +02:00
Andras Timar
ea94e957c1 loolwsd: rpm install of config files 2016-04-14 15:14:59 +02:00
Andras Timar
a8601804ac loolwsd: process loolwsd.xml.in 2016-04-14 15:06:49 +02:00
Andras Timar
a9fb211118 loolwsd: move loolwsd.xml to loolwsd.xml.in 2016-04-14 14:59:27 +02:00
Andras Timar
ec9aa4a50f loolwsd: fix SSL certs/key install 2016-04-14 14:50:48 +02:00
Andras Timar
1f560af63a loolwsd: discovery.xml to datadir 2016-04-14 14:43:31 +02:00
Andras Timar
b3e610eba0 loolwsd: do not install unit test shared libs 2016-04-14 14:43:31 +02:00
Tor Lillqvist
0140b1cd43 Always define ENABLE_DEBUG and _SSL in config.h, as 1 or 0
Correspondingly always use #if, not #ifdef, to test.
2016-04-14 13:43:31 +03:00
Andras Timar
60c969cd77 add security.h to tarball 2016-04-14 12:35:50 +02:00
Andras Timar
24bc458741 define LOOLWSD_CONFIGDIR and LOOLWSD_DATADIR 2016-04-14 12:34:11 +02:00
Jan Holesovsky
1e58864230 Revert unwanted change of hello.odt, and prevent that from happening again. 2016-04-14 11:40:17 +02:00
Pranav Kant
5d8e627ca4 loolwsd: Allow 'downloadas' for all kinds of views
... irrespective of whether the editlock is taken or not.

Change-Id: I159f78fb4c58c973458ae2c5bc53e844de689e14
2016-04-14 15:08:01 +05:30
Jan Holesovsky
7d64501479 Allow setting the server name and port in loolwsd.xml. 2016-04-14 11:13:55 +02:00
Tor Lillqvist
1bd6cdde3b Util::getSignalStatus() is unused
Good, its semantics was a bit odd anyway.
2016-04-14 11:39:42 +03:00
Michael Meeks
b3f17462eb Fix ENABLE_SSL AC_SUBST. 2016-04-14 09:34:52 +01:00
Michael Meeks
35b27b352c Initial font unit test. 2016-04-14 09:34:52 +01:00
Tor Lillqvist
c7d0067969 Util::getChildStatus() is unused
Good, now the odd LOOLExitCode can go away, too.
2016-04-14 11:30:28 +03:00
Miklos Vajna
63d9112977 MasterProcessSession: const auto -> const auto& where it would create a tmp copy
Change-Id: I5bbffb9be562b52f868bfca3f825e8d81dae4eef
2016-04-14 08:36:56 +02:00
Henry Castro
096f7db6d0 loolwsd: report indicator status before websocket is ready 2016-04-13 14:42:46 -04:00
Jan Holesovsky
efb67d68fd The host= parameter for loleaflet.html does not exist any more.
Now loolwsd fills that in directly.

Also show http:// or https:// in 'make run' according to the configuration.
2016-04-13 18:42:07 +02:00
Jan Holesovsky
b09b6eab89 Only the access_token (and _ttl) is supposed to be passed via the form post. 2016-04-13 18:32:00 +02:00
Michael Meeks
1eb92c0dc9 Cleanup and aggregate memory stats. 2016-04-13 14:35:30 +01:00
Tor Lillqvist
8d69c09dbc Expand on the 'busy wait' issue 2016-04-13 16:12:53 +03:00
Tor Lillqvist
4087ac8089 With "disconnect" messages gone, no need for a 'reason' to disconnect()
YAGNI.
2016-04-13 15:56:23 +03:00
Tor Lillqvist
c9796255ae Don't check for undocumented "eof" frames read from a websocket either
Now with "disconnect" frames gone, surely checks for "eof" ones can go
away too, whatever they were.
2016-04-13 15:50:09 +03:00
Tor Lillqvist
e5de11113b Don't check for or send "disconnect" frames anywhere and don't document them
Follow-up to 68b3a2c81e.
2016-04-13 15:49:10 +03:00
Tor Lillqvist
db14143d72 Make the loolkit process counting more reliable
Sleep in both places before counting them, and catch Poco exceptions
while counting (can happen for instance when a /proc entry goes away
while we are looking for its 'comm' file).
2016-04-13 15:33:56 +03:00
Pranav Kant
68b3a2c81e Always save irrespective of nature of socket close
Do not distinguish between normal shutdown or abnormal shutdown.
Also remove 'disconnect' frame to indicate normal shutdown.

Change-Id: I98fd9f5a219feb1097c57302dba14e08ad9bf143
2016-04-13 17:35:10 +05:30
Ashod Nakashian
65ee0a1cdd loolwsd: corrected etc file copying
Change-Id: Ie920bbdee38d4b0a338753a6d483e274052939ce
Reviewed-on: https://gerrit.libreoffice.org/24053
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-13 11:49:31 +00:00
Jan Holesovsky
7e67b38832 Add some paranoia... 2016-04-13 13:44:18 +02:00
Jan Holesovsky
484335321f Introduce LOOLWSD::SSLEnabled for runtime, and allow non-SSL access via WOPI. 2016-04-13 13:11:06 +02:00
Tor Lillqvist
726fd1f66d The CPPUNIT_TESTs I added a moment ago should be first and last in the list 2016-04-13 13:22:35 +03:00
Tor Lillqvist
00660cfe3d Sort #includes 2016-04-13 13:19:26 +03:00
Tor Lillqvist
b4ae5192bb bccu#1678: Add cppunit test that no extra loolkit processes are left over
The number of loolkit processes after running the cppunit tests should
be the same as before running them. (At least, that is the intention
at the moment, I think. If/when this changes, the test will have to be
adapted, of course.)
2016-04-13 13:17:43 +03:00
Tor Lillqvist
0f3d98d2d1 Try to use consistent indentation for parameters to SocketProcessors()
But yeah, not sure why the blocks of the lambdas are de-indented like that.
2016-04-13 12:22:19 +03:00
Tor Lillqvist
c8a46e78a8 bccu#1678: Check whether document can be discarded also in stop predicate
Seems to fix the problem that the loolkit processes hang around
forever even if there is no associated client.
2016-04-13 12:17:59 +03:00
Tor Lillqvist
04f3a9e111 It works better to set TerminationFlag
That global flag is checked all over the place, so setting it will
actually make the threads eventually finish. (All polling is done with
timeout, I think, and then checking TerminationFlag whenever the poll
times out.)

Sure, it would be much better to use an eventfd and poll that, too,
instead of timing out from the polls all the time to check a plain old
boolean flag.
2016-04-13 11:49:16 +03:00
Tor Lillqvist
26ceda2f15 More specific message 2016-04-13 11:49:00 +03:00
Miklos Vajna
4fac6c0126 DocumentBroker: can pass these by reference
Change-Id: I327e515e39671239b8699cfadcf61e088af68b13
2016-04-13 10:05:10 +02:00
Tor Lillqvist
8f3ec463b8 Change some cppunit assertion messages to match what is actually being asserted
If you can't come up with a meaningful message to use in a
CPPUNIT_ASSERT_MESSAGE(), just use CPPUNIT_ASSERT() instead. These
messages aren't intended for end-users but for developers, so it is
pointless to make them high-level and dumbed-down.
2016-04-13 09:58:18 +03:00
Pranav Kant
9ea4624839 loolwsd: Handle socket exceptions while trying to send frame
In case of abnormal termination of session from client-side,
we might still have data being processed in the kit process, for
example, during auto-save. Trying to send such data over an
expired socket towards the client would throw exceptions which
need to be handled, otherwise the auto-save process would not be
successful. Further, the unhandled exception can bring the document
broker in an unstable state with dockey still present in the
object.

Also do not send 'editlock: 0' to a websocket session which is
going to be removed because the session might have been
forcefully terminated from the client-side, in which case sending
data would go nowhere.

Change-Id: I10eb9c818bc81d4db26d5a19dc8bd44f6fbdf32c
2016-04-13 09:56:32 +05:30
Henry Castro
6701dc62ce loolwsd: response bad request 2016-04-12 17:45:25 -04:00
Michael Meeks
25a092d7de Add memory accounting metric to UnitPrefork.
Also add hooks to allow custom LOK <-> WSD message for this test.
2016-04-12 21:58:27 +01:00
Henry Castro
87639db612 loolwsd: test: remove temporary files 2016-04-12 14:34:25 -04:00
Henry Castro
c7abd16399 loolwsd: replace CPPUNIT_ASSERT_MESSAGE -> CPPUNIT_FAIL 2016-04-12 13:56:32 -04:00
Michael Meeks
6a990dfb61 Security bits and test cleanup.
Enforce user being 'lool' for setcap binaries loolmount and loolforkit.

Add warnings if configured without --enable-debug.

Developers should pass --enable-debug to configure.
2016-04-12 17:13:56 +01:00
Pranav Kant
ce64cab64d Update README about Admin changes
... since we have stopped using pipes for admin console.

Change-Id: If2c1814be453cf8c83da16dc78a287c856d9f278
2016-04-12 21:04:54 +05:30
Tor Lillqvist
ec9bc15de8 Make the exit status of run_test.sh reflect its result
Make it match the exit status of the actual ./test program.
2016-04-12 18:29:02 +03:00
Tor Lillqvist
241d421fc7 Kill the "lool_admin_notify.fifo" thing as it is not used
The loolwsd process created it and opened it for reading, but nothing
opened it for writing.

There is still documentation for it in README, that needs to be either
rewritten to match reality or removed.
2016-04-12 18:07:29 +03:00
Tor Lillqvist
745950ceb2 Improve error logging for the fifo creation 2016-04-12 17:57:58 +03:00
Tor Lillqvist
5c6e209567 Log creation and opening of fifos in more detail 2016-04-12 17:49:20 +03:00
Tor Lillqvist
6342c33dda ClientPortNumber is not static any longer 2016-04-12 16:04:59 +03:00
Henry Castro
53aea60ab1 loolwsd: fix -Werror,-Wshadow 2016-04-12 08:32:22 -04:00
Tor Lillqvist
9086f378d8 Pedantry 2016-04-12 14:48:26 +03:00
Tor Lillqvist
8dcd7d22e4 Remove a few more more leftovers from the "broker" terminology 2016-04-12 14:24:47 +03:00
Tor Lillqvist
479d461348 Add a debug option --careerspan to make loolwsd retire after that many seconds
Comes in handly in some testing situations where you don't want to
send a signal to get loolwsd to finish. Option is present only in an
--enable-debug build.
2016-04-12 13:57:45 +03:00
Pranav Kant
9efed29c1d loolwsd: Save using session holding the edit-lock
If the first session used to save does not hold the edit-lock,
all the .uno:Save commands will get converted to dummy messages
and never reach the kit process.

Change-Id: I36cbee778f8c2c5866dcf276cf156fdf9ed8388e
2016-04-12 16:12:23 +05:30
Tor Lillqvist
9c8e4988fa Bin the old --test mode of LOOLWSD
It hardly was relevant any more. The 'connect' test program can be
used for effectively the same kind of testing anyway.
2016-04-12 13:34:33 +03:00
Michael Meeks
cd2f70521b Cleanup configure.ac status messages. 2016-04-12 10:00:44 +01:00
Jan Holesovsky
280fafe03c Add a trivial autogen.sh. 2016-04-12 10:17:20 +02:00
Jan Holesovsky
3d17f3cc4d Add a missing autoheader call. 2016-04-12 10:09:10 +02:00
Tor Lillqvist
d7f107c532 Add m4, and re-order for clarity
Only have under the "Autofoo" comment stuff actually related to
autofoo or configury in general.
2016-04-12 10:49:57 +03:00
Jan Holesovsky
cc3ee1033b Make the autotools steps reliable. 2016-04-12 09:39:53 +02:00
Miklos Vajna
73985418c7 ${systemplate} -> @SYSTEMPLATE_PATH@ to fix make check
Change-Id: I5cb78fa3820c2e48fe071ba2b030b824a6780e10
2016-04-12 08:37:24 +02:00
Tor Lillqvist
255f9304e9 Fix build without --with-lo-path 2016-04-12 09:29:57 +03:00
Miklos Vajna
773dad57ba AdminModel: can pass these by reference
Change-Id: I1c9ff03c06a8de00162cb2987b7218209f514850
2016-04-12 08:09:42 +02:00
Michael Meeks
ea1e2493bf Re-factor tests, move jails & systemplate up a level into loolwsd.
Also generate the test scripts with config.status containing absolute
paths to make them easier to run, and enable the older unit tests.
2016-04-11 22:01:49 +01:00
Tor Lillqvist
0f3fa0e9d4 Don't log the payload inside a CLOSE frame
It is a status code, a 2-byte unsigned integer in network byte order,
potentially followed by a textual reason. But we never include any
specific status codes in the CLOSE frames anyway. (With a Poco-based
WebSocket peer it is always WS_NORMAL_CLOSE, 1000, 0x03 0xE8.)
2016-04-11 17:21:57 +03:00
Tor Lillqvist
ccf73d159d Mention libtoolize, and that building from tarball is simpler
(Is it?)
2016-04-11 17:04:19 +03:00
Tor Lillqvist
9929842a69 It is loolforkit that has capabilities now, not loolwsd 2016-04-11 17:00:11 +03:00
Tor Lillqvist
eb5fcdba93 Consistenly put a colon after the "editlock" in the message sent to the client 2016-04-11 13:31:03 +03:00
Tor Lillqvist
a1f4ded793 YAGNI: Drop parameter with default value that is never overridden
No non-default value is never passed. Just use the default value as such in the function.
2016-04-11 11:30:54 +03:00
Tor Lillqvist
6729bb7726 PipeReader::readLine() is used only internally by processOnce() 2016-04-11 11:23:33 +03:00
Tor Lillqvist
077a4436df Bin unused function PipeReader::process() 2016-04-11 11:21:18 +03:00
Tor Lillqvist
2623208c8f Rename MAINTENANCE_INTERVAL to something more descriptive 2016-04-11 11:17:27 +03:00
Tor Lillqvist
a598ea869c Use less misleading function and variable names
Also, get rid of one default parameter that was passed a non-default
value only 'internally'.
2016-04-11 10:14:26 +03:00
Miklos Vajna
ee1e036aa9 Util: strcpy -> strncpy
Change-Id: I03f50f4e5e7f404364fdf90197750bf7cd762c9c
2016-04-11 09:12:59 +02:00
Tor Lillqvist
1c9a6400b6 Make the testBadLoad() unit test pass again
The server sends an "editlock: 1" message even if no document has been
loaded. Ignore that while waiting for the "error:" message.
2016-04-11 10:00:45 +03:00
Tor Lillqvist
bde585a879 Make the time log messages make more sense semantically 2016-04-11 09:25:32 +03:00
Tor Lillqvist
9d4aeb86d1 I doubt we need nanosecond precision here in the logging
(As in "Most recent inactivity was 8096.000000 ms ago".)
2016-04-11 09:15:12 +03:00
Tor Lillqvist
dfd1782300 Probably we can drop the "30-second check" log output 2016-04-11 09:09:18 +03:00
Ashod Nakashian
abca88c7cf loolwsd: correction to prefork unit-test
Since WSD now takes into account the fact that
ForKit always spawns one child, the unit-test
shouldn't expect +1 preforked children.

Change-Id: I5cbe9d817a0d2ffdf9fb0953ef85450f7b8b224f
Reviewed-on: https://gerrit.libreoffice.org/23980
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-11 03:12:26 +00:00
Ashod Nakashian
63068a5dda loolwsd: command timeout is now a const
Change-Id: I9115f465fe760f4c388294bfb5e14cbb441c1174
Reviewed-on: https://gerrit.libreoffice.org/23979
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-11 03:12:06 +00:00
Ashod Nakashian
280669c253 loolwsd: save on disconnection
Last client disconnection now correctly issues a save
and waits for the confirmation before tearing down
the sockets, queues and threads.

Change-Id: I28c28d79a17d359e9aa1fe67b983ca9fb592b847
Reviewed-on: https://gerrit.libreoffice.org/23978
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-11 03:11:38 +00:00
Ashod Nakashian
1c0f608a59 loolwsd: broker sets edit lock on first session automatically
Change-Id: Icad57130ffb1953cf8c71d4675c116036684569a
Reviewed-on: https://gerrit.libreoffice.org/23977
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-11 03:10:13 +00:00
Ashod Nakashian
4cab42b20f loolwsd: logging improvements
Change-Id: Idba11b0ae18337d78ea504a455ddc9494cff7ef0
Reviewed-on: https://gerrit.libreoffice.org/23967
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-10 17:21:32 +00:00
Ashod Nakashian
2a65f2e397 loolwsd: invoking disconnect on the session from Connection deadlocks
Connection thread should not attempt to disconnect the session,
which in turn will try to unload the document, which will
wait on the connection to destroy. The latter will never
happen since the connection destructor must, correctly,
wait for its thread to finish, which is waiting on itself now.

Since the session disconnect is already called from the session
destructor, there is no need to explicitly invoke it here.

Change-Id: Iaf9e8a10d4caa9001208084e909a14b4d4c5105e
Reviewed-on: https://gerrit.libreoffice.org/23966
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-10 17:19:55 +00:00
Ashod Nakashian
85641d934e loolwsd: for consistency always remove edit lock before taking it
Change-Id: Id24d6737fc3af77097058b28a77d6ca2d757cb9e
Reviewed-on: https://gerrit.libreoffice.org/23965
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-10 17:18:49 +00:00
Ashod Nakashian
60531e7def loolwsd: removed redundant session count in DocumentBroker
The sessions container already has the number of sessions.
No need for separate counters to track them.

Change-Id: I838865e2b8a843e87e81a6cc1226bcacd774b032
Reviewed-on: https://gerrit.libreoffice.org/23964
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-10 17:18:25 +00:00
Ashod Nakashian
e85d726c6c loolwsd: use the first valid session for auto-saving
Change-Id: I3d860c9f91de56f84ae93dc93688cd4898128107
Reviewed-on: https://gerrit.libreoffice.org/23963
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-10 17:15:18 +00:00
Andras Timar
39203290d8 bump version number, because we branched off 1.5.x 2016-04-10 12:53:06 +02:00
Tor Lillqvist
8d77460738 Add one minor thing 2016-04-10 10:44:45 +03:00
Tor Lillqvist
ec1ae85ddb Bin some obsolete lines 2016-04-10 09:40:28 +03:00
Tor Lillqvist
1409702282 Do include what you use even if it apparently gets included indirectly anyway 2016-04-10 09:37:51 +03:00
Tor Lillqvist
df2048c895 No need for <condition_variable> here 2016-04-10 09:36:36 +03:00
Tor Lillqvist
8bd0cb7543 These member variables are not used any more 2016-04-10 09:33:03 +03:00
Tor Lillqvist
3717c0ed27 Bin some unused static member variables 2016-04-10 09:31:56 +03:00
Tor Lillqvist
bdecb37f72 'make check' seems to work much better currently 2016-04-10 09:27:59 +03:00
Tor Lillqvist
fc87a51a69 No fifoCV/fifoMutex any more
(I did not bother checking whether they were just renamed, of whether
the same anti-pattern is present in some other place.)
2016-04-10 09:25:54 +03:00
Henry Castro
9ae7fa5b9b loolwsd: wait until bridge is completed 2016-04-10 00:18:48 -04:00
Ashod Nakashian
21e6ac23ea loolwsd: prevent ctrl+tab from inserting tab characters
Change-Id: I10b32a3e8ea1c8f80fadc9a8e6502b1a8bd322cc
Reviewed-on: https://gerrit.libreoffice.org/23953
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-10 04:15:57 +00:00
Ashod Nakashian
dc137081a7 loolwsd: session container can be private to DocumentBroker
Change-Id: I1539f2ec3ab1bd11d659dab11359cf25a46e1f97
Reviewed-on: https://gerrit.libreoffice.org/23952
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-10 04:15:11 +00:00
Ashod Nakashian
e6d0882791 loolwsd: moved autosave to DocumentBroker
Autosaving is done by DocumentBroker, which
tracks the last save time.

There are two triggers: idle and auto save.
The first triggers when sufficient time passes
after the last interaction the user had with
the UI (currently 30 seconds).
The second triggers when it's been more than
5 minutes since the last save.
Both triggers are conditional on the user
being active after the last save.

The new code auto-saves doesn't issue
a save command per session, but only
one per doc.

Change-Id: Iada15c16002e70710d2c13a3dcfdab036d8935c6
Reviewed-on: https://gerrit.libreoffice.org/23951
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-10 03:37:06 +00:00
Ashod Nakashian
8c1e5057fd loolwsd: last activity time updates ignores non-interactive commands
Change-Id: I763c2945f6acb30bea9d04d91982e9fb0c8ca6ca
Reviewed-on: https://gerrit.libreoffice.org/23950
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-10 03:35:09 +00:00
Ashod Nakashian
213888c45c loolwsd: logging and remove unused vars
Change-Id: Iff4cf5284a959caf84ce6ca5072623b6f95315df
Reviewed-on: https://gerrit.libreoffice.org/23949
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-10 03:33:38 +00:00
Ashod Nakashian
b6d2edb0e3 loolwsd: moved activity tracking into LOOLSession
Change-Id: I87d5afc43bea29ede2ad6e2871c594c4746bc3d5
Reviewed-on: https://gerrit.libreoffice.org/23948
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-10 03:32:58 +00:00
Ashod Nakashian
6a907a7a7f loolwsd: preFork is done once by ForKit already and sanity check count
Change-Id: I8ee843e35198ef88bdf191c11a2a738fae6e6c30
Reviewed-on: https://gerrit.libreoffice.org/23947
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-10 03:28:25 +00:00
Ashod Nakashian
70e8132866 loolwsd: correct handling socket buffer size and exception handling
Change-Id: I3eb28405c8f30a98c1b1e9644e9303d6074337e3
Reviewed-on: https://gerrit.libreoffice.org/23942
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-09 19:56:11 +00:00
Ashod Nakashian
e5846ee2cc loolwsd: supress unused-result and log error
Change-Id: I0ca04d5d9e18fdda6c2dca29386dbcc9a6df7784
Reviewed-on: https://gerrit.libreoffice.org/23941
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-09 19:55:42 +00:00
Ashod Nakashian
435b706f9a loolwsd: must include Poco/Version.h to define POCO_VERSION
Change-Id: I7dbabff60a9fe100caff2af357b8539126c3c003
Reviewed-on: https://gerrit.libreoffice.org/23940
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-09 19:55:18 +00:00
Michael Meeks
5b8f49423d More kit unit testing tentacles. 2016-04-09 18:29:20 +01:00
Michael Meeks
b308792801 Add infrastructure to inject test pieces into loolforkit. 2016-04-09 18:17:12 +01:00
Pranav Kant
9444bb2b87 loolwsd: update documentation about editlock
Change-Id: Id819a2e2d0739a773c5a01ec7bc80152c03bf8f0
2016-04-09 01:52:17 +05:30
Pranav Kant
9469021f74 consistency, server -> client messages ends with a colon
Change-Id: Ia2154603bf0b9432beeaae970f68daa1ea7f7ebd
2016-04-09 01:46:03 +05:30
Jan Holesovsky
156d52b82e loolwsd: Add handling of contextmenu: command. 2016-04-08 19:15:08 +02:00
Jan Holesovsky
756cb64203 Update LOK headers to the latest ones. 2016-04-08 19:15:08 +02:00
Michael Meeks
3e618a97e3 Tests: add timeout, and test for timeout. 2016-04-08 17:36:08 +01:00
Tor Lillqvist
d0309d9a83 No reason to use unsigned instead of bool 2016-04-08 17:17:13 +03:00
Tor Lillqvist
40914ca336 Initialise the Connection::_joined in the constructor
This seems to get rid of the "terminate called after throwing an
instance of 'Poco::SystemException'" problem for me at least.

Sigh. Why can't the compiler warn about such things? I build with
clang++ -Wall -Wextra. The Connection class is fully defined inside
the LOOLKit.cpp so it should be able to, right?
2016-04-08 17:16:28 +03:00
Tor Lillqvist
7d82e059a2 Make Util::signalName() return a const char *instead
Makes its use in handleTerminationSignal() and handleFatalSignal()
less complicated.
2016-04-08 16:06:39 +03:00
Tor Lillqvist
913723e581 Include the "SIG" prefix in Util::signalName() 2016-04-08 15:32:30 +03:00
Tor Lillqvist
4129b7b84e Don't use strsignal(), use Util::signalName()
Presumably it is only developers that are interested in signals, and
terms like SEGV or ABRT are more precise than their textual
descriptions like "Segmentation violation" or "Aborted".
2016-04-08 15:31:47 +03:00
Tor Lillqvist
f7612b989a Give a potential handleFatalSignal() time do its job
Sleep a second before exiting in case we get a fatal signal just when
about to finish, which sadly seems to happen often. (In fact, if
handleFatalSignal() is running at the same time, it will kill the
process so we never get to the _Exit() call.)
2016-04-08 15:22:52 +03:00
Tor Lillqvist
fb0f31d2e8 Print a backtrace on fatal signals 2016-04-08 15:22:22 +03:00
Tor Lillqvist
407f688cb6 Include config.h to get ENABLE_SSL 2016-04-08 14:49:33 +03:00
Tor Lillqvist
cc4791ec49 It is customary to define ENABLE_FOO as 1 2016-04-08 14:35:17 +03:00
Tor Lillqvist
3b5f126b89 Typo 2016-04-08 14:30:48 +03:00
Tor Lillqvist
cc166639ef For more safety (?), catch Poco::Exception in general, not just IOException
Also, display more information about the exception.

Actually I think I should factor out the code to display as much
information as possible from an exception. Currently the amount of
information displayed varies from case to case in the code-base.
2016-04-08 14:28:52 +03:00
Andras Timar
f75a27e3db loolwsd: --disable-ssl option 2016-04-08 13:16:49 +02:00
Tor Lillqvist
c08d35dd15 Add comment 2016-04-08 13:12:21 +03:00
Tor Lillqvist
48bc23f3ce Drop unnecessary variable 2016-04-08 13:09:06 +03:00
Tor Lillqvist
ca4d8ea451 ChildCounter is never incremented or decremented 2016-04-08 13:07:33 +03:00
Tor Lillqvist
481afd0306 Exit bluntly in all cases from a loolkit process 2016-04-08 11:48:02 +03:00
Tor Lillqvist
84650ea2df Use std:: prefix for cstdlib functions 2016-04-08 11:46:42 +03:00
Tor Lillqvist
e026a7073b We don't need _exit here
This is called in the parent loolforkit process. It's in the loolkit
processes that we want to do the blunt exits, I assume.
2016-04-08 11:43:33 +03:00
Tor Lillqvist
756363e4dc Consistency 2016-04-08 11:42:14 +03:00
Tor Lillqvist
f6d9b2c099 Consistency is a virtue
(But sure, tons of much more annoying inconsistencies in style
remain.)
2016-04-08 11:09:46 +03:00
Tor Lillqvist
ecff38df83 These can be static 2016-04-08 11:00:58 +03:00
Miklos Vajna
c034165a90 Util: avoid leaking the channel
Poco::Channel is reference counted, but the initial refcount is 1, so we
need to release channel in order to have it deleted when Poco::Logger
releases it.

Calls to Poco::Logger::shutdown() are still missing though (from
forkit/kit/wsd).

Change-Id: I12ab32047d32e55902c60639d71eb6ef30ffa3bd
2016-04-08 09:15:37 +02:00
Tor Lillqvist
1fcdb8beaa expectContinue is gone in bleeding-edge Poco
Put this inside #if, add the 'override' back for current Poco. Avoids
"warning: 'expectContinue' overrides a member function but is not
marked 'override'" when compiling against current Poco.

Not sure what good it would do to define it at all if compiling
against a bleeding-edge Poco as it won't call it anyway?
2016-04-08 09:29:47 +03:00
Ashod Nakashian
703febc2e2 loolwsd: compatibility fixes with Poco master
Change-Id: Ide03cc4cce528fa15a9f6b6ba546477e557142fe
Reviewed-on: https://gerrit.libreoffice.org/23908
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-08 02:38:56 +00:00
Michael Meeks
7d62c74b83 Fix segv on failure to create a storage, and add unit test infra. 2016-04-07 22:21:14 +01:00
Michael Meeks
86ebefce50 Get subdirs build order right for tests. 2016-04-07 22:21:14 +01:00
Henry Castro
dd96c6a4de loolwsd: handle a POST request in loleaflet 2016-04-07 17:20:45 -04:00
Michael Meeks
8d7a265479 Print preload time. 2016-04-07 20:15:18 +01:00
Michael Meeks
cd47b5e044 Signal safe signal handlers. 2016-04-07 19:39:11 +01:00
Michael Meeks
a454a3c407 Improve test API, and handle failure better. 2016-04-07 19:39:11 +01:00
Michael Meeks
024fd2ee8d Scripting to create and populate jails automatically.
'make check' now builds a system image, and runs tests inside it.
2016-04-07 19:38:33 +01:00
Michael Meeks
ad13dca8f8 First cut at adding integration and unit test hooks into loolwsd.
Add new configure parameter --with-lo-path= which can be used to
auto-populate a system template as required.
2016-04-07 19:38:33 +01:00
Michael Meeks
b6ab8982e6 Guard logger so it can be used during static destructors safely. 2016-04-07 19:38:33 +01:00
Michael Meeks
72a0926b4a Hush - update gitignores. 2016-04-07 19:38:33 +01:00
Tor Lillqvist
c71d12ae63 Process name and id are already part of each logging output line 2016-04-07 20:22:57 +03:00
Tor Lillqvist
557ca90be1 Remove unused IoUtil::readMessage() 2016-04-07 20:18:22 +03:00
Tor Lillqvist
16034f6685 Bin unused INTERVAL_PROBES 2016-04-07 20:09:35 +03:00
Tor Lillqvist
4ed3393f16 Nothing ever passed for the pollTimeoutMs parameter so use the default value in-line 2016-04-07 20:07:56 +03:00
Tor Lillqvist
584a805781 The SocketProcessor() 'name' parameter can now be dropped 2016-04-07 20:07:50 +03:00
Tor Lillqvist
5ea6c4bacf No need to show the SocketProcessor 'name' in the log
The thread name already identifies it sufficiently as can be seen:

kit-05108-00 00:00:01.662974 [loolkit        ] [ChildControllerWS] Starting Socket Processor.
wsd-05087-03 00:00:08.126842 [client_ws_0002 ] [Client_ws_0002] Starting Socket Processor.
wsd-05087-05 00:00:08.153688 [prison_ws_0002 ] [Child_ws_0002] Starting Socket Processor.
2016-04-07 19:52:53 +03:00
Tor Lillqvist
d36c8bbbba Avoid some use-once variables
Also, use different names for the HTTPRequestHandler threads in
ClientRequestHandlerFactory and PrisonerRequestHandlerFactory.
2016-04-07 19:31:56 +03:00
Tor Lillqvist
9acc0b052e Bin one more redundant thread name in debug log 2016-04-07 19:26:01 +03:00
Ashod Nakashian
d014589692 loolwsd: added default LO install path in the config
Change-Id: Ic42acd1a6050104d08a5bcf2ebb90b9b8aabbbfa
Reviewed-on: https://gerrit.libreoffice.org/23899
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-07 14:02:39 +00:00
Tor Lillqvist
711674f7ce Use Log::debug() here, too, for consistency 2016-04-07 15:56:23 +03:00
Tor Lillqvist
4fdd6d684f Reduce redundant information in logging
The logging functions already display the thread name on all output
lines. No need to mention it another time in the thread start and
finish logging messages.
2016-04-07 15:53:53 +03:00
Tor Lillqvist
175bd4c9e2 Use the actual current process names here, too 2016-04-07 11:53:44 +03:00
Tor Lillqvist
931550b435 Quite essential to change loolbroker to loolforkit here, too 2016-04-07 11:53:44 +03:00
Tor Lillqvist
84cd6bbceb Try to be more consistent in terminology
The "Broker" process is called "ForKit" now. The only things called
"broker" now are the DocumentBroker objects in the WSD process.
2016-04-07 11:53:44 +03:00
Tor Lillqvist
d28354c6a6 Bin unused variables 2016-04-07 11:53:44 +03:00
Tor Lillqvist
c520aa4f05 These are not warnings 2016-04-07 11:53:44 +03:00
Tor Lillqvist
acc59a2ea5 Make error messages more consistent and use Log::syserror() in more places
A call to Log::error() should be enough to indicate that it is an
error. We don't need to prefix the message with the string "Error: "
in some cases but not others. (If we do want such a prefix for all
errors, surely then we should add it in the actual Log::error()
function.)

Also, change some more Log::error() calls to Log::syserror() where
appropriate.
2016-04-07 11:53:44 +03:00
Tor Lillqvist
5637064e9a Factor out the prctl() calls
Silly to keep copy-pasting the same couple of lines over and over
again.
2016-04-07 11:53:33 +03:00
Tor Lillqvist
ec604599f1 Introduce separate Log::syserror() function for logging actual syscall errors
Much better than assuming that errno would be relevant at all
Log::error() calls (or alternatively, having to remember to append a
false parameter to the Log::error() call, which had not been done a
single time anyway.)

Call log::syserror() right after a system call has returned an
error. Don't call it otherwise.
2016-04-07 10:36:38 +03:00
Tor Lillqvist
94caec287f We never call Log::warn() with an append_errno parameter
So just drop it. Default parameters are ugly IMHO.
2016-04-07 10:15:51 +03:00
Tor Lillqvist
6229648610 Include dlerror() message in log output also if dlsym() fails 2016-04-07 10:13:56 +03:00
Ashod Nakashian
f04eee1ec4 loolwsd: updated gitignore with renamed binaries
Change-Id: I1c51db6b8254bc70291de51a6bd5f8fd3d53e8fc
Reviewed-on: https://gerrit.libreoffice.org/23882
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-07 04:45:58 +00:00
Ashod Nakashian
9485b4fe63 loolwsd: disable loading of local docs by default
Loading documents from the local filesystem
opens the door to security issues.

By default filesystem storage is disabled,
even if enabled in the config file. The
only way to enable it is to set the
allowlocalstorage command-line argument.

Change-Id: Ib8f57377260817436d101a16757aab38276cbdcd
Reviewed-on: https://gerrit.libreoffice.org/23881
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-07 04:45:31 +00:00
Ashod Nakashian
00940d5a0b loolwsd: configure wsd using the config file
Most all configuration values can now be defined
in the configuration XML. The command-line arguments
can be used to override some of these values (for
the convenience of developement and testing) and,
in a few cases, as a security measure to avoid
storing sensitive data in the configuration file.

Change-Id: I040b807b1a59a3537bb94646150d3c7d711f8b62
Reviewed-on: https://gerrit.libreoffice.org/23880
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-07 04:44:35 +00:00
Ashod Nakashian
29c9ecba2a loolwsd: deny access to directories outside of FileServerRoot
Change-Id: Iea92982ebd5f111c946eb1b12f5dfd7602fffd70
Reviewed-on: https://gerrit.libreoffice.org/23879
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-07 04:43:05 +00:00
Ashod Nakashian
1f88aede00 loolwsd: Admin Console credentials passed on the command line
A new command-line argument, admincreds, must be provided
to set the Admin Console credentials.

The new command-line argument specifies the username
and password in the following format: username/password

If not provided, Admin Console is disabled for security
reasons. A warning is emitted at startup and an error
on every invocation of Admin Console is logged when
no credentials are defined.

Change-Id: I348623949fd0b292f5066e4955759c708204540f
Reviewed-on: https://gerrit.libreoffice.org/23878
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-07 04:42:15 +00:00
Ashod Nakashian
d75bc16753 loolwsd: removed loolwsd pid logging
loolstat now uses `pgrep loolwsd$` instead
of relying on pid dumping in a temp file.

With the Admin Console this tool (loolstat)
is less useful, so this cleanup is probably
a stepping stone to removing it altogether.

Change-Id: Ib7732a00c3d3ea54dffcb71e9fe1a56c4a88016e
Reviewed-on: https://gerrit.libreoffice.org/23877
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-07 04:40:27 +00:00
Ashod Nakashian
05ec505452 loolwsd: added more configuration entries to loolwsd.xml
Change-Id: Iab5ef89b1e152605e6ea869d6c89192e824d92f2
Reviewed-on: https://gerrit.libreoffice.org/23876
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-07 04:39:39 +00:00
Ashod Nakashian
e8ffea5d1c loolwsd: minor cleanup of path handling in config
Change-Id: I6a858e819372326ab582af91ad55a8e84b81608d
Reviewed-on: https://gerrit.libreoffice.org/23875
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-07 04:39:04 +00:00
Jan Holesovsky
204a9c742f loolwsd: Allow asking for credentials even during websocket setup.
It may happen that admin.html is cached, which leads to the cookie not being
set up, which then leads to endless amount of attempts to log in.
2016-04-06 20:17:24 +02:00
Ashod Nakashian
6e5e9033f2 loolwsd: removed Admin pipe
Admin no longer needs a pipe as it's notified
from WSD. It is now a singleton with improved
locking.

The tracking of documents and views still needs
improvement and corrections.

Change-Id: If614331de6dd595c6dd4443f480d4ab588ca4551
Reviewed-on: https://gerrit.libreoffice.org/23860
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-06 13:52:57 +00:00
Ashod Nakashian
0aa60f8745 loolwsd: ignore SIGCHLD and auto-reap zombies
Change-Id: Ia927d4d01c38a8929a47fb8aa014f0ed5896f8ed
Reviewed-on: https://gerrit.libreoffice.org/23859
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-06 13:52:25 +00:00
Ashod Nakashian
5e41763386 loolwsd: disconnect WS before killing/abandoning child
Change-Id: Iff0ac1b57ce9e0fe61871fad9a499d370c2c9294
Reviewed-on: https://gerrit.libreoffice.org/23858
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-06 13:52:05 +00:00
Tor Lillqvist
594d925c9e This is not the place for this documentation any more
Besides, I don't think we actually use such a terminology as that
comment claimed.
2016-04-06 12:51:45 +03:00
Tor Lillqvist
7af1db615d These enums are indeed not used, and are not a good idea, so kill them
To use such enums would be a mistake. It is quite enough to just use
the message tokens as strings. Duplicating them as enums will just
lead to the enums getting out of synch (as they already were). We
would also need functions to covert between the string and enum
forms. It seems to be hard enough to keep the messages documented in
protocol.txt.
2016-04-06 12:51:31 +03:00
Tor Lillqvist
2e5a268bbc bccu#1399: Factor out check whether message indicates user interaction
Add a function to determine whether a client message indicates user
interaction. We need that distinction when deciding when to do an
automatic ("idle" or "auto") save of document being edited.

"Interaction" is a loose term, possibly what we actually want is to
see whether the user is actively doing an edit that changes the
contents of meta-data of the document.
2016-04-06 12:51:02 +03:00
Tor Lillqvist
d4ede7136c bccu#1399: Restrict the meaning of the 'last message' timestamp and rename
It should keep track only of messages that indicate explicit editing
actions by the user. For now, treat anything except 'tile' messages as
such.
2016-04-06 12:50:42 +03:00
Tor Lillqvist
381bd75fe4 Add some clarifying comments 2016-04-06 12:50:09 +03:00
Tor Lillqvist
41a1c0b3f9 Introduce LOOL_NO_AUTOSAVE environment variable 2016-04-06 12:49:13 +03:00
Michael Meeks
2cdc96c76d Close inherited WSD socket after fork.
Leave stderr/stdout etc. though.
2016-04-05 14:51:22 +01:00
Michael Meeks
36d734ab81 Rename loolbroker to loolforkit.
Now we have just one broker - the DocumentBroker inside WSD.
2016-04-05 14:45:46 +01:00
Michael Meeks
6ec2e8ca68 Rename loolbroker to loolforkit - and split the child to LOOLKit.
Move ChildProcessSession to shared_source and fix the static
ClientPortNumber issue.
2016-04-05 14:45:46 +01:00
Henry Castro
3e11956f23 loolwsd: remove pipeKit 2016-04-05 09:31:26 -04:00
Michael Meeks
1216243935 License cleanup.
Boost sample code long gone; and include loleaflet license.
2016-04-05 13:58:41 +01:00