Commit graph

31 commits

Author SHA1 Message Date
Ashod Nakashian
fae850189d loolwsd: include cleanup and organization
A source file (.cpp) must include its own header first.
This insures that the header is self-contained and
doesn't depend on arbitrary (and accidental) includes
before it to compile.

Furthermore, system headers should go next, followed by
C then C++ headers, then libraries (Poco, etc) and, finally,
project headers come last.

This makes sure that headers and included in the same dependency
order to avoid side-effects. For example, Poco should never rely on
anything from our project in the same way that a C header should
never rely on anything in C++, Poco, or project headers.

Also, includes ought to be sorted where possible, to improve
readability and avoid accidental duplicates (of which there
were a few).

Change-Id: I62cc1343e4a091d69195e37ed659dba20cfcb1ef
Reviewed-on: https://gerrit.libreoffice.org/25262
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-21 15:52:54 +00:00
Miklos Vajna
17de53981e Storage: fix missing underscore for non-static members
Change-Id: Ibde55358c9640344e8bb4e6e24b287b1e7d8c6b5
2016-04-19 09:10:28 +02:00
Ashod Nakashian
23003c455c bccu#1696 - enable WOPI connection from the same host by default
Since auto-discovery is problematic, this patch implements
support for both regex patterned hostnames/IPs to allow,
and those to block/deny.

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

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

Defaults updated with same values, but not exhaustive.

Change-Id: Iedfcafe41d07d905b549fb450c3fe625ad44599e
Reviewed-on: https://gerrit.libreoffice.org/24233
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-19 01:41:51 +00:00
Ashod Nakashian
b50a7d507c loolwsd: wopi trusted hosts are stored in set to warn about conflicting config
Change-Id: If27e173ffee753e655057d8516f4f3b3ecda5d3b
Reviewed-on: https://gerrit.libreoffice.org/24159
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:24:58 +00:00
Ashod Nakashian
115e654d63 bccu#1648: Limit trusted WOPI hosts
Control allowed/trusted wopi hosts from config.

Change-Id: I730b4be8ef0d47bdb5e490926486184777de4eb0
Reviewed-on: https://gerrit.libreoffice.org/24135
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-16 17:58:01 +00:00
Ashod Nakashian
a9f58e2657 loolwsd: log Storage construction to identify concrete backend
Change-Id: I0bcb0d08bccd1551abc7c2ffdf79d8f6154dc880
Reviewed-on: https://gerrit.libreoffice.org/24134
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-16 17:57:14 +00:00
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
Michael Meeks
7d62c74b83 Fix segv on failure to create a storage, and add unit test infra. 2016-04-07 22:21:14 +01: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
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
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
Ashod Nakashian
b4a4c45a36 loolwsd: Storage gets last modified time and simplified TileCache construction
Change-Id: I4a7e7b941c136b59ffd7d935310d37d73ac4ec63
Reviewed-on: https://gerrit.libreoffice.org/23540
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-26 17:10:25 +00:00
Ashod Nakashian
bea295bf0d loolwsd: wopi saving must post to /contents
Change-Id: I749ffb8818ed0a0463c2c2da0f1c2730d06b6b1f
Reviewed-on: https://gerrit.libreoffice.org/23493
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-24 13:48:30 +00:00
Pranav Kant
cfac07e3a1 loolwsd: Split DocumentBroker to its header and impl file
Change-Id: I8219300e271892f9f8fdecd8b38d9ea445cb7199
2016-03-23 22:16:35 +05:30
Miklos Vajna
cd5889ee9a loolwsd: fix -Werror,-Winconsistent-missing-override 2016-03-23 17:36:56 +01:00
Ashod Nakashian
8081db3fd9 loolwsd: fixed file info for local files
Change-Id: I8e2588d55d5ecccb9d0becafad4757b7fcb99eaf
Reviewed-on: https://gerrit.libreoffice.org/23453
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-23 00:05:35 +00:00
Ashod Nakashian
ef95d51b67 loolwsd: FileInfo used to authenticate and store with original name
Change-Id: I94105441134ded2146736affba7b763eb3d54791
Reviewed-on: https://gerrit.libreoffice.org/23452
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-23 00:04:58 +00:00
Ashod Nakashian
cf3811a7fb loolwsd: refactored storage construction into factory
Change-Id: I5e1453b100d852424b472d08746d8636b7656755
Reviewed-on: https://gerrit.libreoffice.org/23451
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-23 00:04:15 +00:00
Ashod Nakashian
ca9c14dfdd loolwsd: logs and comments
Change-Id: I2fbfb7ee7ada48390bec65ee6911bde00885fbdb
Reviewed-on: https://gerrit.libreoffice.org/23450
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-23 00:03:36 +00:00
Ashod Nakashian
d48d9044a1 loolwsd: run tests on doc copies
Tests can modify the test documents they use.
Currently there is data-loss protection that
saves an open doc if connection is lost with
the client. For tests this means modification
are saved when a connection is terminated
ungracefully and this both adds noise
to the git checkout and makes subsequent
tests fail.

