Mailinglist Archive: opensuse-commit (1214 mails)
| < Previous | Next > |
commit perl-Mail-DKIM for openSUSE:Factory
- From: root@xxxxxxxxxxxxxxx (h_root)
- Date: Fri, 28 Aug 2009 22:14:06 +0200
- Message-id: <20090828201406.EBF436437@xxxxxxxxxxxxxxx>
Hello community,
here is the log from the commit of package perl-Mail-DKIM for openSUSE:Factory
checked in at Fri Aug 28 22:14:06 CEST 2009.
--------
--- perl-Mail-DKIM/perl-Mail-DKIM.changes 2009-01-26 17:16:57.000000000
+0100
+++ perl-Mail-DKIM/perl-Mail-DKIM.changes 2009-07-20 15:09:31.000000000
+0200
@@ -1,0 +2,12 @@
+Mon Jul 20 15:08:05 CEST 2009 - varkoly@xxxxxxx
+
+- new version: 0.33
+ * signature wrapping was still messed up, hopefully all bugs fixed now
+ * signature wrapping would sometimes cause improper preparation of
+ DKIM signatures, with "simple" canonicalization (issue #2257046)
+ * test scripts:
+ * the included corpus is now verified using a fake-DNS resolver,
+ which means the test corpus can validate even when your DNS
+ servers are really slow
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
Mail-DKIM-0.32.tar.gz
New:
----
Mail-DKIM-0.33.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Mail-DKIM.spec ++++++
--- /var/tmp/diff_new_pack.y8OH7y/_old 2009-08-28 22:13:47.000000000 +0200
+++ /var/tmp/diff_new_pack.y8OH7y/_new 2009-08-28 22:13:47.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package perl-Mail-DKIM (Version 0.32)
+# spec file for package perl-Mail-DKIM (Version 0.33)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -19,8 +19,8 @@
Summary: Signs/verifies Internet mail with DKIM/DomainKey signatures
Name: perl-Mail-DKIM
-Version: 0.32
-Release: 3
+Version: 0.33
+Release: 1
License: GPL v2 or later
Group: Productivity/Networking/Email/Utilities
Url: http://dkimproxy.sourceforge.net/
++++++ Mail-DKIM-0.32.tar.gz -> Mail-DKIM-0.33.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/ChangeLog new/Mail-DKIM-0.33/ChangeLog
--- old/Mail-DKIM-0.32/ChangeLog 2008-05-09 22:45:21.000000000 +0200
+++ new/Mail-DKIM-0.33/ChangeLog 2009-03-10 15:46:58.000000000 +0100
@@ -1,3 +1,48 @@
+2008-11-19: Jason Long <jlong@xxxxxxxxxxx>
+ * lib/Mail/DKIM/Signature.pm, DkSignature.pm (DEFAULT_PREFIX): new
+ method which determines what prefix to use in as_string, prettify,
+ etc.
+ * lib/Mail/DKIM/KeyValueList.pm (wrap): when splitting the h= field,
+ only allow breaks prior to ':' symbols
+
+2008-11-19: Jason Long <jlong@xxxxxxxxxxx>
+ * t/signature.t: further checks for prettify signatures (found a case
+ where the new code caused a regression)
+ * lib/Mail/DKIM/TextWrap.pm (flush): remember to update cur position
+ when flushing text; use a "may_break" internal variable to know
+ whether a linebreak is acceptable; other fixes
+ * t/textwrap.t: another test case illustrating failure in TextWrap.pm
+ * lib/Mail/DKIM/KeyValueList.pm (wrap): call flush() right after the
+ ';' character; this is a further fix for #2257046.
+
+2008-11-10: Jason Long <jlong@xxxxxxxxxxx>
+ * lib/Mail/DKIM/TextWrap.pm (flush): new method to explicitly allow a
+ break at the current point in the string
+ * lib/Mail/DKIM/KeyValueList.pm (wrap): call flush() whenever changing
+ TextWrap parameters (this should complete the fix for #2257046)
+
+2008-11-06: Jason Long <jlong@xxxxxxxxxxx>
+ * t/signature.t: test Mark Martinec's bad-signature-wrapping bug
+
+2008-11-06: Jason Long <jlong@xxxxxxxxxxx>
+ * t/verifier.t: use a "fake" dns implementation, so that this test
+ will pass no matter the user's state of dns
+
+2008-11-06: Jason Long <jlong@xxxxxxxxxxx>
+ * lib/Mail/DKIM/DNS.pm (query): changed API so that it now returns
+ a list of Net::DNS::RR objects, rather than a Net::DNS::Packet object.
+ * lib/Mail/DKIM/Policy.pm: update for the change to the DNS.pm api.
+ * lib/Mail/DKIM/PublicKey.pm: update for the change to the DNS.pm api.
+
+2008-11-06: Jason Long <jlong@xxxxxxxxxxx>
+ * lib/Mail/DKIM/Signature.pm (encode_qp, decode_qp): suppress a warning
+ about an uninitialized value
+ * lib/Mail/DKIM/Common.pm (message_originator, message_sender): if a
+ From/Sender line is present, but blank, still return a valid object
+ * t/public_key.t: new test to check for DNS problems
+
+ -- VERSION 0.32 --
+
2008-05-09: Jason Long <jlong@xxxxxxxxxxx>
* lib/Mail/DKIM/Algorithm/dk_rsa_sha1.pm: when populating a DomainKey
signature's identity, record where the identity came from
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/Changes new/Mail-DKIM-0.33/Changes
--- old/Mail-DKIM-0.32/Changes 2008-06-03 21:08:23.000000000 +0200
+++ new/Mail-DKIM-0.33/Changes 2009-03-10 15:46:58.000000000 +0100
@@ -1,6 +1,25 @@
This file summarizes what's changed between releases of Mail-DKIM.
See the ChangeLog file for the details.
+Version 0.33
+
+ since 0.32_5
+
+ * bugfixes:
+ * signature wrapping was still messed up, hopefully all bugs fixed
+ now
+
+ since 0.32
+
+ * bugfixes:
+ * signature wrapping would sometimes cause improper preparation of
+ DKIM signatures, with "simple" canonicalization (issue #2257046)
+ * test scripts:
+ * the included corpus is now verified using a fake-DNS resolver,
+ which means the test corpus can validate even when your DNS
+ servers are really slow
+
+
Version 0.32 - released 2008-06-03
* removed requirement for Digest::SHA1 (issue #1832549).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/MANIFEST new/Mail-DKIM-0.33/MANIFEST
--- old/Mail-DKIM-0.32/MANIFEST 2008-06-03 21:09:55.000000000 +0200
+++ new/Mail-DKIM-0.33/MANIFEST 2009-03-10 15:52:20.000000000 +0100
@@ -38,8 +38,10 @@
scripts/test_bare_rsa_sha1.pl
scripts/test_canonicalization.pl
scripts/test_nowsp_rsa_sha1.pl
+t/FAKE_DNS.dat
t/Mail-DKIM.t
t/policy.t
+t/public_key.t
t/signature.t
t/simple_canonicalization.t
t/signer.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/META.yml new/Mail-DKIM-0.33/META.yml
--- old/Mail-DKIM-0.32/META.yml 2008-06-03 21:09:55.000000000 +0200
+++ new/Mail-DKIM-0.33/META.yml 2009-03-10 15:52:20.000000000 +0100
@@ -1,16 +1,19 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: Mail-DKIM
-version: 0.32
-version_from:
-installdirs: site
-requires:
+--- #YAML:1.0
+name: Mail-DKIM
+version: 0.33
+abstract: Signs/verifies Internet mail with DKIM/DomainKey
signatures
+license: ~
+author:
+ - Jason Long <jlong@xxxxxxxxxxx>
+generated_by: ExtUtils::MakeMaker version 6.42
+distribution_type: module
+requires:
Crypt::OpenSSL::RSA: 0.24
Digest::SHA: 0
Mail::Address: 0
MIME::Base64: 0
Net::DNS: 0
Test::Simple: 0
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ version: 1.3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/Makefile.PL
new/Mail-DKIM-0.33/Makefile.PL
--- old/Mail-DKIM-0.32/Makefile.PL 2008-06-03 21:09:24.000000000 +0200
+++ new/Mail-DKIM-0.33/Makefile.PL 2009-03-10 15:47:52.000000000 +0100
@@ -4,7 +4,7 @@
# the contents of the Makefile that is written.
WriteMakefile(
NAME => 'Mail::DKIM',
- VERSION => "0.32",
+ VERSION => "0.33",
PREREQ_PM => {
Crypt::OpenSSL::RSA => 0.24,
Digest::SHA => 0,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/README new/Mail-DKIM-0.33/README
--- old/Mail-DKIM-0.32/README 2008-04-14 15:41:24.000000000 +0200
+++ new/Mail-DKIM-0.33/README 2008-11-19 19:34:03.000000000 +0100
@@ -1,4 +1,4 @@
-Mail-DKIM version 0.32
+Mail-DKIM version 0.33
======================
This module implements the various components of the DKIM and DomainKeys
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/TODO new/Mail-DKIM-0.33/TODO
--- old/Mail-DKIM-0.32/TODO 2008-04-14 15:41:24.000000000 +0200
+++ new/Mail-DKIM-0.33/TODO 2008-11-19 19:34:03.000000000 +0100
@@ -51,6 +51,7 @@
- SERVFAIL
- syntax error in public key record
- test DNS timeout for signing policy
+ - test key records composed of fragmented TXT records
- test signature options:
- unspecified query type
- query type of "dns/"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/lib/Mail/DKIM/Common.pm
new/Mail-DKIM-0.33/lib/Mail/DKIM/Common.pm
--- old/Mail-DKIM-0.32/lib/Mail/DKIM/Common.pm 2008-04-14 15:40:10.000000000
+0200
+++ new/Mail-DKIM-0.33/lib/Mail/DKIM/Common.pm 2008-11-19 19:34:03.000000000
+0100
@@ -15,7 +15,7 @@
package Mail::DKIM::Common;
use base "Mail::DKIM::MessageParser";
use Carp;
-our $VERSION = 0.32;
+our $VERSION = 0.33;
sub new
{
@@ -138,7 +138,7 @@
if ($self->{headers_by_name}->{from})
{
my @list =
Mail::Address->parse($self->{headers_by_name}->{from});
- return $list[0];
+ return $list[0] if @list;
}
return Mail::Address->new;
}
@@ -151,12 +151,12 @@
if ($self->{headers_by_name}->{sender})
{
my @list =
Mail::Address->parse($self->{headers_by_name}->{sender});
- return $list[0];
+ return $list[0] if @list;
}
if ($self->{headers_by_name}->{from})
{
my @list =
Mail::Address->parse($self->{headers_by_name}->{from});
- return $list[0];
+ return $list[0] if @list;
}
return Mail::Address->new;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/lib/Mail/DKIM/DNS.pm
new/Mail-DKIM-0.33/lib/Mail/DKIM/DNS.pm
--- old/Mail-DKIM-0.32/lib/Mail/DKIM/DNS.pm 2008-01-24 14:26:43.000000000
+0100
+++ new/Mail-DKIM-0.33/lib/Mail/DKIM/DNS.pm 2008-11-19 19:34:03.000000000
+0100
@@ -6,11 +6,15 @@
use strict;
use warnings;
-# this class contains a method to perform asynchronous DNS queries
+# This class contains a method to perform synchronous DNS queries.
+# Hopefully some day it will have a method to perform
+# asynchronous DNS queries.
package Mail::DKIM::DNS;
use Net::DNS;
+# query- now returns a list of RR objects
+#
sub query
{
my ($domain, $type) = @_;
@@ -44,7 +48,8 @@
alarm 0; #FIXME- restore previous alarm?
die $E if $E;
- return $resp;
+ return () if not $resp;
+ return grep { lc $_->type eq lc $type } $resp->answer;
}
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/lib/Mail/DKIM/DkSignature.pm
new/Mail-DKIM-0.33/lib/Mail/DKIM/DkSignature.pm
--- old/Mail-DKIM-0.32/lib/Mail/DKIM/DkSignature.pm 2008-05-09
22:45:21.000000000 +0200
+++ new/Mail-DKIM-0.33/lib/Mail/DKIM/DkSignature.pm 2008-11-19
19:34:03.000000000 +0100
@@ -102,15 +102,6 @@
=cut
-sub as_string
-{
- my $self = shift;
-
- my $prefix = $self->{prefix} || "DomainKey-Signature:";
-
- return $prefix . $self->Mail::DKIM::KeyValueList::as_string;
-}
-
sub as_string_without_data
{
croak "as_string_without_data not implemented";
@@ -171,6 +162,11 @@
return lc($self->get_tag("c")) || "simple";
}
+sub DEFAULT_PREFIX
+{
+ return "DomainKey-Signature:";
+}
+
=head2 domain() - get or set the domain (d=) field
my $d = $signature->domain; # gets the domain value
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/lib/Mail/DKIM/KeyValueList.pm
new/Mail-DKIM-0.33/lib/Mail/DKIM/KeyValueList.pm
--- old/Mail-DKIM-0.32/lib/Mail/DKIM/KeyValueList.pm 2008-02-20
18:31:40.000000000 +0100
+++ new/Mail-DKIM-0.33/lib/Mail/DKIM/KeyValueList.pm 2008-11-19
19:34:03.000000000 +0100
@@ -160,21 +160,24 @@
{
my $tagname = $tag->{name};
my $tagtype = $args{Tags}->{$tagname} || $args{Default} || "";
+
+ $wrap->{Break} = undef;
+ $wrap->{BreakBefore} = undef;
+ $did_first ? $wrap->add(";") : ($did_first = 1);
+
my ($raw_name, $raw_value) = split(/=/, $tag->{raw}, 2);
unless ($args{PreserveNames})
{
+ $wrap->flush; #allow a break before the tag name
$raw_name =~ s/^\s*/ /;
$raw_name =~ s/\s+$//;
}
-
- $wrap->{Break} = undef;
- $wrap->{BreakBefore} = undef;
- $did_first ? $wrap->add(";") : ($did_first = 1);
$wrap->add($raw_name . "=");
if ($tagtype eq "b64")
{
$raw_value =~ s/\s+//gs; #removes all whitespace
+ $wrap->flush;
$wrap->{Break} = qr/./;
}
elsif ($tagtype eq "list")
@@ -182,13 +185,15 @@
$raw_value =~ s/\s+/ /gs; #reduces any whitespace to
single space
$raw_value =~ s/^\s|\s$//g; #trims preceding/trailing
spaces
$raw_value =~ s/\s*:\s*/:/g;
- $wrap->{Break} = qr/[\s:]/;
+ $wrap->flush;
+ $wrap->{Break} = qr/[\s]/;
$wrap->{BreakBefore} = qr/[:]/;
}
elsif ($tagtype eq "")
{
$raw_value =~ s/\s+/ /gs; #reduces any whitespace to
single space
$raw_value =~ s/^\s|\s$//g; #trims preceding/trailing
spaces
+ $wrap->flush;
$wrap->{Break} = qr/\s/;
}
$wrap->add($raw_value);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/lib/Mail/DKIM/Policy.pm
new/Mail-DKIM-0.33/lib/Mail/DKIM/Policy.pm
--- old/Mail-DKIM-0.32/lib/Mail/DKIM/Policy.pm 2008-02-20 16:41:04.000000000
+0100
+++ new/Mail-DKIM-0.33/lib/Mail/DKIM/Policy.pm 2008-11-19 19:34:03.000000000
+0100
@@ -88,15 +88,15 @@
# if the query takes too long, we should catch it and generate
# an error
#
- my $resp = Mail::DKIM::DNS::query($host, "TXT");
- unless ($resp)
+ my @resp = Mail::DKIM::DNS::query($host, "TXT");
+ unless (@resp)
{
# no response => NXDOMAIN, use default policy
return $class->default;
}
my $strn;
- foreach my $ans ($resp->answer) {
+ foreach my $ans (@resp) {
next unless $ans->type eq "TXT";
$strn = join "", $ans->char_str_list;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/lib/Mail/DKIM/PublicKey.pm
new/Mail-DKIM-0.33/lib/Mail/DKIM/PublicKey.pm
--- old/Mail-DKIM-0.32/lib/Mail/DKIM/PublicKey.pm 2008-05-09
22:30:10.000000000 +0200
+++ new/Mail-DKIM-0.33/lib/Mail/DKIM/PublicKey.pm 2008-11-19
19:34:03.000000000 +0100
@@ -59,14 +59,14 @@
# perform DNS query for public key...
# if the query takes too long, we should generate an error
#
- my $resp = Mail::DKIM::DNS::query($host, "TXT");
- unless ($resp)
+ my @resp = Mail::DKIM::DNS::query($host, "TXT");
+ unless (@resp)
{
# no response => NXDOMAIN
return;
}
- foreach my $ans ($resp->answer) {
+ foreach my $ans (@resp) {
next unless $ans->type eq "TXT";
$strn = join "", $ans->char_str_list;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/lib/Mail/DKIM/Signature.pm
new/Mail-DKIM-0.33/lib/Mail/DKIM/Signature.pm
--- old/Mail-DKIM-0.32/lib/Mail/DKIM/Signature.pm 2008-05-09
22:34:16.000000000 +0200
+++ new/Mail-DKIM-0.33/lib/Mail/DKIM/Signature.pm 2009-03-10
15:47:20.000000000 +0100
@@ -164,7 +164,7 @@
{
my $self = shift;
- my $prefix = $self->{prefix} || "DKIM-Signature:";
+ my $prefix = $self->{prefix} || $self->DEFAULT_PREFIX;
return $prefix . $self->SUPER::as_string;
}
@@ -174,7 +174,7 @@
{
my $self = shift;
- my $prefix = $self->{prefix} || "DKIM-Signature:";
+ my $prefix = $self->{prefix} || $self->DEFAULT_PREFIX;
return $prefix . join(";", map { ">" . $_->{raw} . "<" }
@{$self->{tags}});
}
@@ -407,7 +407,8 @@
my $res = shift;
#TODO- should I worry about non-ASCII systems here?
- $res =~ s/=([\da-fA-F]{2})/pack("C", hex($1))/ge;
+ $res =~ s/=([\da-fA-F]{2})/pack("C", hex($1))/ge
+ if defined $res;
return $res;
}
@@ -422,10 +423,16 @@
my $DISALLOWED = qr/[^!"#\$%&'()*+,\-.\/0-9:;<>?\@A-Z[\\\]^_`a-z{|}~]/;
#TODO- should I worry about non-ASCII systems here?
- $res =~ s/($DISALLOWED)/sprintf('=%02X', ord($1))/eg;
+ $res =~ s/($DISALLOWED)/sprintf('=%02X', ord($1))/eg
+ if defined $res;
return $res;
}
+sub DEFAULT_PREFIX
+{
+ return "DKIM-Signature:";
+}
+
=head2 domain() - get or set the domain (d=) field
my $d = $signature->domain; # gets the domain value
@@ -805,7 +812,7 @@
{
my $self = shift;
$self->wrap(
- Start => length($self->{prefix} || "DKIM-Signature:"),
+ Start => length($self->{prefix} || $self->DEFAULT_PREFIX),
Tags => {
b => "b64",
bh => "b64",
@@ -827,7 +834,7 @@
{
my $self = shift;
$self->wrap(
- Start => length($self->{prefix} || "DKIM-Signature:"),
+ Start => length($self->{prefix} || $self->DEFAULT_PREFIX),
Tags => {
b => "b64",
},
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/lib/Mail/DKIM/Signer.pm
new/Mail-DKIM-0.33/lib/Mail/DKIM/Signer.pm
--- old/Mail-DKIM-0.32/lib/Mail/DKIM/Signer.pm 2008-04-14 15:40:10.000000000
+0200
+++ new/Mail-DKIM-0.33/lib/Mail/DKIM/Signer.pm 2008-11-19 19:34:03.000000000
+0100
@@ -97,7 +97,7 @@
package Mail::DKIM::Signer;
use base "Mail::DKIM::Common";
use Carp;
-our $VERSION = 0.32;
+our $VERSION = 0.33;
# PROPERTIES
#
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/lib/Mail/DKIM/TextWrap.pm
new/Mail-DKIM-0.33/lib/Mail/DKIM/TextWrap.pm
--- old/Mail-DKIM-0.32/lib/Mail/DKIM/TextWrap.pm 2008-02-20
18:31:40.000000000 +0100
+++ new/Mail-DKIM-0.33/lib/Mail/DKIM/TextWrap.pm 2008-11-19
20:27:32.000000000 +0100
@@ -65,7 +65,8 @@
=item Margin
specifies how many characters to allow per line.
-The default is 72.
+The default is 72. If no place to line-break is found on a line, the
+line will extend beyond this margin.
=item Separator
@@ -124,7 +125,9 @@
Swallow => qr/\s/,
Separator => "\n",
cur => 0,
+ may_break => 0,
soft_space => "",
+ word => "",
%args,
};
$self->{Output} ||= \*STDOUT;
@@ -135,9 +138,12 @@
#
# cur - the last known column position
#
+# may_break - nonzero if the current location allows a linebreak
+#
# soft_space - contains added text that will not be printed if a linebreak
# occurs
#
+# word - contains the current word
# Internal methods:
#
@@ -174,19 +180,7 @@
$tw->add("Mary had a little lamb.\n");
You can add() all the text at once, or add() the text in parts by calling
-add() multiple times. If you are doing the latter, be aware that the
-text can be "wrapped" between add() calls, even if it does not match
-the "Break" pattern.
-
-For example, given a margin of 12, this will not wrap
-
- $tw->add("Abcdefghijklmnopqrstuvwxyz");
-
-but this will
-
- $tw->add("Abcdefgh");
- $tw->add("ijklmnop");
- $tw->add("qrstuvwxyz");
+add() multiple times.
=cut
@@ -196,31 +190,35 @@
my $break_after = $self->{Break};
my $break_before = $self->{BreakBefore};
my $swallow = $self->{Swallow};
- while (length $text)
+ $self->{word} .= $text;
+ while (length $self->{word})
{
- my ($word, $remaining);
- if (defined($break_before) and $text =~
/^(.+?)($break_before)(.*)$/s)
+ my $word;
+ if (defined($break_before) and $self->{word} =~
s/^(.+?)($break_before)/$2/s)
{
# note- $1 should have at least one character
$word = $1;
- $remaining = $2 . $3;
}
- elsif (defined($break_after) and $text =~
/^(.*?)($break_after)(.*)$/s)
+ elsif (defined($break_after) and $self->{word} =~
s/^(.*?)($break_after)//s)
{
$word = $1 . $2;
- $remaining = $3;
+ }
+ elsif ($self->{NoBuffering})
+ {
+ $word = $self->{word};
+ $self->{word} = "";
}
else
{
- $word = $text;
- $remaining = "";
+ last;
}
+ die "assertion failed" unless length($word) >= 1;
+
my $next_soft_space;
- if ($word =~ /^(.*)($swallow)$/s)
+ if (defined($swallow) && $word =~ s/($swallow)$//s)
{
- $word = $1;
- $next_soft_space = $2;
+ $next_soft_space = $1;
}
else
{
@@ -230,7 +228,7 @@
my $to_print = $self->{soft_space} . $word;
my $new_pos = _calculate_new_column($self->{cur}, $to_print);
- if ($new_pos > $self->{Margin})
+ if ($new_pos > $self->{Margin} && $self->{may_break})
{
# what would happen if we put the separator in?
my $w_sep = _calculate_new_column($self->{cur},
@@ -242,6 +240,7 @@
$self->output($self->{Separator});
$self->{soft_space} = "";
$self->{cur} = $w_sep;
+ $self->{word} = $word . $next_soft_space .
$self->{word};
next;
}
}
@@ -249,7 +248,7 @@
$self->output($to_print);
$self->{soft_space} = $next_soft_space;
$self->{cur} = $new_pos;
- $text = $remaining;
+ $self->{may_break} = 1;
}
}
@@ -265,10 +264,30 @@
sub finish
{
my $self = shift;
- $self->output($self->{soft_space});
+ $self->flush;
$self->reset;
}
+=head2 flush() - output the current partial word, if any
+
+ $tw->flush;
+
+Call this whenever changing TextWrap's parameters in the middle
+of a string of words. It explicitly allows a line-break at the
+current position in the string, regardless of whether it matches
+the current break pattern.
+
+=cut
+
+sub flush
+{
+ my $self = shift;
+
+ local $self->{NoBuffering} = 1;
+ local $self->{Swallow} = undef;
+ $self->add("");
+}
+
sub output
{
my $self = shift;
@@ -290,6 +309,7 @@
my $self = shift;
$self->{cur} = 0;
$self->{soft_space} = "";
+ $self->{word} = "";
}
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/lib/Mail/DKIM/Verifier.pm
new/Mail-DKIM-0.33/lib/Mail/DKIM/Verifier.pm
--- old/Mail-DKIM-0.32/lib/Mail/DKIM/Verifier.pm 2008-04-14
15:40:10.000000000 +0200
+++ new/Mail-DKIM-0.33/lib/Mail/DKIM/Verifier.pm 2008-11-19
19:34:03.000000000 +0100
@@ -89,7 +89,7 @@
package Mail::DKIM::Verifier;
use base "Mail::DKIM::Common";
use Carp;
-our $VERSION = 0.32;
+our $VERSION = 0.33;
sub init
{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/lib/Mail/DKIM.pm
new/Mail-DKIM-0.33/lib/Mail/DKIM.pm
--- old/Mail-DKIM-0.32/lib/Mail/DKIM.pm 2008-04-14 15:40:10.000000000 +0200
+++ new/Mail-DKIM-0.33/lib/Mail/DKIM.pm 2008-11-19 19:34:03.000000000 +0100
@@ -4,7 +4,7 @@
use warnings;
package Mail::DKIM;
-our $VERSION = 0.32;
+our $VERSION = 0.33;
1;
__END__
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/t/FAKE_DNS.dat
new/Mail-DKIM-0.33/t/FAKE_DNS.dat
--- old/Mail-DKIM-0.32/t/FAKE_DNS.dat 1970-01-01 01:00:00.000000000 +0100
+++ new/Mail-DKIM-0.33/t/FAKE_DNS.dat 2008-11-19 19:34:03.000000000 +0100
@@ -0,0 +1,21 @@
+# this file contains DNS records used by verifier.t
+#
+selector1._domainkey.messiah.edu k=rsa;
p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDhMlYqwtUA9UrrDcNp/IMtdFnytggDl5oIAzJ55oWzPILZE7eX4hLdP6WperHm1WJ9M32XsiKrr4TDbWfp4WjGWBnXf8QMi+WlDuEFOvwVRC/uWy+sAiEf3VcBR5KjGvDovPnGSnW8uDntSOY4HlkTJF/BTWnk29zKmlGyGnw9mQIDAQAB
+test1._domainkey.messiah.edu v=DKIM1; t=y; s=email;
p=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALgSoqXVSEmfcIsOzw7oRuCCOwsmtX/SJnTWxYyj2leFxfS/AVJ+dYfY+hXqMsT7l+MZvvh/R1WzN4MO/kI/7XsCAwEAAQ==
+test2._domainkey.messiah.edu v=DKIM1; s=email:web:fine; x1 = extra ; t =
y:n:extra; h=md5:sha1;
p=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALgSoqXVSEmfcIsOzw7oRuCCOwsmtX/SJnTWxYyj2leFxfS/AVJ+dYfY+hXqMsT7l+MZvvh/R1WzN4MO/kI/7XsCAwEAAQ==
;
+test3._domainkey.messiah.edu v=DKIM1; g=jl*g;
p=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALgSoqXVSEmfcIsOzw7oRuCCOwsmtX/SJnTWxYyj2leFxfS/AVJ+dYfY+hXqMsT7l+MZvvh/R1WzN4MO/kI/7XsCAwEAAQ==
+test4._domainkey.messiah.edu v=DKIM1; g=;
p=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALgSoqXVSEmfcIsOzw7oRuCCOwsmtX/SJnTWxYyj2leFxfS/AVJ+dYfY+hXqMsT7l+MZvvh/R1WzN4MO/kI/7XsCAwEAAQ==
+test5._domainkey.messiah.edu v=DKIM1; t=s;
p=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALgSoqXVSEmfcIsOzw7oRuCCOwsmtX/SJnTWxYyj2leFxfS/AVJ+dYfY+hXqMsT7l+MZvvh/R1WzN4MO/kI/7XsCAwEAAQ==
+testbad1._domainkey.messiah.edu v=DKIM3; t=y;
p=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALgSoqXVSEmfcIsOzw7oRuCCOwsmtX/SJnTWxYyj2leFxfS/AVJ+dYfY+hXqMsT7l+MZvvh/R1WzN4MO/kI/7XsCAwEAAQ==
+testbad2._domainkey.messiah.edu k=rsa; t;
p=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALgSoqXVSEmfcIsOzw7oRuCCOwsmtX/SJnTWxYyj2leFxfS/AVJ+dYfY+hXqMsT7l+MZvvh/R1WzN4MO/kI/7XsCAwEAAQ==
+testbad3._domainkey.messiah.edu k=foobar; t=y;
p=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALgSoqXVSEmfcIsOzw7oRuCCOwsmtX/SJnTWxYyj2leFxfS/AVJ+dYfY+hXqMsT7l+MZvvh/R1WzN4MO/kI/7XsCAwEAAQ==
+testbad4._domainkey.messiah.edu v=DKIM1; s=chat;
p=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALgSoqXVSEmfcIsOzw7oRuCCOwsmtX/SJnTWxYyj2leFxfS/AVJ+dYfY+hXqMsT7l+MZvvh/R1WzN4MO/kI/7XsCAwEAAQ==
+testbad7._domainkey.messiah.edu v=DKIM1; h=bad;
p=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALgSoqXVSEmfcIsOzw7oRuCCOwsmtX/SJnTWxYyj2leFxfS/AVJ+dYfY+hXqMsT7l+MZvvh/R1WzN4MO/kI/7XsCAwEAAQ==
+testbad8._domainkey.messiah.edu v=DKIM1; g=*poe;
p=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALgSoqXVSEmfcIsOzw7oRuCCOwsmtX/SJnTWxYyj2leFxfS/AVJ+dYfY+hXqMsT7l+MZvvh/R1WzN4MO/kI/7XsCAwEAAQ==
+testrevoked._domainkey.messiah.edu k=rsa; t=y; p=
+s1024._domainkey.yahoo.com k=rsa; t=y;
p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDrEee0Ri4Juz+QfiWYui/E9UGSXau/2P8LjnTD8V4Unn+2FAZVGE3kL23bzeoULYv4PeleB3gfmJiDJOKU3Ns5L4KJAUUHjFwDebt0NP+sBK0VKeTATL2Yr/S3bT/xhy+1xtj4RkdV7fVxTn56Lb4udUnwuxK4V5b5PdOKj/+XcwIDAQAB;
n=A 1024 bit key;
+beta._domainkey.gmail.com t=y; k=rsa;
p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC69TURXN3oNfz+G/m3g5rt4P6nsKmVgU1D6cw2X6BnxKJNlQKm10f8tMx6P6bN7juTR1BeD8ubaGqtzm2rWK4LiMJqhoQcwQziGbK1zp/MkdXZEWMCflLY6oUITrivK7JNOLXtZbdxJG2y/RAHGswKKyVhSP9niRsZF/IBr5p8uQIDAQAB
+jakla2._domainkey.ijs.si v=DKIM1;
p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvWSehCSmnxlhzM+P1Ai+7CgzeAcvkL3RdoHFq8JwtpKN3iLnp/s1yRwE/heAi4QQXxDRdlB0bJm5NxZOsckzK7tJM8EdkebMjyXeKOzBKoJaOIlsx4WC2qHqORB0RLqm4lqJFYZJpUypEpskeAGy7WBG7a+1hOlir9+Tf9xtOkwIDAQAB
+shan._domainkey.vmt2.cis.att.net v=DKIM1; k=rsa;
h=sha1:sha256:sha512;n=send%20comments%20to%20tony%40att%2Ecom; g=*;
s=*;p=MHwwDQYJKoZIhvcNAQEBBQADawAwaAJhALSQ1y/+tHT1d9XvpiVap4Z+GFaydEmDgfC48m3wLLmDqfKBADWYIqrCnfKPvZPzGYzo+aJMEiAOTtiNxPWYToiTfJlTpn2YyEEz6OUIXw0uc+NfEQviN4QQr0jVX9yRjwIDAQAB
+foo._domainkey.vmt2.cis.att.net v=DKIM1; k=rsa;
n=send%20comments%20to%20tony%40att%2Ecom; g=*;
s=*;p=MHwwDQYJKoZIhvcNAQEBBQADawAwaAJhALSQ1y/+tHT1d9XvpiVap4Z+GFaydEmDgfC48m3wLLmDqfKBADWYIqrCnfKPvZPzGYzo+aJMEiAOTtiNxPWYToiTfJlTpn2YyEEz6OUIXw0uc+NfEQviN4QQr0jVX9yRjwIDAQAB
+nonexistent._domainkey.messiah.edu NXDOMAIN
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/t/public_key.t
new/Mail-DKIM-0.33/t/public_key.t
--- old/Mail-DKIM-0.32/t/public_key.t 1970-01-01 01:00:00.000000000 +0100
+++ new/Mail-DKIM-0.33/t/public_key.t 2008-11-19 19:34:03.000000000 +0100
@@ -0,0 +1,14 @@
+#!/usr/bin/perl -I../lib
+
+use strict;
+use warnings;
+use Test::More tests => 1;
+
+use Mail::DKIM::Verifier;
+
+my $pubkey = Mail::DKIM::PublicKey->fetch(
+ Protocol => "dns",
+ Selector => "test1",
+ Domain => "messiah.edu",
+ );
+ok($pubkey);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/t/signature.t
new/Mail-DKIM-0.33/t/signature.t
--- old/Mail-DKIM-0.32/t/signature.t 2008-01-24 14:26:43.000000000 +0100
+++ new/Mail-DKIM-0.33/t/signature.t 2008-11-19 19:34:03.000000000 +0100
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::Simple tests => 9;
+use Test::Simple tests => 12;
use Mail::DKIM::Signature;
use Mail::DKIM::TextWrap;
@@ -43,3 +43,27 @@
print "#SAFE--->\n" . $signature->as_string . "\n";
$signature->prettify;
print "#PRETTY->\n" . $signature->as_string . "\n";
+check_pretty($signature->as_string);
+
+
+$unparsed = "DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=ijs.si;
s=jakla2;\n\tt=1225813757; bh=g3zLYH4xKxcPrHOD18z9YfpQcnk/GaJedfustWU5uGs=; b=";
+$signature = Mail::DKIM::Signature->parse($unparsed);
+ok($signature, "parse() works (III)");
+
+print "#BEFORE->\n" . $signature->as_string . "\n";
+$signature->data("blah");
+print "#AFTER-->\n" . $signature->as_string . "\n";
+my $first_part_1 = ($signature->as_string =~ /^(.*?b=)/s)[0];
+$signature->prettify_safe;
+print "#PRETTY->\n" . $signature->as_string . "\n";
+my $first_part_2 = ($signature->as_string =~ /^(.*?b=)/s)[0];
+ok($first_part_1 eq $first_part_2, "signature preserved with prettify_safe");
+
+sub check_pretty
+{
+ my $str = shift;
+ my @lines = split /\n/s, $str;
+
+ my $any_long_lines = grep { length($_) > 72 } @lines;
+ ok(!$any_long_lines, "any lines exceed 72 characters");
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/t/textwrap.t
new/Mail-DKIM-0.33/t/textwrap.t
--- old/Mail-DKIM-0.32/t/textwrap.t 2008-02-20 18:32:18.000000000 +0100
+++ new/Mail-DKIM-0.33/t/textwrap.t 2008-11-19 19:34:03.000000000 +0100
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::Simple tests => 14;
+use Test::Simple tests => 16;
use Mail::DKIM::TextWrap;
@@ -81,6 +81,31 @@
ok($lines[1] eq ":orange", "second line looks ok");
ok($lines[$#lines] =~ /:kiwi$/, "last line looks ok");
+$tw = Mail::DKIM::TextWrap->new(
+ Margin => 10,
+ Output => \$output,
+ );
+$tw->add("apple");
+$tw->add("orange");
+$tw->add("banana");
+$tw->add("apricot");
+$tw->finish;
+check_output("");
+ok(@lines == 1, "no wrapping took place");
+
+$tw = Mail::DKIM::TextWrap->new(
+ Margin => 10,
+ Output => \$output,
+ );
+foreach (qw(apple orange banana apricot))
+{
+ $tw->add($_);
+ $tw->flush;
+}
+$tw->finish;
+check_output("");
+ok(!(grep { length($_) > 10 } @lines), "no long lines");
+
sub check_output
{
my ($test_name) = @_;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mail-DKIM-0.32/t/verifier.t
new/Mail-DKIM-0.33/t/verifier.t
--- old/Mail-DKIM-0.32/t/verifier.t 2008-05-09 22:34:16.000000000 +0200
+++ new/Mail-DKIM-0.33/t/verifier.t 2009-03-10 15:46:59.000000000 +0100
@@ -6,18 +6,15 @@
use Mail::DKIM::Verifier;
+my $homedir = (-d "t") ? "t" : ".";
+
my $dkim = Mail::DKIM::Verifier->new();
ok($dkim, "new() works");
$dkim = Mail::DKIM::Verifier->new_object();
ok($dkim, "new_object() works");
-my $srcfile = "t/test5.txt";
-unless (-f $srcfile)
-{
- $srcfile = "test5.txt" if (-f "test5.txt");
-}
-my $sample_email = read_file($srcfile);
+my $sample_email = read_file("$homedir/test5.txt");
ok($sample_email, "able to read sample email");
ok($sample_email =~ /\015\012/, "sample has proper line endings");
@@ -156,11 +153,7 @@
my ($file, $expected_result) = @_;
print "# verifying message '$file'\n";
$dkim = Mail::DKIM::Verifier->new();
- my $path = "t/corpus/" . $file;
- unless (-f $path)
- {
- $path = "corpus/$file" if (-f "corpus/$file");
- }
+ my $path = "$homedir/corpus/$file";
my $email = read_file($path);
$dkim->PRINT($email);
$dkim->CLOSE;
@@ -168,3 +161,56 @@
print "# result: " . $dkim->result_detail . "\n";
ok($result eq $expected_result, "'$file' should '$expected_result'");
}
+
+# override the DNS implementation, so that these tests do not
+# rely on DNS servers I have no control over
+my $CACHE;
+sub Mail::DKIM::DNS::fake_query
+{
+ my ($domain, $type) = @_;
+ die "can't lookup $type record" if $type ne "TXT";
+
+ unless ($CACHE)
+ {
+ open my $fh, "<", "$homedir/FAKE_DNS.dat"
+ or die "Error: cannot read $homedir/FAKE_DNS.dat: $!\n";
+ $CACHE = {};
+ while (<$fh>)
+ {
+ chomp;
+ next if /^\s*[#;]/ || /^\s*$/;
+ my ($k, $v) = split /\s+/, $_, 2;
+ $CACHE->{$k} = $v eq "NXDOMAIN" ? [] :
+ [ bless \$v, "FakeDNS::Record" ];
+ }
+ close $fh;
+ }
+
+ if (not exists $CACHE->{$domain})
+ {
+ warn "did not cache that DNS entry: $domain\n";
+ print STDERR ">>>\n";
+ print STDERR join("", (Mail::DKIM::DNS::orig_query($domain,
$type))[0]->char_str_list) . "\n";
+ print STDERR "<<<\n";
+ die;
+ }
+
+ return @{$CACHE->{$domain}};
+}
+
+BEGIN {
+ *Mail::DKIM::DNS::orig_query = *Mail::DKIM::DNS::query;
+ *Mail::DKIM::DNS::query = *Mail::DKIM::DNS::fake_query;
+}
+
+package FakeDNS::Record;
+
+sub type
+{
+ return "TXT";
+}
+
+sub char_str_list
+{
+ return ${$_[0]};
+}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-commit+help@xxxxxxxxxxxx
| < Previous | Next > |