Re: implement subject alternative names support for SSL connections

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Alexey Klyukin <alexk(at)hintbits(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: implement subject alternative names support for SSL connections
Date: 2014-07-25 19:52:12
Message-ID: 27727.1406317932@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Magnus Hagander <magnus(at)hagander(dot)net> writes:
> On Fri, Jul 25, 2014 at 7:15 PM, Alexey Klyukin <alexk(at)hintbits(dot)com> wrote:
>> On Fri, Jul 25, 2014 at 6:34 PM, Magnus Hagander <magnus(at)hagander(dot)net>
>>> Why keep looping once you've found a match? When you set result=true
>>> you should break; from the loop I think. Not necessarily for
>>> performance, but there might be something about a different extension
>>> we can't parse for example, no need to fail in that case.

>> The for loop header is for (i = 0; i < alt_names_total && !result; i++), so
>> the loop
>> should terminate right when the result becomes true, which happens if the
>> pg_strcasecmp
>> finds a match between the given dNSName and the name supplied by the client.

> oh, ha. So yeah, that was too quick to count as a review - clearly :)

FWIW, I find that type of loop coding to be extremely poor style,
precisely because it's not too readable. A break in the loop body is
*far* more obvious to the reader. (Not to mention that it doesn't
add overhead to the loop on iterations where you can't break.)

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Lars Ewald (web.de) 2014-07-25 19:59:56 Re: Fwd: Re: Compile fails on AIX 6.1
Previous Message Tom Lane 2014-07-25 19:47:37 Performance issue in pg_dump's dependency loop searching