Deleted Added
sdiff udiff text old ( 44744 ) new ( 56977 )
full compact
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
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{
68 static struct sockaddr_in client;
69 static struct sockaddr_in server;
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);
78 if ((request->config = tli_transport(request->fd)) != 0
79 && STR_EQ(request->config->nc_protofmly, "inet")) {
80 if (request->client->unit != 0) {
81 client = *(struct sockaddr_in *) request->client->unit->addr.buf;
82 request->client->sin = &client;
83 }
84 if (request->server->unit != 0) {
85 server = *(struct sockaddr_in *) request->server->unit->addr.buf;
86 request->server->sin = &server;
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) {
190 if (minor(from_config.st_rdev) == major(from_client.st_rdev))
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 ---