https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6872

--- Comment #2 from Mark Martinec <[email protected]> ---
Created attachment 5115
  --> https://issues.apache.org/SpamAssassin/attachment.cgi?id=5115&action=edit
a fix to sa-update, and some other DNS-related tidbits

trunk:

r1418317 | mmartinec | 2012-12-07 15:04:22 +0100 (Fri, 07 Dec 2012)

- Net::DNS 0.69 $rr->rdatastr no longer quotes returned TXT
  ([rt.cpan.org #81760])
- some other DNS-related cosmetics
- more RR types in AskDNS.pm



Copied from a mailing list:


Mark Martinec wrote:
> Net::DNS has broken sa-update -
> https://rt.cpan.org/Ticket/Display.html?id=81760

Interesting. The Net::DNS 0.68 docs claim:

  man Net::DNS::RR::TXT

   char_str_list
        print "Individual <character-string> list: \n\t",
              join("\n\t", $rr->char_str_list());
       Returns a list of the individual <character-string> elements, as
       unquoted strings.  Used by TXT->rdatastr and TXT->rr_rdata.

       NB: rdatastr will return quoted strings.

But the inserted quotation marks seem silly indeed.

> This patch to sa-update would work around Net::DNS 0.70. $1 should never be
> used anyways unless you're sure the regex matched. It's just asking for
> trouble.

Thanks, fixed now in trunk, r1418317.
Used the same approach/code for sa-update, as was properly used
in SpamAssassin/Dns.pm.

> Also local $1 makes me nervous. It could potentially behave
> different on different versions of perl depending on if bugs existed with
> local or $1.

It's the other way around: missing local($1) could behave differently
depending on a version of perl. Having global $n variables localized
before use makes them undefined and taint-free, and avoids potentially
polluting the same variable used by a caller when invoking some subroutine
or hitting an exception handler. This applies to any version of perl,
it makes a good practice.

Kevin A. McGrail wrote:
Thanks Mark for reviewing this.  And Todd, good catch.
I agree with  Mark's patch re: local but otherwise a good fix.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to