Commit graph

7048 commits

Author SHA1 Message Date
Tor Lillqvist
fc2023723e Attempt to fix the thread problems in the GTK+ testbed app
Use g_idle_add() to make the webkit_web_view_run_javascript() call run
on the GTK+ thread. Correspondingly, need to use a separate
short-lived thread to do the fakeSocketWrite() calls from
handle_lool_message(), so that the GTK+ main loop is ready to run the
added lambda. Or something like that.

Now it gets a bit further, doesn't crash, but just sudddenly exits
before showing the document even.
2018-10-17 23:30:26 +03:00
Tor Lillqvist
0dcad56a6a Sort file names 2018-10-17 22:49:39 +03:00
Tor Lillqvist
452a0a46c2 More work on the GTK+ testbed app
Add plumbing to send messages from the Online code to the JavaScript
code, and vice versa. Similar to what is done for iOS.

Sadly, it crashes. Multi-thread issues. Not surprisingly, it crashes
when I call webkit_web_view_run_javascript() in another thread than
the one where the GTK+ and other Webkit calls were done. I need to
come up with some clever way to do everything from the same thread.

(On iOS, I use dispatch_async(dispatch_get_main_queue(),...) to
schedule a block (i.e., a lambda expression) to be run in the main
thread.)
2018-10-17 22:48:14 +03:00
Tor Lillqvist
d1e550f01e Reset the global 'document' variable to null when not needed any more
Doesn't matter in "real" Online where the kit process will die shortly
after that ayway, but matters a lot in the mobile app, where there is
just one process all the time that handles document after document.

Now I can successfully load another document after closing the first
in the iOS app.
2018-10-17 20:10:52 +03:00
Tor Lillqvist
fb8e6dd820 For MOBILEAPP, don't set TerminationFlag in KitWebSocketHandler::onDisconnect()
Helps in the struggle to get loading of another document after closing
the first to work.
2018-10-17 20:10:52 +03:00
Tor Lillqvist
bd8d612c9f In the MOBILEAPP case, don't set TerminationFlag when there are no sessions
The global TerminationFlag is an abomination that has caused lots of
trouble when developing the mobile app. The less we use it the better.
Here, it gets set elsewhere already when needed; just having no
sessions is not reason enough to set it.
2018-10-17 20:10:52 +03:00
Tor Lillqvist
05c2782a81 Empty out _newCallbacks when stopping a SocketPoll in the MOBILEAPP case
The wakeup() call in SocketPoll::stop() doesn't always (or ever?)
actually cause the wakeup code to be invoked and callbacks called
right after, and we don't want to risk the leftover callbacks being
invoked when the same SocketPoll object is started again. (This did
actually happen.)

