Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aj9QA-0001W3-08 for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Mar 2016 17:51:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1aj9Q9-0003ZO-CL for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Mar 2016 17:51:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1aj9Q8-0003Yr-M3; Thu, 24 Mar 2016 17:51:44 +0000 Received: from smtp-auth.no-ip.com ([8.23.224.61] helo=out.smtp-auth.no-ip.com) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1aj9Q0-00032I-AT; Thu, 24 Mar 2016 17:51:44 +0000 X-No-IP: alvh.no-ip.org@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from alvin.alvh.no-ip.org (unknown [181.42.19.17]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id 13B6B400EFA; Thu, 24 Mar 2016 10:51:32 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 2C7C55C4; Thu, 24 Mar 2016 14:51:29 -0300 (CLT) Date: Thu, 24 Mar 2016 14:51:29 -0300 From: Alvaro Herrera To: Christian Ullrich Cc: pgsql-bugs@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: Re: [HACKERS] BUG #13854: SSPI authentication failure: wrong realm name used Message-ID: <20160324175129.GA677208@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <56EEC584.1080702@chrullrich.net> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -1.1 (-) 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 Christian Ullrich wrote: > * Christian Ullrich wrote: > > >* From: Magnus Hagander [mailto:magnus@hagander.net] > >>Code uses a mix of malloc() and palloc() (through sprintf). Is there a > >>reason for that? > > > >I wasn't sure which to prefer, so I looked around in auth.c, and other than > >RADIUS, everything seems to use malloc() (although the sample size is not > >too great). Should I use palloc() instead? > > The single instance of malloc() has been replaced with palloc(). I'm wary of palloc() in this code actually ... if the allocation fails, I'm not sure it's okay to use ereport(ERROR) which is what would happen with palloc. With the malloc code, you report the problem with elog(LOG) and then return STATUS_ERROR which lets the calling code handle the failure in a different way. I didn't actually review your new code, but I recall this from previous readings of auth code; so if you're going to use palloc(), you better audit what happens on OOM. For the same reason, using psprintf is probably not acceptable either. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs