Commit Graph

46 Commits (94d5f0a86e40543917a9ff7c0749b32cc2982d1b)

Author SHA1 Message Date
Alexander Larsson 4fdac9e5d4 document portal: Disable spice_read as it seems broken
We're getting "fuse: copy from pipe: short read" from
libfuse and a broken filesystem with this. See
https://github.com/flatpak/flatpak/issues/570

I've tried to look into if this is fixable, but I can't
really find any way we could do things differently that
may help, so the fix is to disable spice_read.
2017-02-23 16:55:49 +01:00
Alexander Larsson 84246b6ec5 document-portal: Fix ownership of basic directories
We now report these as the user uid+gid instead of root.
2017-02-14 09:07:15 +01:00
Alexander Larsson 9791268c6b document portal: Support access() on directories 2017-01-18 11:32:44 +01:00
Alexander Larsson 4be202442d document portal: Add some debug spew 2017-01-18 11:32:44 +01:00
Alexander Larsson 8909b5437d document-portal: Treat newly created files (EXCL) as truncated ones
The EXCL pretty much guarantees it is a new file.
2017-01-18 11:32:44 +01:00
Alexander Larsson 13b0c78fe5 document portal: Report right error for setattr 2017-01-18 11:32:44 +01:00
Alexander Larsson bd3eae146a document-portal: Fix warnings on 32bit builds
fi->fh is a uint64, and if we cast that directly to a pointer
on a 32bit arch then we get a warning, so lets first cast
to gsize, and then to pointer.

Should fix https://github.com/flatpak/flatpak/issues/173
2016-11-15 11:32:28 +01:00
Alexander Larsson 5c2d0065db document-portal: Correctly detect truncation and exclusive mode 2016-11-11 11:19:46 +01:00
Alexander Larsson b61259dc79 document-portal: Fix file trucation
We were checking the error return in the wrong way.
2016-11-11 11:00:30 +01:00
Sebastian Rasmussen b21f4bf542 Prefer g_strerror() to strerror()
It handles encodins better, is thread-safe and more portable.
2016-09-15 01:22:54 +08:00
Matthias Clasen b2b281e485 Make flatpak_is_valid_name set a GError
Return detailed information about the problem with the name in
the GError. Update all callers.
2016-09-12 23:25:54 -04:00
Matthias Clasen d245ba3574 fuse: Always fail X_OK in access()
Pointed out by Ray Strode.
2016-07-27 16:00:44 -04:00
Matthias Clasen 0e8faa8c31 document-portal: Implement access()
In testing readonly exports, I noticed that gedit is does not believe
the mode it gets from stat()ing a file a million times. Instead
it calls access() to determine whether to treat it as readonly.
Since the document portal fuse file system did not implement
access(), gedit treated my file as writable and then failed when
I clicked "Save". With this patch, gedit treats the file as read-only
from the get-go.
2016-07-26 14:55:18 -04:00
Matthias Clasen f53533ff48 Fix compiler warnings
There are a number of -Wshadow warnings in document-portal/.
Fix them.
2016-06-09 23:47:41 -04:00
Alexander Larsson c24528d369 Rename source files to flatpak 2016-05-09 09:00:20 +02:00
Alexander Larsson 6a613d1fab Rename all non-autogenerated symbols to flatpak 2016-05-09 09:00:20 +02:00
Alexander Larsson 1ffdf27d92 uncruftify: Initial run, all non-problematic changes 2016-05-06 16:03:27 +02:00
Alexander Larsson af03d2f5b4 Remove unused local variables reported by clang 2016-04-21 09:48:56 +02:00
Alexander Larsson 46a192824c fuse: Store basename in dir so we don't have to keep looking it up
Its immutable for a document anyway
2016-03-14 10:58:08 +01:00
Alexander Larsson 9537bdc339 document portal: Avoid some deadlock
We can't hold the db lock and call into the fuse backend, because that
can create deadlocks if it calls back into the db.
2016-03-14 10:50:34 +01:00
Alexander Larsson 7a61eaa91d Reimplement fuse backend
The magic inode numbers we used before are problematic.

The inode nrs are tied to the file names, so inode changes on rename, which breaks posix expectations.

Also, it relied on 64bit inode space which is not true on i386.