In a normal Online, this is not a problem, as SocketPolls aren't
reused. One document per kit process, a separate kit process for each
document. Not so in a mobile app, there we have just one process that
handles document after document as the user closes one, opens another
(or the same anew), etc.
2018-10-17 20:10:52 +03:00
Tor Lillqvist
9e8a2d3c7e Bin a couple of less useful LOG_INFs inside #ifndef MOBILEAPP
Always good to get rid of ifdefs.
2018-10-17 17:09:04 +03:00
Tor Lillqvist
0af2a52b34 Add a completion handler that logs the success value 2018-10-17 15:59:19 +03:00
Tor Lillqvist
351193e1b7 Don't bother logging the full pathname __FILE__ on iOS 2018-10-17 12:54:36 +03:00
Tor Lillqvist
9afe021b86 Move the non-namespaced anonymizeUrl() to build for MOBILEAPP, too
Also, initialise the AnonymizeFilenames and AnonymizeUsernames
variables to false in the MOBILEAPP case.
2018-10-17 12:35:34 +03:00
Tor Lillqvist
5f01fbdf81 The iOS memrchr() replacement should of course be marked inline 2018-10-17 12:34:49 +03:00
Tor Lillqvist
0d8912ffe9 Test also looking for the last char 2018-10-17 11:55:19 +03:00
Tor Lillqvist
017df44f89 Bypass bTraceStartup thing on MOBILEAPP 2018-10-17 11:48:51 +03:00
Tor Lillqvist
b90fafa54f Adapt to change in LOG_BODY_ parameters 2018-10-17 11:48:22 +03:00
Tor Lillqvist
ccc7d2133d "The memrchr() function is a GNU extension, available since glibc 2.1.91."
Thus it doesn't exist on iOS, so add a trivial implementation. Include
an (ifdeffed out) unit test for it.
2018-10-17 11:46:56 +03:00
Tor Lillqvist
f122e92977 Build the GTK+ testbed app using autofoo
Rename the gtk/gtk.h file to gtk/gtk.hpp to not have it confused with
the actual GTK+ <gtk/gtk.h>.
2018-10-17 11:00:28 +03:00
Tor Lillqvist
15bd1dc48c Fix typo 2018-10-17 11:00:28 +03:00
Miklos Vajna
8316a650d6 test: avoid some unnecessary value parameters 2018-10-17 09:34:18 +02:00
Henry Castro
4a4a888798 loleaflet: mobile: ensure to hide the document name
Change-Id: I5285409f69f8e6568436fcc25a58eca4a24a0886
2018-10-16 21:07:08 -04:00
Ashod Nakashian
df08d6688f wsd: disable anonymization when allow_logging_pii=true
Anonymizing is useless with trace anyway, since no
trace log entry anonymizes, it's more useful to
disable anonymization to help troubleshoot (which is
the reason for enabling tracing in the first place).

Change-Id: I437207e7a798c2288a5d5eb33446cb16491bfbf6
Reviewed-on: https://gerrit.libreoffice.org/59534
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit a2809fd27277fd01d0dafdc0c4f0435fdf85db36)
2018-10-16 20:12:23 -04:00
Jan Holesovsky
3eb1051777 wsd: Don't try to anonymize the /contents at the end.
Change-Id: Ib3737f4afc6d708b7d06acb36f4044df9f5fbe84
Reviewed-on: https://gerrit.libreoffice.org/57586
Reviewed-by: Aron Budea <aron.budea@collabora.com>
Tested-by: Aron Budea <aron.budea@collabora.com>
(cherry picked from commit 9bab03070140227f850112716277c82f2fc41424)
(cherry picked from commit d2f7adca4a8d528e1cac33d877de906d28d34d65)
2018-10-16 20:12:23 -04:00
Jan Holesovsky
9a8e4fc0e8 wsd: safer string splitting
Reviewed-on: https://gerrit.libreoffice.org/57644
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
(cherry picked from commit 17d1fdda7a0c29df12c43b956418c83b59bfe0da)

Change-Id: I88b82a3754c4f5e280f00be8e27614c3fe49eff8
2018-10-16 20:12:23 -04:00
Ashod Nakashian
0fa7ad50d9 wsd: warn when allow_logging_pii forces trace with anonymization
Also move anonymization initialization after logging is initialized.

Change-Id: I5c3753f0b11ae9c3376235e22af204eb3a57f5c8
(cherry picked from commit 02076bdb9128ffe7c26d8bcf420b659ec1d68280)
2018-10-16 20:12:23 -04:00
Ashod Nakashian
a80c5e70c4 wsd: minor cleanup of CheckFileInfo logging
Change-Id: I45a7d281a640cbadfd42f1411f53946ae0142653
(cherry picked from commit 9a35fcd269877f3b42bb34c0d1b3bd6e98450d7d)
2018-10-16 20:12:23 -04:00
Ashod Nakashian
9bfe8b70e2 wsd: don't warn on missing json
Change-Id: I28086152fbf9fc82ddead1a2feb80f21ffdcd208
(cherry picked from commit 7b48be5a9dde4fcec01b8804559ffa4f9c19d53c)
2018-10-16 20:12:23 -04:00
Ashod Nakashian
4e186aca18 wsd: fixed remaining anonymization issues
(cherry picked from commit b7f5809a792e2a0b816d3cfd96511cdd93582d15)

