Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1al1ZH-0003aC-18 for pgsql-bugs@arkaria.postgresql.org; Tue, 29 Mar 2016 21:52:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1al1ZG-0006Wi-4L for pgsql-bugs@arkaria.postgresql.org; Tue, 29 Mar 2016 21:52:54 +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_2) (envelope-from ) id 1al1Yc-00059x-H2; Tue, 29 Mar 2016 21:52:14 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1al1YZ-0004vt-TV; Tue, 29 Mar 2016 21:52:13 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u2TLq5Pb030298; Tue, 29 Mar 2016 17:52:06 -0400 From: Tom Lane To: Alvaro Herrera cc: Christian Ullrich , Magnus Hagander , "pgsql-bugs@postgresql.org" , "pgsql-hackers@postgresql.org" Subject: Re: Re: [HACKERS] BUG #13854: SSPI authentication failure: wrong realm name used In-reply-to: <20160329214032.GA925857@alvherre.pgsql> References: <20160329214032.GA925857@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Tue, 29 Mar 2016 18:40:32 -0300" Date: Tue, 29 Mar 2016 17:52:05 -0400 Message-ID: <30297.1459288325@sss.pgh.pa.us> X-Pg-Spam-Score: -2.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 Alvaro Herrera writes: > So, it seems that ClientAuthentication() expects to raise ereport(FATAL) > in case of authentication failures. But what's the code path that > causes that to happen if a ereport(ERROR) happens in there? Because all > that code is pretty careful to not do ereport(ERROR) directly and > instead return STATUS_ERROR which makes ClientAuthentication do the > FATAL report. If this doesn't matter, then isn't this whole code overly > complicated for no reason? The reason why elog(ERROR) will become a FATAL is that no outer setjmp has been executed yet, so elog.c will realize it has noplace to longjmp to. Whether it's overcomplicated I dunno. I think the idea behind returning STATUS_ERROR is to allow a centralized reporting site to decorate the errors with additional info, as indeed auth_fail does. Certainly that could be done another way (errcontext?), but that's the way we've got. Anyway, as things stand, elog(ERROR) will abort the session safely but you won't necessarily get the kind of logging you want, so expected auth-failure cases should try to go the STATUS_ERROR route. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs