]> git.saurik.com Git - apt.git/commitdiff
Merge branch 'debian/sid' of https://github.com/ion1/apt into debian/sid
authorMichael Vogt <mvo@debian.org>
Thu, 6 Jun 2013 17:17:25 +0000 (19:17 +0200)
committerMichael Vogt <mvo@debian.org>
Thu, 6 Jun 2013 17:17:25 +0000 (19:17 +0200)
cmdline/apt-key
debian/changelog

index c184e3e755b44f96ffd40a43abc7102756d6bb4f..2c087acbc667c6da58363d3de35d0d8cb28f3561 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
@@ -153,7 +163,7 @@ if [ "$1" = "--keyring" ]; then
         #echo "keyfile given"
        shift
        TRUSTEDFILE="$1"
-       if [ -r "$TRUSTEDFILE" ] || [ "$2" = 'add' ]; then
+       if [ -r "$TRUSTEDFILE" ] || [ "$2" = 'add' ] || [ "$2" = 'adv' ]; then
                GPG="$GPG --keyring $TRUSTEDFILE --primary-keyring $TRUSTEDFILE"
        else
                echo >&2 "Error: The specified keyring »$TRUSTEDFILE« is missing or not readable"
@@ -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 e31070aece052feec22a4e0dbe72f8a5dd943ab3..7d22ba396ca462f7dd13c9f1b0b809db7c4df203 100644 (file)
@@ -17,6 +17,11 @@ apt (0.9.8.2) UNRELEASED; urgency=low
   * Fix crash when the "mirror" method does not find any entry
     (closes: #699303)
 
+  [ Johan Kiviniemi ]
+  * cmdline/apt-key:
+    - Create new keyrings with mode 0644 instead of 0600.
+    - Accept a nonexistent --keyring file with the adv subcommand as well.
+
  -- Christian Perrier <bubulle@debian.org>  Thu, 16 May 2013 22:28:22 +0200
 
 apt (0.9.8.1) unstable; urgency=low