shithub: riscv

Download patch

ref: 042f98784acb9f09013f65b0c93b7f56e1b8a10a
parent: ef7b42883242ec39eb4be18c2c5c49b03e5ceaf1
author: aiju <devnull@localhost>
date: Mon Apr 24 19:26:43 EDT 2017

ssh: make number of retries configurable

--- a/sys/man/1/ssh
+++ b/sys/man/1/ssh
@@ -60,6 +60,13 @@
 .B -R
 option.
 .PP
+If
+.I keyboard-interactive
+authentication fails, by default it is retried three times.
+The number of tries can be changed with
+.BR -T .
+Setting it to zero disables keyboard-interactive authentication.
+.PP
 The
 .B -d
 option enables debug output.
--- a/sys/src/cmd/ssh.c
+++ b/sys/src/cmd/ssh.c
@@ -52,9 +52,7 @@
 	WinPackets = 8,		// (1<<15) * 8 = 256K
 };
 
-enum {
-	MaxPwTries = 3 // retry this often for keyboard-interactive
-};
+int MaxPwTries = 3; // retry this often for keyboard-interactive
 
 typedef struct
 {
@@ -1151,6 +1149,10 @@
 		break;
 	case 't':
 		thumbfile = EARGF(usage());
+		break;
+	case 'T':
+		MaxPwTries = strtol(EARGF(usage()), &s, 0);
+		if(*s != 0) usage();
 		break;
 	} ARGEND;