svn commit: r252631 - head/sbin/dhclient

Pawel Jakub Dawidek pjd at FreeBSD.org
Wed Jul 3 22:19:43 UTC 2013


Author: pjd
Date: Wed Jul  3 22:19:43 2013
New Revision: 252631
URL: http://svnweb.freebsd.org/changeset/base/252631

Log:
  MFp4 @229485:
  
  Only allow to overwrite lease file.
  
  Reviewed by:	brooks
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sbin/dhclient/dhclient.c

Modified: head/sbin/dhclient/dhclient.c
==============================================================================
--- head/sbin/dhclient/dhclient.c	Wed Jul  3 22:18:40 2013	(r252630)
+++ head/sbin/dhclient/dhclient.c	Wed Jul  3 22:19:43 2013	(r252631)
@@ -1842,6 +1842,11 @@ rewrite_client_leases(void)
 		leaseFile = fopen(path_dhclient_db, "w");
 		if (!leaseFile)
 			error("can't create %s: %m", path_dhclient_db);
+		if (cap_rights_limit(fileno(leaseFile), CAP_FSTAT | CAP_FSYNC |
+		    CAP_FTRUNCATE | CAP_SEEK | CAP_WRITE) < 0 &&
+		    errno != ENOSYS) {
+			error("can't limit lease descriptor: %m");
+		}
 	} else {
 		fflush(leaseFile);
 		rewind(leaseFile);


More information about the svn-src-head mailing list