diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-01-31 17:42:27 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-01-31 17:42:27 +0000 |
commit | d613eeedff667aa4c64353fb667b5db1a31e5a25 (patch) | |
tree | a77a0e316c95f23c58a135ba498dec12c9a40ef4 /lib/libc/gen | |
parent | 9337e383d2a63a9fe7f2562ce38cafac86e53c9e (diff) |
move utmp to large format, usernames to 32 chars; downsj
Diffstat (limited to 'lib/libc/gen')
-rw-r--r-- | lib/libc/gen/getpwent.c | 17 | ||||
-rw-r--r-- | lib/libc/gen/pwcache.c | 15 |
2 files changed, 15 insertions, 17 deletions
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c index 1ff377ee9ea..ce0d3734c4d 100644 --- a/lib/libc/gen/getpwent.c +++ b/lib/libc/gen/getpwent.c @@ -33,7 +33,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: getpwent.c,v 1.19 2000/04/25 19:11:48 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: getpwent.c,v 1.20 2001/01/31 17:42:25 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -41,7 +41,6 @@ static char rcsid[] = "$OpenBSD: getpwent.c,v 1.19 2000/04/25 19:11:48 deraadt E #include <db.h> #include <syslog.h> #include <pwd.h> -#include <utmp.h> #include <errno.h> #include <unistd.h> #include <stdlib.h> @@ -496,7 +495,7 @@ __has_yppw() DBT key, data; DBT pkey, pdata; int len; - char bf[UT_NAMESIZE]; + char bf[_PW_NAME_LEN]; key.data = (u_char *)_PW_YPTOKEN; key.size = strlen(_PW_YPTOKEN); @@ -504,9 +503,9 @@ __has_yppw() /* Pre-token database support. */ bf[0] = _PW_KEYBYNAME; len = strlen("+"); - bcopy("+", bf + 1, MIN(len, UT_NAMESIZE)); + bcopy("+", bf + 1, MIN(len, _PW_NAME_LEN)); pkey.data = (u_char *)bf; - pkey.size = MIN(len, UT_NAMESIZE) + 1; + pkey.size = MIN(len, _PW_NAME_LEN) + 1; if ((_pw_db->get)(_pw_db, &key, &data, 0) && (_pw_db->get)(_pw_db, &pkey, &pdata, 0)) @@ -572,7 +571,7 @@ getpwnam(name) { DBT key; int len, rval; - char bf[UT_NAMESIZE + 1]; + char bf[_PW_NAME_LEN + 1]; if (!_pw_db && !__initdb()) return ((struct passwd *)NULL); @@ -728,12 +727,12 @@ pwnam_netgrp: bf[0] = _PW_KEYBYNAME; len = strlen(name); - if (len > UT_NAMESIZE) + if (len > _PW_NAME_LEN) rval = 0; else { - bcopy(name, bf + 1, MIN(len, UT_NAMESIZE)); + bcopy(name, bf + 1, MIN(len, _PW_NAME_LEN)); key.data = (u_char *)bf; - key.size = MIN(len, UT_NAMESIZE) + 1; + key.size = MIN(len, _PW_NAME_LEN) + 1; rval = __hashpw(&key); } diff --git a/lib/libc/gen/pwcache.c b/lib/libc/gen/pwcache.c index 6b1997baced..509bdbb10b5 100644 --- a/lib/libc/gen/pwcache.c +++ b/lib/libc/gen/pwcache.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: pwcache.c,v 1.3 1997/07/09 00:28:23 millert Exp $"; +static char rcsid[] = "$OpenBSD: pwcache.c,v 1.4 2001/01/31 17:42:25 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -41,7 +41,6 @@ static char rcsid[] = "$OpenBSD: pwcache.c,v 1.3 1997/07/09 00:28:23 millert Exp #include <pwd.h> #include <stdio.h> #include <string.h> -#include <utmp.h> #define NCACHE 64 /* power of 2 */ #define MASK (NCACHE - 1) /* bits to store with */ @@ -53,7 +52,7 @@ user_from_uid(uid, nouser) { static struct ncache { uid_t uid; - char name[UT_NAMESIZE + 1]; + char name[_PW_NAME_LEN + 1]; } c_uid[NCACHE]; static int pwopen; static char nbuf[15]; /* 32 bits == 10 digits */ @@ -73,8 +72,8 @@ user_from_uid(uid, nouser) return (nbuf); } cp->uid = uid; - (void)strncpy(cp->name, pw->pw_name, UT_NAMESIZE); - cp->name[UT_NAMESIZE] = '\0'; + (void)strncpy(cp->name, pw->pw_name, _PW_NAME_LEN); + cp->name[_PW_NAME_LEN] = '\0'; } return (cp->name); } @@ -86,7 +85,7 @@ group_from_gid(gid, nogroup) { static struct ncache { gid_t gid; - char name[UT_NAMESIZE + 1]; + char name[_PW_NAME_LEN + 1]; } c_gid[NCACHE]; static int gropen; static char nbuf[15]; /* 32 bits == 10 digits */ @@ -106,8 +105,8 @@ group_from_gid(gid, nogroup) return (nbuf); } cp->gid = gid; - (void)strncpy(cp->name, gr->gr_name, UT_NAMESIZE); - cp->name[UT_NAMESIZE] = '\0'; + (void)strncpy(cp->name, gr->gr_name, _PW_NAME_LEN); + cp->name[_PW_NAME_LEN] = '\0'; } return (cp->name); } |