forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6f782a2
committed
Avoid mixing custom and OpenSSL BIO functions
PostgreSQL has for a long time mixed two BIO implementations, which canlead to subtle bugs and inconsistencies. This cleans up our BIO by justjust setting up the methods we need. This patch does not introduce anyfunctionality changes.The following methods are no longer defined due to not being needed: - gets: Not used by libssl - puts: Not used by libssl - create: Sets up state not used by libpq - destroy: Not used since libpq use BIO_NOCLOSE, if it was used it close the socket from underneath libpq - callback_ctrl: Not implemented by socketsThe following methods are defined for our BIO: - read: Used for reading arbitrary length data from the BIO. No change in functionality from the previous implementation. - write: Used for writing arbitrary length data to the BIO. No change in functionality from the previous implementation. - ctrl: Used for processing ctrl messages in the BIO (similar to ioctl). The only ctrl message which matters is BIO_CTRL_FLUSH used for writing out buffered data (or signal EOF and that no more data will be written). BIO_CTRL_FLUSH is mandatory to implement and is implemented as a no-op since there is no intermediate buffer to flush. BIO_CTRL_EOF is the out-of-band method for signalling EOF to read_ex based BIO's. Our BIO is not read_ex based but someone could accidentally call BIO_CTRL_EOF on us so implement mainly for completeness sake.As the implementation is no longer related to BIO_s_socket or callingSSL_set_fd, methods have been renamed to reference the PGconn and Porttypes instead.This also reverts back to using BIO_set_data, with our fallback, as a smalloptimization as BIO_set_app_data require the ex_data mechanism in OpenSSL.Author: David Benjamin <davidben@google.com>Reviewed-by: Andres Freund <andres@anarazel.de>Reviewed-by: Daniel Gustafsson <daniel@yesql.se>Discussion:https://postgr.es/m/CAF8qwaCZ97AZWXtg_y359SpOHe+HdJ+p0poLCpJYSUxL-8Eo8A@mail.gmail.com1 parent4e1fad3 commit6f782a2
File tree
4 files changed
+122
-86
lines changed- src
- backend/libpq
- include/libpq
- interfaces/libpq
4 files changed
+122
-86
lines changedLines changed: 62 additions & 45 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
57 | 57 |
| |
58 | 58 |
| |
59 | 59 |
| |
60 |
| - | |
61 |
| - | |
62 |
| - | |
63 |
| - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
64 | 64 |
| |
65 | 65 |
| |
66 | 66 |
| |
| |||
453 | 453 |
| |
454 | 454 |
| |
455 | 455 |
| |
456 |
| - | |
| 456 | + | |
457 | 457 |
| |
458 | 458 |
| |
459 | 459 |
| |
| |||
890 | 890 |
| |
891 | 891 |
| |
892 | 892 |
| |
893 |
| - | |
| 893 | + | |
894 | 894 |
| |
895 | 895 |
| |
896 |
| - | |
| 896 | + | |
897 | 897 |
| |
898 | 898 |
| |
| 899 | + | |
899 | 900 |
| |
900 | 901 |
| |
901 | 902 |
| |
902 |
| - | |
| 903 | + | |
903 | 904 |
| |
| 905 | + | |
904 | 906 |
| |
905 | 907 |
| |
906 | 908 |
| |
| |||
915 | 917 |
| |
916 | 918 |
| |
917 | 919 |
| |
918 |
| - | |
| 920 | + | |
919 | 921 |
| |
920 | 922 |
| |
921 | 923 |
| |
922 |
| - | |
| 924 | + | |
923 | 925 |
| |
924 | 926 |
| |
925 | 927 |
| |
| |||
933 | 935 |
| |
934 | 936 |
| |
935 | 937 |
| |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
936 | 968 |
| |
937 |
| - | |
| 969 | + | |
938 | 970 |
| |
939 |
| - | |
| 971 | + | |
940 | 972 |
| |
941 |
| - | |
942 | 973 |
| |
943 | 974 |
| |
944 | 975 |
| |
945 | 976 |
| |
946 | 977 |
| |
947 |
| - | |
948 |
| - | |
949 |
| - | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
950 | 981 |
| |
951 |
| - | |
952 |
| - | |
953 |
| - | |
954 |
| - | |
955 |
| - | |
956 |
| - | |
957 |
| - | |
958 |
| - | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
959 | 985 |
| |
960 |
| - | |
961 |
| - | |
| 986 | + | |
| 987 | + | |
962 | 988 |
| |
963 | 989 |
| |
964 | 990 |
| |
965 |
| - | |
| 991 | + | |
966 | 992 |
| |
967 | 993 |
| |
968 |
| - | |
969 | 994 |
| |
970 |
| - | |
| 995 | + | |
971 | 996 |
| |
972 |
| - | |
973 | 997 |
| |
974 | 998 |
| |
975 | 999 |
| |
976 |
| - | |
| 1000 | + | |
977 | 1001 |
| |
978 |
| - | |
979 |
| - | |
980 |
| - | |
981 |
| - | |
982 |
| - | |
| 1002 | + | |
983 | 1003 |
| |
| 1004 | + | |
984 | 1005 |
| |
985 |
| - | |
986 |
| - | |
987 |
| - | |
988 |
| - | |
989 |
| - | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
990 | 1010 |
| |
991 |
| - | |
992 | 1011 |
| |
993 |
| - | |
994 |
| - | |
995 |
| - | |
| 1012 | + | |
996 | 1013 |
| |
997 | 1014 |
| |
998 | 1015 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
204 | 204 |
| |
205 | 205 |
| |
206 | 206 |
| |
| 207 | + | |
207 | 208 |
| |
208 | 209 |
| |
209 | 210 |
| |
|
Lines changed: 58 additions & 41 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
77 | 77 |
| |
78 | 78 |
| |
79 | 79 |
| |
80 |
| - | |
81 |
| - | |
82 |
| - | |
83 |
| - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
84 | 84 |
| |
85 | 85 |
| |
86 | 86 |
| |
| |||
989 | 989 |
| |
990 | 990 |
| |
991 | 991 |
| |
992 |
| - | |
| 992 | + | |
993 | 993 |
| |
994 | 994 |
| |
995 | 995 |
| |
| |||
1670 | 1670 |
| |
1671 | 1671 |
| |
1672 | 1672 |
| |
1673 |
| - | |
| 1673 | + | |
1674 | 1674 |
| |
1675 | 1675 |
| |
1676 |
| - | |
| 1676 | + | |
1677 | 1677 |
| |
1678 |
| - | |
| 1678 | + | |
1679 | 1679 |
| |
1680 | 1680 |
| |
1681 | 1681 |
| |
1682 | 1682 |
| |
| 1683 | + | |
1683 | 1684 |
| |
1684 | 1685 |
| |
1685 | 1686 |
| |
| |||
1707 | 1708 |
| |
1708 | 1709 |
| |
1709 | 1710 |
| |
1710 |
| - | |
| 1711 | + | |
1711 | 1712 |
| |
1712 | 1713 |
| |
1713 | 1714 |
| |
1714 |
| - | |
| 1715 | + | |
1715 | 1716 |
| |
1716 | 1717 |
| |
1717 | 1718 |
| |
| |||
1736 | 1737 |
| |
1737 | 1738 |
| |
1738 | 1739 |
| |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
1739 | 1770 |
| |
1740 |
| - | |
| 1771 | + | |
1741 | 1772 |
| |
1742 | 1773 |
| |
1743 | 1774 |
| |
1744 | 1775 |
| |
1745 | 1776 |
| |
1746 | 1777 |
| |
1747 |
| - | |
| 1778 | + | |
1748 | 1779 |
| |
1749 |
| - | |
| 1780 | + | |
1750 | 1781 |
| |
1751 |
| - | |
1752 | 1782 |
| |
1753 | 1783 |
| |
1754 | 1784 |
| |
1755 | 1785 |
| |
1756 | 1786 |
| |
1757 |
| - | |
| 1787 | + | |
1758 | 1788 |
| |
1759 | 1789 |
| |
1760 | 1790 |
| |
| |||
1763 | 1793 |
| |
1764 | 1794 |
| |
1765 | 1795 |
| |
1766 |
| - | |
1767 |
| - | |
1768 |
| - | |
1769 |
| - | |
1770 |
| - | |
1771 |
| - | |
1772 |
| - | |
1773 |
| - | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
1774 | 1799 |
| |
1775 | 1800 |
| |
1776 | 1801 |
| |
1777 | 1802 |
| |
1778 | 1803 |
| |
1779 |
| - | |
| 1804 | + | |
1780 | 1805 |
| |
1781 | 1806 |
| |
1782 | 1807 |
| |
| |||
1787 | 1812 |
| |
1788 | 1813 |
| |
1789 | 1814 |
| |
1790 |
| - | |
1791 | 1815 |
| |
1792 |
| - | |
| 1816 | + | |
1793 | 1817 |
| |
1794 |
| - | |
1795 | 1818 |
| |
1796 | 1819 |
| |
1797 | 1820 |
| |
1798 |
| - | |
| 1821 | + | |
1799 | 1822 |
| |
1800 |
| - | |
1801 |
| - | |
1802 |
| - | |
1803 |
| - | |
| 1823 | + | |
| 1824 | + | |
1804 | 1825 |
| |
1805 | 1826 |
| |
1806 |
| - | |
1807 |
| - | |
1808 |
| - | |
1809 |
| - | |
1810 |
| - | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
1811 | 1831 |
| |
1812 | 1832 |
| |
1813 |
| - | |
1814 |
| - | |
1815 |
| - | |
1816 |
| - | |
| 1833 | + | |
1817 | 1834 |
| |
1818 | 1835 |
| |
1819 | 1836 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
581 | 581 |
| |
582 | 582 |
| |
583 | 583 |
| |
| 584 | + | |
584 | 585 |
| |
585 | 586 |
| |
586 | 587 |
| |
|
0 commit comments
Comments
(0)