Commit 40026ed
committed
Fix read-only LMDB lookup DBI lifetime
The read-only fapolicyd-cli --check-path setup opened the active LMDB named database and then aborted the transaction. LMDB keeps DBI handles opened by mdb_dbi_open() private to the opening transaction until that transaction commits, so the aborted setup transaction could invalidate readonly_lookup_dbi and make later cursor opens fail.
Commit the read-only setup transaction after opening the active DBI, and keep abort handling for setup failures. This preserves the private read-only environment while making the DBI usable by subsequent read-only lookup transactions.
Add a trustdb_lmdb_test regression that publishes a temporary trust record, closes the writable test environment, starts the CLI read-only lookup state, and verifies the trusted path is found through a later transaction.1 parent 6f9a1b9 commit 40026ed
2 files changed
Lines changed: 54 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5078 | 5078 | | |
5079 | 5079 | | |
5080 | 5080 | | |
| 5081 | + | |
| 5082 | + | |
| 5083 | + | |
| 5084 | + | |
| 5085 | + | |
| 5086 | + | |
| 5087 | + | |
| 5088 | + | |
| 5089 | + | |
5081 | 5090 | | |
5082 | 5091 | | |
5083 | 5092 | | |
5084 | 5093 | | |
5085 | 5094 | | |
5086 | 5095 | | |
| 5096 | + | |
5087 | 5097 | | |
5088 | 5098 | | |
5089 | 5099 | | |
5090 | | - | |
5091 | | - | |
5092 | | - | |
5093 | 5100 | | |
5094 | 5101 | | |
5095 | 5102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
697 | 697 | | |
698 | 698 | | |
699 | 699 | | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
700 | 740 | | |
701 | 741 | | |
702 | 742 | | |
| |||
1538 | 1578 | | |
1539 | 1579 | | |
1540 | 1580 | | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
1541 | 1585 | | |
1542 | 1586 | | |
1543 | 1587 | | |
| |||
0 commit comments