{"id":26,"date":"2008-03-01T01:26:37","date_gmt":"2008-02-29T16:26:37","guid":{"rendered":"http:\/\/www.mozilla.gr.jp\/~shimono\/blog\/?p=26"},"modified":"2008-03-01T01:26:37","modified_gmt":"2008-02-29T16:26:37","slug":"forward-and-procmail","status":"publish","type":"post","link":"https:\/\/blog.himor.in\/?p=26","title":{"rendered":".forward and procmail"},"content":{"rendered":"<p>forward\u3068procmail\u95a2\u4fc2\u3067\u5c11\u3057\u3082\u3081\u305f(?)\u306e\u3067\u30e1\u30e2\u3002<\/p>\n<blockquote><p>&#8220;|IFS=&#8217; &#8216; &amp;&amp; exec \/usr\/bin\/procmail -Yf- || exit 75 #username&#8221;<br \/>\n&#8220;|exec \/usr\/bin\/mailfilter | \/usr\/bin\/procmail -Yf- || exit 75&#8221;<\/p><\/blockquote>\n<p>\u306a\u3069\u306a\u3069\u306e\u9055\u3044\u3068\u610f\u5473\u306b\u3064\u3044\u3066\u3002\u4ee5\u4e0b\u3001smtpd\u306e\u4e2d\u8eab\u306e\u8b70\u8ad6\u306e\u969b\u306f\u3001postfix\u306e\u307f\u3092\u60f3\u5b9a\u3002<\/p>\n<p>1. IFS\u3063\u3066\u4f55<\/p>\n<blockquote><p>IFS = Internal Field Separator\u306e\u7565<\/p><\/blockquote>\n<p>bash\u306a\u3069\u306e\u30b7\u30a7\u30eb\u3067\u306e\u5f15\u6570\u5c55\u958b\u306e\u969b\u306e\u53c2\u7167\u5909\u6570(\u74b0\u5883\u5909\u6570\uff1f)\u3068\u306a\u308b\u3002\u3067\u3001\u5909\u66f4\u3059\u308b\u3068\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30fc\u554f\u984c\u3092\u5f15\u304d\u8d77\u3053\u3059\u3001\u3068\u3044\u3046\u8b66\u544a\u3092\u3069\u3053\u304b\u306e\u30de\u30cb\u30e5\u30a2\u30eb\u3067\u898b\u305f\u3088\u3046\u306a\u3002<\/p>\n<p>2. \u305d\u3082\u305d\u3082||\u3068\u304b&amp;&amp;\u3063\u3066\u4f55<\/p>\n<blockquote><p>|| : \u524d\u306e\u30b3\u30de\u30f3\u30c9\u306e\u7d42\u4e86\u30b9\u30c6\u30fc\u30bf\u30b9\u304c0\u3067\u306a\u3044(\u7570\u5e38\u7d42\u4e86)\u306e\u3068\u304d\u306b\u5b9f\u884c<br \/>\n&amp;&amp; : \u524d\u306e\u30b3\u30de\u30f3\u30c9\u306e\u7d42\u4e86\u30b9\u30c6\u30fc\u30bf\u30b9\u304c0\u306e\u3068\u304d\u306b\u5b9f\u884c<\/p><\/blockquote>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u666e\u901a\u306e\u30b7\u30a7\u30eb\u3092\u5b9f\u884c\u3059\u308b\u3068\u304d\u306e\u3068\u540c\u3058\u3067\u3059\u306a\u3002\u3069\u3061\u307f\u3061\u3001forward\u3092\u89e3\u91c8\u3059\u308blocal\u306f\u3001global\/pipe_command\u306b\u6295\u3052\u308b\u306e\u3067\u3001fork\/exec\u3059\u308b\u3060\u3051\u3060\u3063\u305f\u308a\u3057\u307e\u3059\u304c\u3002\u5834\u6240\u3068\u3057\u3066\u306flocal\/deliver_command()\u95a2\u6570\u3002<\/p>\n<p>3.  exit 75\u306f\uff1f<\/p>\n<p>posix shell\u3067\u306eexit\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c975\u306f\u3001EX_TEMPFAIL\u3067\u3001\u4e00\u6642\u30a8\u30e9\u30fc\u3092\u610f\u5473\u3059\u308b\u3002\u307e\u3041\u3001\u3082\u3046\u4e00\u5ea6\u5b9f\u884c\u3057\u305f\u3089\u6210\u529f\u3059\u308b\u304b\u3082\u306d\u3047\uff5e\u3001\u3068\u3001\u547c\u3073\u51fa\u3057\u3082\u3068\u306e\u30b3\u30de\u30f3\u30c9\u306b\u3044\u3046\u3001\u3068\u3044\u3046\u611f\u3058\u3002<\/p>\n<blockquote><p>\/usr\/include\/sysexits.h:#define EX_TEMPFAIL     75      \/* temp failure; user is invited to retry *\/<\/p><\/blockquote>\n<p>local\u3067\u306f\u3001\u6295\u3052\u3064\u3051\u305f\u30b3\u30de\u30f3\u30c9\u304b\u3089\u306e\u623b\u308a\u5024\u306a\u3069\u306f\u3001global\/pipe_command\u306e\u6700\u5f8c\u3067PIPE_STAT_*\u306b\u306a\u3063\u305f\u3082\u306e\u3092\u53d7\u3051\u53d6\u3063\u3066\u5224\u65ad\u3059\u308b\u3001\u306e\u3067\u3001\u7d42\u4e86\u30b9\u30c6\u30fc\u30bf\u30b9\u304c\u3069\u3046\u53cd\u6620\u3055\u308c\u308b\u304b\u306f\u3001\u3053\u3053\u3092\u898b\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002<\/p>\n<p>4. \u6700\u5f8c\u306e #username<\/p>\n<p>\u5927\u6614\u306esendmail\u3067\u306f\u3001\u3053\u308c\u3092\u3064\u3051\u3066\u304a\u304b\u306a\u3051\u308c\u3070\u3001\u3068\u3044\u3046\u304b\u3001.forward\u306e\u4e2d\u8eab\u304c\u540c\u3058\u5834\u5408\u306b\u3001\u30e6\u30fc\u30b6\u306e\u533a\u5225\u304c\u3064\u304b\u306a\u304f\u306a\u308b\u3001\u3068\u3044\u3046\u30d0\u30b0\u304c\u5b58\u5728\u3057\u305f\u30d0\u30fc\u30b8\u30e7\u30f3\u3082\u3042\u3063\u305f\u3002\u3089\u3057\u3044\u3002(\u3051\u3069\u3001\u906d\u9047\u3057\u305f\u3053\u3068\u306f\u306a\u3044\u3002)<\/p>\n<p>\u306a\u306e\u3067\u3001\u4eca\u306f\u4e0d\u8981\u3002<\/p>\n<p>\u307e\u3041\u3001mail.info\u3068\u304b\u306e\u30ed\u30b0\u306b\u306f\u51fa\u308b\u304b\u3089(\u307b\u304b\u306e\u30b3\u30de\u30f3\u30c9\u90e8\u5206\u3068\u4e00\u7dd2\u306b)\u3001\u7ba1\u7406\u8005\u304c\u969c\u5bb3\u8ffd\u8de1\u3059\u308b\u3068\u304d\u306b\u306f\u4f7f\u3048\u308b\uff1f\u3063\u3066\u3001\u305d\u3093\u306a\u3068\u3053\u308d\u3092\u898b\u308b\u304f\u3089\u3044\u306a\u3089\u3001\u666e\u901a\u306bmail id\u3068\u304b\u3067\u8ffd\u8de1\u3057\u305f\u307b\u3046\u304c\u65e9\u3044\u3068\u601d\u3046\u3051\u3069\u3002\u3002<\/p>\n<p>5. exec\u3064\u3051\u308b\u304b\u3064\u3051\u306a\u3044\u304b<\/p>\n<p>\u901a\u5e38\u306e\u610f\u5473\u3067\u306efork\/exec\u3067\u306e\u52d5\u4f5c\u3068\u540c\u3058\u306a\u3093\u3067\u3057\u3087\u3046\u306d\u3002<\/p>\n<p>&#8220;| exec xxxx&#8221;\u306b\u3057\u3066\u304a\u3051\u3070\u3001|\u3067\u8d77\u52d5\u3055\u308c\u305f\u30b7\u30a7\u30eb(?)\u304c\u305d\u306e\u307e\u307exxxx\u3092exec\u3059\u308b\u306e\u3067\u30d7\u30ed\u30bb\u30b9\u306f\u65b0\u898f\u306b\u4f5c\u3089\u306a\u304f\u3066\u3044\u3044\u3001\u3068\u3044\u3046\u5229\u70b9\u304c\u3042\u308b\u3002\u307e\u3041\u3001\u306a\u304f\u3066\u3082\u3042\u3063\u3066\u3082fork\u5206\u3092\u9664\u3044\u305f\u3089\u52d5\u4f5c\u306f\u540c\u3058\u306a\u306e\u3067\u3001\u3001\u3069\u3061\u3089\u3067\u3082\u3001\u3068\u3044\u3046\u6c17\u306f\u3059\u308b\u3002<\/p>\n<p>\u308f\u304b\u3089\u306a\u3051\u308c\u3070\u3001\u65b0\u3057\u304f\u30bf\u30fc\u30df\u30ca\u30eb\u3092\u8d77\u52d5\u3057\u3066*\u304b\u3089* (\u2190\u91cd\u8981)\u3001&#8221;exec ls&#8221;\u3068\u304b\u3001&#8221;exec ls -a | ls&#8221;\u3068\u304b\u3092\u5b9f\u884c\u3057\u3066\u307f\u308b\u3068\u308f\u304b\u308b\u3068\u601d\u3046\u3002\u305f\u3076\u3093\u3002<\/p>\n<p>\u5927\u91cf\u306b\u30e1\u30fc\u30eb\u3092\u51e6\u7406\u3059\u308b\u30b5\u30fc\u30d0\u3060\u3068\u56f0\u308b\u3088\u306d\u3001\u3068\u3044\u3046\u3051\u3069\u3001copy-on-write\u3060\u304b\u3089\u6614\u307b\u3069\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u3057\u3002\u3002(\u304b\u3068\u3044\u3063\u3066\u3001\u5165\u308c\u306a\u3044\u306e\u3092\u63a8\u5968\u3059\u308b\u308f\u3051\u3067\u306f\u306a\u3044\u304c\u3002)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>forward\u3068procmail\u95a2\u4fc2\u3067\u5c11\u3057\u3082\u3081\u305f(?)\u306e\u3067\u30e1\u30e2\u3002 &#8220;|IFS=&#8217; &#8216; &amp;&amp; exec \/usr\/bin\/procmail -Yf- || exit 75 #username&#8221; &#8220;|exec \/usr\/bin\/mailfilter | \/usr\/bin\/procmail -Yf- || exit 75&#8221; \u306a\u3069\u306a\u3069\u306e\u9055\u3044\u3068\u610f\u5473\u306b\u3064\u3044\u3066\u3002\u4ee5\u4e0b\u3001smtpd\u306e\u4e2d\u8eab\u306e\u8b70\u8ad6\u306e\u969b\u306f\u3001postfix\u306e\u307f\u3092\u60f3\u5b9a\u3002 1. IFS\u3063\u3066\u4f55 IFS = Internal Field Separator\u306e\u7565 bash\u306a\u3069\u306e\u30b7\u30a7\u30eb\u3067\u306e\u5f15\u6570\u5c55\u958b\u306e\u969b\u306e\u53c2\u7167\u5909\u6570(\u74b0\u5883\u5909\u6570\uff1f)\u3068\u306a\u308b\u3002\u3067\u3001\u5909\u66f4\u3059\u308b\u3068\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30fc\u554f\u984c\u3092\u5f15\u304d\u8d77\u3053\u3059\u3001\u3068\u3044\u3046\u8b66\u544a\u3092\u3069\u3053\u304b\u306e\u30de\u30cb\u30e5\u30a2\u30eb\u3067\u898b\u305f\u3088\u3046\u306a\u3002 2. \u305d\u3082\u305d\u3082||\u3068\u304b&amp;&amp;\u3063\u3066\u4f55 || : \u524d\u306e\u30b3\u30de\u30f3\u30c9\u306e\u7d42\u4e86\u30b9\u30c6\u30fc\u30bf\u30b9\u304c0\u3067\u306a\u3044(\u7570\u5e38\u7d42\u4e86)\u306e\u3068\u304d\u306b\u5b9f\u884c &amp;&amp; : \u524d\u306e\u30b3\u30de\u30f3\u30c9\u306e\u7d42\u4e86\u30b9\u30c6\u30fc\u30bf\u30b9\u304c0\u306e\u3068\u304d\u306b\u5b9f\u884c \u3068\u3044\u3046\u3053\u3068\u3067\u3001\u666e\u901a\u306e\u30b7\u30a7\u30eb\u3092\u5b9f\u884c\u3059\u308b\u3068\u304d\u306e\u3068\u540c\u3058\u3067\u3059\u306a\u3002\u3069\u3061\u307f\u3061\u3001forward\u3092\u89e3\u91c8\u3059\u308blocal\u306f\u3001global\/pipe_command\u306b\u6295\u3052\u308b\u306e\u3067\u3001fork\/exec\u3059\u308b\u3060\u3051\u3060\u3063\u305f\u308a\u3057\u307e\u3059\u304c\u3002\u5834\u6240\u3068\u3057\u3066\u306flocal\/deliver_command()\u95a2\u6570\u3002 3. exit 75\u306f\uff1f posix shell\u3067\u306eexit\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c975\u306f\u3001EX_TEMPFAIL\u3067\u3001\u4e00\u6642\u30a8\u30e9\u30fc\u3092\u610f\u5473\u3059\u308b\u3002\u307e\u3041\u3001\u3082\u3046\u4e00\u5ea6\u5b9f\u884c\u3057\u305f\u3089\u6210\u529f\u3059\u308b\u304b\u3082\u306d\u3047\uff5e\u3001\u3068\u3001\u547c\u3073\u51fa\u3057\u3082\u3068\u306e\u30b3\u30de\u30f3\u30c9\u306b\u3044\u3046\u3001\u3068\u3044\u3046\u611f\u3058\u3002 \/usr\/include\/sysexits.h:#define EX_TEMPFAIL 75 \/* temp failure; user is invited to retry *\/ local\u3067\u306f\u3001\u6295\u3052\u3064\u3051\u305f\u30b3\u30de\u30f3\u30c9\u304b\u3089\u306e\u623b\u308a\u5024\u306a\u3069\u306f\u3001global\/pipe_command\u306e\u6700\u5f8c\u3067PIPE_STAT_*\u306b\u306a\u3063\u305f\u3082\u306e\u3092\u53d7\u3051\u53d6\u3063\u3066\u5224\u65ad\u3059\u308b\u3001\u306e\u3067\u3001\u7d42\u4e86\u30b9\u30c6\u30fc\u30bf\u30b9\u304c\u3069\u3046\u53cd\u6620\u3055\u308c\u308b\u304b\u306f\u3001\u3053\u3053\u3092\u898b\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,16,14],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.himor.in\/index.php?rest_route=\/wp\/v2\/posts\/26"}],"collection":[{"href":"https:\/\/blog.himor.in\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.himor.in\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.himor.in\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.himor.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=26"}],"version-history":[{"count":0,"href":"https:\/\/blog.himor.in\/index.php?rest_route=\/wp\/v2\/posts\/26\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.himor.in\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=26"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.himor.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=26"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.himor.in\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=26"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}