Commit graph

45 commits

Author SHA1 Message Date
Miklos Vajna
85dbb4a9af kit: fix UB in ChildSession::disconnect()
Finally unit-copy-paste passes under sanitizers with this. Details:

==8988==ERROR: AddressSanitizer: heap-use-after-free on address 0x60d0005e6de0 at pc 0x000000988e85 bp 0x7fff753316d0 sp 0x7fff753316c8
READ of size 4 at 0x60d0005e6de0 thread T0 (loolkit)
    #0 0x988e84 in std::pair<int const, UserInfo>::pair(std::pair<int const, UserInfo> const&) /home/vmiklos/git/libreoffice/lode/opt_private/gcc-7.3.0/lib64/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_pair.h:292:17
...
    #12 0x9322af in Document::notifyViewInfo() /home/vmiklos/git/libreoffice/online-san/kit/Kit.cpp:1600:53
    #13 0x9303f9 in Document::onUnload(ChildSession const&) /home/vmiklos/git/libreoffice/online-san/kit/Kit.cpp:1566:13
    #14 0x616dcd in ChildSession::disconnect() /home/vmiklos/git/libreoffice/online-san/kit/ChildSession.cpp:96:25
    #15 0x616535 in ChildSession::~ChildSession() /home/vmiklos/git/libreoffice/online-san/kit/ChildSession.cpp:85:5

freed by thread T0 (loolkit) here:
    #0 0x60f9b0 in operator delete(void*) _asan_rtl_:0
...
    #8 0x939292 in Document::~Document() /home/vmiklos/git/libreoffice/online-san/kit/Kit.cpp:913:5

I.e. when the Document dtor clears Document::_sessions, the ChildSession
dtor may be called. But ChildSession expected that it has a valid
Document during its lifetime, which is not a promise we can hold, see
the above trace.

Fix the problem by having a pointer (and not a reference) to a Document
in ChildSession and then:

1) Clear that Document pointer in ChildSessions at the end of the
Document dtor using a new resetDocManager()

2) Check if the Document is nullptr in ChildSession::disconnect()
instead of dereferencing it unconditionally.

Change-Id: I19d3d6bfe9e142a52c199f49aaa347d1a2edbf87
2019-08-16 09:05:54 +02:00
Michael Meeks
9e791fb0d4 clipboard: persist selections for a while after a view closes.
re-factor ClientSession state to be a simpler state machine.
Have a nice disconnect / disconnected handshake on view close.

Change-Id: Ie933cc5c7dfab46c66f4d38a4d75c459aa1cff87
2019-08-05 22:21:54 -04:00
Michael Meeks
d3887f7a94 handle web clipboard request. 2019-08-05 20:06:54 -04:00
Michael Meeks
52e477e57e Switch to text/html for paste where we can.
Build special URLs to detect the same host being in-use, and much more.

Change-Id: I0ca639ea416cb78bf5e5274eac4400542b6b2cda
2019-08-05 15:47:47 -04:00
Henry Castro
760864870f wsd: introduce "TemplateSource" WOPI property
Change-Id: I9df1d5d0d4be7fe10ee15c40c36195c86ccf857e
Reviewed-on: https://gerrit.libreoffice.org/76190
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2019-07-24 12:10:15 +02:00
Tor Lillqvist
f7a70ba9d3 tdf#125681: Get rid of ChildSession::getDocumentMutex() and associated code
Now with the "Unipoll" concept all this locking is unnecessary as the
kit process is single-threaded, and actually it is harmful as the bug
shows.

Michael explains in chat:

But in fact - we should be a single threaded kit process there now. We
are protected by the solar-mutex (which is recursive) while our
locking is not. This was the whole point of the Unipoll refactor: to
remove the extra threads, complex queues, etc. etc. I just left the
mutexes. Even a recursive mutex won't work there; since it needs to be
drop-able and transferable to another (LOK internal thread) in Yield,
so - we should remove them.

