svn commit: r201260 - stable/8/lib/libc/posix1e

Markus Brueffer markus at FreeBSD.org
Wed Dec 30 16:37:58 UTC 2009


Author: markus
Date: Wed Dec 30 16:37:58 2009
New Revision: 201260
URL: http://svn.freebsd.org/changeset/base/201260

Log:
  MFC r200992:
  
  Use a local copy of entry_d for finding matches. Otherwise, if entry_d pointed
  to an entry of 'acl', all ACL entries starting with entry_d would be deleted.
  
  Approved by:	emax (mentor)

Modified:
  stable/8/lib/libc/posix1e/acl_delete_entry.c
Directory Properties:
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/stdtime/   (props changed)

Modified: stable/8/lib/libc/posix1e/acl_delete_entry.c
==============================================================================
--- stable/8/lib/libc/posix1e/acl_delete_entry.c	Wed Dec 30 15:59:40 2009	(r201259)
+++ stable/8/lib/libc/posix1e/acl_delete_entry.c	Wed Dec 30 16:37:58 2009	(r201260)
@@ -75,6 +75,7 @@ int
 acl_delete_entry(acl_t acl, acl_entry_t entry_d)
 {
 	struct acl *acl_int;
+	struct acl_entry entry_int;
 	int i, j, found = 0;
 
 	if (acl == NULL || entry_d == NULL) {
@@ -94,8 +95,12 @@ acl_delete_entry(acl_t acl, acl_entry_t 
 		errno = EINVAL;
 		return (-1);
 	}
+
+	/* Use a local copy to prevent deletion of more than this entry */
+	entry_int = *entry_d;
+
 	for (i = 0; i < acl->ats_acl.acl_cnt;) {
-		if (_entry_matches(&(acl->ats_acl.acl_entry[i]), entry_d)) {
+		if (_entry_matches(&(acl->ats_acl.acl_entry[i]), &entry_int)) {
 			/* ...shift the remaining entries... */
 			for (j = i; j < acl->ats_acl.acl_cnt - 1; ++j)
 				acl->ats_acl.acl_entry[j] =


More information about the svn-src-stable mailing list