Ticket #1485839 (closed Feature Requests: fixed)

Opened 16 months ago

Last modified 3 weeks ago

UUEncoded attachment are not read correctly

Reported by: jernst Owned by:
Priority: 5 Milestone: 0.4-stable
Component: MIME parsing Version: 0.2.1
Severity: normal Keywords: uuencode
Cc:

Description

Here is an example mail that doesn't show up correctly in Roundcube.

[...] Date: Thu, 7 May 2009 16:32:14 +0200 From: X To: Y Subject: Facsimile received from 022123456 Message-Id: <20090507163149-0223642891.22818@voip>

Resolution: 204, 98 pixels/inch Page Number: 0-1 Fax Data: clean (0 = 0x0) Fax Receive Time: 5 secs Fax DCS: 00 55 1E

begin 644 20090507163149-0223642891.pdf M)5!$1BTQ+C$@"B7BX\_3"C$@,"!O8FH*/#P@"B]4>7!E("]#871A;&]G(`HO M4&%G97,@,RP(%(@"CX^"F5N9&]B:@HR(#@;V)J"CP\(`HO0W)E871I;VY$ M871E("A$.C(P,#DP-3W,38S,C$P*0HO36]D1&%T92H1#HR,#`Y,#4P-S$V M,S(Q,"D*+U!R;V1U8V5R("AL:6)T:69F("\@=&EF9C)P9&8@+2`R,#`V,#,R M,RO(&0I"B]#<F5A=&]R("AS<&%N9'-P*0H^/B*96YD;V)J"C,@,"!O8FH* M/#P@"B]4>7!E("]086=E<R*+TMI9',@6RT(#@4B!=(HO0V]U;G0@,2`* M/CX@"F5N9&]B:@HT(#`@;V)J"CP\"B]4>7!E("]086=E(`HO4&%R96YT(#,@ M,"!2(HO365D:6%";W@@6SN,#P,"P+CP,#@-C`Y+C@X,C,@,S(V+C(P M-#%=(HO0V]N=&5N=',@-2P(%(@"B]297-O=7)C97,@/#P@"B]83V)J96-T M(#P\"B]);3$@-RP(%(@/CX*+U!R;V-3970@6RO26UA9V5"(%T*/CX*/CX* M96YD;V)J"C4@,"!O8FH*/#P@"B],96YG=&@@-BP(%(@"B/@IS=')E86T* M<2@-CY+C@X,C,@,"XP,#P(#N,#P,"S,C8N,CT,2P+CP,#@,"XP M,#P(&-M("]);3$@1&\@40H*96YD<W1R96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9@HP(#D@"CP,#P M,#P,#@-C4U,S4@9B*,#P,#P,#Q-BP,#P,"!N(HP,#P,#`P,#8X M(#P,#P(&X@"CP,#P,#R,3<@,#P,#@;B*,#P,#P,#(X,2P,#P M,"!N(HP,#P,#P-#4W(#P,#P(&X@"CP,#P,#U-S4@,#P,#@;B`* M,#P,#P,#4Y,RP,#P,"!N(HP,#P,#R.3,U(#P,#`P(&X@"G1R86EL M97(*/#P*+U-I>F4@.0HO4F]O="Q(#@4B*+TEN9F\@,BP(%(@"B])1%L\ M-C<T-3A"-D)#-C(S-T(S,C8Y.3@S0S8T-S,T.#,S-C8/#8W-#4X0C9"0S8R M,S=",S(V.3DX,T,V-#<S-#@S,S8V/ET*/CX*<W1A<G1X<F5F"C(Y-34*)25% #3T8* ` end

Attachments

1241784224.V802Ie78016M314513.SERVER (78.3 KB) - added by MKelma 16 months ago.
UUENCODED TEST MAIL
1242250099.V802I4b0001M35986.SERVER (28.5 KB) - added by MKelma 16 months ago.
UUENCODED Testmail - attached word document -> NOT working !!

Change History

Changed 16 months ago by alec

  • component changed from Core functionality to MIME parsing
  • milestone changed from later to 0.2.2

Attach sample message, please.

Changed 16 months ago by MKelma

UUENCODED TEST MAIL

Changed 16 months ago by Lazlo

Tested mail, works in Thunderbird, but doesn't show up correctly in Roundcube. (Running on trunk)

Changed 16 months ago by alec

  • status changed from new to closed
  • resolution set to fixed

Fixed in r2471.

Changed 16 months ago by MKelma

thank you - working now. but it produces some error in log files: [13-May-2009 11:26:04] PHP Warning: convert_uudecode() [<a href='function.convert-uudecode'>function.convert-uudecode</a>]: The given parameter is not a valid uuencoded string in /..path../program/lib/imap.inc on line 2424

Changed 16 months ago by alec

Fixed in r2473.

Changed 16 months ago by MKelma

whoooa[[BR]] speed record.... thanks.
working now as expected.

Changed 16 months ago by MKelma

UUENCODED Testmail - attached word document -> NOT working !!

Changed 16 months ago by MKelma

  • status changed from closed to reopened
  • resolution fixed deleted

above testmail with uuencoded word-file does not work in RC
works in thunderbird etc...

Changed 16 months ago by alec

  • status changed from reopened to closed
  • resolution set to fixed

Fixed in r2475.

Changed 5 months ago by alec

  • status changed from closed to reopened
  • type changed from Bugs to Feature Requests
  • resolution fixed deleted
  • milestone changed from 0.2.2 to 0.4-beta

http://www.roundcubeforum.net/5-release-support/17-pending-issues/6435-error-received-attachment.html[[BR]] Inline attachments in plain text body of non-MIME message are not handled.

Changed 3 months ago by alec

  • status changed from reopened to closed
  • resolution set to fixed

Fixed in r3680.

Changed 3 weeks ago by towa48

Guys i have a spaces in uuencoded files (pdf)! Attached file visible in Thunderbird, but doesn't show up correctly in Roundcube (4.0 stable).

But I have blank page if I edit regexp (rcube_message.php) from

$uu_regexp = '/begin [0-7]{3,4} ([^\n]+)\n(([\x21-\x7E]{0,65}\n)+)`\nend/s';

to

$uu_regexp = '/begin [0-7]{3,4} ([^\n]+)\n(([\x20-\x7E]{0,65}\n)+)`\nend/s';

Looks like preg_match_all() get a error, but error log is empty. Help pls

Apache 2.2.9 PHP 5.2.6-1 Roundcube 4.0 stable

Changed 3 weeks ago by alec

Attach sample message.

Changed 3 weeks ago by towa48

sry, i cant. message contains personal data

...
Date: Thu, 12 Aug 2010 06:57:29 +0100
Message-ID: <xxx@intldn.manfinancial.net>
X-Mailer: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2757
X-OriginalArrivalTime: 12 Aug 2010 05:57:30.0048 (UTC) FILETIME=[3FC5D400:01CB39E3]



begin 666 20100811CS60800730.pdf
M)5!$1BTQ+C,*):T*,2 P(&]B:@H\/ HO5'EP92 O0V%T86QO9PHO4&%G97,@
M,S0@,"!2"B]/=71L:6YE<R S-2 P(%(*+U!A9V5-;V1E("]5<V5/=71L:6YE
M<R *+U9I97=E<E!R969E<F5N8V5S(#(@,"!2"B]/<&5N06-T:6]N(%LP("]8
...
...
...
M138U-C@^70HO26YF;R R,2 P(%(*/CX*<W1A<G1X<F5F"C$X,38U,@HE)45/
"1@H`
`
end



If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. http://xxx.com - for important additional terms relating to this e-mail.

Changed 3 weeks ago by alec

If've checked on wikipedia ;) Looks you're right about the change in regexp. Some implementations are using spaces. If you got a blank page there must an error message in the log.

Changed 3 weeks ago by towa48

I think this is PCRE limit http://www.pcre.org/pcre.txt

The  maximum length of a compiled pattern is 65539 (sic) bytes if PCRE is compiled with the default internal linkage size of 2.

I think I need other algorithm for big files.

Changed 3 weeks ago by towa48

Ok. My internal linkage size is 1 (8 KBytes) and preg_match_all() show a blank page. This is my alternative function

	function uu_decode(&$part)
	{
		// @TODO: messages may be huge, hadle body via file
		if (!isset($part->body))
		$part->body = $this->imap->get_message_part($this->uid, $part->mime_id, $part);

		$parts = array();
		/* UUDECODE MOD */
		$uu_regexp = '/begin [0-7]{3,4} ([^\n]+)\n/s';
		if (preg_match_all($uu_regexp, $part->body, $matches, PREG_SET_ORDER)) {
		
			// update message content-type
		$part->ctype_primary   = 'multipart';
		$part->ctype_secondary = 'mixed';
		$part->mimetype        = $part->ctype_primary . '/' . $part->ctype_secondary;
			
			$uu_endstring = "`\nend\n";
			
			// foreach attachments
			foreach ($matches as $pid => $att) {
				
				$startpos = strpos($part->body, $att[1]) + strlen($att[1]) + 1; // "\n"
				$endpos = strpos($part->body, $uu_endstring);
				$filebody = substr($part->body, $startpos, $endpos-$startpos);
				
				// remove attachments bodies from the message body
				$part->body = substr_replace($part->body, "", $startpos, $endpos+strlen($uu_endstring)-$startpos);
				
				$uupart = new rcube_message_part;
				
				$uupart->filename = trim($att[1]);
				$uupart->encoding = 'stream';
				$uupart->body     = convert_uudecode($filebody);
				$uupart->size     = strlen($uupart->body);
				$uupart->mime_id  = 'uu.' . $part->mime_id . '.' . $pid;
				
				$ctype = rc_mime_content_type($uupart->body, $uupart->filename, 'application/octet-stream', true);
				$uupart->mimetype = $ctype;
				list($uupart->ctype_primary, $uupart->ctype_secondary) = explode('/', $ctype);
				
				$parts[] = $uupart;
				unset($matches[$pid]);
			}
			
			// remove attachments headers from the message body
			$part->body = preg_replace($uu_regexp, '', $part->body);
		}
		/* END UUDECODE MOD */
		
        return $parts;
    }
Note: See TracTickets for help on using tickets.