openssh PTY allocation

Morty Abzug morty at frakir.org
Wed Jul 27 13:01:37 EST 2011


[snip]

We continue to have issues with login to ScreenOS devices.
Apparently, the simple workaround of ssh -T $device breaks command
editing.

We're also have problems with scp to ScreenOS devices.  Apparently,
ScreenOS doesn't support "--" option termination.

The following patch seems to "fix" both issues:

diff -ur openssh-5.8p2-orig//clientloop.c openssh-5.8p2-morty/clientloop.c
--- openssh-5.8p2-orig//clientloop.c	Sun Jan 16 12:18:35 2011
+++ openssh-5.8p2-morty/clientloop.c	Tue Jul 26 16:55:17 2011
@@ -1982,7 +1982,7 @@
 			memset(&ws, 0, sizeof(ws));
 
 		channel_request_start(id, "pty-req", 1);
-		client_expect_confirm(id, "PTY allocation", 1);
+		client_expect_confirm(id, "PTY allocation", 0);
 		packet_put_cstring(term != NULL ? term : "");
 		packet_put_int((u_int)ws.ws_col);
 		packet_put_int((u_int)ws.ws_row);
diff -ur openssh-5.8p2-orig//scp.c openssh-5.8p2-morty/scp.c
--- openssh-5.8p2-orig//scp.c	Thu Jan  6 11:41:21 2011
+++ openssh-5.8p2-morty/scp.c	Tue Jul 26 17:02:25 2011
@@ -273,7 +273,6 @@
 			addargs(&args, "-l");
 			addargs(&args, "%s", remuser);
 		}
-		addargs(&args, "--");
 		addargs(&args, "%s", host);
 		addargs(&args, "%s", cmd);
 
@@ -322,7 +321,6 @@
 			addargs(&args, "-l");
 			addargs(&args, "%s", remuser);
 		}
-		addargs(&args, "--");
 		addargs(&args, "%s", host);
 		addargs(&args, "%s", cmd);
 
@@ -601,12 +599,12 @@
 				host = cleanhostname(argv[i]);
 				suser = NULL;
 			}
-			xasprintf(&bp, "%s -f -- %s", cmd, src);
+			xasprintf(&bp, "%s -f %s", cmd, src);
 			if (do_cmd(host, suser, bp, &remin, &remout) < 0)
 				exit(1);
 			(void) xfree(bp);
 			host = cleanhostname(thost);
-			xasprintf(&bp, "%s -t -- %s", cmd, targ);
+			xasprintf(&bp, "%s -t %s", cmd, targ);
 			if (do_cmd2(host, tuser, bp, remin, remout) < 0)
 				exit(1);
 			(void) xfree(bp);
@@ -641,7 +639,6 @@
 			} else {
 				host = cleanhostname(argv[i]);
 			}
-			addargs(&alist, "--");
 			addargs(&alist, "%s", host);
 			addargs(&alist, "%s", cmd);
 			addargs(&alist, "%s", src);
@@ -652,7 +649,7 @@
 				errs = 1;
 		} else {	/* local to remote */
 			if (remin == -1) {
-				xasprintf(&bp, "%s -t -- %s", cmd, targ);
+				xasprintf(&bp, "%s -t %s", cmd, targ);
 				host = cleanhostname(thost);
 				if (do_cmd(host, tuser, bp, &remin,
 				    &remout) < 0)
@@ -685,7 +682,6 @@
 				addargs(&alist, "-r");
 			if (pflag)
 				addargs(&alist, "-p");
-			addargs(&alist, "--");
 			addargs(&alist, "%s", argv[i]);
 			addargs(&alist, "%s", argv[argc-1]);
 			if (do_local_cmd(&alist))
@@ -705,7 +701,7 @@
 				suser = pwd->pw_name;
 		}
 		host = cleanhostname(host);
-		xasprintf(&bp, "%s -f -- %s", cmd, src);
+		xasprintf(&bp, "%s -f %s", cmd, src);
 		if (do_cmd(host, suser, bp, &remin, &remout) < 0) {
 			(void) xfree(bp);
 			++errs;
diff -ur openssh-5.8p2-orig//version.h openssh-5.8p2-morty/version.h
--- openssh-5.8p2-orig//version.h	Thu May  5 01:56:54 2011
+++ openssh-5.8p2-morty/version.h	Tue Jul 26 17:02:39 2011
@@ -2,5 +2,5 @@
 
 #define SSH_VERSION	"OpenSSH_5.8"
 
-#define SSH_PORTABLE	"p2"
+#define SSH_PORTABLE	"p2-MORTY-p2"
 #define SSH_RELEASE	SSH_VERSION SSH_PORTABLE


More information about the openssh-unix-dev mailing list