~ubuntu-branches/ubuntu/hardy/apt/hardy-security

« back to all changes in this revision

Viewing changes to cmdline/apt-key

  • Committer: Package Import Robot
  • Author(s): Jamie Strandboge
  • Date: 2012-06-14 11:00:24 UTC
  • Revision ID: package-import@ubuntu.com-20120614110024-na9lkywhxuomidox
Tags: 0.7.9ubuntu17.5
adjust apt-key to ensure no collisions on subkeys too. Patch thanks to
Marc Deslauriers. (LP: #1013128)

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    #   all keys that are exported must have a valid signature
34
34
    #   from a key in the $distro-master-keyring
35
35
    add_keys=`$GPG_CMD --keyring $ADD_KEYRING --with-colons --list-keys | grep ^pub | cut -d: -f5`
 
36
    all_add_keys=`$GPG_CMD --keyring $ADD_KEYRING --with-colons --list-keys | grep ^[ps]ub | cut -d: -f5`
36
37
    master_keys=`$GPG_CMD --keyring $MASTER --with-colons --list-keys | grep ^pub | cut -d: -f5`
37
 
    
38
 
    for add_key in $add_keys; do
39
38
 
40
 
        # ensure there are no colisions LP: #857472
 
39
    # ensure there are no colisions LP: #857472
 
40
    for all_add_key in $all_add_keys; do
41
41
        for master_key in $master_keys; do
42
 
            if [ "$add_key" = "$master_key" ]; then
43
 
                echo >&2 "Keyid collision for '$add_key' detected, operation aborted"
 
42
            if [ "$all_add_key" = "$master_key" ]; then
 
43
                echo >&2 "Keyid collision for '$all_add_key' detected, operation aborted"
44
44
                return 1
45
45
            fi
46
46
        done
47
 
 
 
47
    done
 
48
    
 
49
    for add_key in $add_keys; do
48
50
        # export the add keyring one-by-one
49
51
        rm -f $TMP_KEYRING
50
52
        $GPG_CMD --keyring $ADD_KEYRING --output $TMP_KEYRING --export $add_key