From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 19:04:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C1641065670; Sat, 5 Dec 2009 19:04:21 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B1B78FC1D; Sat, 5 Dec 2009 19:04:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5J4L5F096489; Sat, 5 Dec 2009 19:04:21 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5J4LTp096485; Sat, 5 Dec 2009 19:04:21 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912051904.nB5J4LTp096485@svn.freebsd.org> From: Ed Schouten Date: Sat, 5 Dec 2009 19:04:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200142 - in head/lib/libc: gen posix1e X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 19:04:21 -0000 Author: ed Date: Sat Dec 5 19:04:21 2009 New Revision: 200142 URL: http://svn.freebsd.org/changeset/base/200142 Log: Don't let the C library depend on . The maximum length of a username has nothing to do with the size of the username in the utmp files. Use MAXLOGNAME, which is defined as 17 (UT_USERSIZE + 1). Modified: head/lib/libc/gen/getlogin.c head/lib/libc/gen/pwcache.c head/lib/libc/posix1e/acl_to_text.c Modified: head/lib/libc/gen/getlogin.c ============================================================================== --- head/lib/libc/gen/getlogin.c Sat Dec 5 19:03:20 2009 (r200141) +++ head/lib/libc/gen/getlogin.c Sat Dec 5 19:04:21 2009 (r200142) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/lib/libc/gen/pwcache.c ============================================================================== --- head/lib/libc/gen/pwcache.c Sat Dec 5 19:03:20 2009 (r200141) +++ head/lib/libc/gen/pwcache.c Sat Dec 5 19:04:21 2009 (r200142) @@ -33,13 +33,13 @@ static char sccsid[] = "@(#)pwcache.c 8. #include __FBSDID("$FreeBSD$"); +#include #include #include #include #include #include -#include #define NCACHE 64 /* power of 2 */ #define MASK (NCACHE - 1) /* bits to store with */ @@ -50,7 +50,7 @@ user_from_uid(uid_t uid, int nouser) static struct ncache { uid_t uid; int found; - char name[UT_NAMESIZE + 1]; + char name[MAXLOGNAME]; } c_uid[NCACHE]; static int pwopen; struct passwd *pw; @@ -66,11 +66,11 @@ user_from_uid(uid_t uid, int nouser) cp->uid = uid; if (pw != NULL) { cp->found = 1; - (void)strncpy(cp->name, pw->pw_name, UT_NAMESIZE); - cp->name[UT_NAMESIZE] = '\0'; + (void)strncpy(cp->name, pw->pw_name, MAXLOGNAME - 1); + cp->name[MAXLOGNAME - 1] = '\0'; } else { cp->found = 0; - (void)snprintf(cp->name, UT_NAMESIZE, "%u", uid); + (void)snprintf(cp->name, MAXLOGNAME - 1, "%u", uid); if (nouser) return (NULL); } @@ -84,7 +84,7 @@ group_from_gid(gid_t gid, int nogroup) static struct ncache { gid_t gid; int found; - char name[UT_NAMESIZE + 1]; + char name[MAXLOGNAME]; } c_gid[NCACHE]; static int gropen; struct group *gr; @@ -100,11 +100,11 @@ group_from_gid(gid_t gid, int nogroup) cp->gid = gid; if (gr != NULL) { cp->found = 1; - (void)strncpy(cp->name, gr->gr_name, UT_NAMESIZE); - cp->name[UT_NAMESIZE] = '\0'; + (void)strncpy(cp->name, gr->gr_name, MAXLOGNAME - 1); + cp->name[MAXLOGNAME - 1] = '\0'; } else { cp->found = 0; - (void)snprintf(cp->name, UT_NAMESIZE, "%u", gid); + (void)snprintf(cp->name, MAXLOGNAME - 1, "%u", gid); if (nogroup) return (NULL); } Modified: head/lib/libc/posix1e/acl_to_text.c ============================================================================== --- head/lib/libc/posix1e/acl_to_text.c Sat Dec 5 19:03:20 2009 (r200141) +++ head/lib/libc/posix1e/acl_to_text.c Sat Dec 5 19:04:21 2009 (r200142) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include "acl_support.h" @@ -58,7 +57,7 @@ _posix1e_acl_to_text(acl_t acl, ssize_t { struct acl *acl_int; char *buf, *tmpbuf; - char name_buf[UT_NAMESIZE+1]; + char name_buf[MAXLOGNAME]; char perm_buf[_POSIX1E_ACL_STRING_PERM_MAXSIZE+1], effective_perm_buf[_POSIX1E_ACL_STRING_PERM_MAXSIZE+1]; int i, error, len; @@ -103,7 +102,7 @@ _posix1e_acl_to_text(acl_t acl, ssize_t goto error_label; error = _posix1e_acl_id_to_name(ae_tag, ae_id, - UT_NAMESIZE+1, name_buf, flags); + MAXLOGNAME, name_buf, flags); if (error) goto error_label; @@ -163,7 +162,7 @@ _posix1e_acl_to_text(acl_t acl, ssize_t goto error_label; error = _posix1e_acl_id_to_name(ae_tag, ae_id, - UT_NAMESIZE+1, name_buf, flags); + MAXLOGNAME, name_buf, flags); if (error) goto error_label;