File openssh-6.6p1-sftp_print_diagnostic_messages.patch of Package openssh.10219

# HG changeset patch
# Parent  a64299ec867eb33de3ebee76c9af1dc9d19756b5
Put back sftp client diagnostic messages in batch mode

bsc#1023275

diff --git a/openssh-6.6p1/sftp.0 b/openssh-6.6p1/sftp.0
--- a/openssh-6.6p1/sftp.0
+++ b/openssh-6.6p1/sftp.0
@@ -158,16 +158,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-6.6p1/sftp.1 b/openssh-6.6p1/sftp.1
--- a/openssh-6.6p1/sftp.1
+++ b/openssh-6.6p1/sftp.1
@@ -248,16 +248,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-6.6p1/sftp.c b/openssh-6.6p1/sftp.c
--- a/openssh-6.6p1/sftp.c
+++ b/openssh-6.6p1/sftp.c
@@ -76,16 +76,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 if possible */
@@ -2240,32 +2242,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);
@@ -2337,16 +2342,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))
openSUSE Build Service is sponsored by