зеркало из https://github.com/Azure/sonic-openssh.git
upstream: make scp(1) in SFTP mode output better match original
scp(1) by suppressing "Retrieving [path]" lines that were emitted to support the interactive sftp(1) client. ok markus@ OpenBSD-Commit-ID: 06be293df5f156a18f366079be2f33fa68001acc
This commit is contained in:
Родитель
48cd39b7a4
Коммит
c677e65365
7
scp.c
7
scp.c
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: scp.c,v 1.219 2021/08/07 00:06:30 djm Exp $ */
|
/* $OpenBSD: scp.c,v 1.220 2021/08/07 00:08:52 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* scp - secure remote copy. This is basically patched BSD rcp which
|
* scp - secure remote copy. This is basically patched BSD rcp which
|
||||||
* uses ssh to do the data transfer (instead of using rcmd).
|
* uses ssh to do the data transfer (instead of using rcmd).
|
||||||
|
@ -1289,7 +1289,8 @@ source_sftp(int argc, char *src, char *targ,
|
||||||
debug3_f("copying local %s to remote %s", src, abs_dst);
|
debug3_f("copying local %s to remote %s", src, abs_dst);
|
||||||
|
|
||||||
if (local_is_dir(src) && iamrecursive) {
|
if (local_is_dir(src) && iamrecursive) {
|
||||||
if (upload_dir(conn, src, abs_dst, pflag, 1, 0, 0) != 0) {
|
if (upload_dir(conn, src, abs_dst, pflag,
|
||||||
|
SFTP_PROGRESS_ONLY, 0, 0) != 0) {
|
||||||
fatal("failed to upload directory %s to %s",
|
fatal("failed to upload directory %s to %s",
|
||||||
src, abs_dst);
|
src, abs_dst);
|
||||||
}
|
}
|
||||||
|
@ -1521,7 +1522,7 @@ sink_sftp(int argc, char *dst, const char *src, struct sftp_conn *conn)
|
||||||
debug("Fetching %s to %s\n", g.gl_pathv[i], abs_dst);
|
debug("Fetching %s to %s\n", g.gl_pathv[i], abs_dst);
|
||||||
if (globpath_is_dir(g.gl_pathv[i]) && iamrecursive) {
|
if (globpath_is_dir(g.gl_pathv[i]) && iamrecursive) {
|
||||||
if (download_dir(conn, g.gl_pathv[i], abs_dst, NULL,
|
if (download_dir(conn, g.gl_pathv[i], abs_dst, NULL,
|
||||||
pflag, 1, 0, 0) == -1)
|
pflag, SFTP_PROGRESS_ONLY, 0, 0) == -1)
|
||||||
err = -1;
|
err = -1;
|
||||||
} else {
|
} else {
|
||||||
if (do_download(conn, g.gl_pathv[i], abs_dst, NULL,
|
if (do_download(conn, g.gl_pathv[i], abs_dst, NULL,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: sftp-client.c,v 1.146 2021/08/07 00:07:18 djm Exp $ */
|
/* $OpenBSD: sftp-client.c,v 1.147 2021/08/07 00:08:52 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
|
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
|
||||||
*
|
*
|
||||||
|
@ -1633,7 +1633,7 @@ download_dir_internal(struct sftp_conn *conn, const char *src, const char *dst,
|
||||||
error("\"%s\" is not a directory", src);
|
error("\"%s\" is not a directory", src);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (print_flag)
|
if (print_flag && print_flag != SFTP_PROGRESS_ONLY)
|
||||||
mprintf("Retrieving %s\n", src);
|
mprintf("Retrieving %s\n", src);
|
||||||
|
|
||||||
if (dirattrib->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) {
|
if (dirattrib->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) {
|
||||||
|
@ -1957,7 +1957,7 @@ upload_dir_internal(struct sftp_conn *conn, const char *src, const char *dst,
|
||||||
error("\"%s\" is not a directory", src);
|
error("\"%s\" is not a directory", src);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (print_flag)
|
if (print_flag && print_flag != SFTP_PROGRESS_ONLY)
|
||||||
mprintf("Entering %s\n", src);
|
mprintf("Entering %s\n", src);
|
||||||
|
|
||||||
attrib_clear(&a);
|
attrib_clear(&a);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: sftp-client.h,v 1.31 2021/08/07 00:02:41 djm Exp $ */
|
/* $OpenBSD: sftp-client.h,v 1.32 2021/08/07 00:08:52 djm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
|
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
|
||||||
|
@ -61,6 +61,11 @@ struct sftp_limits {
|
||||||
u_int64_t open_handles;
|
u_int64_t open_handles;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* print flag values */
|
||||||
|
#define SFTP_QUIET 0 /* be quiet during transfers */
|
||||||
|
#define SFTP_PRINT 1 /* list files and show progress bar */
|
||||||
|
#define SFTP_PROGRESS_ONLY 2 /* progress bar only */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialise a SSH filexfer connection. Returns NULL on error or
|
* Initialise a SSH filexfer connection. Returns NULL on error or
|
||||||
* a pointer to a initialized sftp_conn struct on success.
|
* a pointer to a initialized sftp_conn struct on success.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче