From: Marc G. K. <st...@us...> - 2002-06-20 12:37:16
|
Update of /cvsroot/squirrelmail/squirrelmail/functions In directory usw-pr-cvs1:/tmp/cvs-serv26297 Modified Files: mime.php Log Message: fix for identifying literals in mime_match_parentheses. cyrus sometimes returns literals instead of quoted strings. This fix solves mimedecode errors if there exist " or ) or ( characters in literals. Index: mime.php =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/functions/mime.php,v retrieving revision 1.200 retrieving revision 1.201 diff -u -w -r1.200 -r1.201 --- mime.php 18 Jun 2002 18:05:37 -0000 1.200 +++ mime.php 20 Jun 2002 12:37:12 -0000 1.201 @@ -411,9 +411,12 @@ $j = strlen( $structure ); - // ignore all extra characters - // If inside of a string, skip string -- Boundary IDs and other - // things can have ) in them. + /* + * ignore all extra characters + * If inside of a quoted string or literal, skip it -- Boundary IDs and other + * things can have ) in them. + */ + if ( $structure{$pos} != '(' ) { return( $j ); } @@ -422,7 +425,7 @@ $pos++; if ($structure{$pos} == ')') { return $pos; - } elseif ($structure{$pos} == '"') { + } elseif ($structure{$pos} == '"') { /* check for quoted string */ $pos++; while ( $structure{$pos} != '"' && $pos < $j ) { @@ -433,6 +436,12 @@ } $pos++; } + } elseif ($structure{$pos} == '{') { /* check for literal */ + $str = substr($structure, $pos); + $pos++; + if (preg_match("/^\{(\d+)\}.*/",$str,$reg)) { + $pos = $pos + strlen($reg[1]) + $reg[1] + 2; + } } elseif ( $structure{$pos} == '(' ) { $pos = mime_match_parenthesis ($pos, $structure); } |