diff options
author | Colin Watson <cjwatson@debian.org> | 2010-03-31 10:46:28 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2010-03-31 10:46:28 +0100 |
commit | efd3d4522636ae029488c2e9730b60c88e257d2e (patch) | |
tree | 31e02ac3f16090ce8c53448677356b2b7f423683 /sftp-common.c | |
parent | bbec4db36d464ea1d464a707625125f9fd5c7b5e (diff) | |
parent | d1a87e462e1db89f19cd960588d0c6b287cb5ccc (diff) |
* New upstream release (LP: #535029).
- After a transition period of about 10 years, this release disables SSH
protocol 1 by default. Clients and servers that need to use the
legacy protocol must explicitly enable it in ssh_config / sshd_config
or on the command-line.
- Remove the libsectok/OpenSC-based smartcard code and add support for
PKCS#11 tokens. This support is enabled by default in the Debian
packaging, since it now doesn't involve additional library
dependencies (closes: #231472, LP: #16918).
- Add support for certificate authentication of users and hosts using a
new, minimal OpenSSH certificate format (closes: #482806).
- Added a 'netcat mode' to ssh(1): "ssh -W host:port ...".
- Add the ability to revoke keys in sshd(8) and ssh(1). (For the Debian
package, this overlaps with the key blacklisting facility added in
openssh 1:4.7p1-9, but with different file formats and slightly
different scopes; for the moment, I've roughly merged the two.)
- Various multiplexing improvements, including support for requesting
port-forwardings via the multiplex protocol (closes: #360151).
- Allow setting an explicit umask on the sftp-server(8) commandline to
override whatever default the user has (closes: #496843).
- Many sftp client improvements, including tab-completion, more options,
and recursive transfer support for get/put (LP: #33378). The old
mget/mput commands never worked properly and have been removed
(closes: #270399, #428082).
- Do not prompt for a passphrase if we fail to open a keyfile, and log
the reason why the open failed to debug (closes: #431538).
- Prevent sftp from crashing when given a "-" without a command. Also,
allow whitespace to follow a "-" (closes: #531561).
Diffstat (limited to 'sftp-common.c')
-rw-r--r-- | sftp-common.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/sftp-common.c b/sftp-common.c index 7ebadcc53..a042875c6 100644 --- a/sftp-common.c +++ b/sftp-common.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sftp-common.c,v 1.20 2006/08/03 03:34:42 deraadt Exp $ */ | 1 | /* $OpenBSD: sftp-common.c,v 1.23 2010/01/15 09:24:23 markus 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. |
@@ -36,6 +36,9 @@ | |||
36 | #include <string.h> | 36 | #include <string.h> |
37 | #include <time.h> | 37 | #include <time.h> |
38 | #include <stdarg.h> | 38 | #include <stdarg.h> |
39 | #ifdef HAVE_UTIL_H | ||
40 | #include <util.h> | ||
41 | #endif | ||
39 | 42 | ||
40 | #include "xmalloc.h" | 43 | #include "xmalloc.h" |
41 | #include "buffer.h" | 44 | #include "buffer.h" |
@@ -184,24 +187,23 @@ fx2txt(int status) | |||
184 | * drwxr-xr-x 5 markus markus 1024 Jan 13 18:39 .ssh | 187 | * drwxr-xr-x 5 markus markus 1024 Jan 13 18:39 .ssh |
185 | */ | 188 | */ |
186 | char * | 189 | char * |
187 | ls_file(const char *name, const struct stat *st, int remote) | 190 | ls_file(const char *name, const struct stat *st, int remote, int si_units) |
188 | { | 191 | { |
189 | int ulen, glen, sz = 0; | 192 | int ulen, glen, sz = 0; |
190 | struct passwd *pw; | ||
191 | struct group *gr; | ||
192 | struct tm *ltime = localtime(&st->st_mtime); | 193 | struct tm *ltime = localtime(&st->st_mtime); |
193 | char *user, *group; | 194 | char *user, *group; |
194 | char buf[1024], mode[11+1], tbuf[12+1], ubuf[11+1], gbuf[11+1]; | 195 | char buf[1024], mode[11+1], tbuf[12+1], ubuf[11+1], gbuf[11+1]; |
196 | char sbuf[FMT_SCALED_STRSIZE]; | ||
195 | 197 | ||
196 | strmode(st->st_mode, mode); | 198 | strmode(st->st_mode, mode); |
197 | if (!remote && (pw = getpwuid(st->st_uid)) != NULL) { | 199 | if (!remote) { |
198 | user = pw->pw_name; | 200 | user = user_from_uid(st->st_uid, 0); |
199 | } else { | 201 | } else { |
200 | snprintf(ubuf, sizeof ubuf, "%u", (u_int)st->st_uid); | 202 | snprintf(ubuf, sizeof ubuf, "%u", (u_int)st->st_uid); |
201 | user = ubuf; | 203 | user = ubuf; |
202 | } | 204 | } |
203 | if (!remote && (gr = getgrgid(st->st_gid)) != NULL) { | 205 | if (!remote) { |
204 | group = gr->gr_name; | 206 | group = group_from_gid(st->st_gid, 0); |
205 | } else { | 207 | } else { |
206 | snprintf(gbuf, sizeof gbuf, "%u", (u_int)st->st_gid); | 208 | snprintf(gbuf, sizeof gbuf, "%u", (u_int)st->st_gid); |
207 | group = gbuf; | 209 | group = gbuf; |
@@ -216,8 +218,15 @@ ls_file(const char *name, const struct stat *st, int remote) | |||
216 | tbuf[0] = '\0'; | 218 | tbuf[0] = '\0'; |
217 | ulen = MAX(strlen(user), 8); | 219 | ulen = MAX(strlen(user), 8); |
218 | glen = MAX(strlen(group), 8); | 220 | glen = MAX(strlen(group), 8); |
219 | snprintf(buf, sizeof buf, "%s %3u %-*s %-*s %8llu %s %s", mode, | 221 | if (si_units) { |
220 | (u_int)st->st_nlink, ulen, user, glen, group, | 222 | fmt_scaled((long long)st->st_size, sbuf); |
221 | (unsigned long long)st->st_size, tbuf, name); | 223 | snprintf(buf, sizeof buf, "%s %3u %-*s %-*s %8s %s %s", mode, |
224 | (u_int)st->st_nlink, ulen, user, glen, group, | ||
225 | sbuf, tbuf, name); | ||
226 | } else { | ||
227 | snprintf(buf, sizeof buf, "%s %3u %-*s %-*s %8llu %s %s", mode, | ||
228 | (u_int)st->st_nlink, ulen, user, glen, group, | ||
229 | (unsigned long long)st->st_size, tbuf, name); | ||
230 | } | ||
222 | return xstrdup(buf); | 231 | return xstrdup(buf); |
223 | } | 232 | } |