1 Some cleanup for my last patch.
7 --- portmap_4/pmap_check.c.hostname Wed May 10 10:23:35 2000
8 +++ portmap_4/pmap_check.c Wed May 10 11:03:22 2000
10 static char sccsid[] = "@(#) pmap_check.c 1.6 93/11/21 20:58:59";
15 #include <rpc/pmap_prot.h>
17 @@ -69,8 +70,6 @@ int deny_severity = LOG_WARNING;
18 /* coming from libwrap.a (tcp_wrappers) */
19 extern int hosts_ctl(char *daemon, char *name, char *addr, char *user);
21 -#define good_client(a) hosts_ctl("portmap", "", inet_ntoa(a->sin_addr), "")
23 #define reserved_port(p) (IPPORT_RESERVED/2 < (p) && (p) < IPPORT_RESERVED)
25 #define unreserved_port(p) (IPPORT_RESERVED <= (p) && (p) != NFS_PORT)
26 @@ -88,6 +87,59 @@ extern int hosts_ctl(char *daemon, char
28 #define log_client(addr, proc, prog) \
29 logit(allow_severity, addr, proc, prog, "")
34 +struct sockaddr_in *addr;
40 + /* Check the IP address first. */
41 + if (hosts_ctl("portmap", "", inet_ntoa(addr->sin_addr), ""))
44 + /* Check the hostname. */
45 + hp = gethostbyaddr ((const char *) &(addr->sin_addr),
46 + sizeof (addr->sin_addr), AF_INET);
51 + /* must make sure the hostent is authorative. */
52 + tmpname = alloca (strlen (hp->h_name) + 1);
53 + strcpy (tmpname, hp->h_name);
54 + hp = gethostbyname(tmpname);
56 + /* now make sure the "addr->sin_addr" is on the list */
57 + for (sp = hp->h_addr_list ; *sp ; sp++) {
58 + if (memcmp(*sp, &(addr->sin_addr), hp->h_length)==0)
62 + /* it was a FAKE. */
66 + /* never heard of it. misconfigured DNS? */
69 + /* Check the official name first. */
70 + if (hosts_ctl("portmap", "", hp->h_name, ""))
73 + /* Check aliases. */
74 + for (sp = hp->h_aliases; *sp ; sp++) {
75 + if (hosts_ctl("portmap", "", *sp, ""))
84 /* check_startup - additional startup code */