Change-Id: I7d1e1dfb0e20f14134be5f81da057539b0f86ab9
Reviewed-on: https://gerrit.libreoffice.org/75849
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-07-24 12:09:24 +02:00
Tomaž Vajngerl
02a07d62a5 tdf#124146 touch gesture support, send pan gesture in dialogs
Pan gesture should work for comboboxes, for which panning is
implemented in core.

Change-Id: I0a7e49e9335159a302716f666e2334a9d532c115
Reviewed-on: https://gerrit.libreoffice.org/69720
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2019-03-26 10:48:17 +01:00
Tomaž Vajngerl
7137c953d8 add export, sign and upload as one function for PDF signing
PDF export, signing and upload needs to be done in one operation
as PDF doesn't change the current document. The workflow is just
a bit different to the ODF / OOXML that it needs a change in
behaviour.

Change-Id: I752b293494a2d677fa7f12f2317954cfcf47859b
2019-01-13 23:50:18 +01:00
Tamás Zolnai
31f99bf9f5 Introduce client-server message for requesting the selected shape as SVG
It works for Impress only now.

Change-Id: I130707d8e96e0c633f2531b1cb81ce74dc6ec6e1
2018-12-07 12:39:27 +01:00
Tomaž Vajngerl
5b22fac214 Upload document to Vereign
Save document to a input format (either PDF, ODT, DOCX) and send
the document to Vereign using WOPI protocol.

Change-Id: If9a7d88e91d07c7f1f831c01793f0f73d7a98131
Reviewed-on: https://gerrit.libreoffice.org/63839
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2018-11-29 21:49:51 +01:00
Miklos Vajna
cd08cbf385 Session: make members private 2018-11-13 09:04:19 +01:00
Miklos Vajna
c863e52001 RecordedEvent: make members private 2018-11-12 09:04:01 +01:00
Tomaž Vajngerl
852ed5d981 handle signature status and prepare document signing in WSD
This adds handling of signature status (manually request for the
status or as a callback) in WSD.

In addition prepare support for signing of document, but don't yet
trigger the actual LOKit function (needs the JS building blocks
set up first to know how to handle the payload - certificate and
private key)

Change-Id: Ic76baa5847bb52adde616338187d5979e0093c6d
Reviewed-on: https://gerrit.libreoffice.org/62533
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2018-11-09 09:06:02 +01:00
Miklos Vajna
83bd75476e StateRecorder: make members private 2018-11-09 08:41:35 +01:00
Ashod Nakashian
b6333ada8d wsd: anonymization improvements and unittests
Also support anonymization of downloadas documents
and renaming of documents.

Reviewed-on: https://gerrit.libreoffice.org/57541
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
(cherry picked from commit 78248a542c9ca31bf9ad4cad9b55d78690384395)

Change-Id: I81a80e6290217659987d73f625e5f0fb81cb7ef2
2018-10-16 20:12:23 -04:00
Ashod Nakashian
6c18aa7e88 kit: anonymize usernames and filenames in Kit
Change-Id: Id7928136db71ded7bf6b1a5e8e387db7251f8a35
2018-10-16 20:12:23 -04:00
Ashod Nakashian
a7a03c3c5d wsd: send copied text to client upon .uno:Copy
Change-Id: I39181a0e29e00a0eae389fbab6ee253cf2f23f84
2018-10-16 20:12:23 -04:00
Tor Lillqvist
95eb849217 Still more iOS app and related Online C++ code hacking
Re-think the plumbing between the different parts of the C++ Online
code. Do try to have it work more like in real Online on all but the
lowest socket level. Except that we don't have multiple processes, but
threads inside the same process. And instead of using actual system
sockets for WebSocket traffic between the threads, we use our own
FakeSocket things, with no WebSocket framing of messages.

Reduce the amount of #ifdef MOBILEAPP a bit also by compiling in the
UnitFoo things. Hardcode that so that no unit testing is ever
attempted, though. We don't try to dlopen any library.

Corresponding changes in the app Objective-C code. Plus fixes and
functionality improvements.

Now it gets so far that the JavaScript code thinks it has the document
tiles presented, and doesn't crash. But it hangs occasionally. And all
tiles show up blank.

