Commit graph

1562 commits

Author SHA1 Message Date
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
Miklos Vajna
343e9c468d loolwsd: fix -Werror,-Wsometimes-uninitialized 2016-04-05 14:33:40 +02:00
Henry Castro
5657eac618 loolwsd: remove duplicate exit 2016-04-05 08:29:28 -04:00
Michael Meeks
d498bff3f0 Plural of child is children. 2016-04-05 12:23:02 +01:00
Michael Meeks
0278743fb2 Move pre-forking of children from loolbroker to WSD. 2016-04-05 12:21:04 +01:00
Ashod Nakashian
36a3810541 loolwsd: fixed convert-to and re-enabled test
Change-Id: I91ad9ac7dbe394d4a560081379e35442f1469eb8
Reviewed-on: https://gerrit.libreoffice.org/23825
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-05 03:01:06 +00:00
Ashod Nakashian
4bc26f25d5 loolwsd: wait for new child instances if none is available
Change-Id: If7de4ae73e9432694a0cf032b19d7e0ab9c5a9d1
Reviewed-on: https://gerrit.libreoffice.org/23824
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-05 03:00:21 +00:00
Ashod Nakashian
c2e0812a8c loolwsd: no need to destroy, just exit
Change-Id: I12332678d81b9c0880271f980935b655a1dece08
Reviewed-on: https://gerrit.libreoffice.org/23823
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-05 02:59:48 +00:00
Ashod Nakashian
3499878fae loolwsd: logging and cleanups
Change-Id: I0664be51da54d2e374808256e6598ba025f0324e
Reviewed-on: https://gerrit.libreoffice.org/23822
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-05 02:59:12 +00:00
Ashod Nakashian
94c3033408 loolwsd: wait for the Connection thread to exit before destroying
Also, the thread is joinable only once.

Change-Id: Ia0d8e4c350a6bedcf15873c751fffa837460e4bf
Reviewed-on: https://gerrit.libreoffice.org/23821
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-05 02:58:17 +00:00
Henry Castro
2c18eb8495 loolwsd: remove unnecessary response frame
The response was to verify that the command message
was successfully executed, but it can be replace by log messages.
2016-04-04 16:29:27 -04:00
Pranav Kant
dc28273dcf Fixed a regression in opening password protected docs
Change-Id: Ife378538c98f091e271e0c474fb271c513887774
2016-04-05 00:15:30 +05:30
Tor Lillqvist
321b244eb3 Catch also NetException in SocketProcessor()
Doesn't seem to fix anything, but probably is a good idea to not let
such an exception propagate, but treat it as the connection closing.
2016-04-04 15:46:27 +03:00
Tor Lillqvist
bbb4355e73 Output also a trace in DocumentCallback 2016-04-04 14:20:20 +03:00
Tor Lillqvist
b622b5ea2e Use 'using' consistenly 2016-04-04 13:29:02 +03:00
Tor Lillqvist
2732d756be LibreOfficeKit is not a process
We call the process "loolkit". LibreOfficeKit is an API, and a 'class'
in that API.
2016-04-04 12:12:14 +03:00
Tor Lillqvist
7cb5baedfc Try libmerged first
In the instdir/program of an --enable-mergelibs build of LibreOffice
there is also a dummy libsofficeapp.so. Obviously we don't want to
even try that. So look for libmergedlo.so first.
2016-04-04 12:05:55 +03:00
Tor Lillqvist
383eb5c666 Don't ask broker to fork a non-positive number of children
I easily got the thing into a state where it kept forking new
processes without limit even if no client was doing anything. The log
output contained lines like:

wsd-09526-04 00:00:48.302029 [client_ws_001b ] MasterToBroker: spawn -1

brk-09528-00 00:00:48.279945 [loolbroker     ] Broker command: [spawn -1].

brk-09528-00 00:00:48.279964 [loolbroker     ] Spawning -1 childs per request.
brk-09528-00 00:00:48.279974 [loolbroker     ] Creating -1 new child.

