Refactor OpenSSL initialization and certificate date adjustment for improved clarity and consistency

m3hm3t/pg18_rel_oid_2
Mehmet Yilmaz 2025-05-16 13:14:19 +00:00
parent a70baadecb
commit 3e401a75dc
2 changed files with 22 additions and 18 deletions

View File

@ -2970,11 +2970,11 @@ DeleteNodeRow(char *nodeName, int32 nodePort)
/* PG 18+ adds a bool “deferrable_ok” parameter */ /* PG 18+ adds a bool “deferrable_ok” parameter */
Relation replicaIndex = Relation replicaIndex =
index_open(RelationGetPrimaryKeyIndex(pgDistNode, false), index_open(RelationGetPrimaryKeyIndex(pgDistNode, false),
RowExclusiveLock); AccessShareLock);
#else #else
Relation replicaIndex = Relation replicaIndex =
index_open(RelationGetPrimaryKeyIndex(pgDistNode), index_open(RelationGetPrimaryKeyIndex(pgDistNode),
RowExclusiveLock); AccessShareLock);
#endif #endif

View File

@ -246,9 +246,11 @@ CreateCertificatesWhenNeeded()
* its configuration with ssl enabled. * its configuration with ssl enabled.
*/ */
#if OPENSSL_VERSION_NUMBER >= 0x10100000L #if OPENSSL_VERSION_NUMBER >= 0x10100000L
/* OpenSSL 1.1.0+ */ /* OpenSSL 1.1.0+ */
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_CONFIG, NULL); OPENSSL_init_ssl(OPENSSL_INIT_LOAD_CONFIG, NULL);
#else #else
/* OpenSSL < 1.1.0 */ /* OpenSSL < 1.1.0 */
SSL_library_init(); SSL_library_init();
#endif #endif
@ -383,13 +385,15 @@ CreateCertificate(EVP_PKEY *privateKey)
* expiration date and then suddenly erroring out. * expiration date and then suddenly erroring out.
*/ */
#if OPENSSL_VERSION_NUMBER >= 0x10100000L #if OPENSSL_VERSION_NUMBER >= 0x10100000L
/* OpenSSL 1.1.0+ */ /* OpenSSL 1.1.0+ */
X509_gmtime_adj(X509_getm_notBefore(certificate), 0); X509_gmtime_adj(X509_getm_notBefore(certificate), 0);
X509_gmtime_adj(X509_getm_notAfter (certificate), 0); X509_gmtime_adj(X509_getm_notAfter(certificate), 0);
#else #else
/* OpenSSL < 1.1.0 */ /* OpenSSL < 1.1.0 */
X509_gmtime_adj(X509_get_notBefore(certificate), 0); X509_gmtime_adj(X509_get_notBefore(certificate), 0);
X509_gmtime_adj(X509_get_notAfter (certificate), 0); X509_gmtime_adj(X509_get_notAfter(certificate), 0);
#endif #endif
/* Set the public key for our certificate */ /* Set the public key for our certificate */