Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aWXXX-0002bO-M6 for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Feb 2016 22:59:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aWXXX-0000UK-8l for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Feb 2016 22:59:15 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aWXWu-0008EF-Lv for pgsql-bugs@postgresql.org; Thu, 18 Feb 2016 22:58:36 +0000 Received: from placid2.grammatech.com ([98.159.213.247] helo=placid.grammatech.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aWXWs-00017I-9d for pgsql-bugs@postgresql.org; Thu, 18 Feb 2016 22:58:35 +0000 Received: from placid.grammatech.com (unknown [192.168.219.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by placid.grammatech.com (Postfix) with ESMTPS id 6C3C6B20AA; Thu, 18 Feb 2016 17:58:33 -0500 (EST) Received: from [10.233.219.191] (barracuda.grammatech.com [192.168.219.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by placid.grammatech.com (Postfix) with ESMTPSA id 5E064B20A9; Thu, 18 Feb 2016 17:58:33 -0500 (EST) Subject: Re: BUG #12799: libpq - SSL pqsecure_read() doesn't clean openssl error queue before reading To: Tom Lane References: <20150224030956.2529.83279@wrigleys.postgresql.org> <54EDD30D.5050107@vmware.com> <319431910.43023.1425002429817.JavaMail.zimbra@4linux.com.br> <54F37769.3090406@iki.fi> <56C64197.6060408@grammatech.com> <56C646AF.5010805@grammatech.com> <28955.1455835117@sss.pgh.pa.us> Cc: Peter Geoghegan , pgsql-bugs From: Dave Vitek Message-ID: <56C64C98.2010502@grammatech.com> Date: Thu, 18 Feb 2016 17:58:32 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <28955.1455835117@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 2/18/2016 5:38 PM, Tom Lane wrote: > Dave Vitek writes: >> Maintainers: Peter's patch is better than mine, at least for the front >> end side. I also adjusted be-secure-openssl.c, which perhaps is not >> necessary, but then again it's hard to be sure. It might be worth doing >> a patch for be-secure-openssl.c in the spirit of what Peter did for the >> frontend (sorry, not volunteering :). > +1 for changing both sides. I'm fairly sure that you could provoke > problems of this ilk in the backend too, for example if client connection > is using SSL and we also establish an outgoing SSL connection using > postgres_fdw or dblink. > > BTW, do we have a reproducible test case? > > regards, tom lane I can reproduce it, but I don't have a self contained unit test. Such a test case might look like: call ERR_put_error with SSL_ERROR_SSL and then cause libpq to invoke SSL_read. SSL_get_error after the read will probably return SSL_ERROR_SSL even if the read goes fine, causing postgres to conclude things have failed. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs