Package: trn4
Version: 4.0-test77-16
Severity: minor
Tags: patch
news.eternal-september.org is currently down. The error shown is:
Connecting to news.eternal-september.org...connection to 2.0.0.119: Connection
refused
trying a00:77::2a01:4f9:4b:44c2...connection to a00:77::2a01:4f9:4b:44c2:
Network is unreachable
giving up... connect: Network is unreachable
failed.
However, the IP addresses for news.eternal-september.org are:
$ host news.eternal-september.org
news.eternal-september.org has address 135.181.20.170
news.eternal-september.org has IPv6 address 2a01:4f9:4b:44c2::2
The inet_ntop() function is not passed the correct address.
The attached patch fixes this (and a minor compiler warning about
"possible use before initialization").
Thanks,
Paul
-- System Information:
Debian Release: 12.9
APT prefers stable
APT policy: (800, 'stable'), (500, 'stable-updates'), (500,
'stable-security'), (500, 'unstable'), (500, 'oldstable'), (100,
'bookworm-fasttrack'), (100, 'bookworm-backports-staging')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 6.12.10-amd64 (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8),
LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: sysvinit (via /sbin/init)
LSM: AppArmor: enabled
Versions of packages trn4 depends on:
ii debconf [debconf-2.0] 1.5.82
ii libc6 2.36-9+deb12u9
ii libtinfo6 6.4-4
Versions of packages trn4 recommends:
ii exim4-daemon-heavy [mail-transport-agent] 4.96-15+deb12u6
ii inn2-inews [inews] 2.7.1-1+deb12u1
Versions of packages trn4 suggests:
ii ispell 3.4.05-1
-- debconf information excluded
--- nntpinit.c.orig 2025-03-03 11:52:07.000000000 +0100
+++ nntpinit.c 2025-03-03 11:52:23.756402341 +0100
@@ -136,7 +136,7 @@
int port;
char* service;
{
- int s;
+ int s = -1;
#if INET6
struct addrinfo hints;
struct addrinfo* res;
@@ -157,14 +157,22 @@
return -1;
}
for (res = res0; res; res = res->ai_next) {
- char buf[64] = "";
+ char buf[INET6_ADDRSTRLEN+1] = "";
s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (s < 0) {
cause = "socket";
continue;
}
- inet_ntop(res->ai_family, res->ai_addr, buf, sizeof buf);
+ if (res->ai_family == AF_INET) {
+ struct sockaddr_in *sockin = (struct sockaddr_in *)res->ai_addr;
+ inet_ntop(res->ai_family, &sockin->sin_addr, buf, sizeof(buf));
+ }
+ else {
+ struct sockaddr_in6 *sockin6 = (struct sockaddr_in6 *)res->ai_addr;
+ inet_ntop(res->ai_family, &(sockin6->sin6_addr), buf, sizeof(buf));
+ }
+
if (res != res0)
fprintf(stderr, "trying %s...", buf);