From owner-freebsd-isp Mon Jan 25 16:21:57 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA10312 for freebsd-isp-outgoing; Mon, 25 Jan 1999 16:21:57 -0800 (PST) (envelope-from owner-freebsd-isp@FreeBSD.ORG) Received: from mcclane2.erols.com (mcclane2.erols.com [209.122.46.49]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA10304 for ; Mon, 25 Jan 1999 16:21:54 -0800 (PST) (envelope-from jon@mcclane2.erols.com) Received: from mcclane2.erols.com ([192.168.2.2]) by mcclane2.erols.com (8.8.7/8.8.7) with ESMTP id PAA16533; Mon, 25 Jan 1999 15:13:59 -0500 Message-Id: <199901252013.PAA16533@mcclane2.erols.com> Date: Mon, 25 Jan 1999 19:19:30 -0500 (EST) From: jwhite@cryogen.com Subject: Re: dummy-pop3 server To: root@swimsuit.internet.dk cc: freebsd-isp@FreeBSD.ORG In-Reply-To: MIME-Version: 1.0 Content-Type: TEXT/plain; CHARSET=US-ASCII Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org #!/usr/bin/perl -Tw require 5.003; use strict; use Socket; use Carp; sub spawn; # forward declaration my $port = 110; my $proto = getprotobyname('tcp'); socket(Server, PF_INET, SOCK_STREAM, $proto) or die "socket: $!"; setsockopt(Server, SOL_SOCKET, SO_REUSEADDR, pack("l", 1)) or die "setsockopt: $!"; bind(Server, sockaddr_in($port, INADDR_ANY)) or die "bind: $!"; listen(Server,SOMAXCONN) or die "listen: $!"; my $waitedpid = 0; my $paddr; sub REAPER { $SIG{CHLD} = \&REAPER; # if you don't have sigaction(2) $waitedpid = wait; } $SIG{CHLD} = \&REAPER; for ( ; $paddr = accept(Client,Server); close Client) { my($port,$iaddr) = sockaddr_in($paddr); my $name = gethostbyaddr($iaddr,AF_INET); spawn sub { print "Hey dummy, we have moved the pop3-server; don't use this ip-adress, use the name: mail.our.domain instead.\n"; }; } sub spawn { my $coderef = shift; unless (@_ == 0 && $coderef && ref($coderef) eq 'CODE') { confess "usage: spawn CODEREF"; } my $pid; if (!defined($pid = fork)) { return; } elsif ($pid) { return; # i'm the parent } # else i'm the child -- go spawn open(STDIN, "<&Client") or die "can't dup client to stdin"; open(STDOUT, ">&Client") or die "can't dup client to stdout"; ## open(STDERR, ">&STDOUT") or die "can't dup stdout to stderr"; exit &$coderef(); } #So I was bored :) On 26 Jan, Leif Neland wrote: > I'm looking for a dummy pop3-server, which can authorize anybody, and just > send a single message: 'Hey dummy, we have moved the pop3-server; don't > use this ip-adress, use the name: "mail.our.domain" instead.' > > leif@neland.dk > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-isp" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message