diff options
author | jedgar <jedgar@FreeBSD.org> | 2001-04-24 22:45:41 +0000 |
---|---|---|
committer | jedgar <jedgar@FreeBSD.org> | 2001-04-24 22:45:41 +0000 |
commit | 2da23531d99e45f34811fd6982a681112de0e182 (patch) | |
tree | 0b8830fcccafadf6607f3658e96733124ef8617d /lib/libc/posix1e/acl_delete_entry.c | |
parent | ecbf3eacd9a17a3a9b238e2fa65b2d33d85e8d1f (diff) | |
download | FreeBSD-src-2da23531d99e45f34811fd6982a681112de0e182.zip FreeBSD-src-2da23531d99e45f34811fd6982a681112de0e182.tar.gz |
o Separate acl_t into internal and external representations as
required by POSIX.1e. This maintains the current 'struct acl'
in the kernel while providing the generic external acl_t
interface required to complete the ACL editing library.
o Add the acl_get_entry() function.
o Convert the existing ACL utilities, getfacl and setfacl, to
fully make use of the ACL editing library.
Obtained from: TrustedBSD Project
Diffstat (limited to 'lib/libc/posix1e/acl_delete_entry.c')
-rw-r--r-- | lib/libc/posix1e/acl_delete_entry.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/lib/libc/posix1e/acl_delete_entry.c b/lib/libc/posix1e/acl_delete_entry.c index e961ab2..760078f 100644 --- a/lib/libc/posix1e/acl_delete_entry.c +++ b/lib/libc/posix1e/acl_delete_entry.c @@ -26,8 +26,6 @@ * $FreeBSD$ */ -/* acl_delete_entry() - delete an ACL entry from an ACL */ - #include <sys/types.h> #include "namespace.h" #include <sys/acl.h> @@ -35,26 +33,41 @@ #include <errno.h> #include <string.h> +/* + * acl_delete_entry() (23.4.9): remove the ACL entry indicated by entry_d + * from acl. + */ int acl_delete_entry(acl_t acl, acl_entry_t entry_d) { + struct acl *acl_int; int i; - if (!acl || !entry_d || (acl->acl_cnt < 1) || - (acl->acl_cnt > ACL_MAX_ENTRIES)) { + if (!acl || !entry_d) { + errno = EINVAL; + return -1; + } + + acl_int = &acl->ats_acl; + + if ((acl->ats_acl.acl_cnt < 1) || + (acl->ats_acl.acl_cnt > ACL_MAX_ENTRIES)) { errno = EINVAL; return -1; } - for (i = 0; i < acl->acl_cnt; i++) { + for (i = 0; i < acl->ats_acl.acl_cnt; i++) { /* if this is our entry... */ - if ((acl->acl_entry[i].ae_tag == entry_d->ae_tag) && - (acl->acl_entry[i].ae_id == entry_d->ae_id)) { + if ((acl->ats_acl.acl_entry[i].ae_tag == entry_d->ae_tag) && + (acl->ats_acl.acl_entry[i].ae_id == entry_d->ae_id)) { /* ...shift the remaining entries... */ - while (i < acl->acl_cnt - 1) - acl->acl_entry[i] = acl->acl_entry[++i]; + while (i < acl->ats_acl.acl_cnt - 1) + acl->ats_acl.acl_entry[i] = + acl->ats_acl.acl_entry[++i]; /* ...drop the count and zero the unused entry... */ - acl->acl_cnt--; - bzero(&acl->acl_entry[i], sizeof(struct acl_entry)); + acl->ats_acl.acl_cnt--; + bzero(&acl->ats_acl.acl_entry[i], + sizeof(struct acl_entry)); + acl->ats_cur_entry = 0; return 0; } } |