This fixes that, but there are still several issues remaining.
2016-04-04 11:11:53 +03:00
Tor Lillqvist
9a456770f1 Why 'signed' when 'int' is much simpler? 2016-04-04 10:57:49 +03:00
Tor Lillqvist
194b662b54 Don't truncate response in logging
There is no \r there any more, just a \n.
2016-04-04 10:36:34 +03:00
Tor Lillqvist
f7c213c87e Bin leftover from benchmark code
It died in c118987dc6.
2016-04-04 10:32:56 +03:00
Tor Lillqvist
d262f43b93 ClientPortNumber here can never differ from DEFAULT_CLIENT_PORT_NUMBER
So just use DEFAULT_CLIENT_PORT_NUMBER and don't confusingly include
ChildProcessSession.hpp in the test program sources just to define a
static (file-local) ClientPortNumber variable that never gets set to
anything except its initialized value. ChildProcessSession is specific
to the internals of loolwsd and loolbroker and should not be used in
the test programs.
2016-04-04 10:13:16 +03:00
Tor Lillqvist
d137653db5 Avoid over-engineering: Insert Capabilities.hpp in the only file where used 2016-04-04 10:05:30 +03:00
Miklos Vajna
802c702221 loolwsd: fix -Werror,-Wshadow 2016-04-04 09:02:05 +02:00
Tor Lillqvist
9ec0ae58a4 These can be static 2016-04-04 09:45:21 +03:00
Tor Lillqvist
957788a6e1 Define FIFO_ADMIN_NOTIFY in only one place 2016-04-04 09:43:29 +03:00
Tor Lillqvist
01be515760 Include only what you use 2016-04-04 09:36:27 +03:00
Tor Lillqvist
b6419ee915 Include only what you use 2016-04-04 09:31:52 +03:00
Tor Lillqvist
c2370c56ef Use 'using' consistenly 2016-04-04 09:31:03 +03:00
Tor Lillqvist
8e7196ffa0 Insert LOOLKit.cpp contents into LOOLBroker.cpp
As we don't build a separate loolkit program any more we don't need
LOOLKit.cpp.
2016-04-04 09:23:38 +03:00
Tor Lillqvist
a132e06409 Bin the non-preinit and non-fork code paths
Preiniting LibreOfficeKit and forking kit processes (instead of
spawning) has worked fine for a while, and has been the default way
this works.

No 'loolkit' program gets built any more.
2016-04-04 09:07:59 +03:00
Ashod Nakashian
208612bc10 loolwsd: temporarily disabled convert-to test
Convert-to is broken after re-designing Broker
and simplifying it. Temporarily disabling it
to help `make check` pass until it gets fixed.

Change-Id: Id49f86d8a1a25367233a09b865630ed3a210a4fd
Reviewed-on: https://gerrit.libreoffice.org/23793
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:09:36 +00:00
Ashod Nakashian
fdd3efaad8 loolwsd: reduced some excessive logs to trace level
Change-Id: I9ffcdf5c3ad5781db93e0e3dd7aa7b137c77b25a
Reviewed-on: https://gerrit.libreoffice.org/23792
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:09:19 +00:00
Ashod Nakashian
ed1790d7a3 loolwsd: kit destruction improvements
Change-Id: Ia491e5dc85e13eda12bb47690a8d335ad0917468
Reviewed-on: https://gerrit.libreoffice.org/23791
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:08:53 +00:00
Ashod Nakashian
c118987dc6 loolwsd: Removed Broker <-> Kit pipes
Broker is now just a simple spawn-machine.
It only gets requests from WSD to spawn
new kit instances, which it doesn't even
track.

Once a kit instance is initialized, it
connects to WSD with a control WS.
From there on, it's up to WSD to manage
the kit process.

Also was removed the benchmark logic
since it can no longer function.

