Skip to content

Commit ac89e98

Browse files
committed
add pty support to ssh client
pty and tty support was not enabled or working in the code. Without pty support, ssh client was very non functional - e.g. openssh linux server prompt would not come through. Now ssh client works much better in interactive mode ( uses pty).
1 parent 989b8a9 commit ac89e98

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

clientloop.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2563,6 +2563,7 @@ client_session2_setup(int id, int want_tty, int want_subsystem,
25632563
tty_make_modes(-1, tiop);
25642564

25652565
#else
2566+
packet_put_cstring(term != NULL ? term : "");
25662567
packet_put_int((u_int) 80 /*ws.ws_col*/);
25672568
packet_put_int((u_int) 25 /*ws.ws_row*/);
25682569
packet_put_int((u_int) 640 /*ws.ws_xpixel*/);

contrib/win32/win32compat/sfds.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,12 @@ int sfd_to_fd(int sfd)
264264
return sfd_map[sfd].fd;
265265
}
266266

267+
// set the sfd type to console. GetFileType() in Windows seem to return wrong type for a console returning PIPE (3) in place of CHARTYPE (2)
268+
void sfd_set_to_console(int sfd)
269+
{
270+
sfd_map[sfd].type = SFD_TYPE_CONSOLE;
271+
}
272+
267273
/*
268274
* For an sfd, get the real handle behind it
269275
*/

contrib/win32/win32compat/socket.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,11 @@ int WSHELPisatty(int sfd)
227227
* We can only do this for console fds.
228228
*/
229229

230-
if (sfd_is_console(sfd) && sfd > 0)
230+
if (sfd_is_console(sfd) && sfd >= 0)
231231
{
232-
ret = _isatty(sfd_to_fd(sfd));
232+
//ret = _isatty(sfd_to_fd(sfd));
233233

234-
return ret;
234+
return 1 ; //ret;
235235
}
236236

237237
/*
@@ -2825,7 +2825,11 @@ void allocate_standard_descriptor(int fd)
28252825
{
28262826
DBG_MSG("-> allocate_standard_descriptor(fd = %d)...\n", fd);
28272827

2828-
allocate_sfd(fd);
2828+
int asfd = allocate_sfd(fd);
2829+
2830+
void sfd_set_to_console(int sfd);
2831+
if (asfd >= 0)
2832+
sfd_set_to_console(asfd);
28292833

28302834
DBG_MSG("<- allocate_standard_descriptor()...");
28312835
}

session.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,8 @@ do_exec_pty(Session *s, const char *command)
12051205
* Win32 code.
12061206
*/
12071207

1208-
return 0;
1208+
//return 0;
1209+
return do_exec_pty(s, command);
12091210

12101211
#endif
12111212
}

0 commit comments

Comments
 (0)