Linux vps-61133.fhnet.fr 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
Apache/2.4.25 (Debian)
Server IP : 93.113.207.21 & Your IP : 216.73.216.35
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
src /
Python-3.10.14 /
Modules /
Delete
Unzip
Name
Size
Permission
Date
Action
_blake2
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
_ctypes
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
_decimal
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
_io
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
_multiprocessing
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
_sha3
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
_sqlite
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
_ssl
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
_xxtestfuzz
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
cjkcodecs
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
clinic
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
expat
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
README
112
B
-rw-r--r--
2024-03-19 22:46
Setup
15.15
KB
-rw-r--r--
2024-03-19 22:46
Setup.local
41
B
-rw-r--r--
2025-06-04 09:17
_abc.c
26.09
KB
-rw-r--r--
2024-03-19 22:46
_abc.gcda
8.21
KB
-rw-r--r--
2025-06-04 09:21
_abc.o
228.27
KB
-rw-r--r--
2025-06-04 09:22
_asynciomodule.c
88.39
KB
-rw-r--r--
2024-03-19 22:46
_bisectmodule.c
8.03
KB
-rw-r--r--
2024-03-19 22:46
_bz2module.c
23.65
KB
-rw-r--r--
2024-03-19 22:46
_codecsmodule.c
32.8
KB
-rw-r--r--
2024-03-19 22:46
_codecsmodule.gcda
13.72
KB
-rw-r--r--
2025-06-04 09:21
_codecsmodule.o
374.94
KB
-rw-r--r--
2025-06-04 09:22
_collectionsmodule.c
79.83
KB
-rw-r--r--
2024-03-19 22:46
_collectionsmodule.gcda
14.42
KB
-rw-r--r--
2025-06-04 09:21
_collectionsmodule.o
325.15
KB
-rw-r--r--
2025-06-04 09:22
_contextvarsmodule.c
1.57
KB
-rw-r--r--
2024-03-19 22:46
_cryptmodule.c
1.66
KB
-rw-r--r--
2024-03-19 22:46
_csv.c
50.09
KB
-rw-r--r--
2024-03-19 22:46
_curses_panel.c
18.6
KB
-rw-r--r--
2024-03-19 22:46
_cursesmodule.c
135.6
KB
-rw-r--r--
2024-03-19 22:46
_datetimemodule.c
219.13
KB
-rw-r--r--
2024-03-19 22:46
_dbmmodule.c
14.9
KB
-rw-r--r--
2024-03-19 22:46
_elementtree.c
124.95
KB
-rw-r--r--
2024-03-19 22:46
_functoolsmodule.c
45.07
KB
-rw-r--r--
2024-03-19 22:46
_functoolsmodule.gcda
11.74
KB
-rw-r--r--
2025-06-04 09:21
_functoolsmodule.o
268.69
KB
-rw-r--r--
2025-06-04 09:22
_gdbmmodule.c
21.25
KB
-rw-r--r--
2024-03-19 22:46
_hashopenssl.c
59.7
KB
-rw-r--r--
2024-03-19 22:46
_heapqmodule.c
21.78
KB
-rw-r--r--
2024-03-19 22:46
_iomodule.gcda
6.99
KB
-rw-r--r--
2025-06-04 09:21
_iomodule.o
186.38
KB
-rw-r--r--
2025-06-04 09:22
_json.c
57.57
KB
-rw-r--r--
2024-03-19 22:46
_localemodule.c
22.29
KB
-rw-r--r--
2024-03-19 22:46
_localemodule.gcda
8.57
KB
-rw-r--r--
2025-06-04 09:21
_localemodule.o
181.06
KB
-rw-r--r--
2025-06-04 09:22
_lsprof.c
25.89
KB
-rw-r--r--
2024-03-19 22:46
_lzmamodule.c
48.65
KB
-rw-r--r--
2024-03-19 22:46
_math.c
7.33
KB
-rw-r--r--
2024-03-19 22:46
_math.gcda
2.29
KB
-rw-r--r--
2025-06-04 09:21
_math.h
1007
B
-rw-r--r--
2024-03-19 22:46
_math.o
32.3
KB
-rw-r--r--
2025-06-04 09:22
_opcode.c
2.14
KB
-rw-r--r--
2024-03-19 22:46
_operator.c
46.15
KB
-rw-r--r--
2024-03-19 22:46
_operator.gcda
13.14
KB
-rw-r--r--
2025-06-04 09:21
_operator.o
333.74
KB
-rw-r--r--
2025-06-04 09:22
_pickle.c
229.53
KB
-rw-r--r--
2024-03-19 22:46
_posixsubprocess.c
36.98
KB
-rw-r--r--
2024-03-19 22:46
_queuemodule.c
12.31
KB
-rw-r--r--
2024-03-19 22:46
_randommodule.c
17.76
KB
-rw-r--r--
2024-03-19 22:46
_scproxy.c
6.08
KB
-rw-r--r--
2024-03-19 22:46
_sre.c
79.74
KB
-rw-r--r--
2024-03-19 22:46
_sre.gcda
34.64
KB
-rw-r--r--
2025-06-04 09:21
_sre.o
975.16
KB
-rw-r--r--
2025-06-04 09:22
_ssl.c
186.63
KB
-rw-r--r--
2024-03-19 22:46
_ssl.h
2.08
KB
-rw-r--r--
2024-03-19 22:46
_ssl_data.h
203.14
KB
-rw-r--r--
2024-03-19 22:46
_ssl_data_111.h
208.74
KB
-rw-r--r--
2024-03-19 22:46
_ssl_data_300.h
275.25
KB
-rw-r--r--
2024-03-19 22:46
_stat.c
15.18
KB
-rw-r--r--
2024-03-19 22:46
_stat.gcda
5.7
KB
-rw-r--r--
2025-06-04 09:21
_stat.o
69.77
KB
-rw-r--r--
2025-06-04 09:22
_statisticsmodule.c
4.83
KB
-rw-r--r--
2024-03-19 22:46
_struct.c
68.85
KB
-rw-r--r--
2024-03-19 22:46
_testbuffer.c
82.19
KB
-rw-r--r--
2024-03-19 22:46
_testcapimodule.c
217.47
KB
-rw-r--r--
2024-03-19 22:46
_testclinic.c
22.92
KB
-rw-r--r--
2024-03-19 22:46
_testimportmultiple.c
1.1
KB
-rw-r--r--
2024-03-19 22:46
_testinternalcapi.c
10.76
KB
-rw-r--r--
2024-03-19 22:46
_testmultiphase.c
23.38
KB
-rw-r--r--
2024-03-19 22:46
_threadmodule.c
50.27
KB
-rw-r--r--
2024-03-19 22:46
_threadmodule.gcda
10.46
KB
-rw-r--r--
2025-06-04 09:21
_threadmodule.o
250.8
KB
-rw-r--r--
2025-06-04 09:22
_tkinter.c
93.36
KB
-rw-r--r--
2024-03-19 22:46
_tracemalloc.c
44.86
KB
-rw-r--r--
2024-03-19 22:46
_tracemalloc.gcda
12.51
KB
-rw-r--r--
2025-06-04 09:21
_tracemalloc.o
262.77
KB
-rw-r--r--
2025-06-04 09:22
_uuidmodule.c
3
KB
-rw-r--r--
2024-03-19 22:46
_weakref.c
4.92
KB
-rw-r--r--
2024-03-19 22:46
_weakref.gcda
4.24
KB
-rw-r--r--
2025-06-04 09:21
_weakref.o
84.91
KB
-rw-r--r--
2025-06-04 09:22
_winapi.c
66.78
KB
-rw-r--r--
2024-03-19 22:46
_xxsubinterpretersmodule.c
67.74
KB
-rw-r--r--
2024-03-19 22:46
_zoneinfo.c
73.89
KB
-rw-r--r--
2024-03-19 22:46
addrinfo.h
5.88
KB
-rw-r--r--
2024-03-19 22:46
arraymodule.c
87.46
KB
-rw-r--r--
2024-03-19 22:46
atexitmodule.c
7.29
KB
-rw-r--r--
2024-03-19 22:46
atexitmodule.gcda
4.45
KB
-rw-r--r--
2025-06-04 09:21
atexitmodule.o
97.11
KB
-rw-r--r--
2025-06-04 09:22
audioop.c
59.71
KB
-rw-r--r--
2024-03-19 22:46
binascii.c
54.76
KB
-rw-r--r--
2024-03-19 22:46
bufferedio.gcda
20.46
KB
-rw-r--r--
2025-06-04 09:21
bufferedio.o
414.2
KB
-rw-r--r--
2025-06-04 09:22
bytesio.gcda
10.84
KB
-rw-r--r--
2025-06-04 09:21
bytesio.o
220.71
KB
-rw-r--r--
2025-06-04 09:22
cmathmodule.c
42.3
KB
-rw-r--r--
2024-03-19 22:46
config.c
3.21
KB
-rw-r--r--
2025-06-04 09:17
config.c.in
1.58
KB
-rw-r--r--
2024-03-19 22:46
config.o
34.5
KB
-rw-r--r--
2025-06-04 09:22
errnomodule.c
27.08
KB
-rw-r--r--
2024-03-19 22:46
errnomodule.gcda
8.02
KB
-rw-r--r--
2025-06-04 09:21
errnomodule.o
113.31
KB
-rw-r--r--
2025-06-04 09:22
faulthandler.c
40.52
KB
-rw-r--r--
2024-03-19 22:46
faulthandler.gcda
9.1
KB
-rw-r--r--
2025-06-04 09:21
faulthandler.o
147.28
KB
-rw-r--r--
2025-06-04 09:22
fcntlmodule.c
20.49
KB
-rw-r--r--
2024-03-19 22:46
fileio.gcda
9.01
KB
-rw-r--r--
2025-06-04 09:21
fileio.o
227.98
KB
-rw-r--r--
2025-06-04 09:22
gc_weakref.txt
11.19
KB
-rw-r--r--
2024-03-19 22:46
gcmodule.c
77.27
KB
-rw-r--r--
2024-03-19 22:46
gcmodule.gcda
11.63
KB
-rw-r--r--
2025-06-04 09:21
gcmodule.o
306.44
KB
-rw-r--r--
2025-06-04 09:22
getaddrinfo.c
18.38
KB
-rw-r--r--
2024-03-19 22:46
getbuildinfo.c
1.28
KB
-rw-r--r--
2024-03-19 22:46
getbuildinfo.gcda
3.59
KB
-rw-r--r--
2025-06-04 09:21
getbuildinfo.o
33.84
KB
-rw-r--r--
2025-06-04 09:22
getnameinfo.c
6.18
KB
-rw-r--r--
2024-03-19 22:46
getpath.c
44.99
KB
-rw-r--r--
2024-03-19 22:46
getpath.gcda
8.82
KB
-rw-r--r--
2025-06-04 09:21
getpath.o
160.52
KB
-rw-r--r--
2025-06-04 09:22
grpmodule.c
8.52
KB
-rw-r--r--
2024-03-19 22:46
hashlib.h
2.09
KB
-rw-r--r--
2024-03-19 22:46
iobase.gcda
9.63
KB
-rw-r--r--
2025-06-04 09:21
iobase.o
189.36
KB
-rw-r--r--
2025-06-04 09:22
itertoolsmodule.c
153.67
KB
-rw-r--r--
2024-03-19 22:46
itertoolsmodule.gcda
27.9
KB
-rw-r--r--
2025-06-04 09:21
itertoolsmodule.o
721.27
KB
-rw-r--r--
2025-06-04 09:22
ld_so_aix
6.12
KB
-rwxr-xr-x
2025-06-04 09:17
ld_so_aix.in
6.11
KB
-rw-r--r--
2024-03-19 22:46
main.c
17.65
KB
-rw-r--r--
2024-03-19 22:46
main.gcda
7.28
KB
-rw-r--r--
2025-06-04 09:21
main.o
147.24
KB
-rw-r--r--
2025-06-04 09:22
makesetup
7.67
KB
-rwxr-xr-x
2024-03-19 22:46
makexp_aix
2.67
KB
-rwxr-xr-x
2024-03-19 22:46
mathmodule.c
106.2
KB
-rw-r--r--
2024-03-19 22:46
md5module.c
15.51
KB
-rw-r--r--
2024-03-19 22:46
mmapmodule.c
47.75
KB
-rw-r--r--
2024-03-19 22:46
nismodule.c
12.89
KB
-rw-r--r--
2024-03-19 22:46
ossaudiodev.c
37.49
KB
-rw-r--r--
2024-03-19 22:46
overlapped.c
53.65
KB
-rw-r--r--
2024-03-19 22:46
posixmodule.c
413.46
KB
-rw-r--r--
2024-03-19 22:46
posixmodule.gcda
67.8
KB
-rw-r--r--
2025-06-04 09:21
posixmodule.h
791
B
-rw-r--r--
2024-03-19 22:46
posixmodule.o
1.49
MB
-rw-r--r--
2025-06-04 09:22
pwdmodule.c
8.89
KB
-rw-r--r--
2024-03-19 22:46
pwdmodule.gcda
4.96
KB
-rw-r--r--
2025-06-04 09:21
pwdmodule.o
84.35
KB
-rw-r--r--
2025-06-04 09:22
pyexpat.c
60.39
KB
-rw-r--r--
2024-03-19 22:46
readline.c
40.06
KB
-rw-r--r--
2024-03-19 22:46
resource.c
13.77
KB
-rw-r--r--
2024-03-19 22:46
rotatingtree.c
3.39
KB
-rw-r--r--
2024-03-19 22:46
rotatingtree.h
924
B
-rw-r--r--
2024-03-19 22:46
selectmodule.c
70.06
KB
-rw-r--r--
2024-03-19 22:46
sha1module.c
14.76
KB
-rw-r--r--
2024-03-19 22:46
sha256module.c
22.5
KB
-rw-r--r--
2024-03-19 22:46
sha512module.c
27.29
KB
-rw-r--r--
2024-03-19 22:46
signalmodule.c
52.45
KB
-rw-r--r--
2024-03-19 22:46
signalmodule.gcda
11.11
KB
-rw-r--r--
2025-06-04 09:21
signalmodule.o
235.02
KB
-rw-r--r--
2025-06-04 09:22
socketmodule.c
243.34
KB
-rw-r--r--
2024-03-19 22:46
socketmodule.h
8.56
KB
-rw-r--r--
2024-03-19 22:46
spwdmodule.c
6.69
KB
-rw-r--r--
2024-03-19 22:46
sre.h
2.83
KB
-rw-r--r--
2024-03-19 22:46
sre_constants.h
2.81
KB
-rw-r--r--
2024-03-19 22:46
sre_lib.h
52.08
KB
-rw-r--r--
2024-03-19 22:46
stringio.gcda
9.64
KB
-rw-r--r--
2025-06-04 09:21
stringio.o
193.45
KB
-rw-r--r--
2025-06-04 09:22
symtablemodule.c
3.67
KB
-rw-r--r--
2024-03-19 22:46
symtablemodule.gcda
4.25
KB
-rw-r--r--
2025-06-04 09:21
symtablemodule.o
55.01
KB
-rw-r--r--
2025-06-04 09:22
syslogmodule.c
10.64
KB
-rw-r--r--
2024-03-19 22:46
termios.c
22.52
KB
-rw-r--r--
2024-03-19 22:46
testcapi_long.h
6.77
KB
-rw-r--r--
2024-03-19 22:46
textio.gcda
23.51
KB
-rw-r--r--
2025-06-04 09:21
textio.o
645.09
KB
-rw-r--r--
2025-06-04 09:22
timemodule.c
57.23
KB
-rw-r--r--
2024-03-19 22:46
timemodule.gcda
8.3
KB
-rw-r--r--
2025-06-04 09:21
timemodule.o
177.2
KB
-rw-r--r--
2025-06-04 09:22
tkappinit.c
4.71
KB
-rw-r--r--
2024-03-19 22:46
tkinter.h
881
B
-rw-r--r--
2024-03-19 22:46
unicodedata.c
44.69
KB
-rw-r--r--
2024-03-19 22:46
unicodedata_db.h
531.75
KB
-rw-r--r--
2024-03-19 22:46
unicodename_db.h
2.12
MB
-rw-r--r--
2024-03-19 22:46
winreparse.h
1.59
KB
-rw-r--r--
2024-03-19 22:46
xxlimited.c
9.23
KB
-rw-r--r--
2024-03-19 22:46
xxlimited_35.c
6.88
KB
-rw-r--r--
2024-03-19 22:46
xxmodule.c
12.56
KB
-rw-r--r--
2024-03-19 22:46
xxsubtype.c
10.78
KB
-rw-r--r--
2024-03-19 22:46
xxsubtype.gcda
4.45
KB
-rw-r--r--
2025-06-04 09:21
xxsubtype.o
54.38
KB
-rw-r--r--
2025-06-04 09:22
zlibmodule.c
46.52
KB
-rw-r--r--
2024-03-19 22:46
Save
Rename
/* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /* * "#ifdef FAITH" part is local hack for supporting IPv4-v6 translator. * * Issues to be discussed: * - Thread safe-ness must be checked. * - Return values. There are nonstandard return values defined and used * in the source code. This is because RFC2133 is silent about which error * code must be returned for which situation. * - PF_UNSPEC case would be handled in getipnodebyname() with the AI_ALL flag. */ #if 0 #include <sys/types.h> #include <sys/param.h> #include <sys/sysctl.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <arpa/nameser.h> #include <netdb.h> #include <resolv.h> #include <string.h> #include <stdlib.h> #include <stddef.h> #include <ctype.h> #include <unistd.h> #include "addrinfo.h" #endif #if defined(__KAME__) && defined(ENABLE_IPV6) # define FAITH #endif #define SUCCESS 0 #define GAI_ANY 0 #define YES 1 #define NO 0 #ifdef FAITH static int translate = NO; static struct in6_addr faith_prefix = IN6ADDR_GAI_ANY_INIT; #endif static const char in_addrany[] = { 0, 0, 0, 0 }; static const char in6_addrany[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const char in_loopback[] = { 127, 0, 0, 1 }; static const char in6_loopback[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; struct sockinet { u_char si_len; u_char si_family; u_short si_port; }; static struct gai_afd { int a_af; int a_addrlen; int a_socklen; int a_off; const char *a_addrany; const char *a_loopback; } gai_afdl [] = { #ifdef ENABLE_IPV6 #define N_INET6 0 {PF_INET6, sizeof(struct in6_addr), sizeof(struct sockaddr_in6), offsetof(struct sockaddr_in6, sin6_addr), in6_addrany, in6_loopback}, #define N_INET 1 #else #define N_INET 0 #endif {PF_INET, sizeof(struct in_addr), sizeof(struct sockaddr_in), offsetof(struct sockaddr_in, sin_addr), in_addrany, in_loopback}, {0, 0, 0, 0, NULL, NULL}, }; #ifdef ENABLE_IPV6 #define PTON_MAX 16 #else #define PTON_MAX 4 #endif #ifndef IN_MULTICAST #define IN_MULTICAST(i) (((i) & 0xf0000000U) == 0xe0000000U) #endif #ifndef IN_EXPERIMENTAL #define IN_EXPERIMENTAL(i) (((i) & 0xe0000000U) == 0xe0000000U) #endif #ifndef IN_LOOPBACKNET #define IN_LOOPBACKNET 127 #endif static int get_name(const char *, struct gai_afd *, struct addrinfo **, char *, struct addrinfo *, int); static int get_addr(const char *, int, struct addrinfo **, struct addrinfo *, int); static int str_isnumber(const char *); static const char * const ai_errlist[] = { "success.", "address family for hostname not supported.", /* EAI_ADDRFAMILY */ "temporary failure in name resolution.", /* EAI_AGAIN */ "invalid value for ai_flags.", /* EAI_BADFLAGS */ "non-recoverable failure in name resolution.", /* EAI_FAIL */ "ai_family not supported.", /* EAI_FAMILY */ "memory allocation failure.", /* EAI_MEMORY */ "no address associated with hostname.", /* EAI_NODATA */ "hostname nor servname provided, or not known.",/* EAI_NONAME */ "servname not supported for ai_socktype.", /* EAI_SERVICE */ "ai_socktype not supported.", /* EAI_SOCKTYPE */ "system error returned in errno.", /* EAI_SYSTEM */ "invalid value for hints.", /* EAI_BADHINTS */ "resolved protocol is unknown.", /* EAI_PROTOCOL */ "unknown error.", /* EAI_MAX */ }; #define GET_CANONNAME(ai, str) \ if (pai->ai_flags & AI_CANONNAME) {\ if (((ai)->ai_canonname = (char *)malloc(strlen(str) + 1)) != NULL) {\ strcpy((ai)->ai_canonname, (str));\ } else {\ error = EAI_MEMORY;\ goto free;\ }\ } #ifdef HAVE_SOCKADDR_SA_LEN #define GET_AI(ai, gai_afd, addr, port) {\ char *p;\ if (((ai) = (struct addrinfo *)malloc(sizeof(struct addrinfo) +\ ((gai_afd)->a_socklen)))\ == NULL) goto free;\ memcpy(ai, pai, sizeof(struct addrinfo));\ (ai)->ai_addr = (struct sockaddr *)((ai) + 1);\ memset((ai)->ai_addr, 0, (gai_afd)->a_socklen);\ (ai)->ai_addr->sa_len = (ai)->ai_addrlen = (gai_afd)->a_socklen;\ (ai)->ai_addr->sa_family = (ai)->ai_family = (gai_afd)->a_af;\ ((struct sockinet *)(ai)->ai_addr)->si_port = port;\ p = (char *)((ai)->ai_addr);\ memcpy(p + (gai_afd)->a_off, (addr), (gai_afd)->a_addrlen);\ } #else #define GET_AI(ai, gai_afd, addr, port) {\ char *p;\ if (((ai) = (struct addrinfo *)malloc(sizeof(struct addrinfo) +\ ((gai_afd)->a_socklen)))\ == NULL) goto free;\ memcpy(ai, pai, sizeof(struct addrinfo));\ (ai)->ai_addr = (struct sockaddr *)((ai) + 1);\ memset((ai)->ai_addr, 0, (gai_afd)->a_socklen);\ (ai)->ai_addrlen = (gai_afd)->a_socklen;\ (ai)->ai_addr->sa_family = (ai)->ai_family = (gai_afd)->a_af;\ ((struct sockinet *)(ai)->ai_addr)->si_port = port;\ p = (char *)((ai)->ai_addr);\ memcpy(p + (gai_afd)->a_off, (addr), (gai_afd)->a_addrlen);\ } #endif #define ERR(err) { error = (err); goto bad; } const char * gai_strerror(int ecode) { if (ecode < 0 || ecode > EAI_MAX) ecode = EAI_MAX; return ai_errlist[ecode]; } void freeaddrinfo(struct addrinfo *ai) { struct addrinfo *next; do { next = ai->ai_next; if (ai->ai_canonname) free(ai->ai_canonname); /* no need to free(ai->ai_addr) */ free(ai); } while ((ai = next) != NULL); } static int str_isnumber(const char *p) { unsigned char *q = (unsigned char *)p; while (*q) { if (! isdigit(*q)) return NO; q++; } return YES; } int getaddrinfo(const char*hostname, const char*servname, const struct addrinfo *hints, struct addrinfo **res) { struct addrinfo sentinel; struct addrinfo *top = NULL; struct addrinfo *cur; int i, error = 0; char pton[PTON_MAX]; struct addrinfo ai; struct addrinfo *pai; u_short port; #ifdef FAITH static int firsttime = 1; if (firsttime) { /* translator hack */ { const char *q = getenv("GAI"); if (q && inet_pton(AF_INET6, q, &faith_prefix) == 1) translate = YES; } firsttime = 0; } #endif /* initialize file static vars */ sentinel.ai_next = NULL; cur = &sentinel; pai = &ai; pai->ai_flags = 0; pai->ai_family = PF_UNSPEC; pai->ai_socktype = GAI_ANY; pai->ai_protocol = GAI_ANY; pai->ai_addrlen = 0; pai->ai_canonname = NULL; pai->ai_addr = NULL; pai->ai_next = NULL; port = GAI_ANY; if (hostname == NULL && servname == NULL) return EAI_NONAME; if (hints) { /* error check for hints */ if (hints->ai_addrlen || hints->ai_canonname || hints->ai_addr || hints->ai_next) ERR(EAI_BADHINTS); /* xxx */ if (hints->ai_flags & ~AI_MASK) ERR(EAI_BADFLAGS); switch (hints->ai_family) { case PF_UNSPEC: case PF_INET: #ifdef ENABLE_IPV6 case PF_INET6: #endif break; default: ERR(EAI_FAMILY); } memcpy(pai, hints, sizeof(*pai)); switch (pai->ai_socktype) { case GAI_ANY: switch (pai->ai_protocol) { case GAI_ANY: break; case IPPROTO_UDP: pai->ai_socktype = SOCK_DGRAM; break; case IPPROTO_TCP: pai->ai_socktype = SOCK_STREAM; break; default: pai->ai_socktype = SOCK_RAW; break; } break; case SOCK_RAW: break; case SOCK_DGRAM: if (pai->ai_protocol != IPPROTO_UDP && pai->ai_protocol != GAI_ANY) ERR(EAI_BADHINTS); /*xxx*/ pai->ai_protocol = IPPROTO_UDP; break; case SOCK_STREAM: if (pai->ai_protocol != IPPROTO_TCP && pai->ai_protocol != GAI_ANY) ERR(EAI_BADHINTS); /*xxx*/ pai->ai_protocol = IPPROTO_TCP; break; default: ERR(EAI_SOCKTYPE); /* unreachable */ } } /* * service port */ if (servname) { if (str_isnumber(servname)) { if (pai->ai_socktype == GAI_ANY) { /* caller accept *GAI_ANY* socktype */ pai->ai_socktype = SOCK_DGRAM; pai->ai_protocol = IPPROTO_UDP; } port = htons((u_short)atoi(servname)); } else { struct servent *sp; const char *proto; proto = NULL; switch (pai->ai_socktype) { case GAI_ANY: proto = NULL; break; case SOCK_DGRAM: proto = "udp"; break; case SOCK_STREAM: proto = "tcp"; break; default: fprintf(stderr, "panic!\n"); break; } if ((sp = getservbyname(servname, proto)) == NULL) ERR(EAI_SERVICE); port = sp->s_port; if (pai->ai_socktype == GAI_ANY) { if (strcmp(sp->s_proto, "udp") == 0) { pai->ai_socktype = SOCK_DGRAM; pai->ai_protocol = IPPROTO_UDP; } else if (strcmp(sp->s_proto, "tcp") == 0) { pai->ai_socktype = SOCK_STREAM; pai->ai_protocol = IPPROTO_TCP; } else ERR(EAI_PROTOCOL); /*xxx*/ } } } /* * hostname == NULL. * passive socket -> anyaddr (0.0.0.0 or ::) * non-passive socket -> localhost (127.0.0.1 or ::1) */ if (hostname == NULL) { struct gai_afd *gai_afd; for (gai_afd = &gai_afdl[0]; gai_afd->a_af; gai_afd++) { if (!(pai->ai_family == PF_UNSPEC || pai->ai_family == gai_afd->a_af)) { continue; } if (pai->ai_flags & AI_PASSIVE) { GET_AI(cur->ai_next, gai_afd, gai_afd->a_addrany, port); /* xxx meaningless? * GET_CANONNAME(cur->ai_next, "anyaddr"); */ } else { GET_AI(cur->ai_next, gai_afd, gai_afd->a_loopback, port); /* xxx meaningless? * GET_CANONNAME(cur->ai_next, "localhost"); */ } cur = cur->ai_next; } top = sentinel.ai_next; if (top) goto good; else ERR(EAI_FAMILY); } /* hostname as numeric name */ for (i = 0; gai_afdl[i].a_af; i++) { if (inet_pton(gai_afdl[i].a_af, hostname, pton)) { u_long v4a; #ifdef ENABLE_IPV6 u_char pfx; #endif switch (gai_afdl[i].a_af) { case AF_INET: v4a = ((struct in_addr *)pton)->s_addr; v4a = ntohl(v4a); if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a)) pai->ai_flags &= ~AI_CANONNAME; v4a >>= IN_CLASSA_NSHIFT; if (v4a == 0 || v4a == IN_LOOPBACKNET) pai->ai_flags &= ~AI_CANONNAME; break; #ifdef ENABLE_IPV6 case AF_INET6: pfx = ((struct in6_addr *)pton)->s6_addr[0]; if (pfx == 0 || pfx == 0xfe || pfx == 0xff) pai->ai_flags &= ~AI_CANONNAME; break; #endif } if (pai->ai_family == gai_afdl[i].a_af || pai->ai_family == PF_UNSPEC) { if (! (pai->ai_flags & AI_CANONNAME)) { GET_AI(top, &gai_afdl[i], pton, port); goto good; } /* * if AI_CANONNAME and if reverse lookup * fail, return ai anyway to pacify * calling application. * * XXX getaddrinfo() is a name->address * translation function, and it looks strange * that we do addr->name translation here. */ get_name(pton, &gai_afdl[i], &top, pton, pai, port); goto good; } else ERR(EAI_FAMILY); /*xxx*/ } } if (pai->ai_flags & AI_NUMERICHOST) ERR(EAI_NONAME); /* hostname as alphabetical name */ error = get_addr(hostname, pai->ai_family, &top, pai, port); if (error == 0) { if (top) { good: *res = top; return SUCCESS; } else error = EAI_FAIL; } free: if (top) freeaddrinfo(top); bad: *res = NULL; return error; } static int get_name(addr, gai_afd, res, numaddr, pai, port0) const char *addr; struct gai_afd *gai_afd; struct addrinfo **res; char *numaddr; struct addrinfo *pai; int port0; { u_short port = port0 & 0xffff; struct hostent *hp; struct addrinfo *cur; int error = 0; #ifdef ENABLE_IPV6 int h_error; #endif #ifdef ENABLE_IPV6 hp = getipnodebyaddr(addr, gai_afd->a_addrlen, gai_afd->a_af, &h_error); #else hp = gethostbyaddr(addr, gai_afd->a_addrlen, AF_INET); #endif if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) { GET_AI(cur, gai_afd, hp->h_addr_list[0], port); GET_CANONNAME(cur, hp->h_name); } else GET_AI(cur, gai_afd, numaddr, port); #ifdef ENABLE_IPV6 if (hp) freehostent(hp); #endif *res = cur; return SUCCESS; free: if (cur) freeaddrinfo(cur); #ifdef ENABLE_IPV6 if (hp) freehostent(hp); #endif /* bad: */ *res = NULL; return error; } static int get_addr(hostname, af, res, pai, port0) const char *hostname; int af; struct addrinfo **res; struct addrinfo *pai; int port0; { u_short port = port0 & 0xffff; struct addrinfo sentinel; struct hostent *hp; struct addrinfo *top, *cur; struct gai_afd *gai_afd; int i, error = 0, h_error; char *ap; top = NULL; sentinel.ai_next = NULL; cur = &sentinel; #ifdef ENABLE_IPV6 if (af == AF_UNSPEC) { hp = getipnodebyname(hostname, AF_INET6, AI_ADDRCONFIG|AI_ALL|AI_V4MAPPED, &h_error); } else hp = getipnodebyname(hostname, af, AI_ADDRCONFIG, &h_error); #else hp = gethostbyname(hostname); h_error = h_errno; #endif if (hp == NULL) { switch (h_error) { case HOST_NOT_FOUND: case NO_DATA: error = EAI_NODATA; break; case TRY_AGAIN: error = EAI_AGAIN; break; case NO_RECOVERY: default: error = EAI_FAIL; break; } goto free; } if ((hp->h_name == NULL) || (hp->h_name[0] == 0) || (hp->h_addr_list[0] == NULL)) { error = EAI_FAIL; goto free; } for (i = 0; (ap = hp->h_addr_list[i]) != NULL; i++) { switch (af) { #ifdef ENABLE_IPV6 case AF_INET6: gai_afd = &gai_afdl[N_INET6]; break; #endif #ifndef ENABLE_IPV6 default: /* AF_UNSPEC */ #endif case AF_INET: gai_afd = &gai_afdl[N_INET]; break; #ifdef ENABLE_IPV6 default: /* AF_UNSPEC */ if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)ap)) { ap += sizeof(struct in6_addr) - sizeof(struct in_addr); gai_afd = &gai_afdl[N_INET]; } else gai_afd = &gai_afdl[N_INET6]; break; #endif } #ifdef FAITH if (translate && gai_afd->a_af == AF_INET) { struct in6_addr *in6; GET_AI(cur->ai_next, &gai_afdl[N_INET6], ap, port); in6 = &((struct sockaddr_in6 *)cur->ai_next->ai_addr)->sin6_addr; memcpy(&in6->s6_addr32[0], &faith_prefix, sizeof(struct in6_addr) - sizeof(struct in_addr)); memcpy(&in6->s6_addr32[3], ap, sizeof(struct in_addr)); } else #endif /* FAITH */ GET_AI(cur->ai_next, gai_afd, ap, port); if (cur == &sentinel) { top = cur->ai_next; GET_CANONNAME(top, hp->h_name); } cur = cur->ai_next; } #ifdef ENABLE_IPV6 freehostent(hp); #endif *res = top; return SUCCESS; free: if (top) freeaddrinfo(top); #ifdef ENABLE_IPV6 if (hp) freehostent(hp); #endif /* bad: */ *res = NULL; return error; }