Change-Id: I1bf56bc6416c9eadafba637276bbb8b3107e5727
Reviewed-on: https://gerrit.libreoffice.org/23790
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:08:35 +00:00
Ashod Nakashian
d5e2f64790 loolwsd: WSD <-> Child direct communication
WSD now communicates on a WebSocket directly
with kit processes. ChildProcess encapsulates
kit processes and the control WS, which itself
is owned by DocumentBroker.

Change-Id: Ica209aaa07974739b8e51a14e11325d084e193f6
Reviewed-on: https://gerrit.libreoffice.org/23789
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:08:01 +00:00
Ashod Nakashian
f4b80e630a loolwsd: consume new child from wsd
And spawn new child instances.

Change-Id: I51886f4645a1c8944ccde2e0fae415afc7c8fc24
Reviewed-on: https://gerrit.libreoffice.org/23788
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:07:27 +00:00
Ashod Nakashian
25a68bf7e9 loolwsd: support for child control WS
Change-Id: Id82009a6d5a20eeff9a7b5c628ec719845e7769e
Reviewed-on: https://gerrit.libreoffice.org/23787
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:07:10 +00:00
Ashod Nakashian
4be24759f3 loolwsd: SocketProcessor takes HTTPResponse and not HTTPServerResponse
Change-Id: I8a6e1468bc26b4a81ae13a567fd7331207ac37fc
Reviewed-on: https://gerrit.libreoffice.org/23786
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:06:42 +00:00
Ashod Nakashian
653da3a409 loolwsd: Document::onLoad is now exception safe
In face of exceptions, the lock was not released
and the condition variable was not signalled,
thereby causing all subsequent views on the
same document to fail loading.

Change-Id: I18d3cefcc74a158facefe1e74a9c802ee048b014
Reviewed-on: https://gerrit.libreoffice.org/23785
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:06:24 +00:00
Ashod Nakashian
ae8ce06162 loolwsd: removed unnecessary from pipe messages
Change-Id: I5fc310f98764b31fc50f877c28d6076bbb14866f
Reviewed-on: https://gerrit.libreoffice.org/23784
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:05:46 +00:00
Ashod Nakashian
aacd162673 loolwsd: FIFO_NOTIFY -> FIFO_ADMIN_NOTIFY
Change-Id: Ia42983010b3962ca9228032817c6f9024a74c59f
Reviewed-on: https://gerrit.libreoffice.org/23783
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:05:31 +00:00
Ashod Nakashian
bcf6ab75b8 loolwsd: statics are PascalCased and other cleanups
Change-Id: I1c7c62eb812d2e727b7256152c0c774350d24b52
Reviewed-on: https://gerrit.libreoffice.org/23782
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:05:10 +00:00
Ashod Nakashian
8a318c879a loolwsd: merged child command dispatching into a single class and renamed
Change-Id: I894849ea7a6c69c084e922c76468c5e9eb621406
Reviewed-on: https://gerrit.libreoffice.org/23781
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:04:55 +00:00
Ashod Nakashian
504ffec648 loolwsd: request new child from Broker for convert-to requests
Change-Id: I29ff2a416c04393a2b2875e9ffff429f4e25e4c5
Reviewed-on: https://gerrit.libreoffice.org/23780
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:04:36 +00:00
Ashod Nakashian
21cdf9d503 loolwsd: removed unused authentication function for now
Change-Id: I8c57adecab03eb186aeacea365f092a71e2e097d
Reviewed-on: https://gerrit.libreoffice.org/23779
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:04:18 +00:00
Michael Meeks
0a42ab7b81 Remove bogus 10 second sleep.
Change-Id: If44f28fdca37997eca09679bb9865944909ef4f2
Reviewed-on: https://gerrit.libreoffice.org/23778
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:03:58 +00:00
Michael Meeks
1b25179b25 Use bind mounting to accelerate jail creation.
of the 10k files still linked into the jail; 5700 are from usr/
so bind mount just that directory, also set noatime, ro, and
some other helpful looking options.

