diff options
author | Calle Dybedahl <calle@init.se> | 2015-03-20 20:33:18 +0100 |
---|---|---|
committer | Calle Dybedahl <calle@init.se> | 2015-03-20 20:33:18 +0100 |
commit | 77223a21c47dffe669b192634b2c00ceb3641a23 (patch) | |
tree | d91777de098e5defd242ae628e96db21df2af3fd /src | |
parent | ac5100c8cd834e64a8babd7f98353486583b6b61 (diff) |
Minor IDN fixes.
Diffstat (limited to 'src')
-rw-r--r-- | src/LDNS.xs | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/LDNS.xs b/src/LDNS.xs index 110285e..c3cef69 100644 --- a/src/LDNS.xs +++ b/src/LDNS.xs @@ -16,18 +16,21 @@ to_idn(...) int status; SV *obj = ST(i); - status = idna_to_ascii_8z(SvPV_nolen(obj), &out, IDNA_ALLOW_UNASSIGNED); - if (status == IDNA_SUCCESS) + if (SvPOK(ST(i))) { - SV *new = newSVpv(out,0); - SvUTF8_on(new); /* We know the string is plain ASCII, so let Perl know too */ - mXPUSHs(new); + status = idna_to_ascii_8z(SvPVutf8_nolen(obj), &out, IDNA_ALLOW_UNASSIGNED); + if (status == IDNA_SUCCESS) + { + SV *new = newSVpv(out,0); + SvUTF8_on(new); /* We know the string is plain ASCII, so let Perl know too */ + mXPUSHs(new); + free(out); + } + else + { + croak("Error: %s\n", idna_strerror(status)); + } } - else - { - croak("Error: %s\n", idna_strerror(status)); - } - free(out); } #else croak("libidn not installed"); @@ -2084,6 +2087,7 @@ rr_nsec3_covers(obj,name) ldns_rr2canonical(clone); hashed = ldns_nsec3_hash_name_frm_nsec3(clone, dname); chopped = ldns_dname_left_chop(dname); + ldns_rdf_deep_free(dname); ldns_dname_cat(hashed,chopped); RETVAL = ldns_nsec_covers_name(clone,hashed); ldns_rdf_deep_free(hashed); |