diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2001-06-22 22:21:21 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2001-06-22 22:21:21 +0000 |
commit | dde76ba242eece130dcab7c94b1361ad37f80a0d (patch) | |
tree | 630a3c7aca7f06609f084e2e31df6a736909db26 /usr.bin | |
parent | 634013aca225036290bc60d65b51216d8b7df110 (diff) |
allow long usernames/groups in readdir
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/sftp-server.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/ssh/sftp-server.c b/usr.bin/ssh/sftp-server.c index d26ef239c93..d008ca03d01 100644 --- a/usr.bin/ssh/sftp-server.c +++ b/usr.bin/ssh/sftp-server.c @@ -22,7 +22,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "includes.h" -RCSID("$OpenBSD: sftp-server.c,v 1.26 2001/05/12 19:53:13 markus Exp $"); +RCSID("$OpenBSD: sftp-server.c,v 1.27 2001/06/22 22:21:20 markus Exp $"); #include "buffer.h" #include "bufaux.h" @@ -672,7 +672,7 @@ process_opendir(void) char * ls_file(char *name, struct stat *st) { - int sz = 0; + int ulen, glen, sz = 0; struct passwd *pw; struct group *gr; struct tm *ltime = localtime(&st->st_mtime); @@ -700,8 +700,11 @@ ls_file(char *name, struct stat *st) } if (sz == 0) tbuf[0] = '\0'; - snprintf(buf, sizeof buf, "%s %3d %-8.8s %-8.8s %8llu %s %s", mode, - st->st_nlink, user, group, (unsigned long long)st->st_size, tbuf, name); + ulen = MAX(strlen(user), 8); + glen = MAX(strlen(group), 8); + snprintf(buf, sizeof buf, "%s %3d %-*s %-*s %8llu %s %s", mode, + st->st_nlink, ulen, user, glen, group, + (unsigned long long)st->st_size, tbuf, name); return xstrdup(buf); } |