diff options
Diffstat (limited to 'lib/libc/posix1e/acl_support.c')
-rw-r--r-- | lib/libc/posix1e/acl_support.c | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/lib/libc/posix1e/acl_support.c b/lib/libc/posix1e/acl_support.c index 61e4cf9..b49808f 100644 --- a/lib/libc/posix1e/acl_support.c +++ b/lib/libc/posix1e/acl_support.c @@ -287,59 +287,6 @@ _posix1e_acl_id_to_name(acl_tag_t tag, uid_t id, ssize_t buf_len, char *buf) } } - -/* - * Given a username/groupname from a text form of an ACL, return the uid/gid - * XXX NOT THREAD SAFE, RELIES ON GETPWNAM, GETGRNAM - * XXX USES *PW* AND *GR* WHICH ARE STATEFUL AND THEREFORE THIS ROUTINE - * MAY HAVE SIDE-EFFECTS - * - * XXX currently doesn't deal correctly with a numeric uid being passed - * instead of a username. What is correct behavior here? Check chown. - */ -int -_posix1e_acl_name_to_id(acl_tag_t tag, char *name, uid_t *id) -{ - struct group *g; - struct passwd *p; - unsigned long l; - char *endp; - - switch(tag) { - case ACL_USER: - p = getpwnam(name); - if (p == NULL) { - l = strtoul(name, &endp, 0); - if (*endp != '\0' || l != (unsigned long)(uid_t)l) { - errno = EINVAL; - return (-1); - } - *id = (uid_t)l; - return (0); - } - *id = p->pw_uid; - return (0); - - case ACL_GROUP: - g = getgrnam(name); - if (g == NULL) { - l = strtoul(name, &endp, 0); - if (*endp != '\0' || l != (unsigned long)(gid_t)l) { - errno = EINVAL; - return (-1); - } - *id = (gid_t)l; - return (0); - } - *id = g->gr_gid; - return (0); - - default: - return (EINVAL); - } -} - - /* * Given a right-shifted permission (i.e., direct ACL_PERM_* mask), fill * in a string describing the permissions. |