[ldns-users] fixing pyldns signzone example

Karel Slany karel.slany at nic.cz
Tue Jul 10 15:34:12 UTC 2012


Hello,

I'm working with pyldns again and I've discovered several issues all
addressing the ldns-signzone.py example.

Description of the issues:

The behaviour of the ldns_rr_new_frm_fp_l_() wrapper function has been
modified. The modification caused Python code errors in the
ldns_struct_rr.new_frm_fp* functions. To preserve the functionality of
ldns_struct_rr.new_frm_fp (according to it's docstring) I've introduced
a new wrapper function ldns_rr_new_frm_fp_().

The ldns_dnssec_zone.add_rr() function caused memory corruption issues
-- double frees or accessing of recently freed memory. The Python engine
freed the inserted RR after the reference counter had reached zero.
Because the ldns_dnssec_zone_add_rr does not create a copy of the given
RR so there is a chance of segmentation faults when using this function
directly from Python code. Therefore I've added the
ldns_dnssec_zone_add_rr_() wrapper function which creates a copy of the
inserted RR into the zone.

I've also fixed the pyldns Makefile testenv target entry which used
wrong relative path to _ldns.so.

The patch also introduces a new Python3 example file to the SVN
repository so please don't forget to set the script executable and to
'svn add' it.

chmod +x trunk/contrib/python/examples/python3/ldns-signzone.py
svn add trunk/contrib/python/examples/python3/ldns-signzone.py

I've tested the patch using Python 2.7 and 3.2. As far as I'm concerned,
the patch does not break any current code.

Best regards,
K.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: signzone_example_fix.diff
URL: <http://lists.nlnetlabs.nl/pipermail/ldns-users/attachments/20120710/5f10f791/attachment.ksh>


More information about the ldns-users mailing list