-/* $OpenBSD: inode.c,v 1.27 2016/12/16 17:44:59 krw Exp $ */
+/* $OpenBSD: inode.c,v 1.28 2018/09/16 02:43:11 millert Exp $ */
/* $NetBSD: inode.c,v 1.8 2000/01/28 16:01:46 bouyer Exp $ */
/*
pinode(ino_t ino)
{
struct ext2fs_dinode *dp;
- char *p;
-#ifndef SMALL
- struct passwd *pw;
-#endif
+ const char *p;
time_t t;
u_int32_t uid;
printf(" OWNER=");
uid = letoh16(dp->e2di_uid_low) | (letoh16(dp->e2di_uid_high) << 16);
#ifndef SMALL
- if ((pw = getpwuid((int)uid)) != 0)
- printf("%s ", pw->pw_name);
+ if ((p = user_from_uid(uid, 1)) != NULL)
+ printf("%s ", p);
else
#endif
- printf("%u ", (unsigned)uid);
+ printf("%u ", uid);
printf("MODE=%o\n", letoh16(dp->e2di_mode));
if (preen)
printf("%s: ", cdevname());
-/* $OpenBSD: inode.c,v 1.48 2016/12/16 17:44:59 krw Exp $ */
+/* $OpenBSD: inode.c,v 1.49 2018/09/16 02:43:11 millert Exp $ */
/* $NetBSD: inode.c,v 1.23 1996/10/11 20:15:47 thorpej Exp $ */
/*
pinode(ino_t ino)
{
union dinode *dp;
- char *p;
-#ifndef SMALL
- struct passwd *pw;
-#endif
+ const char *p;
time_t t;
printf(" I=%llu ", (unsigned long long)ino);
dp = ginode(ino);
printf(" OWNER=");
#ifndef SMALL
- if ((pw = getpwuid(DIP(dp, di_uid))) != 0)
- printf("%s ", pw->pw_name);
+ if ((p = user_from_uid(DIP(dp, di_uid), 1)) != NULL)
+ printf("%s ", p);
else
#endif
printf("%u ", (unsigned)DIP(dp, di_uid));
-/* $OpenBSD: fsdbutil.c,v 1.18 2017/07/29 21:14:56 fcambus Exp $ */
+/* $OpenBSD: fsdbutil.c,v 1.19 2018/09/16 02:43:11 millert Exp $ */
/* $NetBSD: fsdbutil.c,v 1.5 1996/09/28 19:30:37 christos Exp $ */
/*-
void
printstat(const char *cp, ino_t inum, union dinode *dp)
{
- struct group *grp;
- struct passwd *pw;
+ const char *name;
time_t t;
char *p;
printf("\n\tATIME=%15.15s %4.4s [%d nsec]\n", &p[4], &p[20],
DIP(dp, di_atimensec));
- if ((pw = getpwuid(DIP(dp, di_uid))))
- printf("OWNER=%s ", pw->pw_name);
+ if ((name = user_from_uid(DIP(dp, di_uid), 1)) != NULL)
+ printf("OWNER=%s ", name);
else
printf("OWNUID=%u ", DIP(dp, di_uid));
- if ((grp = getgrgid(DIP(dp, di_gid))))
- printf("GRP=%s ", grp->gr_name);
+ if ((name = group_from_gid(DIP(dp, di_gid), 1)) != NULL)
+ printf("GRP=%s ", name);
else
printf("GID=%u ", DIP(dp, di_gid));
-/* $OpenBSD: fuser.c,v 1.6 2015/01/16 06:40:08 deraadt Exp $ */
+/* $OpenBSD: fuser.c,v 1.7 2018/09/16 02:43:11 millert Exp $ */
/*
* Copyright (c) 2009 Todd C. Miller <Todd.Miller@courtesan.com>
static void
printfu(struct fuser *fu)
{
- struct passwd *pwd;
+ const char *name;
printf("%d", fu->pid);
fflush(stdout);
fprintf(stderr, "t");
if (uflg) {
- pwd = getpwuid(fu->uid);
- if (pwd != NULL)
- fprintf(stderr, "(%s)", pwd->pw_name);
+ name = user_from_uid(fu->uid, 1);
+ if (name != NULL)
+ fprintf(stderr, "(%s)", name);
else
- fprintf(stderr, "(%d)", fu->uid);
+ fprintf(stderr, "(%u)", fu->uid);
}
putchar(' ');
-/* $OpenBSD: vmctl.c,v 1.57 2018/09/11 04:03:16 ccardenas Exp $ */
+/* $OpenBSD: vmctl.c,v 1.58 2018/09/16 02:43:11 millert Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
char curmem[FMT_SCALED_STRSIZE];
char maxmem[FMT_SCALED_STRSIZE];
char user[16], group[16];
- struct passwd *pw;
- struct group *gr;
+ const char *name;
printf("%5s %5s %5s %7s %7s %7s %12s %s\n", "ID", "PID", "VCPUS",
"MAXMEM", "CURMEM", "TTY", "OWNER", "NAME");
vir = &vmi->vir_info;
if (check_info_id(vir->vir_name, vir->vir_id)) {
/* get user name */
- if ((pw = getpwuid(vmi->vir_uid)) == NULL)
+ name = user_from_uid(vmi->vir_uid, 1);
+ if (name == NULL)
(void)snprintf(user, sizeof(user),
"%d", vmi->vir_uid);
else
- (void)strlcpy(user, pw->pw_name,
- sizeof(user));
+ (void)strlcpy(user, name, sizeof(user));
/* get group name */
if (vmi->vir_gid != -1) {
if (vmi->vir_uid == 0)
*user = '\0';
- if ((gr = getgrgid(vmi->vir_gid)) == NULL)
+ name = group_from_gid(vmi->vir_gid, 1);
+ if (name == NULL)
(void)snprintf(group, sizeof(group),
":%lld", vmi->vir_gid);
else
(void)snprintf(group, sizeof(group),
- ":%s", gr->gr_name);
+ ":%s", name);
(void)strlcat(user, group, sizeof(user));
}