[Pdns-users] PostgreSQL schema for DNSSEC signing

ktm at rice.edu ktm at rice.edu
Fri Jan 10 14:54:16 UTC 2014


On Fri, Jan 10, 2014 at 11:42:18AM +0100, Peter van Dijk wrote:
> Hello Ken,
> 
> replying to both messages in-line.
> 
> On 09 Jan 2014, at 23:47 , ktm at rice.edu wrote:
> 
> > On Thu, Jan 09, 2014 at 10:26:07AM -0600, ktm at rice.edu wrote:
> >>  WHILE lpos <= LENGTH(dnsname) LOOP
> >>    rpos := INSTR(dnsname, '.', lpos);
> 
> rpos is set here, did you miss that?
> 
> > Okay, using the assumption that the code has a bug, here is the PostgreSQL
> > version:
> > 
> > ------------------------------------------------
> > test=> select dnsname_to_raw('moe.rice.edu');
> >         dnsname_to_raw         
> > --------------------------------
> > \x036d6f6504726963650365647500
> > (1 row)
> > 
> > This seems like it should be the correct result, but I would appreciate
> > it if someone who knew would corroborate this. Thank you.
> 
> Above result is correct.
> 
> However:
> This should be identical to above (only one trailing 00):
> vagrant=> select dnsname_to_raw('moe.rice.edu.');
>           dnsname_to_raw          
> ----------------------------------
>  \x036d6f650472696365036564750000
> (1 row)
> 
> This should perhaps be an error (but don’t worry too much, garbage in ..):
> vagrant=> select dnsname_to_raw('moe.rice.edu..');
>            dnsname_to_raw           
> ------------------------------------
>  \x036d6f65047269636503656475000000
> (1 row)
> 
> 
> This may cause trouble at some point (I would expect \x00):
> vagrant=> select dnsname_to_raw('');
> ERROR:  upper bound of FOR loop cannot be null
> CONTEXT:  PL/pgSQL function "dnsname_to_raw" line 28 at FOR with integer loop variable
> 
> And this should certainly be \x00:
> vagrant=> select dnsname_to_raw('.');
>  dnsname_to_raw 
> ----------------
>  \x000000
> (1 row)
> 
> 
> Interesting work! I hope this helps :)
> 
> Kind regards,
> -- 
> Peter van Dijk
> Netherlabs Computer Consulting BV - http://www.netherlabs.nl/
> 

Hi Peter,

Thank you for the test cases. I have updated my function to fix these
discrepancies.

Regards,
Ken




More information about the Pdns-users mailing list