diff options
author | rwatson <rwatson@FreeBSD.org> | 2003-11-03 21:00:16 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2003-11-03 21:00:16 +0000 |
commit | cc028c9ae373c7990a4918c9c8a471a36e45dfdc (patch) | |
tree | d6e329ee42a84feb9467a88ad30376e020301b3b /lib/libc | |
parent | 656a167ab40c34537f6c597feffcbb9724c75f62 (diff) | |
download | FreeBSD-src-cc028c9ae373c7990a4918c9c8a471a36e45dfdc.zip FreeBSD-src-cc028c9ae373c7990a4918c9c8a471a36e45dfdc.tar.gz |
When printing ACLs, truncate user and group names if they're too long,
rather than generating an error. This is consistent with other tools
printing user and group names, and means you can read the ACL using
our tools rather than being up a creek.
PR: 56991
Submitted by: Michael Bretterklieber <mbretter@a-quadrat.at>
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/posix1e/acl_support.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libc/posix1e/acl_support.c b/lib/libc/posix1e/acl_support.c index 93e98bb..61e4cf9 100644 --- a/lib/libc/posix1e/acl_support.c +++ b/lib/libc/posix1e/acl_support.c @@ -241,7 +241,9 @@ _posix1e_acl_check(acl_t acl) /* - * Given a uid/gid, return a username/groupname for the text form of an ACL + * Given a uid/gid, return a username/groupname for the text form of an ACL. + * Note that we truncate user and group names, rather than error out, as + * this is consistent with other tools manipulating user and group names. * XXX NOT THREAD SAFE, RELIES ON GETPWUID, GETGRGID * XXX USES *PW* AND *GR* WHICH ARE STATEFUL AND THEREFORE THIS ROUTINE * MAY HAVE SIDE-EFFECTS @@ -261,7 +263,7 @@ _posix1e_acl_id_to_name(acl_tag_t tag, uid_t id, ssize_t buf_len, char *buf) else i = snprintf(buf, buf_len, "%s", p->pw_name); - if (i < 0 || i >= buf_len) { + if (i < 0) { errno = ENOMEM; return (-1); } @@ -274,7 +276,7 @@ _posix1e_acl_id_to_name(acl_tag_t tag, uid_t id, ssize_t buf_len, char *buf) else i = snprintf(buf, buf_len, "%s", g->gr_name); - if (i < 0 || i >= buf_len) { + if (i < 0) { errno = ENOMEM; return (-1); } |