Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XJrQf-0007k4-KK for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Aug 2014 21:58:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XJrQf-0004GB-4N for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Aug 2014 21:58:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XJrQe-0004G3-1k for pgsql-hackers@postgresql.org; Tue, 19 Aug 2014 21:58:56 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XJrQT-0003fT-Gp for pgsql-hackers@postgresql.org; Tue, 19 Aug 2014 21:58:53 +0000 Received: from sc9-mailhost3.vmware.com (sc9-mailhost3.vmware.com [10.113.161.73]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 17DB929AF9; Tue, 19 Aug 2014 14:58:39 -0700 (PDT) Received: from EX13-CAS-013.vmware.com (EX13-CAS-013.vmware.com [10.113.191.65]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 0EAAB41364; Tue, 19 Aug 2014 14:58:39 -0700 (PDT) Received: from EX13-MBX-024.vmware.com (10.113.191.44) by EX13-MBX-008.vmware.com (10.113.191.28) with Microsoft SMTP Server (TLS) id 15.0.775.38; Tue, 19 Aug 2014 14:58:38 -0700 Received: from [192.168.1.90] (10.113.160.246) by EX13-MBX-024.vmware.com (10.113.191.44) with Microsoft SMTP Server (TLS) id 15.0.775.38; Tue, 19 Aug 2014 14:58:26 -0700 Message-ID: <53F3C87E.2080401@vmware.com> Date: Wed, 20 Aug 2014 00:58:22 +0300 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0 MIME-Version: 1.0 To: Robert Haas , Magnus Hagander CC: Tom Lane , PostgreSQL-development Subject: Re: PQgetssl() and alternative SSL implementations References: <53F1E989.8020609@vmware.com> <10419.1408475397@sss.pgh.pa.us> In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.113.160.246] X-ClientProxiedBy: EX13-CAS-013.vmware.com (10.113.191.65) To EX13-MBX-024.vmware.com (10.113.191.44) X-Pg-Spam-Score: -7.6 (-------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 08/19/2014 10:31 PM, Robert Haas wrote: > On Tue, Aug 19, 2014 at 3:16 PM, Magnus Hagander wrote: >> On Tue, Aug 19, 2014 at 9:09 PM, Tom Lane wrote: >>> Magnus Hagander writes: >>>> On Tue, Aug 19, 2014 at 8:49 PM, Robert Haas wrote: >>>>> I have a hard time believing that something like this will really >>>>> satisfy anyone. Why not just add PQgetSchannelHandleOrWhatever() and >>>>> call it good? We can try to be incredibly thorough in exposing the >>>>> information people want and we will still inevitably miss something >>>>> that someone cares about; worse, we'll spend an awful lot of time and >>>>> energy along the way. >>> >>>> Well, for one you push the full burden onto the application. >>> >>> Robert's got a point though: there is always going to be somebody who >>> wants something we fail to expose. It's better to be able to say "well, >>> you can do PQgetssl and then munge it for yourself" than to have to say >>> "sorry, you're screwed". So if we're going to define PQgetssl as >>> returning NULL when you're not using OpenSSL, I don't see why we >>> shouldn't expose a similarly-defined PQgetXXX for each other underlying >>> implementation we support. There will not be that many of 'em, and >>> I suspect the people with very specific needs will not care about more >>> than one underlying library anyway. >>> >>> This does not say that we shouldn't also try to have some >>> library-independent functionality for interrogating certificate state >>> etc. Just that having an escape hatch isn't a bad thing. Yeah, wouldn't hurt I guess. >> I do agree tha thaving both would be useful. We could have something like >> int PQgetSSLstruct(void **sslstruct) > > I think it's likely smarter to have totally separate functions. > First, to make it less likely that users will try to use a pointer to > one type of object as a pointer to some other kind of object. And > second, because you might, for example, someday have an SSL > implementation that wants to return two pointers. May as well make > that kind of thing easy. The struct it returns is totally SSL-implementation specific anyway, so for an implementation that would like to return two structs, you could well define it to return a struct like: struct { CoolStructA *a; CoolStructB *b; } CoolSSLStruct; I don't much like adding a separate function for every SSL implementation, but you've got a point that it would be nice to make it difficult to call PQgetSSLstruct() and just assume that the returned struct is e.g an OpenSSL struct, while it's actually something else. Perhaps: int PQgetSSLstruct(void **sslstruct, char *structname) You'd call it like PQgetSSLStruct(&mystruct, "openssl"), and it checks that the argument matches the library actually been used, otherwise it returns an error. And if you need to return two structs, you'd call it twice: PQgetSSLStruct(&a, "cool_a") and PQgetSSLStruct(&b, "cool_b"). - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers