Hi, I discovered some dead code in libpq. The proposed patch removes it.
-- Best regards, Aleksander Alekseev
From a51600389608f99698a8b4bedff581a34dd3ae65 Mon Sep 17 00:00:00 2001 From: Aleksander Alekseev <[email protected]> Date: Wed, 5 Aug 2026 14:52:37 +0300 Subject: [PATCH v1] libpq: remove unused scram_client_key_len and scram_server_key_len fields pqConnectOptions2() assigned these two PGconn fields, but nothing ever read them, so they have been write-only since they were introduced. The assignments were redundant in any case: both are reached only after the length has been verified to be equal to SCRAM_MAX_KEY_LEN, and the consumers of scram_client_key_binary and scram_server_key_binary in fe-auth-scram.c use that constant directly. Oversight in 761c79508e7. Author: Aleksander Alekseev <[email protected]> Reviewed-by: TODO FIXME Discussion: TODO FIXME --- src/interfaces/libpq/fe-connect.c | 2 -- src/interfaces/libpq/libpq-int.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 17c2288e9bc..ee398f13998 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -2059,7 +2059,6 @@ pqConnectOptions2(PGconn *conn) libpq_append_conn_error(conn, "invalid SCRAM client key length: %d", len); return false; } - conn->scram_client_key_len = len; } if (conn->scram_server_key) @@ -2082,7 +2081,6 @@ pqConnectOptions2(PGconn *conn) libpq_append_conn_error(conn, "invalid SCRAM server key length: %d", len); return false; } - conn->scram_server_key_len = len; } /* diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h index 3f921207a14..8a729b1e748 100644 --- a/src/interfaces/libpq/libpq-int.h +++ b/src/interfaces/libpq/libpq-int.h @@ -544,9 +544,7 @@ struct pg_conn AddrInfo *addr; /* the array of addresses for the currently * tried host */ bool send_appname; /* okay to send application_name? */ - size_t scram_client_key_len; uint8 *scram_client_key_binary; /* binary SCRAM client key */ - size_t scram_server_key_len; uint8 *scram_server_key_binary; /* binary SCRAM server key */ ProtocolVersion min_pversion; /* protocol version to request */ ProtocolVersion max_pversion; /* protocol version to request */ -- 2.43.0
