pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Christian Ullrich <chris@chrullrich.net>
Cc: pgsql-bugs@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: Re: [HACKERS] BUG #13854: SSPI authentication failure: wrong realm name used
Date: Thu, 24 Mar 2016 14:51:29 -0300
Message-ID: <20160324175129.GA677208@alvherre.pgsql> (raw)
In-Reply-To: <56EEC584.1080702@chrullrich.net>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

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



view thread (31+ messages)  latest in thread

Message-ID: <20160324175129.GA677208@alvherre.pgsql>
Permalink:  ../20160324175129.GA677208@alvherre.pgsql/
Also on:    postgresql.org/message-id/20160324175129.GA677208@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: alvherre@2ndquadrant.com, chris@chrullrich.net, pgsql-hackers@postgresql.org
  Subject: Re: [HACKERS] BUG #13854: SSPI authentication failure: wrong realm name used
  In-Reply-To: <20160324175129.GA677208@alvherre.pgsql>
  References: <56EEC584.1080702@chrullrich.net> <20160324175129.GA677208@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox