query service name properly on libwrap warnings.

NetBSD PR: 8101
This commit is contained in:
itojun 1999-07-28 10:58:31 +00:00
parent ad6d07bbfa
commit e1b53de44e

View File

@ -1,4 +1,4 @@
/* $NetBSD: inetd.c,v 1.51 1999/07/19 15:49:39 ghudson Exp $ */ /* $NetBSD: inetd.c,v 1.52 1999/07/28 10:58:31 itojun Exp $ */
/*- /*-
* Copyright (c) 1998 The NetBSD Foundation, Inc. * Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -77,7 +77,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1991, 1993, 1994\n\
#if 0 #if 0
static char sccsid[] = "@(#)inetd.c 8.4 (Berkeley) 4/13/94"; static char sccsid[] = "@(#)inetd.c 8.4 (Berkeley) 4/13/94";
#else #else
__RCSID("$NetBSD: inetd.c,v 1.51 1999/07/19 15:49:39 ghudson Exp $"); __RCSID("$NetBSD: inetd.c,v 1.52 1999/07/28 10:58:31 itojun Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -660,14 +660,14 @@ run_service(ctrl, sep)
fromhost(&req); fromhost(&req);
denied = !hosts_access(&req); denied = !hosts_access(&req);
if (denied || lflag) { if (denied || lflag) {
sp = getservbyport(sep->se_ctrladdr_in.sin_port, if (getnameinfo(&sep->se_ctrladdr,
sep->se_proto); sep->se_ctrladdr.sa_len, NULL, 0,
if (sp == NULL) { buf, sizeof(buf), 0) != 0) {
/* shouldn't happen */
(void)snprintf(buf, sizeof buf, "%d", (void)snprintf(buf, sizeof buf, "%d",
ntohs(sep->se_ctrladdr_in.sin_port)); ntohs(sep->se_ctrladdr_in.sin_port));
service = buf; }
} else service = buf;
service = sp->s_name;
} }
if (denied) { if (denied) {
syslog(deny_severity, syslog(deny_severity,