ObjFW  Diff

Differences From Artifact [5597695463]:

To Artifact [5e69e0a1d6]:


63
64
65
66
67
68
69




70
71
72
73
74
75
76
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80







+
+
+
+







# include <proto/bsdsocket.h>
#endif

#ifdef OF_NINTENDO_3DS
# include <3ds.h>
#endif

#ifndef SOCK_DNS
# define SOCK_DNS 0
#endif

/*
 * RFC 1035 doesn't specify if pointers to pointers are allowed, and if so how
 * many. Since it's unspecified, we have to assume that it might happen, but we
 * also want to limit it to avoid DoS. Limiting it to 16 levels of pointers and
 * immediately rejecting pointers to itself seems like a fair balance.
 */
#define MAX_ALLOWED_POINTERS 16
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1236
1237
1238
1239
1240
1241
1242




1243
1244
1245
1246
1247
1248
1249







-
-
-
-







#elif defined(OF_AMIGAOS4)
	[self of_parseHosts: HOSTS_PATH];
	[self of_obtainAmigaOS4SystemConfig];
#elif defined(OF_NINTENDO_3DS)
	[self of_obtainNintendo3DSSytemConfig];
#elif defined(OF_HAVE_FILES)
	[self of_parseHosts: HOSTS_PATH];
# ifdef OF_OPENBSD
	[self of_parseHosts: @"/etc/resolv.conf.tail"];
# endif

	[self of_parseResolvConf: RESOLV_CONF_PATH];
#endif

	if (_staticHosts == nil) {
		OFArray *localhost =
#ifdef OF_HAVE_IPV6
		    [OFArray arrayWithObjects: @"::1", @"127.0.0.1", nil];
1785
1786
1787
1788
1789
1790
1791
1792


1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805


1806
1807
1808
1809
1810
1811
1812
1785
1786
1787
1788
1789
1790
1791

1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805

1806
1807
1808
1809
1810
1811
1812
1813
1814







-
+
+












-
+
+







#ifdef OF_HAVE_IPV6
	case OF_SOCKET_ADDRESS_FAMILY_IPV6:
		if (_IPv6Socket == nil) {
			of_socket_address_t address =
			    of_socket_address_parse_ip(@"::", 0);

			_IPv6Socket = [[OFUDPSocket alloc] init];
			[_IPv6Socket of_bindToAddress: &address];
			[_IPv6Socket of_bindToAddress: &address
					    extraType: SOCK_DNS];
			[_IPv6Socket setBlocking: false];
		}

		sock = _IPv6Socket;
		break;
#endif
	case OF_SOCKET_ADDRESS_FAMILY_IPV4:
		if (_IPv4Socket == nil) {
			of_socket_address_t address =
			    of_socket_address_parse_ip(@"0.0.0.0", 0);

			_IPv4Socket = [[OFUDPSocket alloc] init];
			[_IPv4Socket of_bindToAddress: &address];
			[_IPv4Socket of_bindToAddress: &address
					    extraType: SOCK_DNS];
			[_IPv4Socket setBlocking: false];
		}

		sock = _IPv4Socket;
		break;
	default:
		@throw [OFInvalidArgumentException exception];