fcorbelli / zpaqfranz

Deduplicating archiver with encryption and paranoid-level tests. Swiss army knife for the serious backup and disaster recovery manager. Ransomware neutralizer. Win/Linux/Unix
MIT License
279 stars 25 forks source link

Replace gethostbyname() with getaddrinfo() if IPV6 is defined #142

Closed ppisar closed 1 month ago

ppisar commented 1 month ago

gethostbyname() is deprecated by getaddrinfo(). The use of gethostbyname() triggers warnings in quality checks in Fedora distribution.

getaddrinfo() is defined in RFC 2553 and in POSIX.1-2001.

For compatibility, I guarded its use with a non-default IPV6 macro. But since getaddrinfo() is already exclusively used in SERVER code, I think it would make sense to make it default. If you indeed want to enforce IPv4, you can change AF_UNSPEC to AF_INET.

getaddrinfo() has benefits even without IPv6: It supports multi-homed servers when a single hostname has associcated multiple IP addresses.

https://github.com/fcorbelli/zpaqfranz/issues/141