From 93b91d1d639a070a5a900d2cc4a20a7bdd0b2abc Mon Sep 17 00:00:00 2001 From: Roshan Kanwar Date: Wed, 18 Dec 2024 17:05:43 +0530 Subject: [PATCH] Add TDS-specific SSL handshake handling (#3261) This commit adds the TdsSSLHandshake function to handle SSL handshakes specifically for TDS connections. The ProtocolExtensionConfig structure has been updated with a new fn_ssl_handshake function pointer, allowing protocol-specific SSL handling. This change ensures that TDS connections bypass the standard SSL handshake by returning STATUS_OK without invoking ProcessSSLStartup. Task: BABEL-5342 Signed-off-by: Roshan Kanwar --- contrib/babelfishpg_tds/src/backend/tds/tds_srv.c | 3 ++- contrib/babelfishpg_tds/src/backend/tds/tdsprinttup.c | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/contrib/babelfishpg_tds/src/backend/tds/tds_srv.c b/contrib/babelfishpg_tds/src/backend/tds/tds_srv.c index fd3083c61d..b05d1a1f33 100644 --- a/contrib/babelfishpg_tds/src/backend/tds/tds_srv.c +++ b/contrib/babelfishpg_tds/src/backend/tds/tds_srv.c @@ -87,7 +87,8 @@ static ProtocolExtensionConfig pe_config = { TdsShutdown, TdsDestroy, pe_process_command, - pe_report_param_status + pe_report_param_status, + TdsDirectSSLHandshake }; /* diff --git a/contrib/babelfishpg_tds/src/backend/tds/tdsprinttup.c b/contrib/babelfishpg_tds/src/backend/tds/tdsprinttup.c index bc1b9251cb..00f0960d41 100644 --- a/contrib/babelfishpg_tds/src/backend/tds/tdsprinttup.c +++ b/contrib/babelfishpg_tds/src/backend/tds/tdsprinttup.c @@ -122,3 +122,10 @@ TdsDestroy(DestReceiver *self) { pfree(self); } + +static int +TdsDirectSSLHandshake(struct Port *port) +{ + /* Always return STATUS_OK for TDS connections */ + return STATUS_OK; +}