]> git.pld-linux.org Git - packages/rt.git/blob - content-id.patch
- up to 4.2.10; fixes CVE-014-9472, CVE-2015-1165, CVE-2015-1464
[packages/rt.git] / content-id.patch
1 From d2e519d4ed50ccc8f44b66b814f47de5ff63d0cc Mon Sep 17 00:00:00 2001
2 From: Przemyslaw Plewa <przemyslaw.plewa@domena.pl>
3 Date: Fri, 6 Feb 2015 13:50:11 +0100
4 Subject: [PATCH] Use Content-ID when handling multipart message over REST.
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Record Content-ID identifier that came over REST API.
10
11 This allows us to have multipart messages with one (or more) part
12 refering to other parts of message. Content-ID identifier is used for
13 reference.
14
15 Such message also needs multipart/related type (instead of default (in
16 rt) multipart/mixed. So if we detect Content-ID in any part of multipart
17 message we switch Content-Type to multipart/related.
18
19 Signed-off-by: Przemysław Plewa <przemyslaw.plewa@domena.pl>
20 ---
21  lib/RT/Interface/REST.pm | 6 ++++++
22  1 file changed, 6 insertions(+)
23
24 diff --git a/lib/RT/Interface/REST.pm b/lib/RT/Interface/REST.pm
25 index edfc5d3..1c8f555 100644
26 --- a/lib/RT/Interface/REST.pm
27 +++ b/lib/RT/Interface/REST.pm
28 @@ -324,11 +324,17 @@ sub process_attachments {
29          }
30  
31          my $info = $cgi->uploadInfo($fh);
32 +        # If Content-ID exists for attachment then we need multipart/related
33 +        # to be able to refer to this Content-Id in core of mime message
34 +        if($info->{'Content-ID'}) {
35 +            $entity->head->set('Content-Type', 'multipart/related');
36 +        }
37          my $new_entity = $entity->attach(
38              Path => $tmp_fn,
39              Type => $info->{'Content-Type'} || guess_media_type($tmp_fn),
40              Filename => $file,
41              Disposition => $info->{'Content-Disposition'} || "attachment",
42 +            'Content-ID' => $info->{'Content-ID'},
43          );
44          $new_entity->bodyhandle->{'_dirty_hack_to_save_a_ref_tmp_fh'} = $tmp_fh;
45          $i++;
46 -- 
47 2.3.0
48
This page took 0.041623 seconds and 3 git commands to generate.