From owner-svn-src-all@FreeBSD.ORG Fri Dec 25 18:05:06 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F7A11065670; Fri, 25 Dec 2009 18:05:06 +0000 (UTC) (envelope-from markus@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D57D8FC1E; Fri, 25 Dec 2009 18:05:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPI56xn067942; Fri, 25 Dec 2009 18:05:06 GMT (envelope-from markus@svn.freebsd.org) Received: (from markus@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPI56DZ067940; Fri, 25 Dec 2009 18:05:06 GMT (envelope-from markus@svn.freebsd.org) Message-Id: <200912251805.nBPI56DZ067940@svn.freebsd.org> From: Markus Brueffer Date: Fri, 25 Dec 2009 18:05:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200992 - head/lib/libc/posix1e X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Dec 2009 18:05:06 -0000 Author: markus Date: Fri Dec 25 18:05:06 2009 New Revision: 200992 URL: http://svn.freebsd.org/changeset/base/200992 Log: 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 Modified: head/lib/libc/posix1e/acl_delete_entry.c Modified: head/lib/libc/posix1e/acl_delete_entry.c ============================================================================== --- head/lib/libc/posix1e/acl_delete_entry.c Fri Dec 25 17:34:43 2009 (r200991) +++ head/lib/libc/posix1e/acl_delete_entry.c Fri Dec 25 18:05:06 2009 (r200992) @@ -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] =