cmdline/apt-key: Create new keyrings with mode 0644 instead of 0600
authorJohan Kiviniemi <devel@johan.kiviniemi.name>
Wed, 22 May 2013 18:06:26 +0000 (21:06 +0300)
committerJohan Kiviniemi <devel@johan.kiviniemi.name>
Wed, 22 May 2013 18:06:38 +0000 (21:06 +0300)
cmdline/apt-key
debian/changelog

index c184e3e..309c51b 100755 (executable)
@@ -32,6 +32,16 @@ requires_root() {
        fi
 }
 
+# gpg defaults to mode 0600 for new keyrings. Create one with 0644 instead.
+init_keyring() {
+    for path; do
+        if ! [ -e "$path" ]; then
+            touch -- "$path"
+            chmod 0644 -- "$path"
+        fi
+    done
+}
+
 add_keys_with_verify_against_master_keyring() {
     ADD_KEYRING=$1
     MASTER=$2
@@ -198,33 +208,42 @@ fi
 case "$command" in
     add)
         requires_root
+        init_keyring "$TRUSTEDFILE"
         $GPG --quiet --batch --import "$1"
         echo "OK"
         ;;
     del|rm|remove)
         requires_root
+        init_keyring "$TRUSTEDFILE"
         $GPG --quiet --batch --delete-key --yes "$1"
         echo "OK"
         ;;
     update)
+        init_keyring "$TRUSTEDFILE"
        update
        ;;
     net-update)
+        init_keyring "$TRUSTEDFILE"
        net_update
        ;;
     list)
+        init_keyring "$TRUSTEDFILE"
         $GPG --batch --list-keys
         ;;
     finger*)
+        init_keyring "$TRUSTEDFILE"
         $GPG --batch --fingerprint
         ;;
     export)
+        init_keyring "$TRUSTEDFILE"
         $GPG --armor --export "$1"
         ;;
     exportall)
+        init_keyring "$TRUSTEDFILE"
         $GPG --armor --export
         ;;
     adv*)
+        init_keyring "$TRUSTEDFILE"
         echo "Executing: $GPG $*"
         $GPG $*
         ;;
index f5be97b..89da46e 100644 (file)
@@ -10,6 +10,9 @@ apt (0.9.8.2) UNRELEASED; urgency=low
   * buildlib/apti18n.h.in:
     - fix build failure when building without NLS (closes: #671587)
 
+  [ Johan Kiviniemi ]
+  * cmdline/apt-key: Create new keyrings with mode 0644 instead of 0600.
+
  -- Christian Perrier <bubulle@debian.org>  Thu, 16 May 2013 22:28:22 +0200
 
 apt (0.9.8.1) unstable; urgency=low