https://gitlab.synchro.net/main/sbbs/-/commit/0ed3f6b3f2b2827cb3ec6a03
Modified Files:
src/xpdev/netwrap.c
Log Message:
xpdev: an IPv6 address resolved to the local host's name
xp_inet_pton() returns 1 on success, 0 when the string is numeric but not
of the requested address family, and -1 when it doesn't parse at all. getHostNameByAddr() and isValidAddressString() tested for "not -1", so the
0 case counted as success.
That gave getHostNameByAddr() a wrong answer rather than no answer: an
IPv6 argument took the IPv4 branch with sin_addr never written, and getnameinfo() on the resulting 0.0.0.0 succeeds, returning the local
host's name. Every IPv6 address reverse-resolved to the local machine,
the QWK message from_host stamp included.
isValidAddressString() arrived at the right answer either way -- an IPv6
string that returns 0 from the AF_INET call is accepted there, where the
strict test accepts it from the AF_INET6 call instead -- and changes with
it for the contract rather than the behavior.
The comparison arrived with 775e87a614 (2026-03-21) in
getHostNameByAddr(); isValidAddressString() predates it. The test harness
keeps the const on the result it prints.
Co-Authored-By: Claude Opus 5 (1M context) <
noreply@anthropic.com>
--- SBBSecho 3.37-Linux
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)