diff options
author | tim <tim> | 2002-05-14 00:07:18 +0000 |
---|---|---|
committer | tim <tim> | 2002-05-14 00:07:18 +0000 |
commit | 83a8de1c175a27d79c7b766320a2b4255c35b11c (patch) | |
tree | 75b52a3ec276d2ce6b568ad93ea49ec1b000fbde /sshpty.c | |
parent | 0215c4506c678fd4702ea814a05f1c9fef36b22e (diff) | |
download | openssh-83a8de1c175a27d79c7b766320a2b4255c35b11c.tar.gz |
20020514
[sshpty.c] set tty modes when allocating old style bsd ptys to
match what newer style ptys have when allocated. Based on a patch by
Roger Cornelius <rac@tenzing.org>
[README.privsep] UnixWare 7 and OpenUNIX 8 work.
Diffstat (limited to 'sshpty.c')
-rw-r--r-- | sshpty.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -199,6 +199,7 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) const char *ptyminors = "0123456789abcdef"; int num_minors = strlen(ptyminors); int num_ptys = strlen(ptymajors) * num_minors; + struct termios tio; for (i = 0; i < num_ptys; i++) { snprintf(buf, sizeof buf, "/dev/pty%c%c", ptymajors[i / num_minors], @@ -223,6 +224,19 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) close(*ptyfd); return 0; } + /* set tty modes to a sane state for broken clients */ + if (tcgetattr(*ptyfd, &tio) < 0) + log("Getting tty modes for pty failed: %.100s", strerror(errno)); + else { + tio.c_lflag |= (ECHO | ISIG | ICANON); + tio.c_oflag |= (OPOST | ONLCR); + tio.c_iflag |= ICRNL; + + /* Set the new modes for the terminal. */ + if (tcsetattr(*ptyfd, TCSANOW, &tio) < 0) + log("Setting tty modes for pty failed: %.100s", strerror(errno)); + } + return 1; } return 0; |