From owner-freebsd-audit Sun Jul 15 21:52: 3 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id C253937B408; Sun, 15 Jul 2001 21:51:55 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f6G58HF31122; Mon, 16 Jul 2001 01:08:17 -0400 (EDT) (envelope-from mike) Date: Mon, 16 Jul 2001 01:08:17 -0400 (EDT) Message-Id: <200107160508.f6G58HF31122@coffee.q9media.com> To: dwmalone@FreeBSD.org From: Mike Barcroft Cc: audit@FreeBSD.org Subject: inetd(8) warns patch Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG David, I would appreciate your comments on the patch at the end of this message. I'm not entirely sure about removing the legacy setproctitle stuff. If you'd like to keep it in there, the prototype for main() will need two versions. One for the legacy setproctitle and one for normal use. The patch is also available at: http://testbed.q9media.net/freebsd/inetd.20010716.patch Best regards, Mike Barcroft ----------------------------------------------------------------------- inetd.20010716.patch o Remove legacy setproctitle. o Mark unused variables. o Set WARNS?=2 o Tested on i386, alpha. Index: inetd/Makefile =================================================================== RCS file: /home/ncvs/src/usr.sbin/inetd/Makefile,v retrieving revision 1.22 diff -u -r1.22 Makefile --- inetd/Makefile 2001/06/24 09:20:42 1.22 +++ inetd/Makefile 2001/07/16 04:37:56 @@ -5,6 +5,7 @@ PROG= inetd SRCS= inetd.c builtins.c +WARNS?= 2 MAN= inetd.8 MLINKS= inetd.8 inetd.conf.5 Index: inetd/builtins.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/inetd/builtins.c,v retrieving revision 1.35 diff -u -r1.35 builtins.c --- inetd/builtins.c 2001/06/24 09:20:07 1.35 +++ inetd/builtins.c 2001/07/16 04:37:57 @@ -223,7 +223,7 @@ void daytime_stream(s, sep) /* Return human-readable time of day */ int s; - struct servtab *sep; + struct servtab *sep __unused; { char buffer[256]; time_t now; @@ -243,7 +243,7 @@ void discard_dg(s, sep) /* Discard service -- ignore data */ int s; - struct servtab *sep; + struct servtab *sep __unused; { char buffer[BUFSIZE]; @@ -737,7 +737,7 @@ void machtime_stream(s, sep) int s; - struct servtab *sep; + struct servtab *sep __unused; { unsigned long result; Index: inetd/inetd.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/inetd/inetd.c,v retrieving revision 1.93 diff -u -r1.93 inetd.c --- inetd/inetd.c 2001/06/24 09:20:07 1.93 +++ inetd/inetd.c 2001/07/16 04:37:58 @@ -267,11 +267,6 @@ const char *CONFIG = _PATH_INETDCONF; const char *pid_file = _PATH_INETDPID; -#ifdef OLD_SETPROCTITLE -char **Argv; -char *LastArg; -#endif - int getvalue(arg, value, whine) const char *arg, *whine; @@ -290,9 +285,9 @@ } int -main(argc, argv, envp) +main(argc, argv) int argc; - char *argv[], *envp[]; + char *argv[]; { struct servtab *sep; struct passwd *pwd; @@ -322,16 +317,6 @@ const char *servname; int error; - -#ifdef OLD_SETPROCTITLE - Argv = argv; - if (envp == 0 || *envp == 0) - envp = argv; - while (*envp) - envp++; - LastArg = envp[-1] + strlen(envp[-1]); -#endif - openlog("inetd", LOG_PID | LOG_NOWAIT, LOG_DAEMON); while ((ch = getopt(argc, argv, "dlwWR:a:c:C:p:")) != -1) @@ -856,7 +841,7 @@ void flag_reapchild(signo) - int signo; + int signo __unused; { flag_signal('C'); } @@ -894,7 +879,7 @@ void flag_config(signo) - int signo; + int signo __unused; { flag_signal('H'); } @@ -1123,7 +1108,7 @@ void flag_retry(signo) - int signo; + int signo __unused; { flag_signal('A'); } @@ -1969,36 +1954,11 @@ exit(EX_OSERR); } -#ifdef OLD_SETPROCTITLE void inetd_setproctitle(a, s) const char *a; int s; { - int size; - char *cp; - struct sockaddr_storage ss; - char buf[80], pbuf[INET6_ADDRSTRLEN]; - - cp = Argv[0]; - size = sizeof(ss); - if (getpeername(s, (struct sockaddr *)&ss, &size) == 0) { - getnameinfo((struct sockaddr *)&ss, size, pbuf, sizeof(pbuf), - NULL, 0, NI_NUMERICHOST|NI_WITHSCOPEID); - (void) sprintf(buf, "-%s [%s]", a, pbuf); - } else - (void) sprintf(buf, "-%s", a); - strncpy(cp, buf, LastArg - cp); - cp += strlen(cp); - while (cp < LastArg) - *cp++ = ' '; -} -#else -void -inetd_setproctitle(a, s) - const char *a; - int s; -{ socklen_t size; struct sockaddr_storage ss; char buf[80], pbuf[INET6_ADDRSTRLEN]; @@ -2012,8 +1972,6 @@ (void) sprintf(buf, "%s", a); setproctitle("%s", buf); } -#endif - int check_loop(sa, sep) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message