Commit graph

379 commits

Author SHA1 Message Date
Tor Lillqvist
3ea260f972 Portability improvements
Allow the directory parameters to be relative paths; turn them into absolute
ones for later use in the script as we change directories back and forth.

Use cpio instead of cp --parent for each file separately. (The latter has the
problem that parent directories are created using the protection the
corresponding source directory has, and tht might not permit you to copy other
files later into the same directory.)

Also copy usr/share/liblangtag, for the (common) case when LibreOffice is
built to use a system liblangtag.

Don't bother with the special handling of /usr/share/fonts/ghostscript unless
it exists and is a symlink.

With these changes, it worked for CentOS 7, too.
2015-04-29 15:06:18 +03:00
Tor Lillqvist
19276ed5d8 Actually drop the chroot capability also in the child process
I forgot to do it in childMain() in 28c9561722.
2015-04-28 11:24:00 +03:00
Tor Lillqvist
25575961ed We need to check for cache dir access only in the master process 2015-04-28 11:17:26 +03:00
Tor Lillqvist
4d6dfebf8e Expand on debugging details 2015-04-28 11:14:46 +03:00
Tor Lillqvist
2110aef06a No need for this member to be public 2015-04-28 11:02:29 +03:00
Tor Lillqvist
6df6a5d58b Spawn just one child in the --test case 2015-04-28 11:01:18 +03:00
Tor Lillqvist
88cb21867b Spawn children only after starting to listen on the server port
Otherwise some children, especially when there are more than just a few of
them to spawn, might try to contact the server before it is listening.
2015-04-28 10:57:05 +03:00
Tor Lillqvist
9251fefe94 Clarify remaining need for part parameter in messages 2015-04-27 21:58:54 +03:00
Tor Lillqvist
28c9561722 Get rid of the CHROOT capability after using it, or when not needing it 2015-04-27 21:55:36 +03:00
Tor Lillqvist
1b06290d2b Add a part parameter to the tile messages
The JS code always passes in 0 for now. The server parses the parameter and
calls LibreOfficeKitDocument::setPart() before calling paintTile().

Probably also the status, key, mouse and selection messages will need a part
number. The intent is after all that the protocol is as stateless as
possible. (So maybe we should also pass the document URL in each message?)
2015-04-27 21:30:26 +03:00
Tor Lillqvist
389815ac63 Introduce LOLProtocol::getTokenKeyword() and use it
The new function takes a map from keywords to integer values, and accepts
parameters in the form of either name=keyword, or for backward compatibility,
name='keyword'. Use it to parse the type parameter of the key, mouse,
selecttext and selectgraphic messages. This restricts the accepted keywords to
those actually valid for each message.
2015-04-27 21:12:20 +03:00
Tor Lillqvist
5267753b82 Add mention that MasterProcessSession::dispatchChild() should wait 2015-04-27 18:03:52 +03:00
Mihai Varga
9cd120f7ab Restore scrollbar offset 2015-04-27 16:03:50 +03:00
Tor Lillqvist
b2f34b0c3d Maybe /usr/share/fonts/ghostscript is also good to have 2015-04-27 16:01:11 +03:00
Tor Lillqvist
0019dc4943 Preserve timestamp of directories created in the jail
Needed for /usr/share/fonts so that fontconfig trusts its cache, but no harm
doing it for all directories. (Except a slight slowdown, need to see it if
has any significant impact if we would do the utime() only for directories
under /usr/share/fonts.)

Thus we need to pass the FTW_DEPTH flag to nftw() and handle FTP_DP instead of
FTP_D. We also need to make sure the directory is created also in the case of
an empty directory, for which no FTW_F callback of files inside it has been
received.

