Creating files grants permanent permissions to them now. This makes
sense because if a program creates a new file, then it clearly can't
steal any data. This is particularly useful for programs which open an
obscene amount of auxilary files (e.g. neovim with a huge amount of
plugins).
Finally implemented the permanent permission tables using sqlite3. For
now, performance wasn't a consideration. There are a lot of
optimizations that could be made, like having prepared queries. The code
remains fairly untested.
The script was correctly opening the `truth` file by piping `echo` to
it, but then it tried to deny another operation on it. But since pipes
are opened by the script process, the permission was given to the
script. And since the permissions are preserved for the entire runtime
of a process, and child processes inherit permissions of their parents,
any command executed later would also have the necessary permissions to
open `truth` (which was the case for the second operation). Now the
second operation is performed on a different file.
Makefile now gets the necessary `cflags` and `libs` compiler arguments
from `pkg-config` which increases portability and makes adding new
dependencies easier. Also added `TEST` flag, to have automated testing
in the future.
Now the user can choose the "Allow this time." option when prompted.
`ask_access` will return 2 if this option is selected. So far, only the
GUI for this feature is implemented.
Now the program is completely functional and is using zenity dialogues.
`sources` directory was renamed to `src`. UI related stuff was moved to
`src/gui/ui`.
Two new issues to solve:
* Should the ui communication component also be the one that manages
permissions?
* The format of data sent (protocol) needs definition.
Passthrough is usable now. There have been issues with the `access`
operation: it's unclear what it must return, since the answer isn't
known at the time when it is called. If it always returns "denied", many
applications would finish without trying to open a file, thinking the
access would not be granted after `access` call. Although always
returning "permitted" seems like a better choice, it still might cause unexpected
behaviour. Perhaps one way to solve this, is actually asking user
whether to allow access. In any case, this issue needs to be looked
into.
Now source files handling is delegated to functions defined
in `sourcefs.c` file. By encapsulating methods for managing
the underlying source files structure we ensure that all
code changes to the source file protection strategy will be
localized to `sourcefs.c` file.
Also changed Makefile to use more sane way of handling
options and build flags.
After some consideration I decided to use C instead of C++ because:
* `libfuse` is written in C.
* C is simpler.
* My original concerns with using C turned out to be BS.