[sftp-common.c]
     use user_from{uid,gid} to lookup up ids since it keeps a small cache.
     ok djm
This commit is contained in:
Darren Tucker 2010-01-15 11:45:33 +11:00
parent 94881d8dbb
commit a788de2066
2 changed files with 9 additions and 5 deletions

View File

@ -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

View File

@ -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;