From cc028c9ae373c7990a4918c9c8a471a36e45dfdc Mon Sep 17 00:00:00 2001 From: rwatson Date: Mon, 3 Nov 2003 21:00:16 +0000 Subject: 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 --- lib/libc/posix1e/acl_support.c | 8 +++++--- 1 file 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); } -- cgit v1.1