diff options
| author | Michael Vogt <egon@debian-devbox> | 2012-10-12 09:29:28 +0200 |
|---|---|---|
| committer | Michael Vogt <egon@debian-devbox> | 2012-10-12 09:29:28 +0200 |
| commit | ada635b123bf1a1ebec2b3208742ab7fdaae43d6 (patch) | |
| tree | 903c41edc64d35881ed3a18192716fa09fe6fe5d | |
| parent | c018a7368c5f3546ee90ad6bb597d0708ab4cb28 (diff) | |
| parent | 4755c72601c11b800650f942f855cee286c50356 (diff) | |
| download | python-apt-ada635b123bf1a1ebec2b3208742ab7fdaae43d6.tar.gz | |
* apt/auth.py:
- support importing long keyids with leading 0x and mixed case
| -rw-r--r-- | apt/auth.py | 4 | ||||
| -rw-r--r-- | debian/changelog | 2 | ||||
| -rw-r--r-- | tests/test_auth.py | 3 |
3 files changed, 7 insertions, 2 deletions
diff --git a/apt/auth.py b/apt/auth.py index 742b5cc2..eff13b1a 100644 --- a/apt/auth.py +++ b/apt/auth.py @@ -175,7 +175,9 @@ def _add_key_from_keyserver(keyid, keyserver, tmp_keyring_dir): got_fingerprint = line.split(":")[9] # stop after the first to ensure no subkey trickery break - signing_key_fingerprint = keyid + # strip the leading "0x" is there is one and uppercase (as this is + # what gnupg is using) + signing_key_fingerprint = keyid.replace("0x", "").upper() if got_fingerprint != signing_key_fingerprint: raise AptKeyError( "Fingerprints do not match, not importing: '%s' != '%s'" % ( diff --git a/debian/changelog b/debian/changelog index 37e1cbd1..60d78971 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,8 @@ python-apt (0.8.8) UNRELEASED; urgency=low man-in-the-middle attacks (LP: #1016643) * consolidate tests/test_lp1030278.py into the new tests/test_size_to_str.py + * apt/auth.py: + - support importing long keyids with leading 0x and mixed case [ Barry Warsaw ] * python/string.cc, tests/test_lp1030278.py: Fix StrSizeToStr() so that diff --git a/tests/test_auth.py b/tests/test_auth.py index 4e37b3d3..d742a471 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -207,7 +207,8 @@ class TestAuthKeys(unittest.TestCase): self.addCleanup(self._stop_keyserver) apt.auth.add_key_from_keyserver( - "A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553", "hkp://localhost:19191") + "0xa1bD8E9D78F7FE5C3E65D8AF8B48AD6246925553", + "hkp://localhost:19191") ret = apt.auth.list_keys() self.assertEqual(len(ret), 1) |
