diff options
author | Cy Schubert <cy@FreeBSD.org> | 2004-10-29 18:31:14 +0000 |
---|---|---|
committer | Cy Schubert <cy@FreeBSD.org> | 2004-10-29 18:31:14 +0000 |
commit | f0337e4c07d570c30f548e77522b193617ce51b9 (patch) | |
tree | 07baa362a0d93f2a4e6e3d439d04b23f4ebade16 /security/sudosh2 | |
parent | 6f089d1aff8f4ad5abd511272e3265eb17fdb36e (diff) | |
download | ports-f0337e4c07d570c30f548e77522b193617ce51b9.tar.gz ports-f0337e4c07d570c30f548e77522b193617ce51b9.zip |
Notes
Diffstat (limited to 'security/sudosh2')
-rw-r--r-- | security/sudosh2/Makefile | 2 | ||||
-rw-r--r-- | security/sudosh2/files/patch-src::sudosh.c | 129 |
2 files changed, 125 insertions, 6 deletions
diff --git a/security/sudosh2/Makefile b/security/sudosh2/Makefile index cd58476af25a..8c899c526a13 100644 --- a/security/sudosh2/Makefile +++ b/security/sudosh2/Makefile @@ -7,7 +7,7 @@ PORTNAME= sudosh PORTVERSION= 1.4.1 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= security MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= ${PORTNAME:S/_/-/} diff --git a/security/sudosh2/files/patch-src::sudosh.c b/security/sudosh2/files/patch-src::sudosh.c index 9f7d3a914cb3..3209d24268ef 100644 --- a/security/sudosh2/files/patch-src::sudosh.c +++ b/security/sudosh2/files/patch-src::sudosh.c @@ -1,5 +1,5 @@ --- src/sudosh.c.orig Tue Oct 26 18:01:24 2004 -+++ src/sudosh.c Thu Oct 28 15:18:50 2004 ++++ src/sudosh.c Fri Oct 29 11:26:34 2004 @@ -75,6 +75,12 @@ #define SIGCHLD SIGCLD #endif @@ -13,20 +13,67 @@ static struct termios termorig; static struct winsize winorig; -@@ -377,15 +383,24 @@ +@@ -99,6 +105,9 @@ + static void rawmode (int); + static int findms (struct pst *); + void mysyslog (int, const char *, ...); ++#ifdef __FreeBSD__ ++static void sanemode(int ttyfd); ++#endif + + int + main (int argc, char *argv[], char *environ[]) +@@ -255,8 +264,9 @@ + mysyslog (LOG_INFO, start_msg); + mysyslog (LOG_INFO, "to view this session type: sudosh-replay %s-%i", + user, now); +- ++#ifndef __FreeBSD__ + rawmode (0); ++#endif + + if (findms (&pspair) < 0) + { +@@ -269,6 +279,9 @@ + case 0: + close (pspair.mfd); + prepchild (&pspair); ++#ifdef __FreeBSD__ ++ rawmode (0); ++#endif + case -1: + perror ("fork failed"); + bye (1); +@@ -276,6 +289,9 @@ + close (pspair.sfd); + } + ++#ifdef __FreeBSD__ ++ rawmode(0); ++#endif + setuid (getuid ()); + + memset (&sa, 0, sizeof sa); +@@ -377,15 +393,30 @@ { if ((p->mfd = open ("/dev/ptc", O_RDWR)) == -1) { - perror ("Cannot open cloning master pty"); - return -1; +#ifdef __FreeBSD__ ++#define PTYLEN 16 ++ if ((int)(sname= malloc(PTYLEN)) == -1) ++ { ++ perror("Cannot allocate memory"); ++ return -1; ++ } + if (openpty(&p->mfd, &p->sfd, sname, NULL, NULL) == -1) + { +#endif -+ perror ("Cannot open cloning master pty"); -+ return -1; ++ perror ("Cannot open cloning master pty"); ++ return -1; +#ifdef __FreeBSD__ -+ } ++ } +#endif } } @@ -40,3 +87,75 @@ if ((p->sfd = open (sname, O_RDWR)) == -1) { +@@ -456,11 +487,53 @@ + abort (); + } + ++#ifdef __FreeBSD__ ++static void ++sanemode(int ttyfd) ++{ ++ static struct termios termnew; ++ ++ if (tcgetattr(ttyfd, &termnew) == -1) ++ { ++ perror ("tcgetattr failed"); ++ exit (1); ++ } ++ termnew.c_cflag = TTYDEF_CFLAG | (termnew.c_cflag & CLOCAL); ++ termnew.c_iflag = TTYDEF_IFLAG; ++ termnew.c_iflag |= ICRNL; ++ /* preserve user-preference flags in lflag */ ++#define LKEEP (ECHOKE|ECHOE|ECHOK|ECHOPRT|ECHOCTL|ALTWERASE|TOSTOP|NOFLSH) ++ termnew.c_lflag = TTYDEF_LFLAG | (termnew.c_lflag & LKEEP); ++ termnew.c_oflag = TTYDEF_OFLAG; ++ if (tcsetattr(ttyfd, TCSAFLUSH, &termnew) == -1) ++ { ++ perror ("tcsetattr (sane) failed"); ++ exit (1); ++ } ++} ++#endif ++ + static void + rawmode (int ttyfd) + { + static struct termios termnew; + ++#ifdef __FreeBSD__ ++ if (tcgetattr(ttyfd, &termnew) == -1) ++ { ++ perror ("tcgetattr failed"); ++ exit (1); ++ } ++ cfmakeraw(&termnew); ++ termnew.c_cflag &= ~(CSIZE|PARENB); ++ termnew.c_cflag |= CS8; ++ if (tcsetattr(ttyfd, TCSADRAIN, &termnew) == -1) ++ { ++ perror ("tcsetattr (raw) failed"); ++ exit (1); ++ } ++ return; ++#else __FreeBSD__ + #ifdef TCGETS + if (ioctl (ttyfd, TCGETS, &termorig) == -1) + { +@@ -484,6 +557,7 @@ + #ifdef TCSETS + (void) ioctl (ttyfd, TCSETS, &termnew); + #endif ++#endif __FreeBSD__ + } + + static void +@@ -491,6 +565,9 @@ + { + #ifdef TCSETS + (void) ioctl (0, TCSETS, &termorig); ++#endif ++#ifdef __FreeBSD__ ++ sanemode(0); + #endif + + fclose (fttime); |