Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wMStY-00072f-0O for pgsql-hackers@arkaria.postgresql.org; Mon, 11 May 2026 15:50:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wMStU-001Vf6-0l for pgsql-hackers@arkaria.postgresql.org; Mon, 11 May 2026 15:50:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from <9erthalion6@gmail.com>) id 1wMStT-001Vey-35 for pgsql-hackers@lists.postgresql.org; Mon, 11 May 2026 15:50:08 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from <9erthalion6@gmail.com>) id 1wMStR-000000004MM-3TO0 for pgsql-hackers@postgresql.org; Mon, 11 May 2026 15:50:07 +0000 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-b9d9971d059so664872766b.2 for ; Mon, 11 May 2026 08:50:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778514605; x=1779119405; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=g1kLB6t7GYKdZWN/FY+S3N3yNC6uqlq30FyBqUIeU3U=; b=Lfwx0I3t4A5nbSLqmRuqaQ8PhtydC18/wPtDL5p9v0HyD8nDtPMioF16Hi63ZN9Enf sTg79iSJGExu9DKJ7A1APGf0dDZg1XcFlpFN+e0FR/JHnkCTdydaYnrnAQ11zLiQNfz5 jWjOhBLArKV4Nkw/e/JHZ6g9QbtEEzjKe3mR8mCeXauUYK8YWfk2DUv7W9AosDttXdBp F91+VtHCk4HfDw++HMWyg1mwS74Z9k9ci/KdkWYQ/GC7o5jIqC88eRQDyhQ+oBql8HS5 BZDLyT8m7j7REBKklEHNZY2LggnJyn5PxD6w/HNoAAh/Lwfjxc3EcTTAlG/WVlt7m6dQ sL1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778514605; x=1779119405; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g1kLB6t7GYKdZWN/FY+S3N3yNC6uqlq30FyBqUIeU3U=; b=YAjtmgtTgaWJrkUYAUheFkSzFsooe7i2r7A/pU4oro1pnbz9siGWp9rY4f9+z0bizG 4azQdsWlzef1mzEwURaQm6vwtcAnkijlgW9dff0x4kEErKcCvAxgfDKoIgfy/gXifw9z GMpgcv6fbuGzPNmogkJwvxuFEmHNx+6DP2IlXHM/xtfLXxPsVhqy9HOoBV1gPumyHBiV 7H7IIMp1IDi3S+WWzK2B1OfQ3DP7q6/UVMS1WqO1aqpzGUrd2+ydH5bmrIS/6vOg1AYz RmE3nQeoXDAhRNQ5Tu9/OXcSymOiIQg2DNXCbk75VdwbZi/Ds8lkzugdcfXxCEqih4HE tmyg== X-Forwarded-Encrypted: i=1; AFNElJ9wKpKJBMLQvLCYNcE0hrV5cWIhMqVuNGuufxOzqdRnYKyg9iYZDaAsmNd71QHJ+pYmz8+Ocl1/b/9T1Z2l@postgresql.org X-Gm-Message-State: AOJu0YwrW2Az4CaMzz0R60t7igPkcs4FEuPwMbO7XxyudldtJcudfVZL +4ZUHGzbqjUH5S3NCIFaOdsX/s0Aj7WFiLCtob7l0idLHxXI3CcKf9WvHWXj+g== X-Gm-Gg: Acq92OFteIjalHd1Ui0OPoZM4u7OmyfO0LL5DIyAORzxiQrfND2ZbbwLSAp5IM1LK/c YBVhcNUZHMhmuA4w1dJNS46a4lKNc5RQHN8X4bYn4C+eUfi/QAG3sbiNamdLNEBUtF2OORz59YX BvP2bahcARS2I1U1aCJuL8JHkNnKZjOYrYlrB1tTWa2XHij0Ytj0ysi1iJ3coOze5JBID0fhIIv JSuJd51SQmi//3cBgoloDOw0wTf6gmM7i7cVN6g89dQc2nrFiIiIFhY1av1IlyzfPZcecZTI9GZ 9RZ8wRSd6yMHa13BUlqDRqHU9u+1og0PBjmxXKAh8X6su0inDQWOBaXddhOErIpkkyjx2F6lCT0 imTv1kAtgo5QY+m7KutqiqPBvOa28X2g1r01Ytyg8EOsC+9mK/sO9RlSYKtC5aTnjmztj8KVVw2 EXeQPB7CRroGpvc0csdbDoJCAgCWorhuqb8rgYydZWuNhz5MyFG06IXpAwwYPEIVW+tVvQZh4pg k0VIuo+6LjMG2LVdb4+44p5c8JnDB45aTkmLUpB X-Received: by 2002:a17:907:d716:b0:bc3:7893:3bb1 with SMTP id a640c23a62f3a-bc56e40f255mr1399847766b.41.1778514604429; Mon, 11 May 2026 08:50:04 -0700 (PDT) Received: from ddolgov-thinkpadt14sgen1.rmtde.csb (dslb-084-056-106-100.084.056.pools.vodafone-ip.de. [84.56.106.100]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-bcac11b7084sm513953266b.28.2026.05.11.08.50.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2026 08:50:03 -0700 (PDT) Date: Mon, 11 May 2026 17:50:01 +0200 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Cary Huang Cc: Jacob Champion , Daniel Gustafsson , PostgreSQL Hackers Subject: Re: Add ssl_(supported|shared)_groups to sslinfo Message-ID: References: <19e0984fc10.339087cd498909.6340608720119447495@highgo.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <19e0984fc10.339087cd498909.6340608720119447495@highgo.ca> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Fri, May 08, 2026 at 02:36:10PM -0700, Cary Huang wrote: > Hi > > Given that sslinfo is designed to expose diagnostic information > about the current TLS connection, I am supportive of extending > its functionality. Thanks for looking into it. > > /* Send the negotiated group first */ > > if (call_cntr == 0) > > { > > nid = SSL_get_negotiated_group(ssl); > > group_type = CStringGetTextDatum("negotiated"); > > } > > /* Then the shared groups */ > > else if (call_cntr < fctx->nshared + 1) > > { > > nid = SSL_get_shared_group(ssl, call_cntr - 1); > > group_type = CStringGetTextDatum("shared"); > > } > > /* And finally the supported groups */ > > else if (call_cntr < fctx->nsupported + fctx->nshared + 1) > > { > > nid = fctx->supported_groups[call_cntr - fctx->nshared - 1]; > > group_type = CStringGetTextDatum("supported"); > > } > > else > > SRF_RETURN_DONE(funcctx); > > > > /* > > * SSL_group_to_name can return NULL in case of an error, e.g. when no > > * such name was registered for some reason. > > */ > > group_name = SSL_group_to_name(ssl, nid); > > if (group_name == NULL) > > ereport(ERROR, > > (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), > > errmsg("unknown OpenSSL group at position %d", > > call_cntr))); > > It is possible that SSL_get_negotiated_group() and > SSL_get_shared_group() would return NID_undef when there is no > negotiated group. The current code will pass that to > SSL_group_to_name() and raise an error if it returns NULL. > > Instead of failing the whole function, would it be better to > just omit that row since the function returns a SETOF record? > > if nid == NID_undef, we could just omit the row instead of > making a call to SSL_group_to_name(), which most likely will > fail. It makes sense to me in general, but it looks there are some arguments against this: * ssl_extension_info function is also an SRF and returns an error if faced NID_undef. It's probably a good idea to be concistent with the existing functionality. * From what I see SRF API doesn't allow to "skip" a record, available options are either to finish the set with SRF_RETURN_DONE, or to return a NULL record with SRF_RETURN_NEXT_NULL. That means that when facing NID_undef, we can stop altogether and skip all the records after this, or have a NULL record in the output, both don't sound fitting the purpose here. With this in mind I'm inclined to leave it as it is, but open for suggestions.