Hi All,
I'm running into a problem with a pretty old freeware perl script called
"readnews" it is in an archive named "readnews-1.85.tar.gz" that is
available here:
http://web.archive.org/web/20080616183736/http://www.scn.org/~bb615/scripts/readnews-1.85.tar.gz
I used these plus inn to create a private bulletin board setup. The
system works perfectly under FreeBSD 6.4 running perl 5.8.8, and appears
to work under Ubuntu running perl 5.10.1 but fails immediately under
FreeBSD 8.1 running perl 5.10.1
The problem is in this fragment of listgroups.pl:
.
.
.
sub ConnectToNewsServer
{
# get news host name
($name, $aliases, $proto) = getprotobyname ('tcp');
if ($port !~ /^\d+$/)
{
($name, $aliases, $port) = getservbyname ($port, 'tcp');
}
if ($newshost =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/)
{
$thataddr = pack ('C4', $1, $2, $3, $4);
}
else
{
if ($newshost =~ /(\w+)(\.\w+)*/)
{
($name, $aliases, $type, $len, $thataddr) = gethostbyname
($newshost);
}
else
{
print "Error: NNTP host not specified in proper format\n";
exit 1;
}
}
# get socket
$this = pack ($sockaddr, $AF_INET, 0, $thisaddr);
$that = pack ($sockaddr, $AF_INET, $port, $thataddr);
if (!socket (S, $AF_INET, $SOCK_STREAM, $proto))
{
print "Error: socket failed $1\n";
exit 1;
}
# bind to socket
if (!bind (S, $this))
{
print "Error: bind to $this failed $1\n";
exit 1;
}
# connect to socket
if (!connect (S, $that))
{
print "Can't connect to $newshost tcp/ip port $port. Error: $1\n";
exit 1;
}
# buffer the socket
select (S);
$| = 1;
select (STDOUT);
# read server status
$_ = <S>;
($status, $rest) = split (/ /, $_, 2);
if ($status == 200 || $status == 201)
{
# 200 server ready - posting allowed
# 201 server ready - no posting allowed
}
else
{
print "$newshost refused connection: status $status - $rest\n";
exit 0;
}
}
Everytime I run it I get the immediate error
"Can't connect to XXXX tcp/ip port 119. Error: "
(I removed the name of the actual server system)
I've tried this on several FreeBSD systems and get the same problem
on all of them.
If it was a firewall thing I would expect the code to hang
then fail, but this just exits immediately, like it can't
create the socket.
I know the code is a decade old and probably isn't the
recommended way of doing things nowadays but we want to
upgrade the server and this is what is keeping me from
doing it, and I don't want to really tear into the thing
and use something else.
Any suggestions?
Thanks,
Ted
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/