| 624 | } |
| 625 | |
| 626 | static int parse_payload_metadata(struct signature_check *sigc) |
| 627 | { |
| 628 | const char *ident_line = NULL; |
| 629 | size_t ident_len; |
| 630 | struct ident_split ident; |
| 631 | const char *signer_header; |
| 632 | |
| 633 | switch (sigc->payload_type) { |
| 634 | case SIGNATURE_PAYLOAD_COMMIT: |
| 635 | signer_header = "committer"; |
| 636 | break; |
| 637 | case SIGNATURE_PAYLOAD_TAG: |
| 638 | signer_header = "tagger"; |
| 639 | break; |
| 640 | case SIGNATURE_PAYLOAD_UNDEFINED: |
| 641 | case SIGNATURE_PAYLOAD_PUSH_CERT: |
| 642 | /* Ignore payloads we don't want to parse */ |
| 643 | return 0; |
| 644 | default: |
| 645 | BUG("invalid value for sigc->payload_type"); |
| 646 | } |
| 647 | |
| 648 | ident_line = find_commit_header(sigc->payload, signer_header, &ident_len); |
| 649 | if (!ident_line || !ident_len) |
| 650 | return 1; |
| 651 | |
| 652 | if (split_ident_line(&ident, ident_line, ident_len)) |
| 653 | return 1; |
| 654 | |
| 655 | if (!sigc->payload_timestamp && ident.date_begin && ident.date_end) |
| 656 | sigc->payload_timestamp = parse_timestamp(ident.date_begin, NULL, 10); |
| 657 | |
| 658 | return 0; |
| 659 | } |
| 660 | |
| 661 | int check_signature(struct signature_check *sigc, |
| 662 | const char *signature, size_t slen) |
no test coverage detected