Change-Id: I28d2d5cbbdf33fb57ea0f0c0915cb267603ee16d
Reviewed-on: https://gerrit.libreoffice.org/23777
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:03:37 +00:00
Ashod Nakashian
285026b6f6 loolwsd: removed PipeRunnable thread from Broker and merged it with main
Change-Id: Ie10f046ed230d891eb0647e409756a34a4b146b8
Reviewed-on: https://gerrit.libreoffice.org/23776
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:03:21 +00:00
Ashod Nakashian
ba7db55353 loolwsd: cosmetics
Change-Id: I6c0c2e088e1e428d45cc56a31e7c1f3b8966dc2b
Reviewed-on: https://gerrit.libreoffice.org/23775
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:03:07 +00:00
Ashod Nakashian
265210741e loolwsd: removed unused read pipe from ChildProcess
Change-Id: I8307488227bf65a6f6fdd829728cd74722a24f58
Reviewed-on: https://gerrit.libreoffice.org/23774
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:02:51 +00:00
Michael Meeks
7f13face52 Attempt at loolbroker benchmark mode.
Change-Id: Ia1d7450b1e99686e3c654f427c231fd7e0cf8254
Reviewed-on: https://gerrit.libreoffice.org/23773
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:02:24 +00:00
Michael Meeks
4d2cd2fff3 More helpful exception debug.
Change-Id: Ibc76f20ba0ff9e015632bff2b7f049d40d49064b
Reviewed-on: https://gerrit.libreoffice.org/23772
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:01:59 +00:00
Michael Meeks
9266ffc09f Remove apparently un-necessary thread local variable template.
Change-Id: Ia220aff972827a0e49a8dadcdb8f32dcd3eed8c9
Reviewed-on: https://gerrit.libreoffice.org/23771
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:01:42 +00:00
Michael Meeks
23672ac362 Build jails more sparingly eliding un-necessary directories.
Create directories top-down and not bottom up for more efficiency too.
Skip the sdk (if we have it) - ~20k files, and misc. other
pieces that we don't need; still more to go there.

Change-Id: Iccd9ebac495fba414d268b339ef82a161d98a9ca
Reviewed-on: https://gerrit.libreoffice.org/23770
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:01:05 +00:00
Ashod Nakashian
ceaefabc91 Revert "loolwsd: replace fifo for socket WSD -> Broker"
This reverts commit 97c8f35ddf.

Since the Broker design has been extremely simplified,
all communication between Broker <-> Kit are gone.
Only a pipe between WSD and Broker remain.

Temporarily reverting this to apply the Broker redesign,
after which this patch can be reviewed and merged.
This will be easier than trying to merge the redesigned
Broker on top of this.

Change-Id: Ia901fad604008654c01841df62e88918adad45e1
Reviewed-on: https://gerrit.libreoffice.org/23769
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:00:45 +00:00
Henry Castro
97c8f35ddf loolwsd: replace fifo for socket WSD -> Broker 2016-04-03 08:12:10 -04:00
Tor Lillqvist
7a80ca8aa1 Make use of 'using' consistent in this file 2016-04-01 18:57:07 +03:00
Tor Lillqvist
9a874e7cda Catch and ignore FileExceptions when persisting editing tiles
There is nothing that says a client has even requested any tiles, so
there might be none to persist. Don't let an exception thrown by the
DirectoryIterator propagate upwards and cause potential
issues.

Noticed the issue when testing using the 'connect' test program,
giving it input that did not request any tiles.
2016-04-01 18:57:07 +03:00
Tor Lillqvist
593d5d7e08 Actually propagate idle/auto save requests to the kit processes
Had to add a shared pointer to the BasicTileQueue for the session to
the MasterProcessSession object, and restructure the coe a a bit to
allocate BasicTileQueue objects dynamically. Possibly just passing a
reference to a BasicTileQueue in the stack would have worked, but why
risk it?

