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).
This commit is contained in:
quamrulmina 2015-10-05 15:46:37 -05:00
parent 989b8a9f01
commit ac89e98293
4 changed files with 17 additions and 5 deletions

View File

@ -2563,6 +2563,7 @@ client_session2_setup(int id, int want_tty, int want_subsystem,
tty_make_modes(-1, tiop); tty_make_modes(-1, tiop);
#else #else
packet_put_cstring(term != NULL ? term : "");
packet_put_int((u_int) 80 /*ws.ws_col*/); packet_put_int((u_int) 80 /*ws.ws_col*/);
packet_put_int((u_int) 25 /*ws.ws_row*/); packet_put_int((u_int) 25 /*ws.ws_row*/);
packet_put_int((u_int) 640 /*ws.ws_xpixel*/); packet_put_int((u_int) 640 /*ws.ws_xpixel*/);

View File

@ -264,6 +264,12 @@ int sfd_to_fd(int sfd)
return sfd_map[sfd].fd; return sfd_map[sfd].fd;
} }
// 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)
void sfd_set_to_console(int sfd)
{
sfd_map[sfd].type = SFD_TYPE_CONSOLE;
}
/* /*
* For an sfd, get the real handle behind it * For an sfd, get the real handle behind it
*/ */

View File

@ -227,11 +227,11 @@ int WSHELPisatty(int sfd)
* We can only do this for console fds. * We can only do this for console fds.
*/ */
if (sfd_is_console(sfd) && sfd > 0) if (sfd_is_console(sfd) && sfd >= 0)
{ {
ret = _isatty(sfd_to_fd(sfd)); //ret = _isatty(sfd_to_fd(sfd));
return ret; return 1 ; //ret;
} }
/* /*
@ -2825,7 +2825,11 @@ void allocate_standard_descriptor(int fd)
{ {
DBG_MSG("-> allocate_standard_descriptor(fd = %d)...\n", fd); DBG_MSG("-> allocate_standard_descriptor(fd = %d)...\n", fd);
allocate_sfd(fd); int asfd = allocate_sfd(fd);
void sfd_set_to_console(int sfd);
if (asfd >= 0)
sfd_set_to_console(asfd);
DBG_MSG("<- allocate_standard_descriptor()..."); DBG_MSG("<- allocate_standard_descriptor()...");
} }

View File

@ -1205,7 +1205,8 @@ do_exec_pty(Session *s, const char *command)
* Win32 code. * Win32 code.
*/ */
return 0; //return 0;
return do_exec_pty(s, command);
#endif #endif
} }