diff options
author | Justus Winter <[email protected]> | 2016-04-20 12:55:45 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2016-04-20 13:02:37 +0000 |
commit | f8adf1a3234655877a4f985d627d98567507002c (patch) | |
tree | fc52acddf11211860bdfa2608c376bf783884d3a /agent/gpg-agent.c | |
parent | tests: Test the migration from a classic GnuPG home directory. (diff) | |
download | gnupg-f8adf1a3234655877a4f985d627d98567507002c.tar.gz gnupg-f8adf1a3234655877a4f985d627d98567507002c.zip |
agent: Sanitize permissions of the private key directory.
* agent/gpg-agent.c (create_private_keys_directory): Set permissions.
* common/sysutils.c (modestr_to_mode): New function.
(gnupg_mkdir): Use new function.
(gnupg_chmod): New function.
* common/sysutils.h (gnupg_chmod): New prototype.
* tests/migrations/from-classic.test: Test migration with existing
directory.
GnuPG-bug-id: 2312
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to '')
-rw-r--r-- | agent/gpg-agent.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c index 8aab2b951..a87052a92 100644 --- a/agent/gpg-agent.c +++ b/agent/gpg-agent.c @@ -1908,9 +1908,13 @@ create_private_keys_directory (const char *home) else if (!opt.quiet) log_info (_("directory '%s' created\n"), fname); } + if (gnupg_chmod (fname, "-rwx")) + log_error (_("can't set permissions of '%s': %s\n"), + fname, strerror (errno)); xfree (fname); } + /* Create the directory only if the supplied directory name is the same as the default one. This way we avoid to create arbitrary directories when a non-default home directory is used. To cope |