diff options
author | Darren Tucker <dtucker@zip.com.au> | 2010-01-15 11:45:33 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2010-01-15 11:45:33 +1100 |
commit | a788de206647e1ffa51b0a95bac1951a02880f76 (patch) | |
tree | 5f7f15b3b01c15218848f042689a45f9035a275f | |
parent | 94881d8dbb228e170d476d35fb523425c0c4c001 (diff) | |
download | openssh-git-a788de206647e1ffa51b0a95bac1951a02880f76.tar.gz |
- dtucker@cvs.openbsd.org 2010/01/14 23:41:49
[sftp-common.c]
use user_from{uid,gid} to lookup up ids since it keeps a small cache.
ok djm
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | sftp-common.c | 10 |
2 files changed, 9 insertions, 5 deletions
@@ -11,6 +11,10 @@ when using ChrootDirectory, make sure we test for the existence of the user's shell inside the chroot; bz #1679, patch from alex AT rtfs.hu; ok dtucker + - dtucker@cvs.openbsd.org 2010/01/14 23:41:49 + [sftp-common.c] + use user_from{uid,gid} to lookup up ids since it keeps a small cache. + ok djm 20100114 - (djm) [platform.h] Add missing prototype for diff --git a/sftp-common.c b/sftp-common.c index 96eb4f79..d015d754 100644 --- a/sftp-common.c +++ b/sftp-common.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp-common.c,v 1.21 2010/01/13 01:40:16 djm Exp $ */ +/* $OpenBSD: sftp-common.c,v 1.22 2010/01/14 23:41:49 dtucker Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. * Copyright (c) 2001 Damien Miller. All rights reserved. @@ -198,14 +198,14 @@ ls_file(const char *name, const struct stat *st, int remote, int si_units) char sbuf[FMT_SCALED_STRSIZE]; strmode(st->st_mode, mode); - if (!remote && (pw = getpwuid(st->st_uid)) != NULL) { - user = pw->pw_name; + if (!remote) { + user = user_from_uid(st->st_uid, 0); } else { snprintf(ubuf, sizeof ubuf, "%u", (u_int)st->st_uid); user = ubuf; } - if (!remote && (gr = getgrgid(st->st_gid)) != NULL) { - group = gr->gr_name; + if (!remote) { + group = group_from_gid(st->st_gid, 0); } else { snprintf(gbuf, sizeof gbuf, "%u", (u_int)st->st_gid); group = gbuf; |