X-Git-Url: http://andersk.mit.edu/gitweb/gssapi-openssh.git/blobdiff_plain/f5799ae11d9a6d85b68449a35cd4077ae9090357..c7931c9aedd8e12fdd0df715dcefce0e0c95be6a:/openssh/sshpty.c diff --git a/openssh/sshpty.c b/openssh/sshpty.c index a7e7e27..e1e6031 100644 --- a/openssh/sshpty.c +++ b/openssh/sshpty.c @@ -12,7 +12,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshpty.c,v 1.4 2001/12/19 07:18:56 deraadt Exp $"); +RCSID("$OpenBSD: sshpty.c,v 1.3 2001/07/22 21:32:27 markus Exp $"); #ifdef HAVE_UTIL_H # include @@ -156,7 +156,7 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) *ttyfd = open(name, O_RDWR | O_NOCTTY); if (*ttyfd < 0) { error("Could not open pty slave side %.100s: %.100s", - name, strerror(errno)); + name, strerror(errno)); close(*ptyfd); return 0; } @@ -164,8 +164,8 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) #else /* HAVE_DEV_PTS_AND_PTC */ #ifdef _CRAY char buf[64]; - int i; - int highpty; + int i; + int highpty; #ifdef _SC_CRAY_NPTY highpty = sysconf(_SC_CRAY_NPTY); @@ -199,7 +199,6 @@ 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], @@ -224,19 +223,6 @@ 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; @@ -289,7 +275,7 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname) if (fd < 0) error("%.100s: %.100s", ttyname, strerror(errno)); close(*ttyfd); - *ttyfd = fd; + *ttyfd = fd; #else /* _CRAY */ /* First disconnect from the old controlling tty. */ @@ -342,7 +328,7 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname) fd = open(_PATH_TTY, O_WRONLY); if (fd < 0) error("open /dev/tty failed - could not set controlling tty: %.100s", - strerror(errno)); + strerror(errno)); else { close(fd); } @@ -353,7 +339,7 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname) void pty_change_window_size(int ptyfd, int row, int col, - int xpixel, int ypixel) + int xpixel, int ypixel) { struct winsize w; w.ws_row = row; @@ -392,15 +378,15 @@ pty_setowner(struct passwd *pw, const char *ttyname) if (st.st_uid != pw->pw_uid || st.st_gid != gid) { if (chown(ttyname, pw->pw_uid, gid) < 0) { - if (errno == EROFS && + if (errno == EROFS && (st.st_uid == pw->pw_uid || st.st_uid == 0)) error("chown(%.100s, %d, %d) failed: %.100s", - ttyname, pw->pw_uid, gid, - strerror(errno)); + ttyname, pw->pw_uid, gid, + strerror(errno)); else fatal("chown(%.100s, %d, %d) failed: %.100s", - ttyname, pw->pw_uid, gid, - strerror(errno)); + ttyname, pw->pw_uid, gid, + strerror(errno)); } } @@ -409,10 +395,10 @@ pty_setowner(struct passwd *pw, const char *ttyname) if (errno == EROFS && (st.st_mode & (S_IRGRP | S_IROTH)) == 0) error("chmod(%.100s, 0%o) failed: %.100s", - ttyname, mode, strerror(errno)); + ttyname, mode, strerror(errno)); else fatal("chmod(%.100s, 0%o) failed: %.100s", - ttyname, mode, strerror(errno)); + ttyname, mode, strerror(errno)); } } }