]> git.notmuchmail.org Git - notmuch/commit - notmuch-config.c
notmuch-config: replace config reading function
authorIoan-Adrian Ratiu <adi@adirat.com>
Sat, 10 Dec 2016 19:54:07 +0000 (21:54 +0200)
committerDavid Bremner <david@tethera.net>
Thu, 15 Dec 2016 23:34:30 +0000 (08:34 +0900)
commitf2a038825b73d4b9fa6cfd3ecbe661f1e6a49840
tree662a1b91fad9920bc96f673dcca04d4b2843ea80
parent59ec7960242dfa8382c440d719a394877fa0fc35
notmuch-config: replace config reading function

Config files are currently read using glib's g_key_file_load_from_file
function which is very inconvenient because it's limited by design to read
only from "regular data files" in a filesystem. Because of this limitation
notmuch can't read configs from pipes, fifos, sockets, stdin, etc. Not even
"notmuch --config=/dev/stdin" works:

Error reading configuration file /dev/stdin: Not a regular file

So replace g_key_file_load_from_file with g_key_file_load_from_data which
gives us much more freedom to read configs from multiple sources.

This also helps the more security sensitive users: If someone has private
information in the config file, it can be encrypted on disk, then decrypted
in RAM and passed through a pipe directly to notmuch without the use of
intermediate plain text files.

Signed-off-by: Ioan-Adrian Ratiu <adi@adirat.com>
notmuch-config.c