[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[postfix-jp:02387] Re: Postfix-Cyrus LMTP problem



> Jan 19 23:48:18 mandheling lmtpd[8130]: refused connection from unknown

cyrus-imapd-2.1.11/master/{service,service-thread}.c
にこのメッセージを吐く部分がありました。

static int libwrap_ask(struct request_info *r, int fd)
{
    int a;
    struct sockaddr_in sin;
    socklen_t len = sizeof(sin);

    /* is this a connection from the local host? */
    if (getpeername(fd, (struct sockaddr *) &sin, &len) == 0) {
        if (sin.sin_family == AF_UNIX) {
            return 1;
        }
    }

    /* i hope using the sock_* functions are legal; it certainly makes
       this code very easy! */
    request_set(r, RQ_FILE, fd, 0);
    sock_host(r);

    a = hosts_access(r);
    if (!a) {
        syslog(deny_severity, "refused connection from %s", eval_client(r));
    }

    return a;
}

TCP wrapperのチェックで弾かれているようです。
でも、Unix domain socketなのになぜ? と思ったら、別のスレッドで

KIMURA Yasuhiro <yasu@xxxxxxxxxxx> wrote:
> 今ports/mail/cyrus-imapd2を見てみたら、パッチの中にファ
>  イルの場所に関するもの以外のものがいくつかあるようでしたので。

ということで見てみたところ、portsではこの部分に対してパッチを当ているようです。
http://www.jp.freebsd.org/cgi/cvsweb.cgi/ports/mail/cyrus-imapd2/files/patch-df?rev=1.3&content-type=text/x-cvsweb-markup

Revision 1.3, Thu Aug 15 16:10:56 2002 UTC (5 months ago) by ume 
Branch: MAIN 
CVS Tags: RELEASE_5_0_0, RELEASE_4_7_0, HEAD
Changes since 1.2: +5 -3 lines 

It seems getpeername() returns with no error but doesn't fill struct
sockaddr correctly against PF_UNIX socket under 5-CURRENT.  Because of
this behavior, PF_UNIX socket was always checked by libwrap.  This
work around prevents PF_UNIX socket from checking by libwrap to always
allow LMTP.


Index: master/service.c
diff -u master/service.c.orig master/service.c
--- master/service.c.orig       Thu Aug 15 06:02:41 2002
+++ master/service.c    Fri Aug 16 00:28:31 2002
@@ -103,8 +103,13 @@
     socklen_t len = sizeof(sin);
     
     /* is this a connection from the local host? */
+    memset(&sin, 0, len);
     if (getpeername(fd, (struct sockaddr *) &sin, &len) == 0) {
-       if (((struct sockaddr *)&sin)->sa_family == AF_UNIX) {
+       switch (((struct sockaddr *)&sin)->sa_family) {
+       case AF_INET:
+       case AF_INET6:
+           break;
+       default:
            return 1;
        }
     }

Follow-Ups
[postfix-jp:02391] Re: Postfix-Cyrus LMTP problem, Shuji Kono
References
[postfix-jp:02377] Re: Postfix-Cyrus LMTP problem, Shuji Kono
[postfix-jp:02380] Re: Postfix-Cyrus LMTP problem, Taoka Fumiyoshi
[postfix-jp:02384] Re: Postfix-Cyrus LMTP problem, Shuji Kono

[検索ページ] [Postfix-JP ML Home]