Просмотр исходного кода

apt-key del should correctly handle keyids prefixed with 0x

Daniel Kahn Gillmor лет назад: 10
Родитель
Сommit
f7bd44bae0
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      cmdline/apt-key.in

+ 4 - 0
cmdline/apt-key.in

@@ -191,6 +191,10 @@ remove_key_from_keyring() {
     for KEY in "$@"; do
     for KEY in "$@"; do
 	local FINGERPRINTS="${GPGHOMEDIR}/keyringfile.keylst"
 	local FINGERPRINTS="${GPGHOMEDIR}/keyringfile.keylst"
 	get_fingerprints_of_keyring "$KEYRINGFILE" > "$FINGERPRINTS"
 	get_fingerprints_of_keyring "$KEYRINGFILE" > "$FINGERPRINTS"
+
+        # strip leading 0x, if present:
+        KEY="$(printf %s "$KEY" | sed s/^0x//)"
+
 	# check if the key is in this keyring
 	# check if the key is in this keyring
 	if ! grep -iq "^[0-9A-F]*${KEY}$" "$FINGERPRINTS"; then
 	if ! grep -iq "^[0-9A-F]*${KEY}$" "$FINGERPRINTS"; then
 	    continue
 	    continue