mirror of
https://github.com/rofl0r/proxychains-ng.git
synced 2024-12-21 11:48:57 +00:00
fix the never-ending issues with the wrong glibc prototype of getnameinfo
this bug was fixed shortly before 2.14 release, so we checked for that. however some distros decided to backport this fix to earlier versions, breaking our compiletime check. http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=e4ecafe004b3d4270b3a9dace8f970047400ed38 the portable solution is to stick the function into a separate comilation unit that does not see the glibc prototype. closes #7
This commit is contained in:
parent
b255484a42
commit
ce655fdac8
3
Makefile
3
Makefile
@ -15,7 +15,8 @@ sysconfdir=$(prefix)/etc
|
||||
|
||||
SRCS = $(sort $(wildcard src/*.c))
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
LOBJS = src/core.o src/common.o src/libproxychains.o src/shm.o \
|
||||
LOBJS = src/nameinfo.o \
|
||||
src/core.o src/common.o src/libproxychains.o src/shm.o \
|
||||
src/allocator_thread.o src/ip_type.o src/stringdump.o \
|
||||
src/hostentdb.o src/hash.o
|
||||
|
||||
|
@ -381,22 +381,16 @@ void freeaddrinfo(struct addrinfo *res) {
|
||||
return;
|
||||
}
|
||||
|
||||
// work around a buggy prototype in GLIBC. according to the bugtracker it has been fixed in git at 02 May 2011.
|
||||
// 2.14 came out in June 2011 so that should be the first fixed version
|
||||
#if defined(__GLIBC__) && (__GLIBC__ < 3) && (__GLIBC_MINOR__ < 14)
|
||||
int getnameinfo(const struct sockaddr *sa,
|
||||
socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, unsigned int flags)
|
||||
#else
|
||||
int getnameinfo(const struct sockaddr *sa,
|
||||
socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, int flags)
|
||||
#endif
|
||||
int pc_getnameinfo(const struct sockaddr *sa, socklen_t salen,
|
||||
char *host, socklen_t hostlen, char *serv,
|
||||
socklen_t servlen, int flags)
|
||||
{
|
||||
char ip_buf[16];
|
||||
int ret = 0;
|
||||
|
||||
INIT();
|
||||
|
||||
PDEBUG("getnameinfo: %s %s\n", host, serv);
|
||||
PFUNC();
|
||||
|
||||
if(!proxychains_resolver) {
|
||||
ret = true_getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
|
||||
|
13
src/nameinfo.c
Normal file
13
src/nameinfo.c
Normal file
@ -0,0 +1,13 @@
|
||||
#include <sys/socket.h>
|
||||
|
||||
extern int pc_getnameinfo(const void *sa, socklen_t salen,
|
||||
char *host, socklen_t hostlen, char *serv,
|
||||
socklen_t servlen, int flags);
|
||||
|
||||
|
||||
int getnameinfo(const void *sa, socklen_t salen,
|
||||
char *host, socklen_t hostlen, char *serv,
|
||||
socklen_t servlen, int flags) {
|
||||
return pc_getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user