aboutsummaryrefslogtreecommitdiff
path: root/security/sudosh
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2005-06-01 21:27:52 +0000
committerCy Schubert <cy@FreeBSD.org>2005-06-01 21:27:52 +0000
commita0574edeab7154296b960235d21dd6af0fe976de (patch)
treeafa54261022f9bc09dbf7c933df7a4eda7b3144e /security/sudosh
parentbd8f52ef221f9f39e5e12a2b689f8187f397d910 (diff)
downloadports-a0574edeab7154296b960235d21dd6af0fe976de.tar.gz
ports-a0574edeab7154296b960235d21dd6af0fe976de.zip
Notes
Diffstat (limited to 'security/sudosh')
-rw-r--r--security/sudosh/Makefile4
-rw-r--r--security/sudosh/distinfo4
-rw-r--r--security/sudosh/files/patch-src::sudosh.c171
3 files changed, 76 insertions, 103 deletions
diff --git a/security/sudosh/Makefile b/security/sudosh/Makefile
index 37d3b05de559..69aae02808ea 100644
--- a/security/sudosh/Makefile
+++ b/security/sudosh/Makefile
@@ -6,11 +6,11 @@
#
PORTNAME= sudosh
-PORTVERSION= 1.4.9.1
+PORTVERSION= 1.6.3
CATEGORIES= security
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_EXTENDED}
MASTER_SITE_SUBDIR= ${PORTNAME:S/_/-/}
-DISTNAME= ${PORTNAME}-${PORTVERSION:C/\.[0-9]*$/p&/:C/p\./p/}
+DISTNAME= ${PORTNAME}-${PORTVERSION}
MAINTAINER= cy@FreeBSD.org
COMMENT= A sudo shell
diff --git a/security/sudosh/distinfo b/security/sudosh/distinfo
index b64e616ae094..ef4001cfa03f 100644
--- a/security/sudosh/distinfo
+++ b/security/sudosh/distinfo
@@ -1,2 +1,2 @@
-MD5 (sudosh-1.4.9p1.tar.gz) = 7153c33f928f724a8530f6ba5f84eee9
-SIZE (sudosh-1.4.9p1.tar.gz) = 114980
+MD5 (sudosh-1.6.3.tar.gz) = 700ee8c6060c1512ac0c2731b5727cc6
+SIZE (sudosh-1.6.3.tar.gz) = 119980
diff --git a/security/sudosh/files/patch-src::sudosh.c b/security/sudosh/files/patch-src::sudosh.c
index 7c906c4b31ab..e54829cf8c68 100644
--- a/security/sudosh/files/patch-src::sudosh.c
+++ b/security/sudosh/files/patch-src::sudosh.c
@@ -1,5 +1,5 @@
---- src/sudosh.c.orig Tue Mar 22 21:05:05 2005
-+++ src/sudosh.c Thu Mar 24 14:54:25 2005
+--- src/sudosh.c.orig Thu May 12 19:37:44 2005
++++ src/sudosh.c Wed Jun 1 14:05:14 2005
@@ -24,6 +24,9 @@
#include <unistd.h>
#include <signal.h>
@@ -10,9 +10,9 @@
#include "config.h"
-@@ -75,6 +78,12 @@
- #define SIGCHLD SIGCLD
- #endif
+@@ -81,6 +84,12 @@
+
+ #define WRITE(a, b, c) do_write(a, b, c, __FILE__, __LINE__)
+#ifdef __FreeBSD__
+#include <sys/types.h>
@@ -23,57 +23,35 @@
static struct termios termorig;
static struct winsize winorig;
-@@ -105,6 +114,9 @@
- static int findms(struct pst *);
- void mysyslog(int, const char *, ...);
- void mklogdir(void);
-+#ifdef __FreeBSD__
-+static void sanemode(int ttyfd);
-+#endif
-
- int main(int argc, char *argv[], char *environ[])
+@@ -423,17 +432,41 @@
{
-@@ -265,8 +277,9 @@
- mysyslog(LOG_INFO, start_msg);
- mysyslog(LOG_INFO, "to view this session type: sudosh-replay %s-%s-%i",
- sudo_user, user_name, now);
--
-+#ifndef __FreeBSD__
- rawmode(0);
-+#endif
+ char *sname;
- if (findms(&pspair) < 0) {
- perror("open pty failed");
-@@ -283,6 +296,9 @@
- default:
- close(pspair.sfd);
- }
+#ifdef __FreeBSD__
-+ rawmode (0);
-+#endif
-
- setuid(getuid());
-
-@@ -372,15 +388,30 @@
-
++#define PTYLEN 16
++ char sname_area[PTYLEN];
++ struct termios tt;
++ struct winsize win;
++
++ sname = sname_area;
++ if (tcgetattr(STDIN_FILENO, &tt) == -1) {
++ perror("tcgetattr");
++ return -1;
++ }
++ if (ioctl(STDIN_FILENO, TIOCGWINSZ, &win) == -1) {
++ perror("ioctl");
++ return -1;
++ }
++ if (openpty(&p->mfd, &p->sfd, sname, &tt, &win) == -1) {
++#else
if ((p->mfd = open("/dev/ptmx", O_RDWR)) == -1) {
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;
-+#ifdef __FreeBSD__
-+ }
+#endif
+ perror("Cannot open cloning master pty");
+ return -1;
++#ifndef __FreeBSD__
}
++#endif
}
+#if !defined(__FreeBSD_version) || (defined(__FreeBSD_version) && __FreeBSD_version >= 500000)
@@ -87,67 +65,62 @@
if ((p->sfd = open(sname, O_RDWR)) == -1) {
perror("open slave pty");
-@@ -447,10 +478,46 @@
- abort();
- }
+@@ -488,7 +521,10 @@
+ for (i = 3; i < 100; ++i)
+ close(i);
+-#ifdef TCSETS
+#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)
++ (void) tcsetattr(0, TCSADRAIN, &termorig);
++ (void) login_tty(pst->sfd);
++#else
+ (void) ioctl(0, TCSETS, &termorig);
+ #endif
+ (void) ioctl(0, TIOCSWINSZ, &winorig);
+@@ -528,25 +564,32 @@
{
static struct termios termnew;
+-#ifdef TCGETS
+#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);
-+ }
-+#else __FreeBSD__
- #ifdef TCGETS
++ if (tcgetattr(ttyfd, &termorig) == -1) {
++ perror("tcgetattr failed");
++#else
if (ioctl(ttyfd, TCGETS, &termorig) == -1) {
perror("ioctl TCGETS failed");
-@@ -472,12 +539,16 @@
- #ifdef TCSETS
++#endif
+ exit(1);
+ }
+-#endif
+
+ if (ioctl(ttyfd, TIOCGWINSZ, &winorig) == -1) {
+ perror("ioctl TIOCGWINSZ failed");
+ exit(1);
+ }
+
++#ifdef __FreeBSD__
++ (void) cfmakeraw(&termnew);
++ termnew.c_lflag &= ~ECHO;
++ (void) tcsetattr(ttyfd, TCSAFLUSH, &termnew);
++#else
+ termnew.c_cc[VEOF] = 1;
+ termnew.c_iflag = BRKINT | ISTRIP | IXON | IXANY;
+ termnew.c_oflag = 0;
+ termnew.c_cflag = termorig.c_cflag;
+ termnew.c_lflag &= ~ECHO;
+
+-#ifdef TCSETS
(void) ioctl(ttyfd, TCSETS, &termnew);
#endif
-+#endif __FreeBSD__
}
-
- static void bye(int signum)
- {
- #ifdef TCSETS
- (void) ioctl(0, TCSETS, &termorig);
-+#endif
+@@ -556,7 +599,9 @@
+ char s[32];
+ char t[32];
+ char *sp, *tp;
+-#ifdef TCSETS
+#ifdef __FreeBSD__
-+ sanemode(0);
++ (void) tcsetattr(0, TCSADRAIN, &termorig);
++#else
+ (void) ioctl(0, TCSETS, &termorig);
#endif
- fclose(fttime);