It is safest to not exit the nftw() in the FTW_SLN case.
2015-04-27 15:57:18 +03:00
Tor Lillqvist
074a54dd6c Make sure the fontconfig cache works for the sys-template
Need to copy /var/cache/fontconfig, too. For it to be valid, the directory
timestamps in /usr/share/fonts must be preserved.
2015-04-27 15:49:25 +03:00
Tor Lillqvist
be2bb356c3 Add seconds.milliseconds to the log prefix 2015-04-27 14:16:37 +03:00
Michael Meeks
6b17e8b022 Update README, and install ld.so.* into the jail. 2015-04-27 10:00:31 +01:00
Michael Meeks
1317941b5a Use shell variables to make it more cut/paste-able. 2015-04-27 09:44:59 +01:00
Tor Lillqvist
68d15726c4 Rephrase statement more logically 2015-04-27 11:27:29 +03:00
Tor Lillqvist
bced6a0771 Clarification 2015-04-27 11:26:00 +03:00
Mihai Varga
b6671341a7 The map handles keypress events but no panning keys 2015-04-27 10:18:13 +03:00
Mihai Varga
7fa1ae861d The map should not yet handle keyboard events 2015-04-27 09:57:06 +03:00
Miklos Vajna
0615ce950f LOOLSession: log error if nftw() fails
Should help finding out the problem if --lotemplate is given a
non-existing directory by mistake.
2015-04-25 01:40:16 +02:00
Tor Lillqvist
7d25ffada6 Remove part that is not relevant any longer
I don't see the busy looping any more, and child porcesses are indeed now
pre-spawned as needed (not just "re-started").
2015-04-24 18:56:24 +03:00
Tor Lillqvist
d6005eb524 Mention we need a part number parameter in many places 2015-04-24 18:54:50 +03:00
Miklos Vajna
4a7265ae76 Makefile: fix autoreconf warning
Makefile.am:18: warning: deprecated feature: target 'SETCAP' overrides 'SETCAP$(EXEEXT)'
Makefile.am:18: change your target to read 'SETCAP$(EXEEXT)'
/usr/share/automake-1.13/am/program.am: target 'SETCAP$(EXEEXT)' was defined here
Makefile.am:1:   while processing program 'SETCAP'
2015-04-24 17:27:21 +02:00
Tor Lillqvist
e9f3e815fe Don't try to run the 'display' program if there is no $DISPLAY 2015-04-24 18:18:56 +03:00
Tor Lillqvist
3ff60eaea1 Mention that the tile cache directory needs to be created 2015-04-24 17:46:01 +03:00
Mihai Varga
caf7c2e6c6 The map should not trace a resize event
The container div should handle the resize by updating the scrollbars
This fixes the map crash during window resize.
2015-04-24 17:21:38 +03:00
Tor Lillqvist
3ee29053aa Add a section about coding style 2015-04-24 14:34:43 +03:00
Tor Lillqvist
4eaffc74f0 Log the exit status of a child process, or the signal that killed it 2015-04-24 13:14:57 +03:00
Tor Lillqvist
00da867e97 Cosmetics 2015-04-24 12:49:47 +03:00
Tor Lillqvist
4782d05852 Add Util::signalName() 2015-04-24 12:49:19 +03:00
Tor Lillqvist
91d0e9329c Fix the waitpid() use
We don't want to use WNOHANG, not sure where I got that idea from. That leads
to busy looping. The loop is in a thread of its own, so it is fine to just
wait ("hang") for some child to die.
2015-04-24 11:26:41 +03:00
Tor Lillqvist
4f9739854a s/localhost/127.0.0.1/
Makes the chrooted child process more reliable on diverse distros/versions.
Let's use 127.0.0.1 in all cases for consistency.
2015-04-23 18:52:19 +03:00
Jan Holesovsky
5f2de45584 Update README with debugging hints. 2015-04-23 17:29:56 +02:00
Jan Holesovsky
2d23eaff6d Add the debug suffix to Poco libs only when self-built. 2015-04-23 17:29:56 +02:00
Jan Holesovsky
8be550056b SLEEPFORDEBUGGER is still useful for debugging, re-introduce that.
This reverts commit af3545b897.
2015-04-23 17:29:56 +02:00
Tor Lillqvist
ed07f1a4e1 Avoid accessing string out of bounds 2015-04-23 17:16:44 +03:00
Tor Lillqvist
4d717182ad Look for setcap during configury 2015-04-23 16:00:48 +03:00
Jan Holesovsky
bf929d5618 Add libcap-progs to the README as dependency. 2015-04-23 14:54:14 +02:00
Tor Lillqvist
ae500514f5 Forgot to actually have the --test switch in the example of its use 2015-04-23 15:51:10 +03:00
Tor Lillqvist
a181692255 Simplify
Just use find ... -type f instead of a for loop.

One note: I wonder how text rendering by the LO code in the child process
works even if we haven't copied any actual fonts into the sys template (and
thus chroot jail)? Is FreeType (or whatever it) already present in the
process, and font files open, even before the chroot? Weird.
2015-04-23 15:24:20 +03:00
Tor Lillqvist
d970d327b9 Don't exit if cp fails
It might be that for instance there is no /lib64/ld-*, as on a 32-bit system.
2015-04-23 15:18:22 +03:00
Tor Lillqvist
b8f2ce741e Fix thinko 2015-04-23 14:44:41 +03:00
Tor Lillqvist
b49d4d8885 Use shared_ptr and weak_ptr in attempt to make the pointer dance more robust
It was obviously very wrong to use both a unique_ptr to the
MasterProcessSession in WebSocketRequestHandler::handleRequest(), and then a
bare pointers to the peer object in the MasterProcessSession object. We got
crashes here and there related to the destructors.

Let's see if we can manage without mutexes.
2015-04-22 21:50:17 +03:00
Tor Lillqvist
eade187ebb Bin pointless logging
We logged effectively the same information a few lines earlier.
2015-04-22 21:50:04 +03:00
Tor Lillqvist
59bd08299c _childId is used only in MasterProcessSession 2015-04-22 21:49:53 +03:00
Tor Lillqvist
08f53df08a _childIdToChildSession[childId] is not used 2015-04-22 21:49:37 +03:00