Change-Id: I756ccd4b810fdc4dd62a83c1704c59c6a947e615
2018-10-16 20:12:23 -04:00
Ashod Nakashian
5d6a228a8b wsd: don't anonymize 'contents' URI
Reviewed-on: https://gerrit.libreoffice.org/57707
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
(cherry picked from commit 7cadf9da49c2b804f30f1e8c2d2998c768b9d365)

Change-Id: Ia66729453a1f7db6105a0332de0f8bad3835f3f5
2018-10-16 20:12:23 -04:00
Ashod Nakashian
ff6f49c598 wsd: more string split tests
Change-Id: Idd6e99954b11238eaf64e11e7969d0aee1612557
Reviewed-on: https://gerrit.libreoffice.org/57648
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
(cherry picked from commit f64e0fba92ad80776572255951b2e0d76bc76e73)
2018-10-16 20:12:23 -04: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
00a44d6e81 wsd: flush logs before existing
This is important for when we abort with some explanation.
Often said explanation doesn't show up anywhere to be useful.

Also, issue fatal logs for abnormal exist and use SFL to log errno.

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

Change-Id: Ic67064ef40ef6e93d26e5847ecd32bdd49c3cc8b
2018-10-16 20:12:23 -04:00
Ashod Nakashian
053161b3f5 wsd: move string utilities into Util
Reviewed-on: https://gerrit.libreoffice.org/57539
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
(cherry picked from commit fb2671c4145edd4d4e359f0dcf5cc84835487cd4)

Change-Id: Idc578dff4e8ee5e48c1b7780d3feb2d21c6a9b13
2018-10-16 20:12:23 -04:00
Ashod Nakashian
b516891815 wsd: prevent anonymization to empty strings
Change-Id: Ib4f90db5d39e7bf2e2f0b6566b1927363e6afcec
Reviewed-on: https://gerrit.libreoffice.org/57377
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
(cherry picked from commit 84245aa61e89cda6a9075a7059b5a7d839389719)
2018-10-16 20:12:23 -04:00
Ashod Nakashian
4587dde56f wsd: anonymize filename by using the WOPI file ID
Reviewed-on: https://gerrit.libreoffice.org/57254
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
(cherry picked from commit 5e3568ff1029da948f05d1c0e0c56c6d0706690e)

Change-Id: I869cae3846c8630b192246bc68cc90e70c50d1fd
2018-10-16 20:12:23 -04:00
Ashod Nakashian
1d5b6ca20b wsd: use obfascated user id when provided by WOPI
Change-Id: I69a17dff0e5e6b27e4538d9fe9019e4d1eebb16f
Reviewed-on: https://gerrit.libreoffice.org/57171
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
(cherry picked from commit 62dadb8aaa5cf9ba8cbbe0bc7f84dfc1076104c1)
2018-10-16 20:12:23 -04:00
Ashod Nakashian
1d814fca8c wsd: allow tracing with anonymization
Useful for troubleshooting and other non-prod setups.

To enable, add a subnode under logging/anonymize in
loolwsd.xml called allow_logging_pii with a boolean
value of true:

<logging>
  <anonymize>
    <allow_logging_pii>true</allow_logging_pii>
  </anonymize>
</logging>

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

Change-Id: If74acaac0ea442ee5a7860453182180663a5108b
2018-10-16 20:12:23 -04:00
Ashod Nakashian
c93f98d8c4 configure: support disabling anonymization
And inform the user of the anonymization level.

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

Change-Id: I95cf832d5c4103744207214ffbf4e85d177ff190
2018-10-16 20:12:23 -04:00
Ashod Nakashian
87d442712e wsd: force anonymization when enabled with configure
This prevents disabling from loolwsd.xml when
the flags to anonymize are baked in at compile time.

