summaryrefslogtreecommitdiff
path: root/usr.sbin/user
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2007-01-12 13:25:13 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2007-01-12 13:25:13 +0000
commit4e522f10c804eca8dcccd764198ce88b31ac003a (patch)
tree506f66c02edf835cc3462a6b6fd364ddccc7f3d9 /usr.sbin/user
parentf73c77146258edc89b22e41bdaab83a4d0c0d942 (diff)
Compare against the username, so listing groups when given a numeric
user id to userinfo works. From Alf Schlichting; ok millert@
Diffstat (limited to 'usr.sbin/user')
-rw-r--r--usr.sbin/user/user.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/user/user.c b/usr.sbin/user/user.c
index d1af6f6d244..c10e1dc03bf 100644
--- a/usr.sbin/user/user.c
+++ b/usr.sbin/user/user.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: user.c,v 1.67 2006/12/20 01:58:46 ray Exp $ */
+/* $OpenBSD: user.c,v 1.68 2007/01/12 13:25:12 otto Exp $ */
/* $NetBSD: user.c,v 1.69 2003/04/14 17:40:07 agc Exp $ */
/*
@@ -2196,7 +2196,8 @@ userinfo(int argc, char **argv)
(void) printf("groups\t%s", grp->gr_name);
while ((grp = getgrent()) != NULL) {
for (cpp = grp->gr_mem ; *cpp ; cpp++) {
- if (strcmp(*cpp, *argv) == 0 && grp->gr_gid != pwp->pw_gid)
+ if (strcmp(*cpp, pwp->pw_name) == 0 &&
+ grp->gr_gid != pwp->pw_gid)
(void) printf(" %s", grp->gr_name);
}
}