Anyway, progress.

Change-Id: I769497c9a46ddb74984bc7af36d132b7b43895d4
2018-09-19 11:31:18 +03:00
Tor Lillqvist
87b85ff8f0 Be consistent in how we name "interface" abstract classes
We already use a suffix "Interface" for SocketHandlerInterface, so
rename IDocumentManager to DocumentManagerInterface.

Naming "interface" classes with an "I" prefix is C# and COM style.
Sure, that is a convention as good as any other, but let's try to be
consistent within this rather small code-base.

Change-Id: I9c356df327debd780f23ed2b2e6d6e630328861e
2018-09-12 19:27:23 +03:00
Tor Lillqvist
b59d160a08 Intermediate commit of work in progress on an iOS app
The app is unimaginatively called "Mobile" for now.

Runs but crashes pretty quickly after loading the document by the LO
core. Will need some heavy changes to get a ClientSession object
created in there, too, to handle the (emulated) WebSocket messages
from the JavaScript. It would then handle some of these messages
itself, and forwards some to the ChildSession, which in this case is
in the same process. Now the messsages from the JavaScript go to a
ChildSession, which is wrong. As the assertion says, "Tile traffic
should go through the DocumentBroker-LoKit WS"
2018-09-12 18:32:05 +03:00
Jan Holesovsky
98ed24257b Move the functionality from connectToMonitor() to SocketPoll.
Change-Id: Iab2ac09638323f5e59f7a2ea0d880f52989ad64d
2018-05-18 15:16:40 +02:00
Pranav Kant
ad1da235d3 IME support
Dialogs still need to be adapted to this. Only works for documents as of
now.

Change-Id: I0fb1114e279a9e563943f3f65dd5a577523e9841
2018-02-08 14:16:34 +05:30
Miklos Vajna
e76485d8b9 kit: spell out non-trivial autos to improve readability
Change-Id: I69b025b08a69c8780d40b39074d7d7abb12cc3af
2018-02-07 10:18:12 +01:00
Pranav Kant
53fc694a3c lokdialog: Use dialog close LOK API when user clicks 'X'
Change-Id: I3a90eb8b83688eed7db8228763633e31f82e58d1
2017-12-05 00:41:19 +05:30
Pranav Kant
849eb0d500 lokdialog: Adapt to LOK dialog API changes
Change-Id: I653304e71573eb253e09a72bc87d54b8554ba7ff
2017-12-04 22:13:50 +05:30
Marco Cecchetti
29a233e5a9 calc: set outline state
use a specific message from the client for set the visibility state of
a group instead of hijacking the update row/column header message

Change-Id: I69d66b30db0b4d8a0082cbd2524120491d4f97cb
Reviewed-on: https://gerrit.libreoffice.org/45446
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Tested-by: Marco Cecchetti <mrcekets@gmail.com>
2017-12-01 01:10:43 +01:00
Pranav Kant
a19121bbbc Adapt to dialog API changes in LOK
... and bypass some unncessary DocumentBroker handling of dialog
messages.

Change-Id: I378dff7a9786479baaa43f5fde9d30f35bc7f948
2017-11-28 22:18:21 +05:30
Pranav Kant
5355c52e10 Allow sending binary websocket frames from IDocument interface
Change-Id: I89f304e69e0c7b5f87bd2883a775d5c256674ef0
2017-11-28 22:18:21 +05:30
Pranav Kant
e9e162b35e lokdialog: Mouse/key events, canvas use & child window impl.
Change-Id: If8ae5c284e7166d4a01bd664644134f11197f988
2017-10-25 00:39:03 -07:00
Marco Cecchetti
dee39a562c support for rendering a watermark on each tile
Change-Id: I3edccac49a3bcd3d2493d8d7ef3a1ae29307e727
Reviewed-on: https://gerrit.libreoffice.org/41898
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-09-07 17:28:44 +02:00
Aditya Dewan
3a43f69116 tdf#108341 automatic editor switch and follow added
Change-Id: I5129256a0633916a3ca2cb05ccba39a5f4a5d398
Reviewed-on: https://gerrit.libreoffice.org/39299
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-07-06 09:46:49 +02:00
Ashod Nakashian
8a2c60e5b6 wsd: avoid race during viewinfo notification
Change-Id: If2d8adc67337a5529cb6898808a84727ff1df38e
Reviewed-on: https://gerrit.libreoffice.org/38123
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-29 06:47:42 +02:00
Ashod Nakashian
da2d3cbc92 wsd: support per-user links and commands
userextrainfo is a json array that contains
extra user-specific links.

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

