openssh/openssh-7.2p2-sftp_print_diagnostic_messages.patch

131 lines
3.7 KiB
Diff
Raw Normal View History

# HG changeset patch
# Parent af7fb4f9e794f639262d9847e95c52a74017aaaf
Put back sftp client diagnostic messages in batch mode
bsc#1023275
diff --git a/openssh-7.2p2/sftp.0 b/openssh-7.2p2/sftp.0
--- a/openssh-7.2p2/sftp.0
+++ b/openssh-7.2p2/sftp.0
@@ -162,16 +162,19 @@ DESCRIPTION
VerifyHostKeyDNS
-P port
Specifies the port to connect to on the remote host.
-p Preserves modification times, access times, and modes from the
original files transferred.
+ -Q Not-so-quiet batch mode: forces printing of diagnostic messages
+ in batch mode.
+
-q Quiet mode: disables the progress meter as well as warning and
diagnostic messages from ssh(1).
-R num_requests
Specify how many requests may be outstanding at any one time.
Increasing this may slightly improve file transfer speed but will
increase memory usage. The default is 64 outstanding requests.
diff --git a/openssh-7.2p2/sftp.1 b/openssh-7.2p2/sftp.1
--- a/openssh-7.2p2/sftp.1
+++ b/openssh-7.2p2/sftp.1
@@ -251,16 +251,19 @@ For full details of the options listed b
.It UserKnownHostsFile
.It VerifyHostKeyDNS
.El
.It Fl P Ar port
Specifies the port to connect to on the remote host.
.It Fl p
Preserves modification times, access times, and modes from the
original files transferred.
+.It Fl Q
+Not-so-quiet batch mode: forces printing of diagnostic messages
+in batch mode.
.It Fl q
Quiet mode: disables the progress meter as well as warning and
diagnostic messages from
.Xr ssh 1 .
.It Fl R Ar num_requests
Specify how many requests may be outstanding at any one time.
Increasing this may slightly improve file transfer speed
but will increase memory usage.
diff --git a/openssh-7.2p2/sftp.c b/openssh-7.2p2/sftp.c
--- a/openssh-7.2p2/sftp.c
+++ b/openssh-7.2p2/sftp.c
@@ -79,16 +79,18 @@ FILE* infile;
/* Are we in batchfile mode? */
int batchmode = 0;
/* PID of ssh transport process */
static pid_t sshpid = -1;
/* Suppress diagnositic messages */
int quiet = 0;
+/* Force diagnositic messages in batch mode */
+int loud = 0;
/* This is set to 0 if the progressmeter is not desired. */
int showprogress = 1;
/* When this option is set, we always recursively download/upload directories */
int global_rflag = 0;
/* When this option is set, we resume download or upload if possible */
@@ -2263,32 +2265,35 @@ main(int argc, char **argv)
addargs(&args, "-oForwardAgent no");
addargs(&args, "-oPermitLocalCommand no");
addargs(&args, "-oClearAllForwardings yes");
ll = SYSLOG_LEVEL_INFO;
infile = stdin;
while ((ch = getopt(argc, argv,
- "1246afhpqrvCc:D:i:l:o:s:S:b:B:F:P:R:")) != -1) {
+ "1246afhpQqrvCc:D:i:l:o:s:S:b:B:F:P:R:")) != -1) {
switch (ch) {
/* Passed through to ssh(1) */
case '4':
case '6':
case 'C':
addargs(&args, "-%c", ch);
break;
/* Passed through to ssh(1) with argument */
case 'F':
case 'c':
case 'i':
case 'o':
addargs(&args, "-%c", ch);
addargs(&args, "%s", optarg);
break;
+ case 'Q':
+ loud = 1;
+ break;
case 'q':
ll = SYSLOG_LEVEL_ERROR;
quiet = 1;
showprogress = 0;
addargs(&args, "-%c", ch);
break;
case 'P':
addargs(&args, "-oPort %s", optarg);
@@ -2360,16 +2365,18 @@ main(int argc, char **argv)
ssh_program = optarg;
replacearg(&args, 0, "%s", ssh_program);
break;
case 'h':
default:
usage();
}
}
+ if (batchmode && loud)
+ quiet = 0;
if (!isatty(STDERR_FILENO))
showprogress = 0;
log_init(argv[0], ll, SYSLOG_FACILITY_USER, 1);
if (sftp_direct == NULL) {
if (optind == argc || argc > (optind + 2))