The actual logic when to do auto / idle save is not quite right still,
did not change that in this commit.
2016-04-01 18:57:07 +03:00
Tor Lillqvist
d379ed2113 Improve logging and orderly shutdown 2016-04-01 18:57:07 +03:00
Tor Lillqvist
9e0a8cc43f These are not overridden in derived classes, no need to be virtual 2016-04-01 18:57:07 +03:00
Tor Lillqvist
e3f8fc41a1 Add 'override' 2016-04-01 18:57:06 +03:00
Tor Lillqvist
6c78a8f633 Typo 2016-04-01 18:57:06 +03:00
Tor Lillqvist
14be412f8f It was PipeRunnable::syncChildren() that wrote "query url" messages to the pipe 2016-04-01 18:57:06 +03:00
Tor Lillqvist
a20344b520 Bin PipeRunnable::syncChildren() which died in cbabd6177d 2016-04-01 18:57:06 +03:00
Andras Timar
324f72d844 Revert "serve loleaflet from apache2, until we solve access control problem"
This reverts commit 21cd9167c4.
2016-04-01 16:31:33 +02:00
Pranav Kant
28cf20b091 bccu#1640: Add elapsed time field to admin console
Time increment is handled on client-side, server only sends the
elapsed time during first page-load.

Change-Id: I73e98fd95ca9f391b625a8dcfc7e3490878c6a40
2016-04-01 13:33:45 +05:30
Pranav Kant
d186e05a0d loolwsd: Use filename in admin console
... instead of long URIs.

Change-Id: I9d13285ce81967a4ff9eb518086743540d7a2a90
2016-03-31 22:47:26 +05:30
Pranav Kant
b8e9075f23 bccu#1621: Introduce an edit lock
... which can be taken only one at a time. Others can only view,
not edit. When a session with edit lock exits, the edit lock is
handed over to the next alive session.

Change-Id: I712a4e70369f1d07c1d83af416a0f5c288b05c7d
2016-03-31 19:24:14 +05:30
Pranav Kant
26dd4e0b4b loolwsd: Verify JWT token's expiry time
Change-Id: I6e6913e7918ac4c36ab98457054e5660cce3a854
2016-03-31 17:25:29 +05:30
Tor Lillqvist
422834ebef Improve logging
Don't embed newlines in "lines" written to the log. When logging stuff
read from or written to the fifos, translate newlines to " / " for
clarity.

(If we would want complete, exact verbose logging, we should be really
pedantic and log all non-printable bytes in hex anyway, etc, so
displaying newlines as space-separated slashes should be OK. It isn't
as if there would be totally arbitary data passed through the fifos
anyway.)
2016-03-31 11:01:52 +03:00
Pranav Kant
4ae077200c loolwsd: Separate AdminModel header and implementation
Change-Id: Iddf107aa7985988deba800030e75243a831a7532
2016-03-31 13:00:30 +05:30
Pranav Kant
939388c6e6 loolwsd: Arrange sources/header in makefile alphabetically
Change-Id: I0bc70b34a590d84ac9c15f0d9d0000d02cadba74
2016-03-31 12:57:44 +05:30
Pranav Kant
f1ede0c4ba loolwsd: Split Storage, Auth classes into header/impl files
Change-Id: I5d8990db8f8f4aa7a88bbb0cc84b97149cf4f8c0
2016-03-31 12:57:44 +05:30
Pranav Kant
d26246dab0 loolwsd: Temporarily use hard-coded path to key file
We will switch to reading all these values as soon as wip
configuration file object is accessible globally.

Change-Id: I16eff339349683050be1985eefabc34854cccba3
2016-03-31 00:56:57 +05:30
Andras Timar
21cd9167c4 serve loleaflet from apache2, until we solve access control problem 2016-03-30 20:13:38 +02:00
Pranav Kant
ba96b95954 loolwsd: Setup client SSL
We act as a client when we communicate with owncloud server.

For time being, just accept whatever certificates owncloud server
gives us. We might want to get more strict here in future.