Change-Id: If38ad3815bc9f18ed51b6626fc8c03528e7b8327
Reviewed-on: https://gerrit.libreoffice.org/56089
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
(cherry picked from commit 8844d238f1c7a0bd71f6ddd3b59f4ea18bf3bdbb)
2018-10-16 20:12:23 -04:00
Ashod Nakashian
9fc7bc3625 wsd: log wopi CheckFileInfo with correct casing
Change-Id: I3e5e0000168ed6cf8910f593443a6b54324079c2
Reviewed-on: https://gerrit.libreoffice.org/56073
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
(cherry picked from commit 9001978d32f9dab769b1138a92d5e0eb7cb90b00)
2018-10-16 20:12:23 -04:00
Jan Holesovsky
f44b59b2d1 wsd: dump history in trace-logging only
(cherry picked from commit 1d5074146ad4532d86e7b5cfa7d0f518feee13c5)

Change-Id: Ibbefb93aa378f6faecbdb8b8c4f59013696b73c7
2018-10-16 20:12:23 -04:00
Jan Holesovsky
97df23eff5 anonymization: Anonymize uri's in the tilecache
(cherry picked from commit 2581772ecef22016348eba9cb51d19c7c6c53412)

Change-Id: I927d05e0329e3b2375f8d04f23b4356f2fd31764
2018-10-16 20:12:23 -04:00
Jan Holesovsky
6984d9a1ac anonymization: Anonymize uri's in the documentbroker
Change-Id: I1940b3eeb1761ec399716f237514020e97a785b1
(cherry picked from commit 49df5275451eb29ad2e10c156351f3255b8f756b)
2018-10-16 20:12:23 -04:00
Jan Holesovsky
726b50cc52 anonymization: Anonymize uri's in loolwsd
(cherry picked from commit 431f02ba982dd706767ccc8daf91c4840c640ac4)

Change-Id: I1d5d41ee8c3a3af1d437ec400fc8e27eb3de99db
2018-10-16 20:12:23 -04:00
Jan Holesovsky
6ec9b5c836 anonymization: Anonymize uri's in the storage
(cherry picked from commit 34359547cc735ebae4014837bcb92b7f0136bdf0)

Change-Id: Ifba57c5c765b9f2291255cc7de567520a21370ef
2018-10-16 20:12:23 -04:00
Jan Holesovsky
564fd6c621 anonymization: Anonymize urls in Kit.cpp
(cherry picked from commit 3a530d247496e577ed994c9cbece5faebd68e850)

Change-Id: I02c24e53664dbc971e8b5b4bdc3e607a53769bd0
2018-10-16 20:12:23 -04:00
Jan Holesovsky
25ef47adb4 Add a helpful warning for the dev builds.
Change-Id: I07d9c4d84e1edf9807a0683667d8d24d4c39ff38
(cherry picked from commit 2d9ca904d1065e91fac0c6ca2b509feecd931798)
2018-10-16 20:12:23 -04:00
Ashod Nakashian
a483d7ddef wsd: anonymize saveas
Change-Id: I58e349781952a97c3251b0e52e26abb34d44e9c0
2018-10-16 20:12:23 -04:00
Ashod Nakashian
f8ec98c144 wsd: anonymize downloadas
Change-Id: I6dff7189d78d339f1f5db7afef2b62da4df23759
2018-10-16 20:12:23 -04:00
Ashod Nakashian
d748dec556 wsd: anonymize document saving
Change-Id: Ic819883e39a544ec16d6ac144a08ed9f9f568cc0
2018-10-16 20:12:23 -04:00
Ashod Nakashian
7f569a61dc wsd: anonymize jailed filename
Change-Id: I0af46ae6779caf9851e3142889940e4f774f9eb9
2018-10-16 20:12:23 -04:00