Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Jun 2000 19:19:12 -0400 (EDT)
From:      Mikhail Teterin <mi@privatelabs.com>
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        arpwatch@ee.lbl.gov
Subject:   ports/19047: net/arpwatch patched to use tmpfile() instead of mktemp()
Message-ID:  <200006052319.TAA03349@misha.privatelabs.com>

next in thread | raw e-mail | index | archive | help

>Number:         19047
>Category:       ports
>Synopsis:       net/arpwatch patched to use tmpfile() instead of mktemp()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 05 16:30:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Mikhail Teterin
>Release:        FreeBSD 4.0-STABLE i386
>Organization:
Virtual Estates, Inc.
>Environment:

>Description:

	The arpwatch  can (rightfully) be considered  a security
	software. Its  use of  mktemp, while  safe can  still be
	eliminated.

	The attached patch  is rather simple and  can be dropped
	into  the patches  subdirectory of  the port...  It also
	makes the report function a little bit faster.

	I'm fairly certain the report() function can use vfork()
	instead of fork, but I'm not 100% sure :) -- it is right
	next to the area I'm patching -- please review...

>How-To-Repeat:

>Fix:

--- report.c	Wed Jul 29 01:16:46 1998
+++ report.c	Mon Jun  5 19:06:31 2000
@@ -242,5 +242,5 @@
 	register int pid;
 	register FILE *f;
-	char tempfile[64], cpu[64], os[64];
+	char cpu[64], os[64];
 	char *fmt = "%20s: %s\n";
 	char *watcher = WATCHER;
@@ -286,12 +286,8 @@
 		/* Child */
 		closelog();
-		(void)strcpy(tempfile, "/tmp/arpwatch.XXXXXX");
-		(void)mktemp(tempfile);
-		if ((f = fopen(tempfile, "w+")) == NULL) {
-			syslog(LOG_ERR, "child open(%s): %m", tempfile);
+		if ((f = tmpfile()) == NULL) {
+			syslog(LOG_ERR, "tmpfile(): %m");
 			exit(1);
 		}
-		if (unlink(tempfile) < 0)
-			syslog(LOG_ERR, "unlink(%s): %m", tempfile);
 	}
 

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200006052319.TAA03349>