1 |
slords |
1.1 |
diff -Nur -x '*.orig' -x '*.rej' smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/tnef2mime mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/tnef2mime |
2 |
|
|
--- smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/tnef2mime 2007-01-27 16:29:42.000000000 -0700 |
3 |
|
|
+++ mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/tnef2mime 2007-01-27 16:29:26.000000000 -0700 |
4 |
|
|
@@ -40,6 +40,13 @@ |
5 |
|
|
$self->register_hook("data_post", "tnef2mime"); |
6 |
|
|
} |
7 |
|
|
|
8 |
|
|
+sub hasMessageClassProperty { |
9 |
|
|
+ my $self = shift; |
10 |
|
|
+ my $data = $self->data("Attachment"); |
11 |
|
|
+ return 0 unless $data; |
12 |
|
|
+ return index( $data, pack( "H*", "8008" ) ) >= 0; |
13 |
|
|
+} |
14 |
|
|
+ |
15 |
|
|
# for future use |
16 |
|
|
sub kill_part ($) |
17 |
|
|
{ |
18 |
|
|
@@ -68,19 +75,35 @@ |
19 |
|
|
# if $tnef is undefined here, the application/octet-stream was not a ms-tnef and we are done. |
20 |
|
|
return 1 if( ! defined $tnef ); |
21 |
|
|
|
22 |
|
|
+ my $keep_tnef=0; |
23 |
|
|
for ($tnef->attachments) |
24 |
|
|
{ |
25 |
|
|
next if !defined $_->datahandle; |
26 |
|
|
+ |
27 |
|
|
+ if( hasMessageClassProperty($_) ) # Outlook MAPI object |
28 |
|
|
+ { |
29 |
|
|
+ $keep_tnef++; |
30 |
|
|
+ $self->log(LOGWARN, sprintf "Outlook MAPI object #%i: %s", $keep_tnef, $_->longname); |
31 |
|
|
+ next; |
32 |
|
|
+ } |
33 |
|
|
+ |
34 |
|
|
my $mimetype = $mm->checktype_filename( $_->datahandle->path ); |
35 |
|
|
$attachments[$count] = MIME::Entity->build( |
36 |
|
|
Path=>$_->datahandle->path, |
37 |
|
|
Filename=>$_->longname, |
38 |
|
|
Encoding=>"base64", |
39 |
|
|
Type=>$mimetype ); |
40 |
|
|
- $self->log(LOGDEBUG, |
41 |
|
|
- sprintf "converted attachment #%i: %s (%s, %ld bytes)", $count+1, $_->longname, $mimetype, $_->size ); |
42 |
|
|
+ $self->log(LOGWARN, |
43 |
|
|
+ sprintf "File attachment #%i: %s (%s, %ld bytes)", $count+1, $_->longname, $mimetype, $_->size ); |
44 |
|
|
$count++; |
45 |
|
|
} |
46 |
|
|
+ |
47 |
|
|
+ if( $keep_tnef ) |
48 |
|
|
+ { |
49 |
|
|
+ $attachments[$count++] = $part; |
50 |
|
|
+ $self->log(LOGWARN, "Original TNEF file attached." ); |
51 |
|
|
+ } |
52 |
|
|
+ |
53 |
|
|
push( @tnefs, $tnef ); # remind for cleanup |
54 |
|
|
$foundtnef=1; |
55 |
|
|
return 0; |