So, this is a new implementation that uses a more traditional approach
of dynamically allocating inodes as needed.
2016-03-11 17:00:08 +01:00
Alexander Larsson 4177f358cb common: Make it explicit that XdgAppError are portal errors 2015-12-08 12:16:38 +01:00
Alexander Larsson cf5050126e fuse: Disable entry cache to work around race condition 2015-10-01 18:02:13 +02:00
Alexander Larsson 2d31c3c7da fuse: Supply mode when creating files
https://bugs.freedesktop.org/show_bug.cgi?id=92034
2015-09-18 14:27:32 +02:00
Alexander Larsson 4ca4f78483 document portal: Fix crashes when dbus activated
We handle the first message (the activating message) before we
have gotten the name aquired message. Make sure that this
is correctly handled.
2015-09-09 16:25:51 +02:00
Alexander Larsson 31837cdaa3 fuse: Drop DOC_DIR_INO_CLASS
We can just use a APP_DOC_DIR_INO_CLASS with app_id 0.
This gets rid of some duplicated code.
2015-09-08 15:23:18 +02:00
Alexander Larsson 42c6cd4574 document portal: Correctly handle recursive documents
I.e. if you pass in a document fd to the document portal we
reuse the existing id.
2015-09-08 14:53:14 +02:00
Alexander Larsson ad9f05397e fuse: Add some more debug spew 2015-09-08 11:15:31 +02:00
Alexander Larsson bb6e476f62 fuse: Raise entry cache times now that we invalidate 2015-09-08 11:15:05 +02:00
Alexander Larsson 8fe6a115f6 fuse: Properly invalidate inodes and entries 2015-09-08 11:09:40 +02:00
Alexander Larsson 8af69c93af fuse: Unmount previous fuse instance if ENOTCONN 2015-09-08 09:33:44 +02:00
Alexander Larsson 2f115c89af document-portal: Actually respect WRITE permissions 2015-09-04 17:00:37 +02:00
Alexander Larsson 6cf4d24a09 document-portal: Use xdg_app_is_valid_name() to validate app names 2015-09-04 14:50:02 +02:00
Alexander Larsson 83201bd7e4 fuse: Always open files with O_NOFOLLOW
Following symlinks is risky as the sandbox may control them.
2015-09-04 14:16:45 +02:00
Alexander Larsson 0c07417d5f Add debug output for release 2015-09-03 22:17:00 +02:00
Alexander Larsson 04879fdea5 Store and verify parent dir dev/ino and pass O_PATH fds
In order to be robust against symlink attacks (i.e. make a document
for a path, then replace it with a symlink somewhere else and have the
portal read that instead) we store the parent dev/ino when we create
the document id and always verify that (atomically with the *at
syscalls) on each use.

Also, we pass O_PATH fds when creating documents, as it allows us
to be a bit safer. For instance we can verify that the fd is a O_PATH
fd before doing any ops on it, and it makes it possible to avoid other
symlink trickery.

Also, we drop the double add methods, and just use the O_PATH version.
2015-09-03 22:17:00 +02:00
Alexander Larsson 4a298aeec3 fuse: Make filesystem multithreaded
This allows us to handle multiple apps better.
2015-09-03 22:16:43 +02:00
Alexander Larsson 6775dc1002 Use g_auto(GStrv) instead of glnx_strfreev 2015-08-31 09:51:48 +02:00
Alexander Larsson 52525f46fd Remove ununsed variables reported by clang 2015-08-27 16:13:15 +02:00
Alexander Larsson 42012a7d5a Drop the xdp specific errors and use the xdg-app ones 2015-08-27 10:40:58 +02:00
Alexander Larsson b6355e1acb Document portal: Store paths, not uris
There is no way to do this for generic uris anyway, lets not
pretend we're solving a larger problem.
2015-08-27 10:38:22 +02:00
Alexander Larsson 12fbd9ff95 Make document portal use the new permission store 2015-08-26 17:11:35 +02:00
Alexander Larsson c465c15e51 Don't list empty names in opendir
This happened in my devel system by mistake and it broke readdir.
2015-08-04 12:05:21 +02:00
Alexander Larsson f76f6a39ef document-portal: *always* use the by-app location
This is better as you can't accidentally access another apps docs (although
you can still see the backing real files)
2015-07-11 10:48:53 +02:00
Alexander Larsson 4c4c66fc2d Add GetMountPoint method for document portal
This is both to get the mount path and to have a nice way
to activate the mount.
2015-07-10 17:02:38 +02:00
Alexander Larsson 929071ad10 Import xdg-document-portal from github repo
This pulls in the daemon code from:
     https://github.com/alexlarsson/xdg-document-portal/

We need this in xdg-app because we need to set up the mounts correctly.
2015-07-10 16:56:39 +02:00