summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2010-01-15 11:45:33 +1100
committerDarren Tucker <dtucker@zip.com.au>2010-01-15 11:45:33 +1100
commita788de206647e1ffa51b0a95bac1951a02880f76 (patch)
tree5f7f15b3b01c15218848f042689a45f9035a275f
parent94881d8dbb228e170d476d35fb523425c0c4c001 (diff)
- 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--ChangeLog4
-rw-r--r--sftp-common.c10
2 files changed, 9 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 8a324f350..257204240 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
1520100114 1920100114
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;