Re: Re: [HACKERS] BUG #13854: SSPI authentication failure: wrong realm name used

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Christian Ullrich <chris(at)chrullrich(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [HACKERS] BUG #13854: SSPI authentication failure: wrong realm name used
Date: 2016-03-24 17:51:29
Message-ID: 20160324175129.GA677208@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Christian Ullrich wrote:
> * Christian Ullrich wrote:
>
> >* From: Magnus Hagander [mailto:magnus(at)hagander(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Geoghegan 2016-03-24 19:10:42 Re: Re: Missing rows with index scan when collation is not "C" (PostgreSQL 9.5)
Previous Message Robbie Harwood 2016-03-24 17:12:43 Re: BUG #13854: SSPI authentication failure: wrong realm name used

Browse pgsql-hackers by date

  From Date Subject
Next Message Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?= 2016-03-24 18:11:39 Re: Alter or rename enum value
Previous Message Teodor Sigaev 2016-03-24 17:45:40 Re: [PATCH] we have added support for box type in SP-GiST index