'mail' and other links can also be added.

Change-Id: I37c4c68bfa0b7ee659e017b4867dcb8cf5c2ca2f
Reviewed-on: https://gerrit.libreoffice.org/38120
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-29 06:45:18 +02:00
Jan Holesovsky
04bf59060d inactive: Record also the change tracking and comments.
Unfortunately we need to record the entire sequences of what was happening.

Change-Id: I6c52f187e881dd3eadaea6958c0d49ed8f6942cb
Reviewed-on: https://gerrit.libreoffice.org/36960
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-04-25 18:20:03 +02:00
Jan Holesovsky
c36e619d24 inactive: Invalidate tiles when we return back to the active state.
Change-Id: Ib97d6463c52ecf153d3c19ab7efc47d99b71ce9b
2017-04-24 19:24:28 +02:00
Jan Holesovsky
9f17050a7d Pass the locale settings from loleaflet to wsd/kit.
Change-Id: Ie530db73cfbdb62787f16eae0f4b07fbf8b8acb4
2017-03-24 12:34:32 +01:00
Jan Holesovsky
ad20adce1a fuzzer: Don't handle signals when fuzzing.
Change-Id: I2febdf96bcbbd5c6edaf791d99a77674e6f0b0a9
2017-02-08 21:39:55 +01:00
Ashod Nakashian
5dad626b6d wsd: remove handling of depricated partpagerectangles command
Change-Id: I13285e83179ab7654b6fd21a6548730e74d67425
2017-02-05 21:59:22 -05:00
Ashod Nakashian
25be7f0ab6 wsd: use own tokenizer
Change-Id: Ia6e58767e3a138d086d4e0ae287782d3ed558076
Reviewed-on: https://gerrit.libreoffice.org/33418
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-23 04:37:21 +00:00
Tor Lillqvist
11ae90cfcb No Hungarian notation please
Change-Id: Ia624de45a792db7e39f2245aaea7d940b30b0db2
2017-01-13 14:52:08 +02:00
Tomaž Vajngerl
5d22bd5c95 Update cursor positions on active user - record events per view
When the user becomes inactive, we have to record events, that are
important to restore the user's document viewport when he becomes
active again.
We currently don't discriminate view events so events with different
view ID are considered as the same event and thus get overwritten.
The effect of this is that only the last cursor or selection of a
different view (different user working on a document) is updated
when the user becomes active again.
With this we discriminate view events and record them per view ID.
When the user becomes active again, we replay them for all views.

Change-Id: I0c6b9209f4d592d88fb23227c4de41084b8cd736
2017-01-02 14:34:46 +01:00
Ashod Nakashian
477ca6f414 loolwsd: cleanup the Sessions
Change-Id: I3cd065ab84e17f943fa7de7e094db574ff6fde07
Reviewed-on: https://gerrit.libreoffice.org/31931
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-13 04:35:00 +00:00
Ashod Nakashian
e60bc28a00 loolwsd: LOOLSession -> Session
Change-Id: I94369480fb0a6789375dfe5610ada300e94b80eb
Reviewed-on: https://gerrit.libreoffice.org/31930
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-13 04:34:19 +00:00
Michael Meeks
c1a398977f Adapt makefiles, includes etc. to new locations. 2016-11-25 09:58:57 +00:00
Michael Meeks
cca657c8f2 Apply the pre-branch rename script to re-organize the source. 2016-11-25 09:58:48 +00:00
Renamed from loolwsd/ChildSession.hpp (Browse further)