Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 May 2000 13:34:09 -0700 (PDT)
From:      Archie Cobbs <archie@whistle.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/18817: possible file descriptor leak in dhclient(8)
Message-ID:  <200005252034.NAA09637@bubba.whistle.com>

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

>Number:         18817
>Category:       bin
>Synopsis:       possible file descriptor leak in dhclient(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 25 13:40:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Archie Cobbs
>Release:        FreeBSD 3.4-RELEASE i386
>Organization:
Whistle Communications, Inc.
>Environment:

	3.4-RELEASE

>Description:

	It appears that the function read_client_leases() in dhclient(8)
	clparse.c contains a file descriptor leak. The FILE *cfile is
	never fclose()'d.

	Also, when the dhclient-script is exec'd, we don't want any open
	file descriptors in the dhclient(8) process to be inherited by
	the child process (i.e., the script). So dhclient should be doing
	an ``fcntl(fileno(fp), F_SETFD, 1)'' for every FILE* it opens that
	can possibly still be open when the script is executed (e.g, the
	lease file).

>How-To-Repeat:

	Was determined by inspection; this could all be wrong.

>Fix:
	
Index: clparse.c
===================================================================
RCS file: /cvs/freebsd/src/contrib/isc-dhcp/client/clparse.c,v
retrieving revision 1.3.2.2
diff -u -u -r1.3.2.2 clparse.c
--- clparse.c	1999/05/08 18:05:07	1.3.2.2
+++ clparse.c	2000/05/25 20:34:16
@@ -170,6 +170,8 @@
 			parse_client_lease_statement (cfile, 0);
 
 	} while (1);
+
+	fclose (cfile);
 }
 
 /* client-declaration :== 


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


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




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