Skip to content

Commit

Permalink
fixup: Handle map to initial
Browse files Browse the repository at this point in the history
  • Loading branch information
IngelaAndin committed Nov 1, 2023
1 parent 7673473 commit 5ee3e86
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/public_key/src/pubkey_cert.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1063,9 +1063,17 @@ handle_policy_mapping_ext(#'PolicyMappings_SEQOF'{
MapPolicy =
fun(#{valid_policy := ValidPolicy, expected_policy_set := Set} = Node)
when ValidPolicy == IssuerPolicy ->
case Set of %% Initial policy should be mapped over, but can be mapped to itself
[ValidPolicy] when SubjectPolicy =/= ValidPolicy ->
case Set of %% Initial policy should be mapped over ..
[ValidPolicy] when ValidPolicy =/= SubjectPolicy ->
Node#{expected_policy_set => [SubjectPolicy]};
%% , but can be mapped to itself ..
[ValidPolicy] when ValidPolicy == SubjectPolicy ->
case lists:member(SubjectPolicy, Set) of %% .. as first mapping
true ->
Node;
false -> %% .. or later add back
Node#{expected_policy_set => Set ++ [SubjectPolicy]}
end;
_ ->
Node#{expected_policy_set => Set ++ [SubjectPolicy]}
end;
Expand Down

0 comments on commit 5ee3e86

Please sign in to comment.