summaryrefslogtreecommitdiff
path: root/sshpty.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2001-12-21 14:45:46 +1100
committerDamien Miller <djm@mindrot.org>2001-12-21 14:45:46 +1100
commit9f0f5c64bc4b6144e3fed6a7f538f7c21819a492 (patch)
treef79317ab211f59181a61b526f566e9c8cfe70c73 /sshpty.c
parent89681214ca2f50a1b1ed6164c3afe1ce14995ffc (diff)
- deraadt@cvs.openbsd.org 2001/12/19 07:18:56
[auth1.c auth2.c auth2-chall.c auth-bsdauth.c auth.c authfile.c auth.h] [auth-krb4.c auth-rhosts.c auth-skey.c bufaux.c canohost.c channels.c] [cipher.c clientloop.c compat.c compress.c deattack.c key.c log.c mac.c] [match.c misc.c nchan.c packet.c readconf.c rijndael.c rijndael.h scard.c] [servconf.c servconf.h serverloop.c session.c sftp.c sftp-client.c] [sftp-glob.c sftp-int.c sftp-server.c ssh-add.c ssh-agent.c ssh.c] [sshconnect1.c sshconnect2.c sshconnect.c sshd.8 sshd.c sshd_config] [ssh-keygen.c sshlogin.c sshpty.c sshtty.c ttymodes.c uidswap.c] basic KNF done while i was looking for something else
Diffstat (limited to 'sshpty.c')
-rw-r--r--sshpty.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sshpty.c b/sshpty.c
index e1e603141..71c48b573 100644
--- a/sshpty.c
+++ b/sshpty.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: sshpty.c,v 1.3 2001/07/22 21:32:27 markus Exp $"); 15RCSID("$OpenBSD: sshpty.c,v 1.4 2001/12/19 07:18:56 deraadt Exp $");
16 16
17#ifdef HAVE_UTIL_H 17#ifdef HAVE_UTIL_H
18# include <util.h> 18# include <util.h>
@@ -156,7 +156,7 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen)
156 *ttyfd = open(name, O_RDWR | O_NOCTTY); 156 *ttyfd = open(name, O_RDWR | O_NOCTTY);
157 if (*ttyfd < 0) { 157 if (*ttyfd < 0) {
158 error("Could not open pty slave side %.100s: %.100s", 158 error("Could not open pty slave side %.100s: %.100s",
159 name, strerror(errno)); 159 name, strerror(errno));
160 close(*ptyfd); 160 close(*ptyfd);
161 return 0; 161 return 0;
162 } 162 }
@@ -328,7 +328,7 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname)
328 fd = open(_PATH_TTY, O_WRONLY); 328 fd = open(_PATH_TTY, O_WRONLY);
329 if (fd < 0) 329 if (fd < 0)
330 error("open /dev/tty failed - could not set controlling tty: %.100s", 330 error("open /dev/tty failed - could not set controlling tty: %.100s",
331 strerror(errno)); 331 strerror(errno));
332 else { 332 else {
333 close(fd); 333 close(fd);
334 } 334 }
@@ -339,7 +339,7 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname)
339 339
340void 340void
341pty_change_window_size(int ptyfd, int row, int col, 341pty_change_window_size(int ptyfd, int row, int col,
342 int xpixel, int ypixel) 342 int xpixel, int ypixel)
343{ 343{
344 struct winsize w; 344 struct winsize w;
345 w.ws_row = row; 345 w.ws_row = row;
@@ -378,15 +378,15 @@ pty_setowner(struct passwd *pw, const char *ttyname)
378 378
379 if (st.st_uid != pw->pw_uid || st.st_gid != gid) { 379 if (st.st_uid != pw->pw_uid || st.st_gid != gid) {
380 if (chown(ttyname, pw->pw_uid, gid) < 0) { 380 if (chown(ttyname, pw->pw_uid, gid) < 0) {
381 if (errno == EROFS && 381 if (errno == EROFS &&
382 (st.st_uid == pw->pw_uid || st.st_uid == 0)) 382 (st.st_uid == pw->pw_uid || st.st_uid == 0))
383 error("chown(%.100s, %d, %d) failed: %.100s", 383 error("chown(%.100s, %d, %d) failed: %.100s",
384 ttyname, pw->pw_uid, gid, 384 ttyname, pw->pw_uid, gid,
385 strerror(errno)); 385 strerror(errno));
386 else 386 else
387 fatal("chown(%.100s, %d, %d) failed: %.100s", 387 fatal("chown(%.100s, %d, %d) failed: %.100s",
388 ttyname, pw->pw_uid, gid, 388 ttyname, pw->pw_uid, gid,
389 strerror(errno)); 389 strerror(errno));
390 } 390 }
391 } 391 }
392 392
@@ -395,10 +395,10 @@ pty_setowner(struct passwd *pw, const char *ttyname)
395 if (errno == EROFS && 395 if (errno == EROFS &&
396 (st.st_mode & (S_IRGRP | S_IROTH)) == 0) 396 (st.st_mode & (S_IRGRP | S_IROTH)) == 0)
397 error("chmod(%.100s, 0%o) failed: %.100s", 397 error("chmod(%.100s, 0%o) failed: %.100s",
398 ttyname, mode, strerror(errno)); 398 ttyname, mode, strerror(errno));
399 else 399 else
400 fatal("chmod(%.100s, 0%o) failed: %.100s", 400 fatal("chmod(%.100s, 0%o) failed: %.100s",
401 ttyname, mode, strerror(errno)); 401 ttyname, mode, strerror(errno));
402 } 402 }
403 } 403 }
404} 404}