diff options
author | markus <markus@FreeBSD.org> | 2009-12-25 18:05:06 +0000 |
---|---|---|
committer | markus <markus@FreeBSD.org> | 2009-12-25 18:05:06 +0000 |
commit | de21e8d4af0e2f652c8c84fd1155a2170de348c1 (patch) | |
tree | 39bfa1148fcc40a523e17007027d8acfc2b81e5e | |
parent | e7ece2eefaa128d347aab6a4050958622f6876f6 (diff) | |
download | FreeBSD-src-de21e8d4af0e2f652c8c84fd1155a2170de348c1.zip FreeBSD-src-de21e8d4af0e2f652c8c84fd1155a2170de348c1.tar.gz |
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.
Reviewed by: trasz
Approved by: emax (mentor)
MFC after: 3 days
-rw-r--r-- | lib/libc/posix1e/acl_delete_entry.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/libc/posix1e/acl_delete_entry.c b/lib/libc/posix1e/acl_delete_entry.c index 7dd60b8..09b4507 100644 --- a/lib/libc/posix1e/acl_delete_entry.c +++ b/lib/libc/posix1e/acl_delete_entry.c @@ -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 entry_d) 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] = |