Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8fb5936

Browse files
committed
Make the memory layout of Port struct independent of USE_OPENSSL
Commit d39a49c added new fields to the struct, but missed the "keep these last" comment on the previous fields. Add placeholder variables so that the offsets of the fields are the same whether you build with USE_OPENSSL or not. This is a courtesy to extensions that might peek at the fields, to make the ABI the same regardless of the options used to build PostgreSQL. In reality, I don't expect any extensions to look at the 'raw_buf' fields. Firstly, they are new in v17, so no one's written such extensions yet. Secondly, extensions should have no business poking at those fields anyway. Nevertheless, fix this properly on 'master'. On v17, we mustn't change the memory layout, so just fix the comments. Author: Jacob Champion Discussion: https://www.postgresql.org/message-id/raw/CAOYmi%2BmKVJNzn5_TD_MK%3DhqO64r_w8Gb0FHCLk0oAkW-PJv8jQ@mail.gmail.com
1 parent ee937f0 commit 8fb5936

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/include/libpq/libpq-be.h

+7-2
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,17 @@ typedef struct Port
207207
bool last_read_was_eof;
208208

209209
/*
210-
* OpenSSL structures. (Keep these last so that the locations of other
211-
* fields are the same whether or not you build with SSL enabled.)
210+
* OpenSSL structures. As with GSSAPI above, to keep struct offsets
211+
* constant, NULL pointers are stored when SSL support is not enabled.
212+
* (Although extensions should have no business accessing the raw_buf
213+
* fields anyway.)
212214
*/
213215
#ifdef USE_OPENSSL
214216
SSL *ssl;
215217
X509 *peer;
218+
#else
219+
void *ssl;
220+
void *peer;
216221
#endif
217222

218223
/*

0 commit comments

Comments
 (0)