summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2016-04-20 14:55:45 +0200
committerJustus Winter <justus@g10code.com>2016-04-20 15:02:37 +0200
commitf8adf1a3234655877a4f985d627d98567507002c (patch)
treefc52acddf11211860bdfa2608c376bf783884d3a /tests
parenttests: Test the migration from a classic GnuPG home directory. (diff)
downloadgnupg2-f8adf1a3234655877a4f985d627d98567507002c.tar.xz
gnupg2-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 <justus@g10code.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/migrations/from-classic.test15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/migrations/from-classic.test b/tests/migrations/from-classic.test
index 4ee3b616f..a61a5c36f 100755
--- a/tests/migrations/from-classic.test
+++ b/tests/migrations/from-classic.test
@@ -50,3 +50,18 @@ assert_migrated()
setup_home
trigger_migration
assert_migrated
+
+# Test with an existing private-keys-v1.d.
+setup_home
+mkdir "$GNUPGHOME/private-keys-v1.d"
+trigger_migration
+assert_migrated
+
+# Test with an existing private-keys-v1.d with weird permissions.
+setup_home
+mkdir "$GNUPGHOME/private-keys-v1.d"
+chmod 0 "$GNUPGHOME/private-keys-v1.d"
+trigger_migration
+assert_migrated
+
+# XXX Check a case where the migration fails.