tli.c (44744) | tli.c (56977) |
---|---|
1 /* 2 * tli_host() determines the type of transport (connected, connectionless), 3 * the transport address of a client host, and the transport address of a 4 * server endpoint. In addition, it provides methods to map a transport 5 * address to a printable host name or address. Socket address results are 6 * in static memory; tli structures are allocated from the heap. 7 * 8 * The result from the hostname lookup method is STRING_PARANOID when a host 9 * pretends to have someone elses name, or when a host name is available but 10 * could not be verified. 11 * 12 * Diagnostics are reported through syslog(3). 13 * 14 * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands. | 1 /* 2 * tli_host() determines the type of transport (connected, connectionless), 3 * the transport address of a client host, and the transport address of a 4 * server endpoint. In addition, it provides methods to map a transport 5 * address to a printable host name or address. Socket address results are 6 * in static memory; tli structures are allocated from the heap. 7 * 8 * The result from the hostname lookup method is STRING_PARANOID when a host 9 * pretends to have someone elses name, or when a host name is available but 10 * could not be verified. 11 * 12 * Diagnostics are reported through syslog(3). 13 * 14 * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands. |
15 * 16 * $FreeBSD: head/contrib/tcp_wrappers/tli.c 56977 2000-02-03 10:27:03Z shin $ |
|
15 */ 16 17#ifndef lint 18static char sccsid[] = "@(#) tli.c 1.15 97/03/21 19:27:25"; 19#endif 20 21#ifdef TLI 22 --- 37 unchanged lines hidden (view full) --- 60static char *tli_error(); 61static void tli_sink(); 62 63/* tli_host - look up endpoint addresses and install conversion methods */ 64 65void tli_host(request) 66struct request_info *request; 67{ | 17 */ 18 19#ifndef lint 20static char sccsid[] = "@(#) tli.c 1.15 97/03/21 19:27:25"; 21#endif 22 23#ifdef TLI 24 --- 37 unchanged lines hidden (view full) --- 62static char *tli_error(); 63static void tli_sink(); 64 65/* tli_host - look up endpoint addresses and install conversion methods */ 66 67void tli_host(request) 68struct request_info *request; 69{ |
70#ifdef INET6 71 static struct sockaddr_storage client; 72 static struct sockaddr_storage server; 73#else |
|
68 static struct sockaddr_in client; 69 static struct sockaddr_in server; | 74 static struct sockaddr_in client; 75 static struct sockaddr_in server; |
76#endif |
|
70 71 /* 72 * If we discover that we are using an IP transport, pretend we never 73 * were here. Otherwise, use the transport-independent method and stick 74 * to generic network addresses. XXX hard-coded protocol family name. 75 */ 76 77 tli_endpoints(request); | 77 78 /* 79 * If we discover that we are using an IP transport, pretend we never 80 * were here. Otherwise, use the transport-independent method and stick 81 * to generic network addresses. XXX hard-coded protocol family name. 82 */ 83 84 tli_endpoints(request); |
85#ifdef INET6 |
|
78 if ((request->config = tli_transport(request->fd)) != 0 | 86 if ((request->config = tli_transport(request->fd)) != 0 |
79 && STR_EQ(request->config->nc_protofmly, "inet")) { | 87 && (STR_EQ(request->config->nc_protofmly, "inet") || 88 STR_EQ(request->config->nc_protofmly, "inet6"))) { 89#else 90 if ((request->config = tli_transport(request->fd)) != 0 91 && STR_EQ(request->config->nc_protofmly, "inet")) { 92#endif |
80 if (request->client->unit != 0) { | 93 if (request->client->unit != 0) { |
94#ifdef INET6 95 client = *(struct sockaddr_storage *) request->client->unit->addr.buf; 96 request->client->sin = (struct sockaddr *) &client; 97#else |
|
81 client = *(struct sockaddr_in *) request->client->unit->addr.buf; 82 request->client->sin = &client; | 98 client = *(struct sockaddr_in *) request->client->unit->addr.buf; 99 request->client->sin = &client; |
100#endif |
|
83 } 84 if (request->server->unit != 0) { | 101 } 102 if (request->server->unit != 0) { |
85 server = *(struct sockaddr_in *) request->server->unit->addr.buf; 86 request->server->sin = &server; | 103#ifdef INET6 104 server = *(struct sockaddr_storage *) request->server->unit->addr.buf; 105 request->server->sin = (struct sockaddr *) &server; 106#else 107 server = *(struct sockaddr_in *) request->server->unit->addr.buf; 108 request->server->sin = &server; 109#endif |
87 } 88 tli_cleanup(request); 89 sock_methods(request); 90 } else { 91 request->hostname = tli_hostname; 92 request->hostaddr = tli_hostaddr; 93 request->cleanup = tli_cleanup; 94 } --- 87 unchanged lines hidden (view full) --- 182 return (0); 183 } 184 if ((handlep = setnetconfig()) == 0) { 185 tcpd_warn("setnetconfig: %m"); 186 return (0); 187 } 188 while (config = getnetconfig(handlep)) { 189 if (stat(config->nc_device, &from_config) == 0) { | 110 } 111 tli_cleanup(request); 112 sock_methods(request); 113 } else { 114 request->hostname = tli_hostname; 115 request->hostaddr = tli_hostaddr; 116 request->cleanup = tli_cleanup; 117 } --- 87 unchanged lines hidden (view full) --- 205 return (0); 206 } 207 if ((handlep = setnetconfig()) == 0) { 208 tcpd_warn("setnetconfig: %m"); 209 return (0); 210 } 211 while (config = getnetconfig(handlep)) { 212 if (stat(config->nc_device, &from_config) == 0) { |
213#ifdef NO_CLONE_DEVICE 214 /* 215 * If the network devices are not cloned (as is the case for 216 * Solaris 8 Beta), we must compare the major device numbers. 217 */ 218 if (major(from_config.st_rdev) == major(from_client.st_rdev)) 219#else |
|
190 if (minor(from_config.st_rdev) == major(from_client.st_rdev)) | 220 if (minor(from_config.st_rdev) == major(from_client.st_rdev)) |
221#endif |
|
191 break; 192 } 193 } 194 if (config == 0) { 195 tcpd_warn("unable to identify transport protocol"); 196 return (0); 197 } 198 --- 143 unchanged lines hidden --- | 222 break; 223 } 224 } 225 if (config == 0) { 226 tcpd_warn("unable to identify transport protocol"); 227 return (0); 228 } 229 --- 143 unchanged lines hidden --- |