summaryrefslogtreecommitdiffstats
path: root/lib/libc/posix1e/acl_support.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2010-06-14 02:26:13 +0000
committerkientzle <kientzle@FreeBSD.org>2010-06-14 02:26:13 +0000
commitd044db72cde3de09555ea28bbefb87928e06cba2 (patch)
tree1d64160cef3b44b15cf499fb8c787135cab68962 /lib/libc/posix1e/acl_support.c
parent3ae58b63eb2724bc12dc01948bb82258b3d1dcbe (diff)
downloadFreeBSD-src-d044db72cde3de09555ea28bbefb87928e06cba2.zip
FreeBSD-src-d044db72cde3de09555ea28bbefb87928e06cba2.tar.gz
Separate _posix1e_acl_id_to_name() into a separate file, to
break an unnecessary dependency on getpwuid() and getgrgid(). MFC after: 1 month
Diffstat (limited to 'lib/libc/posix1e/acl_support.c')
-rw-r--r--lib/libc/posix1e/acl_support.c55
1 files changed, 0 insertions, 55 deletions
diff --git a/lib/libc/posix1e/acl_support.c b/lib/libc/posix1e/acl_support.c
index afbe7de..9f5404c 100644
--- a/lib/libc/posix1e/acl_support.c
+++ b/lib/libc/posix1e/acl_support.c
@@ -269,61 +269,6 @@ _posix1e_acl_check(acl_t acl)
return (0);
}
-
-/*
- * 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
- */
-int
-_posix1e_acl_id_to_name(acl_tag_t tag, uid_t id, ssize_t buf_len, char *buf,
- int flags)
-{
- struct group *g;
- struct passwd *p;
- int i;
-
- switch(tag) {
- case ACL_USER:
- if (flags & ACL_TEXT_NUMERIC_IDS)
- p = NULL;
- else
- p = getpwuid(id);
- if (!p)
- i = snprintf(buf, buf_len, "%d", id);
- else
- i = snprintf(buf, buf_len, "%s", p->pw_name);
-
- if (i < 0) {
- errno = ENOMEM;
- return (-1);
- }
- return (0);
-
- case ACL_GROUP:
- if (flags & ACL_TEXT_NUMERIC_IDS)
- g = NULL;
- else
- g = getgrgid(id);
- if (g == NULL)
- i = snprintf(buf, buf_len, "%d", id);
- else
- i = snprintf(buf, buf_len, "%s", g->gr_name);
-
- if (i < 0) {
- errno = ENOMEM;
- return (-1);
- }
- return (0);
-
- default:
- return (EINVAL);
- }
-}
-
/*
* Given a right-shifted permission (i.e., direct ACL_PERM_* mask), fill
* in a string describing the permissions.
OpenPOWER on IntegriCloud