rofl0r / proxychains-ng

proxychains ng (new generation) - a preloader which hooks calls to sockets in dynamically linked programs and redirects it through one or more socks/http proxies. continuation of the unmaintained proxychains project. the sf.net page is currently not updated, use releases from github release page instead.
http://sourceforge.net/projects/proxychains-ng/files
GNU General Public License v2.0
9.82k stars 1.08k forks source link

[error]failed to detect getnameinfo signature #486

Closed enterusernamecontinue closed 1 year ago

enterusernamecontinue commented 1 year ago

CentOS 7.9.2009 need help.

[root@centos ~]# yum install -y git gcc
[root@centos ~]# git clone https://github.com/rofl0r/proxychains-ng.git
[root@centos proxychains-ng]# ./configure --prefix=/usr/local/proxychains --sysconfdir=/etc

checking whether C compiler works ... yes
checking whether C compiler understands -Wno-unknown-pragmas ... yes
checking whether getnameinfo() servlen argument is POSIX compliant (socklen_t) ... no
checking whether getnameinfo() flags argument is unsigned ... no
checking whether getnameinfo() servlen argument is size_t ... no
checking whether getnameinfo() servlen and nodelen argument is size_t ... no
failed to detect getnameinfo signature
rofl0r commented 1 year ago

please provide output of this command find /usr/ -name netdb.h -exec grep -C 2 getnameinfo {} \; 2>/dev/null

enterusernamecontinue commented 1 year ago

please provide output of this command find /usr/ -name netdb.h -exec grep -C 2 getnameinfo {} \; 2>/dev/null

[root@centos ~]# find /usr/ -name netdb.h -exec grep -C 2 getnameinfo {} \; 2>/dev/null
#ifdef __USE_GNU
/* Scope delimiter for getaddrinfo(), getnameinfo().  */
# define SCOPE_DELIMITER        '%'
#endif
--
   This function is a possible cancellation point and therefore not
   marked with __THROW.  */
extern int getnameinfo (const struct sockaddr *__restrict __sa,
                        socklen_t __salen, char *__restrict __host,
                        socklen_t __hostlen, char *__restrict __serv,
rofl0r commented 1 year ago

please use -C 5 so we get the full prototype of the func, it seems to be spawning multiple lines

enterusernamecontinue commented 1 year ago

please use -C 5 so we get the full prototype of the func, it seems to be spawning multiple lines

[root@centos ~]# find /usr/ -name netdb.h -exec grep -C 5 getnameinfo {} \; 2>/dev/null
/* Highest reserved Internet port number.  */
# define IPPORT_RESERVED        1024
#endif

#ifdef __USE_GNU
/* Scope delimiter for getaddrinfo(), getnameinfo().  */
# define SCOPE_DELIMITER        '%'
#endif

#ifdef __USE_MISC
/* Print error indicated by `h_errno' variable on standard error.  STR
--

/* Translate a socket address to a location and service name.

   This function is a possible cancellation point and therefore not
   marked with __THROW.  */
extern int getnameinfo (const struct sockaddr *__restrict __sa,
                        socklen_t __salen, char *__restrict __host,
                        socklen_t __hostlen, char *__restrict __serv,
                        socklen_t __servlen, int __flags);
#endif  /* POSIX */
rofl0r commented 1 year ago

thanks, can you also paste output of cc -v --version ?

enterusernamecontinue commented 1 year ago

@rofl0r thanks.

[root@centos ~]# cc -v --version
Using built-in specs.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
cc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
COLLECT_GCC_OPTIONS='-v' '--version' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/cc1 -quiet -v help-dummy -quiet -dumpbase help-dummy -mtune=generic -march=x86-64 -auxbase help-dummy -version --version -o /tmp/cc2O3Pl7.s
GNU C (GCC) version 4.8.5 20150623 (Red Hat 4.8.5-44) (x86_64-redhat-linux)
        compiled by GNU C version 4.8.5 20150623 (Red Hat 4.8.5-44), GMP version 6.0.0, MPFR version 3.1.1, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=92 --param ggc-min-heapsize=117854
COLLECT_GCC_OPTIONS='-v' '--version' '-mtune=generic' '-march=x86-64'
 as -v --64 --version -o /tmp/cc4QXQsE.o /tmp/cc2O3Pl7.s
GNU assembler version 2.27 (x86_64-redhat-linux) using BFD version version 2.27-44.base.el7
GNU assembler version 2.27-44.base.el7
Copyright (C) 2016 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-redhat-linux'.
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '--version' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2 --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 --version /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. /tmp/cc4QXQsE.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o
collect2 version 4.8.5 20150623 (Red Hat 4.8.5-44)
/usr/bin/ld --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 --version /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. /tmp/cc4QXQsE.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o
GNU ld version 2.27-44.base.el7
Copyright (C) 2016 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
rofl0r commented 1 year ago

ok, it seems that your specific compiler version doesn't like a prototype with __restrict removed, but to make sure, please paste the following snippet into a file called test.c and then run cc test.c and provide me with the output it produces, thanks.

#define _GNU_SOURCE
#include <netdb.h>
int getnameinfo(const struct sockaddr *, socklen_t, char *, socklen_t, char *, socklen_t, int);
int main() {
return 0;
}
rofl0r commented 1 year ago

oh, while you're at it, please also do cc -E test.c -o test.i and upload the contents of test.i somewhere as its contents are likely too big for being pasted into a comment (you could rename it to test.txt and attach to a comment here on github, or upload to a pastebin like 0x0.st)

enterusernamecontinue commented 1 year ago

ok, it seems that your specific compiler version doesn't like a prototype with __restrict removed, but to make sure, please paste the following snippet into a file called test.c and then run cc test.c and provide me with the output it produces, thanks.

#define _GNU_SOURCE
#include <netdb.h>
int getnameinfo(const struct sockaddr *, socklen_t, char *, socklen_t, char *, socklen_t, int);
int main() {
return 0;
}
[root@centos ~]# vi test.c
[root@centos ~]# cc test.c
In file included from /usr/include/sys/socket.h:39:0,
                 from /usr/include/netinet/in.h:24,
                 from /usr/include/netdb.h:27,
                 from test.c:2:[root@hz ~]# cc -E test.c -o test.i
In file included from /usr/include/sys/socket.h:39:0,
                 from /usr/include/netinet/in.h:24,
                 from /usr/include/netdb.h:27,
                 from test.c:2:
/usr/include/bits/socket.h:350:24: fatal error: asm/socket.h: No such file or directory
 #include <asm/socket.h>
                        ^
compilation terminated.

oh, while you're at it, please also do cc -E test.c -o test.i and upload the contents of test.i somewhere as its contents are likely too big for being pasted into a comment (you could rename it to test.txt and attach to a comment here on github, or upload to a pastebin like 0x0.st)

[root@centos ~]# cc -E test.c -o test.i
In file included from /usr/include/sys/socket.h:39:0,
                 from /usr/include/netinet/in.h:24,
                 from /usr/include/netdb.h:27,
                 from test.c:2:
/usr/include/bits/socket.h:350:24: fatal error: asm/socket.h: No such file or directory
 #include <asm/socket.h>
                        ^
compilation terminated.

[root@centos ~]# ll
[root@centos ~]# find / -name 'test.i'
[root@centos ~]# cc -E test.c > test.txt

test.txt

rofl0r commented 1 year ago

thanks. the issue is because your libc header installation isn't complete. on centos you need to install the packages glibc-headers and kernel-headers. i added a check to configure to provide a better error message.