Change-Id: I4813d19412b66ecf57d6cdef9c3ac94fbbaa521f
2016-03-30 21:41:00 +05:30
Pranav Kant
27a42affd0 loolwsd: This is a server, not client
Change-Id: I8db0a73048998566b4b60a7f39fe57617b9dca8d
2016-03-30 21:41:00 +05:30
Miklos Vajna
f30e22d0a3 loolwsd: fix -Werror,-Wshadow 2016-03-30 09:39:48 +02:00
Ashod Nakashian
494b90e541 loolwsd: new unittests
Change-Id: I935dbc79df638a7481f851b3e7b42703b97b93ec
Reviewed-on: https://gerrit.libreoffice.org/23648
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 02:06:32 +00:00
Ashod Nakashian
cbabd6177d loolwsd: improved child spawning and management
Spare child processes are now in a separate
container. A FIFO that gives older instances
priority to avoid using instances too young
to have initialized fully.

In addition, spare instances are now
proactively spawned such that there
is at least a minimum number of
spares at any given time.

Change-Id: Ibdb206d88473adb306c274f4af39798c784258a0
Reviewed-on: https://gerrit.libreoffice.org/23647
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 02:05:57 +00:00
Ashod Nakashian
2ba9bddf9a loolwsd: logging improvements
Change-Id: Ie656aa9d9f19762a960f6608cdadccf3c7eee665
Reviewed-on: https://gerrit.libreoffice.org/23646
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 02:03:25 +00:00
Ashod Nakashian
fe69c4d5b6 loolwsd: pipe plumbing cleanup
Change-Id: I5519235a4601e1e38cedc3f06ffe9386434a292d
Reviewed-on: https://gerrit.libreoffice.org/23645
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 02:02:53 +00:00
Ashod Nakashian
ecce874315 loolwsd: new PipeReader class to poll and tokenize pipe messages
Change-Id: I5676b313ca4c7e711ead04c1491fe36591a00531
Reviewed-on: https://gerrit.libreoffice.org/23644
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 01:59:31 +00:00
Ashod Nakashian
c966a804f8 loolwsd: throw when we fail to connect to lokit
Change-Id: I52f5c923cfc8fa4c28309066d8457418154e6b20
Reviewed-on: https://gerrit.libreoffice.org/23643
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 01:57:21 +00:00
Ashod Nakashian
9150d560c0 loolwsd: thread -> session
Change-Id: I7d9f84a2c9afea5f541f5815929745d2de93c8fa
Reviewed-on: https://gerrit.libreoffice.org/23642
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 01:56:45 +00:00
Ashod Nakashian
59db6cbc09 loolwsd: recursive_mutex -> mutex in LOOLBroker
Change-Id: I72be54cc67b965bbd13a6630d1243d8d59ba0fc4
Reviewed-on: https://gerrit.libreoffice.org/23641
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 01:55:55 +00:00
Ashod Nakashian
4b38df7455 loolwsd: lokit command handling improvements
Change-Id: I81baddb30805ee1bce5399171a40e73a18af68bf
Reviewed-on: https://gerrit.libreoffice.org/23640
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 01:52:55 +00:00
Ashod Nakashian
4305d333b2 loolwsd: lokit process can only host one url in its lifetime
Change-Id: I561e5b81a748b7ec567af9aff968ba5c66ad44bf
Reviewed-on: https://gerrit.libreoffice.org/23639
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 01:49:36 +00:00
Ashod Nakashian
3d2c2fde3b loolwsd: logging and misc cleanup
Change-Id: If3cea8191fe15fc752c436cd33d2a68dc2d88598
Reviewed-on: https://gerrit.libreoffice.org/23638
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 01:46:34 +00:00
Ashod Nakashian
b25fe9d88a loolwsd: moved SocketProcessor to IoUtil and generalized more
Change-Id: I527e57d2430e21249cf8cd4867f22fdbbd092b09
Reviewed-on: https://gerrit.libreoffice.org/23637
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 01:45:20 +00:00