X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=support%2Fmisc%2Ftcpwrapper.c;h=d8a742f49da0af6c9fec8a0262bcf89c8f28606f;hp=498a8290ec3f20057dbaa7b1d599fd11c9df869b;hb=b1f8653d43b6bfaf80a44efcb7418bcf898d3af1;hpb=764e46f5c5fe1a6e376f4cd350424f33afc9e838 diff --git a/support/misc/tcpwrapper.c b/support/misc/tcpwrapper.c index 498a829..d8a742f 100644 --- a/support/misc/tcpwrapper.c +++ b/support/misc/tcpwrapper.c @@ -25,9 +25,7 @@ * authorized by the /etc/hosts.{allow,deny} files. The local system is * always treated as an authorized host. The access control tables are never * consulted for requests from the local system, and are always consulted - * for requests from other hosts. Access control is based on IP addresses - * only; attempts to map an address to a host name might cause the - * portmapper to hang. + * for requests from other hosts. * * Author: Wietse Venema (wietse@wzv.win.tue.nl), dept. of Mathematics and * Computing Science, Eindhoven University of Technology, The Netherlands. @@ -221,14 +219,16 @@ u_long prognum; char *text; { char *procname; - char procbuf[4 * sizeof(u_long)]; + char procbuf[16 + 4 * sizeof(u_long)]; char *progname; - char progbuf[4 * sizeof(u_long)]; + char progbuf[16 + 4 * sizeof(u_long)]; struct rpcent *rpc; /* * Fork off a process or the portmap daemon might hang while * getrpcbynumber() or syslog() does its thing. + * + * Don't forget to wait for the children, too... */ if (fork() == 0) { @@ -240,16 +240,18 @@ char *text; } else if ((rpc = getrpcbynumber((int) prognum))) { progname = rpc->r_name; } else { - sprintf(progname = progbuf, "%lu", prognum); + snprintf(progname = progbuf, sizeof (progbuf), + "prog (%lu)", prognum); } /* Try to map procedure number to name. */ - sprintf(procname = procbuf, "%lu", (u_long) procnum); + snprintf(procname = procbuf, sizeof (procbuf), + "proc (%lu)", (u_long) procnum); /* Write syslog record. */ - syslog(severity, "connect from %s to %s(%s)%s", + syslog(severity, "connect from %s to %s in %s%s", inet_ntoa(addr->sin_addr), procname, progname, text); exit(0); }