/usr/share/perl5/Mail/DKIM/MessageParser.pm is in libmail-dkim-perl 0.39-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | #!/usr/bin/perl
# Copyright 2005 Messiah College. All rights reserved.
# Jason Long <jlong@messiah.edu>
# Copyright (c) 2004 Anthony D. Urso. All rights reserved.
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
use strict;
use warnings;
package Mail::DKIM::MessageParser;
use Carp;
sub new_object
{
my $class = shift;
return $class->TIEHANDLE(@_);
}
sub new_handle
{
my $class = shift;
local *TMP;
tie *TMP, $class, @_;
return *TMP;
}
sub TIEHANDLE
{
my $class = shift;
my %args = @_;
my $self = bless \%args, $class;
$self->init;
return $self;
}
sub init
{
my $self = shift;
$self->{in_header} = 1;
$self->{buf} = "";
}
sub PRINT
{
my $self = shift;
my $buf = $self->{buf};
$buf .= @_ == 1 ? $_[0] : join("", @_) if @_;
if ($self->{in_header}) {
while (length $buf)
{
if (substr($buf,0,2) eq "\015\012")
{
$buf = substr($buf, 2);
$self->finish_header();
$self->{in_header} = 0;
last;
}
if ($buf !~ /^(.+?\015\012)[^\ \t]/s)
{
last;
}
my $header = $1;
$self->add_header($header);
$buf = substr($buf, length($header));
}
}
if (!$self->{in_header}) {
my $j = rindex($buf,"\015\012");
if ($j >= 0)
{
$self->add_body(substr($buf, 0, $j+2));
substr($buf, 0, $j+2) = '';
}
}
$self->{buf} = $buf;
return 1;
}
sub CLOSE
{
my $self = shift;
my $buf = $self->{buf};
if ($self->{in_header})
{
if (length $buf)
{
# A line of header text ending CRLF would not have been
# processed yet since before we couldn't tell if it was
# the complete header. Now that we're in CLOSE, we can
# finish the header...
$buf =~ s/\015\012$//s;
$self->add_header("$buf\015\012");
}
$self->finish_header;
$self->{in_header} = 0;
}
else
{
if (length $buf)
{
$self->add_body($buf);
}
}
$self->{buf} = "";
$self->finish_body;
return 1;
}
sub add_header
{
die "add_header not implemented";
}
sub finish_header
{
die "finish_header not implemented";
}
sub add_body
{
die "add_body not implemented";
}
sub finish_body
{
# do nothing by default
}
sub reset
{
carp "reset not implemented";
}
1;
|