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);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to