diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | sftp-common.c | 10 |
2 files changed, 9 insertions, 5 deletions
@@ -11,6 +11,10 @@ | |||
11 | when using ChrootDirectory, make sure we test for the existence of the | 11 | when using ChrootDirectory, make sure we test for the existence of the |
12 | user's shell inside the chroot; bz #1679, patch from alex AT rtfs.hu; | 12 | user's shell inside the chroot; bz #1679, patch from alex AT rtfs.hu; |
13 | ok dtucker | 13 | ok dtucker |
14 | - dtucker@cvs.openbsd.org 2010/01/14 23:41:49 | ||
15 | [sftp-common.c] | ||
16 | use user_from{uid,gid} to lookup up ids since it keeps a small cache. | ||
17 | ok djm | ||
14 | 18 | ||
15 | 20100114 | 19 | 20100114 |
16 | - (djm) [platform.h] Add missing prototype for | 20 | - (djm) [platform.h] Add missing prototype for |
diff --git a/sftp-common.c b/sftp-common.c index 96eb4f79a..d015d7549 100644 --- a/sftp-common.c +++ b/sftp-common.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sftp-common.c,v 1.21 2010/01/13 01:40:16 djm Exp $ */ | 1 | /* $OpenBSD: sftp-common.c,v 1.22 2010/01/14 23:41:49 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2001 Damien Miller. All rights reserved. | 4 | * 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) | |||
198 | char sbuf[FMT_SCALED_STRSIZE]; | 198 | char sbuf[FMT_SCALED_STRSIZE]; |
199 | 199 | ||
200 | strmode(st->st_mode, mode); | 200 | strmode(st->st_mode, mode); |
201 | if (!remote && (pw = getpwuid(st->st_uid)) != NULL) { | 201 | if (!remote) { |
202 | user = pw->pw_name; | 202 | user = user_from_uid(st->st_uid, 0); |
203 | } else { | 203 | } else { |
204 | snprintf(ubuf, sizeof ubuf, "%u", (u_int)st->st_uid); | 204 | snprintf(ubuf, sizeof ubuf, "%u", (u_int)st->st_uid); |
205 | user = ubuf; | 205 | user = ubuf; |
206 | } | 206 | } |
207 | if (!remote && (gr = getgrgid(st->st_gid)) != NULL) { | 207 | if (!remote) { |
208 | group = gr->gr_name; | 208 | group = group_from_gid(st->st_gid, 0); |
209 | } else { | 209 | } else { |
210 | snprintf(gbuf, sizeof gbuf, "%u", (u_int)st->st_gid); | 210 | snprintf(gbuf, sizeof gbuf, "%u", (u_int)st->st_gid); |
211 | group = gbuf; | 211 | group = gbuf; |