Re: [exim] lmtp delivery to cyrus store over unix socket req…

Góra strony
Delete this message
Reply to this message
Autor: Stephen Gran
Data:  
Dla: exim-users
Temat: Re: [exim] lmtp delivery to cyrus store over unix socket requires /etc/hosts.allow entry. why?
On Tue, Oct 18, 2005 at 09:20:51AM -0700, OpenMacNews said:
> hi,
>
> Tony Finch wrote:
> > On Tue, 18 Oct 2005, OpenMacNews wrote:
> >> if there's a check you can suggest i can run to help clarify, happy to
> >> do so ...
> >
> > Not a trivial one or I would have done it myself :-)
>
> well, i didn't want to presume ... you could be 'occupied' at a pub, or sumthin' ;-)
>
> > The thing to do is to
> > write something to call getpeername() on a connected unix domain socket
> > and print the result.
> >
> >>> 0.0.0.0 is a synonym for localhost.
> >> clear. just odd to me that they'd use 0.0.0.0, and that the "ususal"
> >> 127.0.0.1 or 'localhost' entries in hosts.allow are simply
> >> infeffectual/ignored.
> >
> > 0.0.0.0 would make sense if the socket address were unset or incorrectly
> > set.
>
> hmmm ... food for thought while i read-up. sounds like it's worth posting on info-cyrus, too.


A quick perl hack that may do (rough and untested, but you get the idea):

use Socket;
my $sockname = "/tmp/test.sock";
socket(UNIX, PF_UNIX, SOCK_STREAM, 0) || die "socket: $!";
unlink($sockname);
bind(UNIX, sockaddr_un($sockname)) || die "bind: $!";
chmod(0666, $sockname);
listen(UNIX, SOMAXCONN) || die "listen: $!";
close(STDIN);
close(STDOUT);
while (1)
{
    @conn = accept(C, UNIX);
    printf STDERR("sock is %s, peer is %s\n", $conn[0], $conn[1]);
    sysread(C, $_, 1024);
    close(C);
}


And then dump something into it somehow (another short script that
writes to it, or the netcat that talks to sockets). The bit here is
that accept on a socket in perl in list context returns a 2 element
array containing the peer as the second element, so it becomes easy for
you to test the result of getpeerbyname().

Take care,
--
--------------------------------------------------------------------------
|  Stephen Gran                  | Money is the root of all wealth.        |
|  steve@???             |                                         |
|  http://www.lobefin.net/~steve |                                         |

--------------------------------------------------------------------------