This patch makes temp copies of the original
doc before a test is run and deletes them
afterwards.

Change-Id: I1dd6ff2b839701e85c8bd502ba75170c01fa106e
Reviewed-on: https://gerrit.libreoffice.org/23447
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-23 00:00:34 +00:00
Ashod Nakashian
52d9e2033c loolwsd: improved WopiStorage with working PutFile
Change-Id: I2bba701ca0c89783851757e91e9336a64f6f6c52
Reviewed-on: https://gerrit.libreoffice.org/23208
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-14 03:03:30 +00:00
Ashod Nakashian
9bf88691c6 loolwsd: DocumentStoreManager maintains Storage instance
Change-Id: I0c86a7a7a3bb8d52a3f83570ccb4eded42ef4090
Reviewed-on: https://gerrit.libreoffice.org/23205
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-14 03:01:07 +00:00
Ashod Nakashian
e8214c1d2a loolwsd: refactored Storage classes
Change-Id: I3cc3aa2c1ddf70b8d2f3489aa4047f6470c93eb2
Reviewed-on: https://gerrit.libreoffice.org/23108
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-10 04:23:16 +00:00
Ashod Nakashian
cef1d842f9 loolwsd: added user-agent and response header logging to WOPI GetFile
Change-Id: Ia7fba845d67b27c25accb8515a44c57eed112a9b
Reviewed-on: https://gerrit.libreoffice.org/23054
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-09 02:36:52 +00:00
Ashod Nakashian
e5fcdb890e loolwsd: corrections to file and wopi URI handling
Change-Id: I7389a30931be01a40714167039055a758187bd82
Reviewed-on: https://gerrit.libreoffice.org/23053
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-09 02:34:10 +00:00
Ashod Nakashian
978147df55 loolwsd: refactored path manipulation in Storage.
Change-Id: I320c5638353b03df4fd0be612bb66c26e4f498a3
Reviewed-on: https://gerrit.libreoffice.org/23052
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-09 02:33:39 +00:00
Ashod Nakashian
6c69519562 Storage is used to manage files locally
Change-Id: Id50eca8fe1136777ca99c60d78c15e1a47397993
Reviewed-on: https://gerrit.libreoffice.org/23049
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-09 02:31:47 +00:00
Pranav Kant
afb7e7dcff loolwsd: Make clients subscribe to commands
... for which they want to be notified.

Needed to add some missing header files to Storage and Auth class
because of conflict raised when LOOLWSD.hpp is included in
Admin.cpp

Change-Id: Ia1c8ed82f8cd979eaf93267ae5dfa347acf895f4
2016-03-08 15:14:14 +05:30
Ashod Nakashian
743311af21 loolwsd: added wopi storage manager
Change-Id: Ia28fb3d42c43387432e0b183a1bcf6b0924da820
Reviewed-on: https://gerrit.libreoffice.org/22885
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-04 03:06:28 +00:00
Miklos Vajna
ae07c555bb loolwsd: fix -Werror,-Winconsistent-missing-override 2016-02-23 09:32:25 +01:00
Ashod Nakashian
13f9b7a2db loolwsd: Storage Abstraction support
An abstract Storage abstraction class is added.
There will be a factory to instantiate concrete
implementation for a given backend.

For WebDAV and similar hosted backends, authentication
and authorization will be done by the implementation
with the help of the Auth abstraction.

Change-Id: I38ec5dad4c2c4ce16df30d65826df96751b10e2d
Reviewed-on: https://gerrit.libreoffice.org/22513
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-19 21:45:25 +00:00