/[smeserver]/rpms/smeserver-qpsmtpd/sme8/smeserver-qpsmtpd-1.2.1-disclaimer.patch
ViewVC logotype

Contents of /rpms/smeserver-qpsmtpd/sme8/smeserver-qpsmtpd-1.2.1-disclaimer.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Sat Jun 16 17:48:11 2007 UTC (17 years, 4 months ago) by slords
Branch: MAIN
CVS Tags: smeserver-qpsmtpd-1_2_1-42_el5_sme, smeserver-qpsmtpd-1_2_1-45_el5_sme, smeserver-qpsmtpd-1_2_1-51_el5_sme, smeserver-qpsmtpd-1_2_1-52_el5_sme, smeserver-qpsmtpd-1_2_1-47_el5_sme, smeserver-qpsmtpd-1_2_1-49_el5_sme, smeserver-qpsmtpd-1_2_1-57_el5_sme, smeserver-qpsmtpd-1_2_1-44_el5_sme, smeserver-qpsmtpd-1_2_1-55_el5_sme, smeserver-qpsmtpd-1_2_1-56_el5_sme, smeserver-qpsmtpd-1_2_1-53_el5_sme, smeserver-qpsmtpd-1_2_1-54_el5_sme, smeserver-qpsmtpd-1_2_1-50_el5_sme, smeserver-qpsmtpd-1_2_1-43_el5_sme, smeserver-qpsmtpd-1_2_1-46_el5_sme
Updates

1 diff -Nur -x '*.orig' -x '*.rej' smeserver-qpsmtpd-1.2.1/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugins/65disclaimer mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugins/65disclaimer
2 --- smeserver-qpsmtpd-1.2.1/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugins/65disclaimer 1969-12-31 17:00:00.000000000 -0700
3 +++ mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugins/65disclaimer 2007-06-16 11:28:49.000000000 -0600
4 @@ -0,0 +1,6 @@
5 +{
6 + return "# disclaimer disabled"
7 + unless ($smtpd{disclaimer} || 'disabled') eq "enabled";
8 + return "disclaimer";
9 +}
10 +
11 diff -Nur -x '*.orig' -x '*.rej' smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/disclaimer mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/disclaimer
12 --- smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/disclaimer 1969-12-31 17:00:00.000000000 -0700
13 +++ mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/disclaimer 2007-06-16 10:59:29.000000000 -0600
14 @@ -0,0 +1,99 @@
15 +use MIME::Parser;
16 +use MIME::Entity;
17 +
18 +sub hook_data_post {
19 + my ($self, $transaction) = @_;
20 +
21 + if ($transaction->data_size > 10 * 1024 * 1024) {
22 + $self->log(LOGWARN, "Message too large to sign");
23 + return DECLINED;
24 + } elsif ( $transaction->header->get('X-Qpsmtp-Disclaimer') ) {
25 + $self->log(LOGNOTICE, "Message already has disclaimer attached");
26 + return DECLINED;
27 + }
28 +
29 + $self->qp->version =~ m/([\.\d]+).*/;
30 + my $versionnum = $1;
31 + my @rcpt_hosts = ($self->qp->config("me"), $self->qp->config("rcpthosts"));
32 +
33 + my $fromhost = $transaction->sender->host;
34 + my $fromlocal = 0;
35 +
36 + for my $allowed (@rcpt_hosts) {
37 + $allowed =~ s/^\s*(\S+)/$1/;
38 + ($fromlocal = 1, last) if (($fromhost eq lc $allowed) or (substr($allowed,0,1) eq "." and
39 + $fromhost =~ m/\Q$allowed\E$/i));
40 + }
41 +
42 + if (($versionnum >= 0.26) and ($fromlocal == 0)) {
43 + my $more_rcpt_hosts = $self->qp->config('morercpthosts', 'map');
44 + $fromlocal = 1 if exists $more_rcpt_hosts->{$fromhost};
45 + }
46 +
47 + unless ($fromlocal) {
48 + $self->log(LOGDEBUG, "Not from local domain");
49 + return DECLINED;
50 + }
51 +
52 + my $toexternal=0;
53 + foreach my $rcpt ( $transaction->recipients ) {
54 + my $local = 0;
55 + my $host = $rcpt->host;
56 +
57 + for my $allowed (@rcpt_hosts) {
58 + $allowed =~ s/^\s*(\S+)/$1/;
59 + ($local = 1, last) if (($host eq lc $allowed) or (substr($allowed,0,1) eq "." and
60 + $host =~ m/\Q$allowed\E$/i));
61 + }
62 +
63 + if (($versionnum >= 0.26) and ($local == 0)) {
64 + my $more_rcpt_hosts = $self->qp->config('morercpthosts', 'map');
65 + $local = 1 if exists $more_rcpt_hosts->{$host};
66 + }
67 +
68 + ($toexternal = 1, last) unless $local;
69 + }
70 +
71 + unless ($toexternal) {
72 + $self->log(LOGDEBUG, "Not from local domain");
73 + return DECLINED;
74 + }
75 +
76 + my $parser = new MIME::Parser;
77 + $parser->output_under( $self->spool_dir() );
78 + $parser->extract_uuencode(1);
79 + my $ent = $parser->parse_open( $transaction->body_filename() );
80 +
81 + my @lines;
82 + if ( @lines = $self->qp->config("disclaimer_$fromhost") ) {
83 + $self->log(LOGDEBUG, "Found disclaimer for domain: $fromhost");
84 + } elsif ( @lines = $self->qp->config("disclaimer") ) {
85 + $self->log(LOGDEBUG, "Found general disclaimer");
86 + } else {
87 + $self->log(LOGERROR, "No disclaimer found for domain: $fromhost");
88 + return DECLINED;
89 + }
90 + $ent->make_multipart( 'mixed', Force => 1 ) if $ent->parts == 2 && $ent->mime_type eq 'multipart/alternative';
91 + $ent->attach( Data => join("\n", @lines),
92 + Encoding => '-SUGGEST',
93 + Filename => 'disclaimer.txt',
94 + Type => 'text/plain');
95 + if ($ent->parts <= 2) {
96 + $transaction->header->empty();
97 + $transaction->header($ent->head());
98 + }
99 + $transaction->header->replace( 'X-Qpsmtp-Disclaimer', $fromhost );
100 + $self->log(LOGNOTICE, "Attached disclaimer for domain: $fromhost");
101 +
102 + open BFN, ">" . $transaction->body_filename();
103 + $ent->print(\*BFN);
104 + close BFN;
105 + $transaction->body_resetpos();
106 +
107 + $ent->purge();
108 + rmdir( $parser->output_dir );
109 +
110 + return DECLINED;
111 +}
112 +
113 +# vi: ft=perl ts=4

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed