@@ -4,6 +4,7 @@ class PostgresqlAT11 < Formula
4
4
url "https://ftp.postgresql.org/pub/source/v11.22/postgresql-11.22.tar.bz2"
5
5
sha256 "2cb7c97d7a0d7278851bbc9c61f467b69c094c72b81740b751108e7892ebe1f0"
6
6
license "PostgreSQL"
7
+ revision 1
7
8
8
9
bottle do
9
10
sha256 arm64_sonoma : "3a8e0f24e7e667923d8a7621dd7739b2124b49e85a1e287b4751ba9b046bc5ab"
@@ -36,6 +37,10 @@ class PostgresqlAT11 < Formula
36
37
depends_on "util-linux"
37
38
end
38
39
40
+ # Fix compatibility with OpenSSL 3.2
41
+ # Ref https://www.postgresql.org/message-id/CX9SU44GH3P4.17X6ZZUJ5D40N%40neon.tech
42
+ patch :DATA
43
+
39
44
def install
40
45
ENV . prepend "LDFLAGS" , "-L#{ Formula [ "openssl@3" ] . opt_lib } -L#{ Formula [ "readline" ] . opt_lib } "
41
46
ENV . prepend "CPPFLAGS" , "-I#{ Formula [ "openssl@3" ] . opt_include } -I#{ Formula [ "readline" ] . opt_include } "
@@ -133,3 +138,91 @@ def caveats
133
138
assert_equal opt_lib . to_s , shell_output ( "#{ bin } /pg_config --pkglibdir" ) . chomp
134
139
end
135
140
end
141
+
142
+ __END__
143
+ diff --git a/src/backend/libpq/be-secure-openssl.c b/src/backend/libpq/be-secure-openssl.c
144
+ index e307bfea82..255f5d61b7 100644
145
+ --- a/src/backend/libpq/be-secure-openssl.c
146
+ +++ b/src/backend/libpq/be-secure-openssl.c
147
+ @@ -663,11 +663,6 @@ be_tls_write(Port *port, void *ptr, size_t len, int *waitfor)
148
+ * to retry; do we need to adopt their logic for that?
149
+ */
150
+
151
+ -#ifndef HAVE_BIO_GET_DATA
152
+ -#define BIO_get_data(bio) (bio->ptr)
153
+ -#define BIO_set_data(bio, data) (bio->ptr = data)
154
+ -#endif
155
+ -
156
+ static BIO_METHOD *my_bio_methods = NULL;
157
+
158
+ static int
159
+ @@ -677,7 +672,7 @@ my_sock_read(BIO *h, char *buf, int size)
160
+
161
+ if (buf != NULL)
162
+ {
163
+ - res = secure_raw_read(((Port *) BIO_get_data(h)), buf, size);
164
+ + res = secure_raw_read(((Port *) BIO_get_app_data(h)), buf, size);
165
+ BIO_clear_retry_flags(h);
166
+ if (res <= 0)
167
+ {
168
+ @@ -697,7 +692,7 @@ my_sock_write(BIO *h, const char *buf, int size)
169
+ {
170
+ int res = 0;
171
+
172
+ - res = secure_raw_write(((Port *) BIO_get_data(h)), buf, size);
173
+ + res = secure_raw_write(((Port *) BIO_get_app_data(h)), buf, size);
174
+ BIO_clear_retry_flags(h);
175
+ if (res <= 0)
176
+ {
177
+ @@ -773,7 +768,7 @@ my_SSL_set_fd(Port *port, int fd)
178
+ SSLerr(SSL_F_SSL_SET_FD, ERR_R_BUF_LIB);
179
+ goto err;
180
+ }
181
+ - BIO_set_data(bio, port);
182
+ + BIO_set_app_data(bio, port);
183
+
184
+ BIO_set_fd(bio, fd, BIO_NOCLOSE);
185
+ SSL_set_bio(port->ssl, bio, bio);
186
+ diff --git a/src/interfaces/libpq/fe-secure-openssl.c b/src/interfaces/libpq/fe-secure-openssl.c
187
+ index 55e231e849..bf091c0ec5 100644
188
+ --- a/src/interfaces/libpq/fe-secure-openssl.c
189
+ +++ b/src/interfaces/libpq/fe-secure-openssl.c
190
+ @@ -1491,11 +1491,6 @@ PQsslAttribute(PGconn *conn, const char *attribute_name)
191
+ * to retry; do we need to adopt their logic for that?
192
+ */
193
+
194
+ -#ifndef HAVE_BIO_GET_DATA
195
+ -#define BIO_get_data(bio) (bio->ptr)
196
+ -#define BIO_set_data(bio, data) (bio->ptr = data)
197
+ -#endif
198
+ -
199
+ static BIO_METHOD *my_bio_methods;
200
+
201
+ static int
202
+ @@ -1503,7 +1498,7 @@ my_sock_read(BIO *h, char *buf, int size)
203
+ {
204
+ int res;
205
+
206
+ - res = pqsecure_raw_read((PGconn *) BIO_get_data(h), buf, size);
207
+ + res = pqsecure_raw_read((PGconn *) BIO_get_app_data(h), buf, size);
208
+ BIO_clear_retry_flags(h);
209
+ if (res < 0)
210
+ {
211
+ @@ -1533,7 +1528,7 @@ my_sock_write(BIO *h, const char *buf, int size)
212
+ {
213
+ int res;
214
+
215
+ - res = pqsecure_raw_write((PGconn *) BIO_get_data(h), buf, size);
216
+ + res = pqsecure_raw_write((PGconn *) BIO_get_app_data(h), buf, size);
217
+ BIO_clear_retry_flags(h);
218
+ if (res <= 0)
219
+ {
220
+ @@ -1624,7 +1619,7 @@ my_SSL_set_fd(PGconn *conn, int fd)
221
+ SSLerr(SSL_F_SSL_SET_FD, ERR_R_BUF_LIB);
222
+ goto err;
223
+ }
224
+ - BIO_set_data(bio, conn);
225
+ + BIO_set_app_data(bio, conn);
226
+
227
+ SSL_set_bio(conn->ssl, bio, bio);
228
+ BIO_set_fd(bio, fd, BIO_NOCLOSE);
0 commit comments