Moya's Blog

About

慈濟大陸賑災、緬甸風災捐款: External link mark
郵政劃撥帳號-06692433
戶名-佛教慈濟基金會賑災專戶
(註明四川震災或緬甸風災)
慈濟捐款網站請按此 External link mark


處順境若能慈悲,則後福自在,仆逆境倘得智慧,則遺禍自消,於順境若能不喜,則後患不至,當逆境或能捨得,則福自踵來。此慈悲喜捨,便是大般涅槃無上妙法,入世行者或能三思。


《既然清淨,何必有網?》
《譬如大日,遍照不爽。》
《上下十方,無為自在;》
《因陀羅手,去曼達礙。》


靜思晨語系列 獅子吼大德 慈濟的好友 雅虎的好友 老骨頭級的朋友

21 Aug 2008 - 18:58 in by MoyaTseng
2.6.1 已經釋出了,所以提供新的 patch。其實是大同小異的,不過不做新的,我自己做的 ports local/amavisd-new 裝不起來,所以只好先做給它了~
--- amavisd.orig        2008-06-29 08:37:58.000000000 +0800
+++ amavisd     2008-08-21 19:28:52.000000000 +0800
@@ -2026,6 +2026,7 @@
 use subs @EXPORT_OK;
 
 use Errno qw(ENOENT EACCES EAGAIN ESRCH);
+use POSIX qw(isprint);
 use IO::File ();
 use Digest::MD5 2.22;  # need 'clone' method
 # use Encode;  # Perl 5.8  UTF-8 support
@@ -2077,13 +2078,74 @@
   }
 }
 
-sub safe_decode($$;$) {
-  if (!$unicode_aware) { $_[1] }  # just return the second argument
-  else {
+sub isbig5($)
+{
+  my $code = shift;
+
+  if (length($code) >= 2)
+  {
+    my @code = split '', $code;
+    if (ord($code[0]) < 161)
+    {
+      return (0);
+    }
+    else
+    {
+      if (((ord($code[1]) >= 64) && (ord($code[1]) <= 126)) ||
+          ((ord($code[1]) >= 161) && (ord($code[1]) <= 254)))
+      {
+        return (1);
+      }
+    }
+  }
+  return (0);
+}
+
+sub isbig5str($)
+{
+  my $astr = shift;
+  my $alen = length($astr);
+  my $rlen = 0;
+
+  while ($rlen < $alen)
+  {
+    if (isbig5(substr($astr, $rlen, $alen - $rlen)))
+    {
+      $rlen += 2;
+    }
+    elsif (isprint(substr($astr, $rlen, 1)))
+    {
+      $rlen += 1;
+    }
+    else
+    {
+      return (0);
+    }
+  }
+  return (1);
+}
+
+sub safe_decode($$;$)
+{
+  if (!$unicode_aware)
+  {
+    $_[1];
+  } # just return the second argument
+  else
+  {
     my($encoding,$str,$check) = @_;
-    $check = 0  if !defined($check);
-    my($taint) = substr($str,0,0);  # taintedness of the string
-    $taint . Encode::decode($encoding,untaint($str),$check);  # preserve taint
+    $check = 0 if !defined($check);
+    my($taint) = substr($str,0,0); # taintedness of the string
+    my($u_str) = untaint($str);
+    my($d_str) = $taint . Encode::decode($encoding,$u_str,$check); # preserve
+    if (($d_str eq $u_str) && isbig5str($u_str))
+    {
+      $taint . Encode::decode("big5",$u_str,$check)
+    }
+    else
+    {
+      $d_str;
+    }
   }
 }
 
@@ -12554,7 +12616,7 @@
   Amavis::Lookup::RE->new(@$Amavis::Conf::map_full_type_to_short_type_re);
 
 # default location of the config file if none specified
-push(@config_files, '/etc/amavisd.conf')  if !@config_files;
+push(@config_files, '/usr/local/etc/amavisd.conf')  if !@config_files;
 # Read and evaluate config files, which may override default settings
 Amavis::Conf::include_config_files(@config_files);
 Amavis::Conf::supply_after_defaults();


Leave a Reply

You may have to login or register to comment if you haven't already.

訪客統計: 149136 人次



請按此訂閱每日人間菩提。靜思晨語 External link mark
本站所有言論均不代表慈濟基金會 External link mark


我為你祝福
我也要許願

r1 – 21 Aug 2008 – 19:30:30 – Main.MoyaTseng
Copyright © 1999-2008 by the contributing authors. All material on this collaboration platform is the property of the contributing authors. Ideas, requests, problems regarding Moya's Blog? Send feedback.