feature(keyringctl): raise exception on duplicate uid data
This commit is contained in:
parent
b653edfcdc
commit
b32c37bec1
@ -354,6 +354,10 @@ def convert_certificate(
|
||||
current_packet_fingerprint = None
|
||||
current_packet_uid = Uid(simplify_ascii(packet_dump_field(packet, "Value")))
|
||||
|
||||
if current_packet_uid in uids:
|
||||
raise Exception(
|
||||
f"Duplicate User ID {current_packet_uid} used in packet {uids[current_packet_uid]} and {packet}"
|
||||
)
|
||||
uids[current_packet_uid] = packet
|
||||
elif packet.name.endswith("UserAttribute"):
|
||||
current_packet_mode = "uattr"
|
||||
|
@ -423,6 +423,22 @@ def test_convert_signature_packet(
|
||||
"bar",
|
||||
does_not_raise(),
|
||||
),
|
||||
(
|
||||
Path("foo.asc"),
|
||||
[
|
||||
Path("--PublicKey"),
|
||||
Path("--Signature"),
|
||||
Path("--UserID"),
|
||||
Path("--UserID"),
|
||||
],
|
||||
[
|
||||
"".join(choice("ABCDEF" + digits) for _ in range(40)),
|
||||
"foo <foo@bar.com>",
|
||||
"foo <foo@bar.com>",
|
||||
],
|
||||
"bar",
|
||||
raises(Exception),
|
||||
),
|
||||
(
|
||||
Path("foo.asc"),
|
||||
[
|
||||
|
Loading…
Reference in New Issue
Block a user